Class AbstractJpaTestCase

java.lang.Object
net.officefloor.jpa.test.AbstractJpaTestCase

public abstract class AbstractJpaTestCase extends Object
Abstract functionality for the JPA testing.
Author:
Daniel Sagenschneider
  • Field Details

  • Constructor Details

    • AbstractJpaTestCase

      public AbstractJpaTestCase()
  • Method Details

    • loadJpaProperties

      protected abstract void loadJpaProperties(PropertyConfigurable jpa)
      Loads the properties for the JpaManagedObjectSource.
      Parameters:
      jpa - PropertyConfigurable to receive the Property values.
    • getMockEntityClass

      protected abstract Class<? extends IMockEntity> getMockEntityClass()
      Obtains the IMockEntity implementation Class.
      Returns:
      IMockEntity implementation Class.
    • getNoConnectionFactoryExceptionClass

      protected abstract Class<?> getNoConnectionFactoryExceptionClass()
      Obtains the Class of Exception when no connection available.
      Returns:
      Class of Exception when no connection available.
    • getNoConnectionFactoryExceptionMessage

      protected abstract String getNoConnectionFactoryExceptionMessage()
      Obtains the message of Exception when no connection available.
      Returns:
      Message of Exception when no connection available.
    • getJpaManagedObjectSourceClass

      protected Class<? extends JpaManagedObjectSource> getJpaManagedObjectSourceClass()
      Allows overriding the JpaManagedObjectSource Class for vendor specific implementations.
      Returns:
      JpaManagedObjectSource Class to use in testing.
    • loadDataSourceProperties

      protected void loadDataSourceProperties(PropertyConfigurable mos)
      Loads the properties for the DataSourceManagedObjectSource.
      Parameters:
      mos - PropertyConfigurable.
    • cleanDatabase

      protected void cleanDatabase(Connection connection) throws SQLException
      Cleans the database.
      Parameters:
      connection - Connection.
      Throws:
      SQLException - If fails to clean the database.
    • setUp

      @BeforeEach public void setUp() throws Exception
      Sets up the test.
      Throws:
      Exception - On test failure.
    • tearDown

      @AfterEach public void tearDown() throws Exception
      Tears down the test.
      Throws:
      Exception - On test failure.
    • 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 Throwable
      Ensure if EntityManager is managing the DataSource that it is validated on start up.
      Throws:
      Throwable - On test failure.
    • connectionReadWithCompiler

      @Test public void connectionReadWithCompiler() throws Throwable
      Ensure able to read entry from database with compiled wrappers.
      Throws:
      Throwable - On test failure.
    • connectionReadWithDynamicProxy

      @Test public void connectionReadWithDynamicProxy() throws Throwable
      Ensure able to read entry from database with Proxy.
      Throws:
      Throwable - On test failure.
    • dataSourceRead

      @Test public void dataSourceRead() throws Throwable
      Ensure able to read entry via DataSource.
      Throws:
      Throwable - On test failure.
    • doReadTest

      public void doReadTest(boolean isConnection) throws Throwable
      Ensure able to read entry from database.
      Parameters:
      isConnection - Indicates if Connection otherwise DataSource.
      Throws:
      Throwable - On test failure.
    • insertWithCompiler

      @Test public void insertWithCompiler() throws Throwable
      Ensure able to insert entry into database with compiled wrappers.
      Throws:
      Throwable - On test failure.
    • insertWithDynamicProxy

      @Test public void insertWithDynamicProxy() throws Throwable
      Ensure able to insert entry into database with Proxy.
      Throws:
      Throwable - On test failure.
    • insertDataSource

      @Test public void insertDataSource() throws Throwable
      Ensure able to insert entry via DataSource.
      Throws:
      Throwable - On test failure.
    • doInsertTest

      public void doInsertTest(boolean isConnection) throws Throwable
      Ensure able to insert entry into database.
      Parameters:
      isConnection - Indicates if Connection otherwise DataSource.
      Throws:
      Throwable - On test failure.
    • updateWithCompiler

      @Test public void updateWithCompiler() throws Throwable
      Ensure able to update entry into database with compiled wrappers.
      Throws:
      Throwable - On test failure.
    • updateWithDynamicProxy

      @Test public void updateWithDynamicProxy() throws Throwable
      Ensure able to update entry into database with Proxy.
      Throws:
      Throwable - On test failure.
    • updateDataSource

      @Test public void updateDataSource() throws Throwable
      Ensure able to update entry via DataSource.
      Throws:
      Throwable - On test failure.
    • doUpdateTest

      public void doUpdateTest(boolean isConnection) throws Throwable
      Ensure able to update entry into database.
      Parameters:
      isConnection - Indicates if Connection otherwise DataSource.
      Throws:
      Throwable - On test failure.
    • deleteWithCompiler

      @Test public void deleteWithCompiler() throws Throwable
      Ensure able to delete entry from database with compiled wrappers.
      Throws:
      Throwable - On test failure.
    • deleteWithDynamicProxy

      @Test public void deleteWithDynamicProxy() throws Throwable
      Ensure able to delete entry from database with Proxy.
      Throws:
      Throwable - On test failure.
    • deleteDataSource

      @Test public void deleteDataSource() throws Throwable
      Ensure able to delete entry via DataSource.
      Throws:
      Throwable - On test failure.
    • doDeleteTest

      public void doDeleteTest(boolean isConnection) throws Throwable
      Ensure able to delete entry from database.
      Parameters:
      isConnection - Indicates if Connection otherwise DataSource.
      Throws:
      Throwable - On test failure.
    • forceCommitWithCompiler

      @Test public void forceCommitWithCompiler() throws Throwable
      Undertake forcing commit with compiled wrappers.
      Throws:
      Throwable - On test failure.
    • forceCommitWithDynamicProxy

      @Test public void forceCommitWithDynamicProxy() throws Throwable
      Undertake forcing commit with Proxy.
      Throws:
      Throwable - On test failure.
    • isTransactional

      protected boolean isTransactional()
      Indicates if JPA is transactional.
      Returns:
      true if JPA is transactional.
    • stressInsertWithCompiler

      public void stressInsertWithCompiler(org.junit.jupiter.api.TestInfo testInfo) throws Throwable
      Undertake stress insert test with compiled wrappers.
      Parameters:
      testInfo - TestInfo.
      Throws:
      Throwable - On test failure.
    • stressInsertWithDynamicProxy

      public void stressInsertWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo) throws Throwable
      Undertake stress insert test with Proxy.
      Parameters:
      testInfo - TestInfo.
      Throws:
      Throwable - On test failure.
    • testStressInsertDataSource

      public void testStressInsertDataSource(org.junit.jupiter.api.TestInfo testInfo) throws Throwable
      Undertake stress insert test with DataSource.
      Parameters:
      testInfo - TestInfo.
      Throws:
      Throwable - On test failure.
    • stressSelectWithCompiler

      public void stressSelectWithCompiler(org.junit.jupiter.api.TestInfo testInfo) throws Throwable
      Ensure stress select with compiled wrappers.
      Parameters:
      testInfo - TestInfo.
      Throws:
      Throwable - On test failure.
    • stressSelectWithDynamicProxy

      public void stressSelectWithDynamicProxy(org.junit.jupiter.api.TestInfo testInfo) throws Throwable
      Ensure stress select with Proxy.
      Parameters:
      testInfo - TestInfo.
      Throws:
      Throwable - On test failure.
    • stressSelectDataSource

      public void stressSelectDataSource(org.junit.jupiter.api.TestInfo testInfo) throws Throwable
      Ensure stress select with DataSource.
      Parameters:
      testInfo - TestInfo.
      Throws:
      Throwable - On test failure.