Package net.officefloor.jpa.test
Class AbstractJpaTestCase
- java.lang.Object
-
- net.officefloor.jpa.test.AbstractJpaTestCase
-
public abstract class AbstractJpaTestCase extends java.lang.ObjectAbstract functionality for the JPA testing.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractJpaTestCase.DeleteSectionMock section for deleting entity.static classAbstractJpaTestCase.InsertSectionMock section for inserting entity.static classAbstractJpaTestCase.NewThreadstatic classAbstractJpaTestCase.ReadSectionMock section for reading entity.static classAbstractJpaTestCase.ResultHolder for the result.static classAbstractJpaTestCase.SelectInputstatic classAbstractJpaTestCase.SelectParameterstatic classAbstractJpaTestCase.StressInsertSectionstatic classAbstractJpaTestCase.StressSelectSectionstatic classAbstractJpaTestCase.UpdateSectionMock section for updating entity.
-
Field Summary
Fields Modifier and Type Field Description protected java.sql.ConnectionconnectionConnection.protected static java.lang.Class<? extends IMockEntity>mockEntityClassIMockEntityimplementationClass.protected OfficeFloorofficeFloorprotected AutoWireStateManagerstateManager
-
Constructor Summary
Constructors Constructor Description AbstractJpaTestCase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcleanDatabase(java.sql.Connection connection)Cleans the database.voidconnectionReadWithCompiler()Ensure able to read entry from database with compiled wrappers.voidconnectionReadWithDynamicProxy()Ensure able to read entry from database withProxy.voiddataSourceRead()Ensure able to read entry viaDataSource.voiddeleteDataSource()Ensure able to delete entry viaDataSource.voiddeleteWithCompiler()Ensure able to delete entry from database with compiled wrappers.voiddeleteWithDynamicProxy()Ensure able to delete entry from database withProxy.voiddoDeleteTest(boolean isConnection)Ensure able to delete entry from database.voiddoInsertTest(boolean isConnection)Ensure able to insert entry into database.voiddoReadTest(boolean isConnection)Ensure able to read entry from database.voiddoUpdateTest(boolean isConnection)Ensure able to update entry into database.voidforceCommitWithCompiler()Undertake forcing commit with compiled wrappers.voidforceCommitWithDynamicProxy()Undertake forcing commit withProxy.protected java.lang.Class<? extends JpaManagedObjectSource>getJpaManagedObjectSourceClass()Allows overriding theJpaManagedObjectSourceClassfor vendor specific implementations.protected abstract java.lang.Class<? extends IMockEntity>getMockEntityClass()Obtains theIMockEntityimplementationClass.voidinsertDataSource()Ensure able to insert entry viaDataSource.voidinsertWithCompiler()Ensure able to insert entry into database with compiled wrappers.voidinsertWithDynamicProxy()Ensure able to insert entry into database withProxy.protected booleanisTransactional()Indicates if JPA is transactional.protected voidloadDataSourceProperties(PropertyConfigurable mos)Loads the properties for theDataSourceManagedObjectSource.protected abstract voidloadJpaProperties(PropertyConfigurable jpa)Loads the properties for theJpaManagedObjectSource.voidmanagedConnectivity()Ensure ifEntityManageris managing theDataSourcethat it is validated on start up.voidsetUp()voidspecification()Validate the specificationvoidstressInsertWithCompiler(org.junit.jupiter.api.TestInfo testInfo)Undertake stress insert test with compiled wrappers.voidstressInsertWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo)Undertake stress insert test withProxy.voidstressSelectDataSource(org.junit.jupiter.api.TestInfo testInfo)Ensure stress select withDataSource.voidstressSelectWithCompiler(org.junit.jupiter.api.TestInfo testInfo)Ensure stress select with compiled wrappers.voidstressSelectWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo)Ensure stress select withProxy.voidtearDown()voidtestStressInsertDataSource(org.junit.jupiter.api.TestInfo testInfo)Undertake stress insert test withDataSource.voidtype_Connection()Validate the type.voidtype_DataSource()Validate the type.voidtype_Default()Validate the type.voidtype_Managed()Validate the type.voidupdateDataSource()Ensure able to update entry viaDataSource.voidupdateWithCompiler()Ensure able to update entry into database with compiled wrappers.voidupdateWithDynamicProxy()Ensure able to update entry into database withProxy.
-
-
-
Field Detail
-
mockEntityClass
protected static java.lang.Class<? extends IMockEntity> mockEntityClass
IMockEntityimplementationClass.
-
connection
protected java.sql.Connection connection
Connection.
-
stateManager
protected AutoWireStateManager stateManager
-
officeFloor
protected OfficeFloor officeFloor
-
-
Method Detail
-
loadJpaProperties
protected abstract void loadJpaProperties(PropertyConfigurable jpa)
Loads the properties for theJpaManagedObjectSource.- Parameters:
jpa-PropertyConfigurableto receive thePropertyvalues.
-
getMockEntityClass
protected abstract java.lang.Class<? extends IMockEntity> getMockEntityClass()
Obtains theIMockEntityimplementationClass.- Returns:
IMockEntityimplementationClass.
-
getJpaManagedObjectSourceClass
protected java.lang.Class<? extends JpaManagedObjectSource> getJpaManagedObjectSourceClass()
Allows overriding theJpaManagedObjectSourceClassfor vendor specific implementations.- Returns:
JpaManagedObjectSourceClassto use in testing.
-
loadDataSourceProperties
protected void loadDataSourceProperties(PropertyConfigurable mos)
Loads the properties for theDataSourceManagedObjectSource.- Parameters:
mos-PropertyConfigurable.
-
cleanDatabase
protected void cleanDatabase(java.sql.Connection connection) throws java.sql.SQLExceptionCleans the database.- Parameters:
connection-Connection.- Throws:
java.sql.SQLException- If fails to clean the database.
-
setUp
@BeforeEach public void setUp() throws java.lang.Exception- Throws:
java.lang.Exception
-
tearDown
@AfterEach public void tearDown() throws java.lang.Exception- Throws:
java.lang.Exception
-
specification
@Test public void specification()
Validate the specification
-
type_Connection
@Test public void type_Connection()
Validate the type.
-
type_DataSource
@Test public void type_DataSource()
Validate the type.
-
type_Managed
@Test public void type_Managed()
Validate the type.
-
type_Default
@Test public void type_Default()
Validate the type.
-
managedConnectivity
@Test public void managedConnectivity() throws java.lang.ThrowableEnsure ifEntityManageris managing theDataSourcethat it is validated on start up.- Throws:
java.lang.Throwable- On test failure.
-
connectionReadWithCompiler
@Test public void connectionReadWithCompiler() throws java.lang.ThrowableEnsure able to read entry from database with compiled wrappers.- Throws:
java.lang.Throwable
-
connectionReadWithDynamicProxy
@Test public void connectionReadWithDynamicProxy() throws java.lang.ThrowableEnsure able to read entry from database withProxy.- Throws:
java.lang.Throwable- On test failure.
-
dataSourceRead
@Test public void dataSourceRead() throws java.lang.ThrowableEnsure able to read entry viaDataSource.- Throws:
java.lang.Throwable- On test failure.
-
doReadTest
public void doReadTest(boolean isConnection) throws java.lang.ThrowableEnsure able to read entry from database.- Parameters:
isConnection- Indicates ifConnectionotherwiseDataSource.- Throws:
java.lang.Throwable- On test failure.
-
insertWithCompiler
@Test public void insertWithCompiler() throws java.lang.ThrowableEnsure able to insert entry into database with compiled wrappers.- Throws:
java.lang.Throwable- On test failure.
-
insertWithDynamicProxy
@Test public void insertWithDynamicProxy() throws java.lang.ThrowableEnsure able to insert entry into database withProxy.- Throws:
java.lang.Throwable- On test failure.
-
insertDataSource
@Test public void insertDataSource() throws java.lang.ThrowableEnsure able to insert entry viaDataSource.- Throws:
java.lang.Throwable- On test failure.
-
doInsertTest
public void doInsertTest(boolean isConnection) throws java.lang.ThrowableEnsure able to insert entry into database.- Parameters:
isConnection- Indicates ifConnectionotherwiseDataSource.- Throws:
java.lang.Throwable- On test failure.
-
updateWithCompiler
@Test public void updateWithCompiler() throws java.lang.ThrowableEnsure able to update entry into database with compiled wrappers.- Throws:
java.lang.Throwable- On test failure.
-
updateWithDynamicProxy
@Test public void updateWithDynamicProxy() throws java.lang.ThrowableEnsure able to update entry into database withProxy.- Throws:
java.lang.Throwable- On test failure.
-
updateDataSource
@Test public void updateDataSource() throws java.lang.ThrowableEnsure able to update entry viaDataSource.- Throws:
java.lang.Throwable- On test failure.
-
doUpdateTest
public void doUpdateTest(boolean isConnection) throws java.lang.ThrowableEnsure able to update entry into database.- Parameters:
isConnection- Indicates ifConnectionotherwiseDataSource.- Throws:
java.lang.Throwable- On test failure.
-
deleteWithCompiler
@Test public void deleteWithCompiler() throws java.lang.ThrowableEnsure able to delete entry from database with compiled wrappers.- Throws:
java.lang.Throwable- On test failure.
-
deleteWithDynamicProxy
@Test public void deleteWithDynamicProxy() throws java.lang.ThrowableEnsure able to delete entry from database withProxy.- Throws:
java.lang.Throwable- On test failure.
-
deleteDataSource
@Test public void deleteDataSource() throws java.lang.ThrowableEnsure able to delete entry viaDataSource.- Throws:
java.lang.Throwable- On test failure.
-
doDeleteTest
public void doDeleteTest(boolean isConnection) throws java.lang.ThrowableEnsure able to delete entry from database.- Parameters:
isConnection- Indicates ifConnectionotherwiseDataSource.- Throws:
java.lang.Throwable- On test failure.
-
forceCommitWithCompiler
@Test public void forceCommitWithCompiler() throws java.lang.ThrowableUndertake forcing commit with compiled wrappers.- Throws:
java.lang.Throwable- On test failure.
-
forceCommitWithDynamicProxy
@Test public void forceCommitWithDynamicProxy() throws java.lang.ThrowableUndertake forcing commit withProxy.- Throws:
java.lang.Throwable- On test failure.
-
isTransactional
protected boolean isTransactional()
Indicates if JPA is transactional.- Returns:
trueif JPA is transactional.
-
stressInsertWithCompiler
public void stressInsertWithCompiler(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.ThrowableUndertake stress insert test with compiled wrappers.- Throws:
java.lang.Throwable- On test failure.
-
stressInsertWithDynamicProxy
public void stressInsertWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.ThrowableUndertake stress insert test withProxy.- Throws:
java.lang.Throwable- On test failure.
-
testStressInsertDataSource
public void testStressInsertDataSource(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.ThrowableUndertake stress insert test withDataSource.- Throws:
java.lang.Throwable- On test failure.
-
stressSelectWithCompiler
public void stressSelectWithCompiler(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.ThrowableEnsure stress select with compiled wrappers.- Throws:
java.lang.Throwable- On test failure.
-
stressSelectWithDynamicProxy
public void stressSelectWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.ThrowableEnsure stress select withProxy.- Throws:
java.lang.Throwable- On test failure.
-
stressSelectDataSource
public void stressSelectDataSource(org.junit.jupiter.api.TestInfo testInfo) throws java.lang.ThrowableEnsure stress select withDataSource.- Throws:
java.lang.Throwable- On test failure.
-
-