public class DatabaseClassLoadingTest extends BaseJDBCTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE| Constructor and Description |
|---|
DatabaseClassLoadingTest(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
addEntries(java.util.zip.ZipOutputStream zos,
java.io.File dir,
java.lang.String dbName,
int old) |
private static void |
addFile(java.util.zip.ZipOutputStream zos,
java.io.File f,
java.lang.String dbName,
int old) |
private void |
checkCorrectLoader(java.lang.String className,
java.sql.PreparedStatement ps1,
java.sql.PreparedStatement ps2,
java.sql.PreparedStatement ps3) |
private void |
checkLoading(java.lang.String order)
Run a number of tests to ensure classes are loaded
from the correct class loader.
|
private static void |
createArchive(java.lang.String jarName,
java.io.File dbDir,
java.lang.String dbName)
jarname - jarname to use path - path to database dbname - database name
in archive
|
private void |
derby2035Workaround() |
private static void |
getResourceTests(java.sql.Connection conn) |
private void |
installJar(java.lang.String resource,
java.lang.String jarName) |
private void |
loadJavaClass(java.lang.String method,
java.lang.String expectedSQLState)
Test loading classes in the java. and javax. namespaces
from a jar, it should be disallowed or be ignored.
|
private static void |
readOnlyTest(javax.sql.DataSource ds)
Run an number of statements against a jar'ed database to
ensure it is read-only and that class loading works from
jar files embedded in jar'ed up databases.
|
private void |
removeJar(java.lang.String jarName) |
private void |
replaceJar(java.lang.String resource,
java.lang.String jarName) |
private static void |
setContextClassLoader(java.net.URL url) |
private void |
setDBClasspath(java.lang.String cp) |
private static void |
signersTests(java.sql.Connection conn) |
static junit.framework.Test |
suite()
Run the tests only in embedded since this is testing
server side behaviour.
|
void |
test_5352()
Test that restricted table functions can be invoked from inside jar files stored in
the database.
|
void |
testAddContact()
Test that a new connection successfully sees the changes.
|
void |
testAlterTable()
Alter the table to add a column, the add contact procedure
should still work.
|
void |
testClassLoadOrdering()
Test ordering of class loading.
|
void |
testClassPathRollback()
check the roll back of class loading.
|
void |
testCreateDatabaseJar()
Create a Jar of the current database.
|
void |
testDatabaseInClasspath() |
void |
testDatabaseInJar()
Test the jar'ed up database created by testCreateDatabaseJar
accessing the database using the jar(path to archive)db form
of database name.
|
void |
testGetResource() |
void |
testHackedJarReplacedClass()
Replace the signed jar with a hacked jar. emc.class modified to diable
valid e-mail address check but using same signatures within jar.
|
void |
testIndirectLoading()
Test that loading of Derby's internal classes from
an installed jar file is disallowed.
|
void |
testInvalidJar()
replace with a hacked jar file, emc.class modified to
be an invalid class (no signing on this jar).
|
void |
testJarHandling()
Test the sqlj procedures without setting any database
classpath.
|
void |
testLoadDerbyClassIndirectly()
Load a org.apache.derby class directly (ie. through a direct procedure call)
from the jar file.
|
void |
testLoadJavaClassDirectly()
Load a java.sql class directly (ie. through a direct procedure call)
from the jar file.
|
void |
testLoadJavaClassDirectly2()
Load a java.derby99 class directly (ie. through a direct procedure call)
from the jar file.
|
void |
testLoadJavaClassDirectly3()
Load a javax.derby99 class directly (ie. through a direct procedure call)
from the jar file.
|
void |
testLoadJavaClassIndirectly()
Load a java.sql class indirectly (ie. through a valid class
in the installed jar file) from the jar file.
|
void |
testRemoveJar() |
void |
testReplacedClass()
Change of class due to testReplaceJar that
changes the application to run checks on the e-mail
to ensure it is valid (in this case by seeing if
it simply includes 'spam' in the title).
|
void |
testReplaceJar()
Replace the jar to later test the prepare from a different
connection picks up the new version.
|
void |
testSecondJar()
now add another jar in to test two jars and
a quoted identifer for the jar names.
|
void |
testSetClasspath()
Set the classpath to include the MAIL_APP jar.
|
void |
testSignedJar()
Test to see if the jar signatures can be obtained from the jar file.
|
void |
testTableFunctionInJar()
Test that table functions can be invoked from inside jar files stored in
the database.
|
void |
testUDAInJar()
Test that user-defined aggregates can be invoked from inside jar files stored in
the database.
|
void |
testWithNoClasspath()
Install the jar, but don't set the classpath.
|
void |
testWithNoInstalledJars()
Test the routines fail before the jars that contain their
code have been installed and/or set in the classpath.
|
assertCallError, assertCheckTable, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, emptyStatementCache, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, 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, usingEmbeddedalarm, 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, runsWithEmma, runsWithJaCoCo, setSystemProperty, sleep, sleepAtLeastOneTick, traceitassertEquals, 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, toStringpublic static junit.framework.Test suite()
public void testWithNoInstalledJars()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testJarHandling()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testWithNoClasspath()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testSetClasspath()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testAddContact()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testGetResource()
throws java.sql.SQLException
java.sql.SQLExceptionprivate static void getResourceTests(java.sql.Connection conn)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testAlterTable()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testClassPathRollback()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testReplaceJar()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testReplacedClass()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testSecondJar()
throws java.sql.SQLException,
java.net.MalformedURLException
java.net.MalformedURLExceptionjava.sql.SQLExceptionpublic void testSignedJar()
throws java.sql.SQLException,
java.net.MalformedURLException
keytool -delete -alias emccto -keystore emcks -storepass ab987c
keytool -genkey -dname "cn=EMC CTO, ou=EMC APP, o=Easy Mail Company, c=US" -alias emccto -keypass kpi135 -keystore emcks -storepass ab987c
keytool -selfcert -alias emccto -keypass kpi135 -validity 36500 -keystore emcks -storepass ab987c
keytool -keystore emcks -storepass ab987c -list -v
jarsigner -keystore emcks -storepass ab987c -keypass kpi135 -signedjar dcl_emc2s.jar dcl_emc2.jar emccto
keytool -delete -alias emccto -keystore emcks -storepass ab987c
java.sql.SQLExceptionjava.net.MalformedURLExceptionprivate static void signersTests(java.sql.Connection conn)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testHackedJarReplacedClass()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testInvalidJar()
throws java.sql.SQLException,
java.net.MalformedURLException
java.net.MalformedURLExceptionjava.sql.SQLExceptionpublic void testRemoveJar()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testCreateDatabaseJar()
throws java.lang.Exception
java.lang.Exceptionpublic void testDatabaseInJar()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testDatabaseInClasspath()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testLoadJavaClassIndirectly()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testLoadJavaClassDirectly()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testLoadJavaClassDirectly2()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testLoadJavaClassDirectly3()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testLoadDerbyClassIndirectly()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionprivate void loadJavaClass(java.lang.String method,
java.lang.String expectedSQLState)
throws java.sql.SQLException,
java.net.MalformedURLException
java.net.MalformedURLExceptionjava.sql.SQLExceptionprivate static void readOnlyTest(javax.sql.DataSource ds)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testClassLoadOrdering()
throws java.sql.SQLException,
java.net.MalformedURLException
java.net.MalformedURLExceptionjava.sql.SQLExceptionprivate void checkLoading(java.lang.String order)
throws java.sql.SQLException
order - Order the entry point classes will be loaded.java.sql.SQLExceptionprivate void checkCorrectLoader(java.lang.String className,
java.sql.PreparedStatement ps1,
java.sql.PreparedStatement ps2,
java.sql.PreparedStatement ps3)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testIndirectLoading()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testTableFunctionInJar()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void testUDAInJar()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionpublic void test_5352()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionprivate void installJar(java.lang.String resource,
java.lang.String jarName)
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionprivate void replaceJar(java.lang.String resource,
java.lang.String jarName)
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLExceptionjava.net.MalformedURLExceptionprivate void removeJar(java.lang.String jarName)
throws java.sql.SQLException
java.sql.SQLExceptionprivate void setDBClasspath(java.lang.String cp)
throws java.sql.SQLException
java.sql.SQLExceptionprivate void derby2035Workaround()
throws java.sql.SQLException
java.sql.SQLExceptionprivate static void createArchive(java.lang.String jarName,
java.io.File dbDir,
java.lang.String dbName)
throws java.lang.Exception
java.lang.Exceptionstatic void addEntries(java.util.zip.ZipOutputStream zos,
java.io.File dir,
java.lang.String dbName,
int old)
throws java.lang.Exception
java.lang.Exceptionprivate static void addFile(java.util.zip.ZipOutputStream zos,
java.io.File f,
java.lang.String dbName,
int old)
throws java.io.IOException
java.io.IOExceptionprivate static void setContextClassLoader(java.net.URL url)
Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.