Package net.officefloor.jdbc.test
Class AbstractJdbcTestCase
- java.lang.Object
-
- net.officefloor.jdbc.test.AbstractJdbcTestCase
-
public abstract class AbstractJdbcTestCase extends java.lang.Object
Abstract tests for an JDBC vendor implementation.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractJdbcTestCase.ConnectionDecoratorSection
static class
AbstractJdbcTestCase.ConnectivitySection
static interface
AbstractJdbcTestCase.Flows
static class
AbstractJdbcTestCase.InsertSection
static class
AbstractJdbcTestCase.NewThread
static class
AbstractJdbcTestCase.SelectParameter
static class
AbstractJdbcTestCase.SelectSection
-
Field Summary
Fields Modifier and Type Field Description protected java.sql.Connection
connection
Connection
.
-
Constructor Summary
Constructors Constructor Description AbstractJdbcTestCase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
cleanDatabase(java.sql.Connection connection)
Cleans the database.protected abstract java.lang.Class<? extends DataSourceManagedObjectSource>
getDataSourceManagedObjectSourceClass()
Obtains theDataSourceManagedObjectSource
Class
being tested.protected abstract java.lang.Class<? extends ReadOnlyConnectionManagedObjectSource>
getReadOnlyConnectionManagedObjectSourceClass()
Obtains theReadOnlyConnectionManagedObjectSource
Class
being tested.protected abstract void
loadConnectionProperties(PropertyConfigurable mos)
Loads the properties for theReadOnlyConnectionManagedObjectSource
.protected abstract void
loadDataSourceProperties(PropertyConfigurable mos)
Loads the properties for theDataSourceManagedObjectSource
.protected void
loadOptionalConnectionSpecification(java.util.Properties properties)
Enables adding additionalConnection
properties to specification.protected void
loadOptionalDataSourceSpecification(java.util.Properties properties)
Enables adding additionalDataSource
properties to specification.protected void
setUp()
protected void
tearDown()
void
testDataSourceConnectionManagement()
Ensure connection management forDataSource
.void
testDataSourceConnectionManagementViaProxy()
Ensure connection management forDataSource
.void
testDataSourceConnectivity()
EnsureDataSource
connectivity.void
testDataSourceSelectStress(org.junit.jupiter.api.TestInfo testInfo)
Undertakes select stress forDataSource
.void
testDataSourceSelectStressWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo)
Undertakes select stress for writableConnection
withProxy
.void
testDataSourceSpecification()
Ensure correct specification forDataSource
.void
testDataSourceType()
Ensure correct type forDataSource
.void
testDataSourceValidateConnectivity()
Ensure correct type forDataSource
.void
testInsertConnectionStressWithCompiler(org.junit.jupiter.api.TestInfo testInfo)
Ensure can stress test against the database with compiled wrappers.void
testInsertConnectionStressWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo)
Ensure can stress test against the database withProxy
.void
testInsertConnectionTransactionStressWithCompiler(org.junit.jupiter.api.TestInfo testInfo)
Ensure can stress test against the database with transactions with compiled wrappers.void
testInsertConnectionTransactionStressWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo)
Ensure can stress test against the database with transactions.void
testReadOnlyConnectionManagement()
Ensure connection management for read-onlyConnection
.void
testReadOnlyConnectionManagementViaProxy()
Ensure connection management for read-onlyConnection
.void
testReadOnlyConnectionSpecification()
Ensure correct specification for read-onlyConnection
.void
testReadOnlyConnectivity()
Ensure read-only connectivity.void
testReadOnlySelectStressWithCompiler(org.junit.jupiter.api.TestInfo testInfo)
Undertakes select stress for read-onlyConnection
with compiled wrappers.void
testReadOnlySelectStressWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo)
Undertakes select stress for read-onlyConnection
withProxy
.void
testReadOnlyType()
Ensure correct type for read-onlyConnection
.void
testReadOnlyValidateConnectivity()
Ensure correct type for read-onlyConnection
.
-
-
-
Method Detail
-
getReadOnlyConnectionManagedObjectSourceClass
protected abstract java.lang.Class<? extends ReadOnlyConnectionManagedObjectSource> getReadOnlyConnectionManagedObjectSourceClass()
Obtains theReadOnlyConnectionManagedObjectSource
Class
being tested.- Returns:
ReadOnlyConnectionManagedObjectSource
Class
being tested.
-
getDataSourceManagedObjectSourceClass
protected abstract java.lang.Class<? extends DataSourceManagedObjectSource> getDataSourceManagedObjectSourceClass()
Obtains theDataSourceManagedObjectSource
Class
being tested.- Returns:
DataSourceManagedObjectSource
Class
being tested.
-
loadConnectionProperties
protected abstract void loadConnectionProperties(PropertyConfigurable mos)
Loads the properties for theReadOnlyConnectionManagedObjectSource
.- Parameters:
mos
-PropertyConfigurable
.
-
loadDataSourceProperties
protected abstract void loadDataSourceProperties(PropertyConfigurable mos)
Loads the properties for theDataSourceManagedObjectSource
.- Parameters:
mos
-PropertyConfigurable
.
-
cleanDatabase
protected abstract void cleanDatabase(java.sql.Connection connection) throws java.sql.SQLException
Cleans the database.- Parameters:
connection
-Connection
.- Throws:
java.sql.SQLException
- On failure to clean up the database.
-
setUp
@BeforeEach protected void setUp() throws java.lang.Exception
- Throws:
java.lang.Exception
-
tearDown
@AfterEach protected void tearDown() throws java.lang.Exception
- Throws:
java.lang.Exception
-
loadOptionalConnectionSpecification
protected void loadOptionalConnectionSpecification(java.util.Properties properties)
Enables adding additionalConnection
properties to specification.- Parameters:
properties
-Properties
to be loaded with additional specification.
-
loadOptionalDataSourceSpecification
protected void loadOptionalDataSourceSpecification(java.util.Properties properties)
Enables adding additionalDataSource
properties to specification.- Parameters:
properties
-Properties
to be loaded with additional specification.
-
testReadOnlyConnectionSpecification
@Test public void testReadOnlyConnectionSpecification() throws java.lang.Exception
Ensure correct specification for read-onlyConnection
.- Throws:
java.lang.Exception
- On test failure.
-
testDataSourceSpecification
@Test public void testDataSourceSpecification() throws java.lang.Exception
Ensure correct specification forDataSource
.- Throws:
java.lang.Exception
- On test failure.
-
testReadOnlyType
@Test public void testReadOnlyType() throws java.lang.Exception
Ensure correct type for read-onlyConnection
.- Throws:
java.lang.Exception
- On test failure.
-
testDataSourceType
@Test public void testDataSourceType() throws java.lang.Exception
Ensure correct type forDataSource
.- Throws:
java.lang.Exception
- On test failure.
-
testReadOnlyConnectivity
@Test public void testReadOnlyConnectivity() throws java.lang.Throwable
Ensure read-only connectivity.- Throws:
java.lang.Throwable
-
testDataSourceConnectivity
@Test public void testDataSourceConnectivity() throws java.lang.Throwable
EnsureDataSource
connectivity.- Throws:
java.lang.Throwable
-
testReadOnlyConnectionManagement
@Test public void testReadOnlyConnectionManagement() throws java.lang.Throwable
Ensure connection management for read-onlyConnection
.- Throws:
java.lang.Exception
- On test failure.java.lang.Throwable
-
testReadOnlyConnectionManagementViaProxy
@Test public void testReadOnlyConnectionManagementViaProxy() throws java.lang.Throwable
Ensure connection management for read-onlyConnection
.- Throws:
java.lang.Exception
- On test failure.java.lang.Throwable
-
testDataSourceConnectionManagement
@Test public void testDataSourceConnectionManagement() throws java.lang.Throwable
Ensure connection management forDataSource
.- Throws:
java.lang.Exception
- On test failure.java.lang.Throwable
-
testDataSourceConnectionManagementViaProxy
@Test public void testDataSourceConnectionManagementViaProxy() throws java.lang.Throwable
Ensure connection management forDataSource
.- Throws:
java.lang.Exception
- On test failure.java.lang.Throwable
-
testReadOnlyValidateConnectivity
@Test public void testReadOnlyValidateConnectivity() throws java.lang.Exception
Ensure correct type for read-onlyConnection
.- Throws:
java.lang.Exception
- On test failure.
-
testDataSourceValidateConnectivity
@Test public void testDataSourceValidateConnectivity() throws java.lang.Exception
Ensure correct type forDataSource
.- Throws:
java.lang.Exception
- On test failure.
-
testInsertConnectionStressWithCompiler
public void testInsertConnectionStressWithCompiler(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.Throwable
Ensure can stress test against the database with compiled wrappers.- Throws:
java.lang.Throwable
- On test failure.
-
testInsertConnectionStressWithDynamicProxy
public void testInsertConnectionStressWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.Throwable
Ensure can stress test against the database withProxy
.- Throws:
java.lang.Throwable
- On test failure.
-
testInsertConnectionTransactionStressWithCompiler
public void testInsertConnectionTransactionStressWithCompiler(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.Throwable
Ensure can stress test against the database with transactions with compiled wrappers.- Throws:
java.lang.Throwable
- On test failure.
-
testInsertConnectionTransactionStressWithDynamicProxy
public void testInsertConnectionTransactionStressWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.Throwable
Ensure can stress test against the database with transactions.- Throws:
java.lang.Throwable
- On test failure.
-
testReadOnlySelectStressWithCompiler
public void testReadOnlySelectStressWithCompiler(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.Throwable
Undertakes select stress for read-onlyConnection
with compiled wrappers.- Throws:
java.lang.Throwable
- On test failure.
-
testReadOnlySelectStressWithDynamicProxy
public void testReadOnlySelectStressWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.Throwable
Undertakes select stress for read-onlyConnection
withProxy
.- Throws:
java.lang.Throwable
- On test failure.
-
testDataSourceSelectStress
public void testDataSourceSelectStress(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.Throwable
Undertakes select stress forDataSource
.- Throws:
java.lang.Throwable
- On test failure.
-
testDataSourceSelectStressWithDynamicProxy
public void testDataSourceSelectStressWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.Throwable
Undertakes select stress for writableConnection
withProxy
.- Throws:
java.lang.Throwable
- On test failure.
-
-