public class CompatibilityCombinations extends BaseTestCase
compatibilitytest.properties
which must be available in ${user.dir}
.
The compatibility tests are (currently) run without a SecurityManager.
Run as
java -Djava.security.policy="<NONE>" junit.textui.TestRunner org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilityCombinations
The following is an example and explanation of the
compatibilitytest.properties
file:
#############################
# The test suite to be run for compatibility testing:
test.testSuite=org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite
# Optional, default false
# test.printDebug=false
# Optional, default false
# test.showSysinfo=true
# Optional, default false
# test.includeUpgrade=true
# Simply means the database files are NOT removed between server starts.
# Observe that trunk should not be included when test.includeUpgrade=true.
#############################
# Server port to use: optional, default 1527
test.serverPort=1527
# Since CompatibilitySuite and JDBCDriverTest only handles default..
# Most tests are not yet ready for a non-default value.
#############################
# Jvms to be used for server and client side:
# 'jvm.versions' tells how many. 'jvm.N=
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
COMPATIBILITYTEST_PROPFILE
Name of properties file defining the test environment
and compatibility test combinations to be run.
|
private static java.lang.String |
compatibilityTestSuite |
private static int |
DERBY_JAR |
private static int |
DERBYCLIENT_JAR |
private static java.lang.String[][] |
derbyLib |
private static int |
DERBYMAX_JAR |
private static int |
DERBYNET_JAR |
private static boolean[] |
derbySecurityEnabled |
private static int |
DERBYTESTING_JAR |
private static java.lang.String[] |
derbyVerLibs |
private static java.lang.String[] |
derbyVersionNames |
private static java.lang.String |
embeddedDriver |
private static boolean |
includeUpgrade |
private static java.lang.String |
junit_jar |
private static java.lang.String |
JVMloc |
private static boolean |
latestOnly
Only test the combinations that include the latest version if this
flag is true.
|
private static java.lang.String |
networkServerControl |
private static boolean |
printDebug |
private static java.lang.String |
PS |
private static boolean |
runEmbedded |
private static boolean |
runSrvrClnt |
private static java.lang.String |
securityProperty
The option string used to turn off running Derby server with a SecurityManager.
|
private static java.lang.String |
serverHost |
private static int |
serverPort |
private java.lang.Process |
serverProc
The process in which the network server is running.
|
private static boolean |
showSysinfo |
private static java.lang.String |
singleClient |
private static java.lang.String |
singleClientVM |
private static java.lang.String |
singleServer |
private static java.lang.String |
singleServerVM |
private static java.lang.String |
specialTestingJar |
private static java.lang.String |
test_jars |
private static java.lang.String[] |
VM_Ids |
private static java.lang.String[] |
vmNames |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
CompatibilityCombinations(java.lang.String testcaseName)
Creates a new instance of CompatibilityCombinations
|
Modifier and Type | Method and Description |
---|---|
private static void |
DEBUG(java.lang.String s) |
private static void |
DEBUG(java.lang.String s,
java.io.PrintWriter out) |
private void |
initEnvironment()
Set up the total environment for running the compatibility test
combinations as given by the
compatibilitytest.properties file. |
private boolean |
oneTest(java.lang.String clientJvm,
java.lang.String clientClassPath,
boolean debug,
java.lang.String testName,
java.lang.String driverName,
java.lang.String databaseName,
java.lang.String combinationName,
java.io.PrintWriter summaryFile)
Run the compatibility tests for one given combination of
Derby client version, client jvm version, server jvm version and Derby server version.
|
private void |
pingServer()
Checks to see that the server is up.
|
private static void |
processDEBUGOutput(java.lang.Process proc) |
private static void |
processOutput(java.lang.Process proc,
java.io.PrintWriter out) |
private void |
recreateDB(int serverVersion,
java.lang.String clientJvm,
java.lang.String clientClassPath,
boolean debug,
java.lang.String databaseName,
boolean removeDBfiles)
Recreate - create database from scratch or keep database but re-initialize user defined tables.
|
protected void |
setUp()
Parent super()
|
private void |
startServer(int serverVM,
int serverVersion) |
private void |
stopServer(int serverVM,
int serverVersion) |
static junit.framework.Test |
suite()
Create the suite of tests
|
private void |
sysinfoEmbedded(int clientVM,
int clientVersion,
java.lang.String combinationName) |
private void |
sysinfoServerFromClient(int clientVM,
int clientVersion,
java.lang.String combinationName) |
protected void |
tearDown()
Parent super()
|
void |
testEmbeddedTrunk()
Run the combinations of client Derby and JVM versions
against the embedded highest(usually trunk) version on JVM versions.
|
void |
testLoopThruAllCombinations()
Run the combinations of Derby versions and JVM versions on the client side
against the Derby versions and JVM versions on the server side.
|
private static java.lang.String |
testOutput(java.lang.Process proc,
java.io.PrintWriter out)
Get .out and .err from the process running oneTest.
|
private static java.lang.String[] |
toStringArray(java.util.List list) |
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isJava8, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runBare, runsWithEmma, runsWithJaCoCo, setSystemProperty, sleep, sleepAtLeastOneTick, traceit
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, toString
private static final java.lang.String COMPATIBILITYTEST_PROPFILE
${user.dir}
private static java.lang.String securityProperty
test.securityOption=noSecurityManager
from the file given by
COMPATIBILITYTEST_PROPFILE
.private static java.lang.String[] derbyVersionNames
private static java.lang.String[] derbyVerLibs
private static boolean[] derbySecurityEnabled
private static java.lang.String[] vmNames
private static java.lang.String[] VM_Ids
private static final int DERBY_JAR
private static final int DERBYCLIENT_JAR
private static final int DERBYNET_JAR
private static final int DERBYTESTING_JAR
private static final int DERBYMAX_JAR
private static java.lang.String[][] derbyLib
private static java.lang.String junit_jar
private static java.lang.String test_jars
private static java.lang.String serverHost
private static int serverPort
private static java.lang.String compatibilityTestSuite
private static final java.lang.String embeddedDriver
private static final java.lang.String networkServerControl
private static java.lang.String specialTestingJar
private static boolean latestOnly
private static java.lang.String singleClient
private static java.lang.String singleClientVM
private static java.lang.String singleServer
private static java.lang.String singleServerVM
private static final java.lang.String PS
private static final java.lang.String JVMloc
private static boolean runEmbedded
private static boolean runSrvrClnt
private static boolean printDebug
private static boolean showSysinfo
private static boolean includeUpgrade
private java.lang.Process serverProc
public CompatibilityCombinations(java.lang.String testcaseName)
testcaseName
- Identifying the test.protected void setUp() throws java.lang.Exception
setUp
in class junit.framework.TestCase
java.lang.Exception
- .protected void tearDown() throws java.lang.Exception
tearDown
in class junit.framework.TestCase
java.lang.Exception
- .public static junit.framework.Test suite()
public void testEmbeddedTrunk() throws java.lang.Exception
Observe that testEmbeddedTrunk
is really just
code to select combination of Derby and Jvm versions
to be run.
The real compatibility tests are given by
jdbcSuite = "org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite"
The number of combinations can be restricted by specifying the
properties
java.lang.Exception
- .public void testLoopThruAllCombinations() throws java.lang.Exception
Observe that testLoopThruAllCombinations
is really just
code to select combination of Derby and Jvm versions
to be run.
The real compatibility tests are given by
jdbcSuite = "org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite"
The number of combinations can be restricted by specifying the
properties
java.lang.Exception
- .private boolean oneTest(java.lang.String clientJvm, java.lang.String clientClassPath, boolean debug, java.lang.String testName, java.lang.String driverName, java.lang.String databaseName, java.lang.String combinationName, java.io.PrintWriter summaryFile) throws java.lang.Exception
clientJvm
- Path for client Jvm to be used.clientClassPath
- Class path for Derby client.debug
- Print debug.testName
- The test suite to be used for the compatibility test.
Currently only using org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite
.driverName
- Driver to be used: None null for embedded only. Null means find default in jars.databaseName
- Name of database to connect to.combinationName
- Name describing the combination. Used as part of report file(s) for this test combination.summaryFile
- Name of file summarizing results for all combinations of tests.java.lang.Exception
- .private static java.lang.String testOutput(java.lang.Process proc, java.io.PrintWriter out) throws java.io.IOException
java.io.IOException
private void initEnvironment() throws java.io.IOException
compatibilitytest.properties
file.
The following properties are recognized:
java.io.IOException
- .private static java.lang.String[] toStringArray(java.util.List list)
private void startServer(int serverVM, int serverVersion) throws java.lang.Exception
java.lang.Exception
private void recreateDB(int serverVersion, java.lang.String clientJvm, java.lang.String clientClassPath, boolean debug, java.lang.String databaseName, boolean removeDBfiles)
With removeDBfiles
existing database files are deleted.
This is normally done when starting a new Derby server version.
By setting test.includeUpgrade=true
in
COMPATIBILITYTEST_PROPFILE
database files will not
be deleted, thus forcing upgrade to be performed.
serverVersion
- clientJvm
- clientClassPath
- debug
- databaseName
- removeDBfiles
- Remove data base files when (re-)creating the database.private void pingServer() throws java.lang.Exception
Checks to see that the server is up. If the server doesn't come up in a reasonable amount of time, throw an assert failure.
java.lang.Exception
- .private void stopServer(int serverVM, int serverVersion)
private void sysinfoServerFromClient(int clientVM, int clientVersion, java.lang.String combinationName) throws java.lang.Exception
java.lang.Exception
private void sysinfoEmbedded(int clientVM, int clientVersion, java.lang.String combinationName) throws java.lang.Exception
java.lang.Exception
private static void processOutput(java.lang.Process proc, java.io.PrintWriter out) throws java.lang.Exception
java.lang.Exception
private static void processDEBUGOutput(java.lang.Process proc) throws java.lang.Exception
java.lang.Exception
private static void DEBUG(java.lang.String s)
private static void DEBUG(java.lang.String s, java.io.PrintWriter out)
Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.