|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.derbyTesting.junit.BaseTestCase
org.apache.derbyTesting.junit.BaseJDBCTestCase
org.apache.derbyTesting.functionTests.tests.lang.DatabaseClassLoadingTest
public class DatabaseClassLoadingTest
Test database class loading, executing routines from the installed jars including accessing resources. Replacing jars and handling signed jars is also tested.
| Field Summary |
|---|
| Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase |
|---|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE |
| Constructor Summary | |
|---|---|
DatabaseClassLoadingTest(java.lang.String name)
|
|
| Method Summary | |
|---|---|
(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 |
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 |
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. |
| Methods inherited from class org.apache.derbyTesting.junit.BaseTestCase |
|---|
alarm, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertSecurityManager, assertThrowableEquals, execJavaCmd, fail, getFailureFolder, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeSystemProperty, runBare, setSystemProperty, traceit |
| Methods inherited from class junit.framework.TestCase |
|---|
countTestCases, createResult, getName, run, run, runTest, setName, setUp, toString |
| Methods inherited from class junit.framework.Assert |
|---|
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, fail, fail |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DatabaseClassLoadingTest(java.lang.String name)
| Method Detail |
|---|
public static junit.framework.Test suite()
public void testWithNoInstalledJars()
throws java.sql.SQLException
java.sql.SQLException
public void testJarHandling()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
public void testWithNoClasspath()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
public void testSetClasspath()
throws java.sql.SQLException
java.sql.SQLException
public void testAddContact()
throws java.sql.SQLException
java.sql.SQLException
public void testGetResource()
throws java.sql.SQLException
java.sql.SQLException
private static void getResourceTests(java.sql.Connection conn)
throws java.sql.SQLException
java.sql.SQLException
public void testAlterTable()
throws java.sql.SQLException
java.sql.SQLException
public void testClassPathRollback()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
public void testReplaceJar()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
public void testReplacedClass()
throws java.sql.SQLException
java.sql.SQLException
public void testSecondJar()
throws java.sql.SQLException,
java.net.MalformedURLException
java.net.MalformedURLException
java.sql.SQLException
public 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.SQLException
java.net.MalformedURLException
private static void signersTests(java.sql.Connection conn)
throws java.sql.SQLException
java.sql.SQLException
public void testHackedJarReplacedClass()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
public void testInvalidJar()
throws java.sql.SQLException,
java.net.MalformedURLException
java.net.MalformedURLException
java.sql.SQLException
public void testRemoveJar()
throws java.sql.SQLException
java.sql.SQLException
public void testCreateDatabaseJar()
throws java.lang.Exception
java.lang.Exception
public void testDatabaseInJar()
throws java.sql.SQLException
java.sql.SQLException
public void testDatabaseInClasspath()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
public void testLoadJavaClassIndirectly()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
public void testLoadJavaClassDirectly()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
public void testLoadJavaClassDirectly2()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
public void testLoadJavaClassDirectly3()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
public void testLoadDerbyClassIndirectly()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
private void loadJavaClass(java.lang.String method,
java.lang.String expectedSQLState)
throws java.sql.SQLException,
java.net.MalformedURLException
java.net.MalformedURLException
java.sql.SQLException
private static void readOnlyTest(javax.sql.DataSource ds)
throws java.sql.SQLException
java.sql.SQLException
public void testClassLoadOrdering()
throws java.sql.SQLException,
java.net.MalformedURLException
java.net.MalformedURLException
java.sql.SQLException
private void checkLoading(java.lang.String order)
throws java.sql.SQLException
order - Order the entry point classes will be loaded.
java.sql.SQLException
private void checkCorrectLoader(java.lang.String className,
java.sql.PreparedStatement ps1,
java.sql.PreparedStatement ps2,
java.sql.PreparedStatement ps3)
throws java.sql.SQLException
java.sql.SQLException
public void testIndirectLoading()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
public void testTableFunctionInJar()
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
private void installJar(java.lang.String resource,
java.lang.String jarName)
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
private void replaceJar(java.lang.String resource,
java.lang.String jarName)
throws java.sql.SQLException,
java.net.MalformedURLException
java.sql.SQLException
java.net.MalformedURLException
private void removeJar(java.lang.String jarName)
throws java.sql.SQLException
java.sql.SQLException
private void setDBClasspath(java.lang.String cp)
throws java.sql.SQLException
java.sql.SQLException
private void derby2035Workaround()
throws java.sql.SQLException
java.sql.SQLException
private static void createArchive(java.lang.String jarName,
java.io.File dbDir,
java.lang.String dbName)
throws java.lang.Exception
java.lang.Exception
static void addEntries(java.util.zip.ZipOutputStream zos,
java.io.File dir,
java.lang.String dbName,
int old)
throws java.lang.Exception
java.lang.Exception
private 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)
|
Built on Sat 2009-11-28 18:44:18-0800, from revision 885187 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||