public class CollationTest extends BaseJDBCTestCase
Modifier and Type | Field and Description |
---|---|
private static java.lang.String[] |
ENGLISH_CASE_INSENSITIVE
Test cases to run with English case-insensitive collation.
|
private static java.lang.String[] |
ENGLISH_CASE_SENSITIVE
Test cases to run with English case-sensitive collation.
|
private static java.lang.String[] |
FRENCH_CASE_SENSITIVE
Test cases to run with French case-sensitive collation.
|
private static java.lang.String |
INVALID_ESCAPE
SQL state that signals invalid escape sequence in LIKE expressions.
|
private static java.lang.String[] |
NAMES |
private static java.lang.String[] |
NORWEGIAN_CASE_SENSITIVE
Test cases to run with Norwegian case-sensitive collation.
|
private static java.lang.String[] |
POLISH_CASE_SENSITIVE
Test cases to run with Polish case-sensitive collation.
|
private static java.lang.String[] |
SWEDISH_CASE_INSENSITIVE
Test cases to run with Swedish case-insensitive collation.
|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
CollationTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private void |
checkLangBasedQuery(java.sql.Statement s,
java.lang.String query,
java.lang.String[][] expectedResult)
Execute the passed statement and compare the results against the
expectedResult
|
private static junit.framework.Test |
collatedSuite(java.lang.String locale,
boolean caseInsensitive,
java.lang.String[] testNames)
Return a suite that uses a single use database with
a set of test cases from this class, plus potentially some other
test cases.
|
private void |
commonTestingForTerritoryBasedDB(java.sql.Statement s) |
private void |
compareAgrave(int expectedMatchCountForEqual,
int expectedMatchCountForLike,
int expectedDistinctRows)
For a TERRITORY_BASED collation french database, differences between
pre-composed accents such as "?" (A-grave) and combining accents
such as "A?" (A, combining-grave) should match for
= , but
not for LIKE . |
private void |
compareAgrave(java.lang.String dataType,
int expectedMatchCountForEqual,
int expectedMatchCountForLike,
int expectedDistinctRows)
Helper for
compareAgrave(int, int, int) which performs the test
for one data type. |
private static boolean |
hasBuggySwedishLocale()
Check whether the JVM suffers from this bug:
http://bugs.sun.com/view_bug.do?
|
static java.lang.String |
hello()
Name says it all
|
private void |
joinTesting(java.sql.Statement s,
java.lang.String leftTableName,
java.lang.String rightTableName,
java.lang.String leftTableSource,
java.lang.String rightTableSource,
java.lang.String joinSpecification,
java.lang.String usingClause,
java.lang.String[][] expectedResults) |
static java.sql.Clob |
makeClob(java.lang.String contents)
Clob-creating function
|
static java.lang.String |
mimic(java.lang.String val)
Just return the value as passed in.
|
private void |
setUpTable(java.sql.Statement s) |
static junit.framework.Test |
suite()
Tests only need to run in embedded since collation
is a server side operation.
|
void |
test_5951()
Test for an overload which was missing.
|
void |
testDefaultCollation()
Test order by with default collation
|
void |
testDerby6227()
Regression test case for DERBY-6227.
|
void |
testDerby6890() |
void |
testEnglishCollation()
Test order by with English collation
|
void |
testFrenchCollation() |
void |
testInListNorwayCollation()
Test in list with constant and non constant elements and Norwegian collation
DERBY-6025(Wrong results with IN lists and indexes in territory based
collation)
|
void |
testLikeEscapeClauseLengthRestriction()
Regression test case for DERBY-6030.
|
void |
testMissingCollatorSupport()
We should get a locale unavailable message because there is no support for
locale xx.
|
void |
testNorwayCollation()
Test order by with Norwegian collation
|
void |
testNullColumnInInsert()
DERBY-5531 Assert failure when inserting NULL into indexed column with
territory-based collation
Make sure that when the row being inserted has all nulls, we do not run
into assert failure
|
void |
testPolishCollation()
Test order by with polish collation
|
void |
testSwedishCaseInsensitiveCollation()
Test with Swedish case insensitive collation
|
void |
testUsingClauseAndNaturalJoin()
Test USING clause and NATURAL JOIN for case insensitive and
case sensitive collations.
|
assertCallError, assertCheckTable, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeast
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, setUp, toString
private static final java.lang.String[] NAMES
private static final java.lang.String[] ENGLISH_CASE_SENSITIVE
private static final java.lang.String[] ENGLISH_CASE_INSENSITIVE
private static final java.lang.String[] NORWEGIAN_CASE_SENSITIVE
private static final java.lang.String[] POLISH_CASE_SENSITIVE
private static final java.lang.String[] FRENCH_CASE_SENSITIVE
private static final java.lang.String[] SWEDISH_CASE_INSENSITIVE
private static final java.lang.String INVALID_ESCAPE
public void testDefaultCollation() throws java.sql.SQLException
java.sql.SQLException
public void testFrenchCollation() throws java.sql.SQLException
java.sql.SQLException
private void compareAgrave(int expectedMatchCountForEqual, int expectedMatchCountForLike, int expectedDistinctRows) throws java.sql.SQLException
=
, but
not for LIKE
. They should never match for UCS_BASIC. We insert
both into a table and search based on =
and LIKE
.expectedMatchCountForEqual
- number of rows we expect back for =.
2 for French, 1 for EnglishexpectedMatchCountForLike
- number of rows we expect back for LIKE.
1 for French and EnglishexpectedDistinctRows
- number of rows expected from SELECT DISTINCTjava.sql.SQLException
private void compareAgrave(java.lang.String dataType, int expectedMatchCountForEqual, int expectedMatchCountForLike, int expectedDistinctRows) throws java.sql.SQLException
compareAgrave(int, int, int)
which performs the test
for one data type.java.sql.SQLException
public void testPolishCollation() throws java.sql.SQLException
java.sql.SQLException
public void testInListNorwayCollation() throws java.sql.SQLException
java.sql.SQLException
public void testNorwayCollation() throws java.sql.SQLException
java.sql.SQLException
public void testNullColumnInInsert() throws java.sql.SQLException
java.sql.SQLException
public void testUsingClauseAndNaturalJoin() throws java.sql.SQLException
java.sql.SQLException
private void joinTesting(java.sql.Statement s, java.lang.String leftTableName, java.lang.String rightTableName, java.lang.String leftTableSource, java.lang.String rightTableSource, java.lang.String joinSpecification, java.lang.String usingClause, java.lang.String[][] expectedResults) throws java.sql.SQLException
java.sql.SQLException
public void testEnglishCollation() throws java.sql.SQLException
java.sql.SQLException
public void testSwedishCaseInsensitiveCollation() throws java.sql.SQLException
java.sql.SQLException
private void commonTestingForTerritoryBasedDB(java.sql.Statement s) throws java.sql.SQLException
java.sql.SQLException
public static java.lang.String hello()
public static java.lang.String mimic(java.lang.String val)
val
- value to returnprivate void setUpTable(java.sql.Statement s) throws java.sql.SQLException
java.sql.SQLException
private void checkLangBasedQuery(java.sql.Statement s, java.lang.String query, java.lang.String[][] expectedResult) throws java.sql.SQLException
s
- statement object to use to execute the queryquery
- string with the query to execute.expectedResult
- Null for this means that the passed query is
expected to return an empty resultset. If not empty, then the resultset
from the query should match this parameterjava.sql.SQLException
public void testMissingCollatorSupport() throws java.sql.SQLException
java.sql.SQLException
public static junit.framework.Test suite()
private static boolean hasBuggySwedishLocale()
private static junit.framework.Test collatedSuite(java.lang.String locale, boolean caseInsensitive, java.lang.String[] testNames)
locale
- Locale to use for the databasecaseInsensitive
- Indicates if the database should use a case insensitive collation.testNames
- the tests to run in the specified localepublic void test_5951() throws java.lang.Exception
java.lang.Exception
public static java.sql.Clob makeClob(java.lang.String contents) throws java.lang.Exception
java.lang.Exception
public void testLikeEscapeClauseLengthRestriction() throws java.sql.SQLException
java.sql.SQLException
public void testDerby6227() throws java.sql.SQLException
String.equals()
. That does not give the right
results if the database collation defines equality in a different way
than String.equals()
, for example when running with case
insensitive collation (collation=TERRITORY_BASED:PRIMARY
).java.sql.SQLException
public void testDerby6890() throws java.sql.SQLException
java.sql.SQLException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.