Class H2Test


  • public abstract class H2Test
    extends Object
    Provides an in-memory H2 Test Case. Supports JUnit 4.8.1 Annotations
    Since:
    17.10.0
    • Constructor Detail

      • H2Test

        public H2Test()
    • Method Detail

      • setUp

        public void setUp()
                   throws Exception
        This method is called before a test is executed, creating a DataContext and associating it to the current Thread.
        Throws:
        Exception - if an error occurs
        See Also:
        TestCase.setUp()
      • tearDownAfterEachTest

        public void tearDownAfterEachTest()
                                   throws Exception
        Tear down after each test.
        Throws:
        Exception - if an error occurs
      • getDataContext

        public static org.apache.cayenne.access.DataContext getDataContext()
        Return the thread local DataContext.
        Returns:
        the thread local DataContexts
      • setupDataSource

        protected void setupDataSource()
                                throws Exception
        Set up the test case data source.
        Throws:
        Exception - if an error occurs
      • initDatabaseSchema

        protected void initDatabaseSchema​(org.apache.cayenne.access.DataNode dataNode,
                                          org.apache.cayenne.map.DataMap dataMap)
                                   throws Exception
        Create the demonstration database schema using the given Cayenne DataNode and DataMap.
        Parameters:
        dataNode - the Cayenne DataNode
        dataMap - the Cayenne DataMap
        Throws:
        Exception
      • getCayenneDomainLocation

        protected String getCayenneDomainLocation()
      • getDataSourceUrl

        protected String getDataSourceUrl()
      • getDataSourceUser

        protected String getDataSourceUser()
      • getDataSourcePassword

        protected String getDataSourcePassword()
      • getDataSourceJndiNames

        protected String[] getDataSourceJndiNames()