public class VerifySignatures extends BaseTestCase
Modifier and Type | Class and Description |
---|---|
private static class |
VerifySignatures.ClassInfo
Data structure holding a Derby implementation class and the
JDBC interface it is supposed to implement.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.Class[] |
JDBC_INTERFACES
All the java.sql and javax.sql interfaces specified by JDBC 4.0.
|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
VerifySignatures(java.lang.String name)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
private static void |
addClass(java.util.Set<VerifySignatures.ClassInfo> classes,
java.lang.Class implementation,
java.lang.Class iface)
Adds a
ClassInfo object to a set. |
private static void |
checkImplementationMethod(java.lang.Class<?> derbyImplementation,
java.lang.reflect.Method ifaceMethod)
checks that a class implements a specific method.
|
private static void |
collectClassesFromCallableStatement(java.sql.Connection conn,
java.util.Set<VerifySignatures.ClassInfo> classes)
Perform JDBC operations on a
CallableStatement . |
private static void |
collectClassesFromConnection(java.sql.Connection conn,
java.util.Set<VerifySignatures.ClassInfo> classes)
Perform JDBC operations on a
Connection . |
private static void |
collectClassesFromConnectionPoolDataSource(java.util.Set<VerifySignatures.ClassInfo> classes)
Obtain a connection from a
ConnectionPoolDataSource
object and perform JDBC operations on it. |
private static void |
collectClassesFromDataSource(java.util.Set<VerifySignatures.ClassInfo> classes)
Obtain a connection from a
DataSource object and
perform JDBC operations on it. |
private static void |
collectClassesFromPreparedStatement(java.sql.Connection conn,
java.util.Set<VerifySignatures.ClassInfo> classes)
Perform JDBC operations on a
PreparedStatement . |
private static void |
collectClassesFromStatement(java.sql.Connection conn,
java.util.Set<VerifySignatures.ClassInfo> classes)
Perform JDBC operations on a
Statement . |
private static void |
collectClassesFromXADataSource(java.util.Set<VerifySignatures.ClassInfo> classes)
Obtain a connection from an
XADataSource object
and perform JDBC operations on it. |
private static java.lang.Class |
findCompatibleClass(java.lang.Class exception,
java.lang.Class[] declared)
Search an array of classes for a class that is identical to
or a super-class of the specified exception class.
|
private static java.util.Set<java.lang.Class> |
getAllInterfaces(java.lang.Class iface)
Get the set consisting of an interface and all its
super-interfaces.
|
private static java.util.Set<java.lang.Class> |
getInterfacesToCheck()
Returns the declared set of JDBC interfaces that
Derby implements.
|
static junit.framework.Test |
suite()
Build a suite of tests to be run.
|
void |
testAllJDBCObjects() |
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, runBare, 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, tearDown, toString
private static final java.lang.Class[] JDBC_INTERFACES
public VerifySignatures(java.lang.String name)
public static junit.framework.Test suite()
public void testAllJDBCObjects() throws java.lang.NoSuchMethodException, java.sql.SQLException
java.lang.NoSuchMethodException
java.sql.SQLException
private static void collectClassesFromDataSource(java.util.Set<VerifySignatures.ClassInfo> classes) throws java.sql.SQLException
DataSource
object and
perform JDBC operations on it. Collect the classes of all JDBC
objects that are found.classes
- set into which classes are collectedjava.sql.SQLException
- if a database error occursprivate static void collectClassesFromConnectionPoolDataSource(java.util.Set<VerifySignatures.ClassInfo> classes) throws java.sql.SQLException
ConnectionPoolDataSource
object and perform JDBC operations on it. Collect the classes
of all JDBC objects that are found.classes
- set into which classes are collectedjava.sql.SQLException
- if a database error occursprivate static void collectClassesFromXADataSource(java.util.Set<VerifySignatures.ClassInfo> classes) throws java.sql.SQLException
XADataSource
object
and perform JDBC operations on it. Collect the classes of all
JDBC objects that are found.classes
- set into which classes are collectedjava.sql.SQLException
- if a database error occursprivate static void collectClassesFromConnection(java.sql.Connection conn, java.util.Set<VerifySignatures.ClassInfo> classes) throws java.sql.SQLException
Connection
. Collect
the classes of all JDBC objects that are found.conn
- connection to a databaseclasses
- set into which classes are collectedjava.sql.SQLException
- if a database error occursprivate static void collectClassesFromStatement(java.sql.Connection conn, java.util.Set<VerifySignatures.ClassInfo> classes) throws java.sql.SQLException
Statement
. Collect
the classes of all JDBC objects that are found.conn
- connection to a databaseclasses
- set into which classes are collectedjava.sql.SQLException
- if a database error occursprivate static void collectClassesFromPreparedStatement(java.sql.Connection conn, java.util.Set<VerifySignatures.ClassInfo> classes) throws java.sql.SQLException
PreparedStatement
.
Collect the classes of all JDBC objects that are found.conn
- connection to a databaseclasses
- set into which classes are collectedjava.sql.SQLException
- if a database error occursprivate static void collectClassesFromCallableStatement(java.sql.Connection conn, java.util.Set<VerifySignatures.ClassInfo> classes) throws java.sql.SQLException
CallableStatement
.
Collect the classes of all JDBC objects that are found.conn
- connection to a databaseclasses
- set into which classes are collectedjava.sql.SQLException
- if a database error occursprivate static void addClass(java.util.Set<VerifySignatures.ClassInfo> classes, java.lang.Class implementation, java.lang.Class iface)
ClassInfo
object to a set.classes
- set to which the class should be addedimplementation
- Derby implementation classiface
- JDBC interface supposed to be implementedprivate static java.util.Set<java.lang.Class> getAllInterfaces(java.lang.Class iface)
iface
- an interfaceiface
and all its
super-interfacesprivate static void checkImplementationMethod(java.lang.Class<?> derbyImplementation, java.lang.reflect.Method ifaceMethod) throws java.lang.NoSuchMethodException
derbyImplementation
- The Derby implementation class which is testedifaceMethod
- The method that should be implemented.java.lang.NoSuchMethodException
private static java.lang.Class findCompatibleClass(java.lang.Class exception, java.lang.Class[] declared)
exception
- an exception classdeclared
- an array of exception classes declared to
be thrown by a methodnull
if no compatible
class is foundprivate static java.util.Set<java.lang.Class> getInterfacesToCheck()
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.