db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g.@apache.org
Subject svn commit: r1870877 - in /db/torque/torque4/trunk: ./ torque-templates/src/test/java/org/apache/torque/templates/ torque-test/ torque-test/src/test/java/org/apache/torque/ torque-test/src/test/java/org/apache/torque/avalon/ torque-test/src/test/java/o...
Date Thu, 05 Dec 2019 14:03:09 GMT
Author: gk
Date: Thu Dec  5 14:03:08 2019
New Revision: 1870877

URL: http://svn.apache.org/viewvc?rev=1870877&view=rev
Log:
poms
- fix rats check excludes
- fix forkCount warning, copy env files to classpath
Torque-Test
- fix AvalonMapBuildersTest
- fix cache.ccf packages
- use JUnit 5 assertions in DataTest and AvalonMapBuildersTest
- support (basic) testing in IDE without maven: allow test extension to read adapterProfileFallback without having environment settings
- update and format JUnit 5 extensions

Modified:
    db/torque/torque4/trunk/pom.xml
    db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
    db/torque/torque4/trunk/torque-test/pom.xml
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/avalon/AvalonMapBuildersTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallback.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallbackExtension.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/BeanConditionalContainerTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/DataContainerTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/ManagerConditionalContainerTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallback.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallbackExtension.java
    db/torque/torque4/trunk/torque-test/src/test/profile/mysql/torque.usersettings.properties
    db/torque/torque4/trunk/torque-test/src/test/resources/cache.ccf

Modified: db/torque/torque4/trunk/pom.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/pom.xml?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/pom.xml (original)
+++ db/torque/torque4/trunk/pom.xml Thu Dec  5 14:03:08 2019
@@ -431,19 +431,18 @@
             <exclude>velocity.log</exclude>
             <exclude>.checkstyle</exclude>
             <exclude>checkstyle-cache.ccf</exclude>
-            <exclude>derby.log</exclude>
-            <exclude>LICENSE-EDL.txt</exclude>
+            <exclude>**/derby.log</exclude>
+            <exclude>**/LICENSE-EDL.txt</exclude>
             <exclude>DEPENDENCIES</exclude>
             <!-- special excludes for torque-test because this is not a module 
               in the normal build process -->
-            <exclude>torque-test/target/**/*</exclude>
-            <exclude>torque-test/.classpath</exclude>
-            <exclude>torque-test/.project</exclude>
-            <exclude>torque-test/.settings/**</exclude>
             <exclude>torque-test/src/main/generated-java/**/*</exclude>
-            <exclude>torque-test/derby.log</exclude>
             <!-- hsqldb-jenkins -->
             <exclude>torque-test/torque-test/**</exclude>
+            <exclude>**/target/**</exclude>
+            <exclude>**/.classpath</exclude>
+            <exclude>**/.project</exclude>
+            <exclude>**/.settings/**</exclude>
           </excludes>
         </configuration>
         <executions>

Modified: db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java (original)
+++ db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java Thu Dec  5 14:03:08 2019
@@ -1,6 +1,6 @@
 package org.apache.torque.templates;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
+
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Asse
 
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.File;
 import java.io.FileInputStream;

Modified: db/torque/torque4/trunk/torque-test/pom.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/pom.xml?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/pom.xml (original)
+++ db/torque/torque4/trunk/torque-test/pom.xml Thu Dec  5 14:03:08 2019
@@ -520,10 +520,10 @@
              <exclude>**/junit5/extension/**</exclude>
           </excludes>
           <!--excludedGroups>docker</excludedGroups-->
-          <forkCount>0</forkCount>
+          <forkCount>1</forkCount>
           <reuseForks>false</reuseForks>
           <!-- forkMode>pertest</forkMode--><!-- normally pertest, if remote debugging with mvnDebug port 8000, setting in console -DforkMode=never or forkCount=0 seems to have no effect, set here -->
-          <systemPropertyVariables combine.children="append">
+          <systemPropertyVariables combine.children="override">
               <torque.configuration.file>src/test/profile/${torque.test.profileDirectory}/Torque.properties</torque.configuration.file>
               <torque.callback>host</torque.callback>
           </systemPropertyVariables>
@@ -1199,6 +1199,7 @@
                             <goal>start</goal>
                         </goals>
                         <configuration>
+                            <!-- may set it here environment variables: dockerhost, .. -->
                             <images>
                                 <image>
                                     <name>mysql:${torque.test.mysql.version}</name>
@@ -1210,6 +1211,8 @@
                                             <MYSQL_USER>${torque.database.user}</MYSQL_USER>
                                             <MYSQL_PASSWORD>${torque.database.password}</MYSQL_PASSWORD>
                                         </env>
+                                        <!-- this is too late for reading GLOBAL env DOCKER_HOST -> issue of the plugin?  -->
+                                        <!--envPropertyFile>${project.basedir}/src/test/profile/mysql/docker-resources/docker-java.properties</envPropertyFile-->
                                         <ports>
                                             <port>3306:3306</port>
                                         </ports>
@@ -1217,7 +1220,7 @@
                                             <log>database system is ready to accept connections.</log>
                                             <time>20000</time>
                                         </wait-->
-                                    </run>
+                                    </run><!-- target/classes/ --> 
                                 </image>
                             </images>
                         </configuration>
@@ -1297,6 +1300,26 @@
                           </includes>
                       </resource>
                     </resources> 
+                    </configuration>
+                </execution>
+                <execution>
+                  <id>copy-resources-2</id>
+                  <phase>validate</phase>
+                  <goals>
+                    <goal>copy-resources</goal>
+                  </goals>
+                  <configuration>
+                    <outputDirectory>${basedir}/target/test-classes</outputDirectory>
+                    <resources>
+                      <resource>
+                        <directory>src/test/profile/mysql/docker-resources</directory>
+                        <filtering>false</filtering>
+                        <includes>
+                            <include>docker-java.properties</include>
+                            <include>testcontainers.properties</include>
+                          </includes>
+                      </resource>
+                    </resources> 
                     </configuration>
                 </execution>
               </executions>

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java Thu Dec  5 14:03:08 2019
@@ -46,6 +46,7 @@ import org.apache.torque.util.CountHelpe
  * @author <a href="mailto:seade@backstagetech.com.au">Scott Eade</a>
  * @version $Id$
  */
+//@HostCallback(adapterProfile ="mysql")
 @HostCallback
 public abstract class BaseDatabaseTestCase  
 {

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java Thu Dec  5 14:03:08 2019
@@ -27,10 +27,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -42,7 +39,6 @@ import org.apache.torque.adapter.MysqlAd
 import org.apache.torque.criteria.Criteria;
 import org.apache.torque.criteria.Criterion;
 import org.apache.torque.junit5.extension.AdapterProvider;
-import org.apache.torque.junit5.extension.HostCallback;
 import org.apache.torque.om.mapper.CompositeMapper;
 import org.apache.torque.om.mapper.IntegerMapper;
 import org.apache.torque.om.mapper.RecordMapper;
@@ -178,12 +174,11 @@ public class DataTest extends BaseDataba
         crit.setLimit(10);
         crit.setOffset(5);
         List<Book> books = BookPeer.doSelect(crit);
-        assertEquals("List should have 10 books", 10, books.size());
+        assertEquals(10, books.size(), "List should have 10 books");
         for (Book book : books)
         {
             String title = book.getTitle();
-            assertTrue("Incorrect title: " + title,
-                    titleSet.contains(title));
+            assertTrue( titleSet.contains(title), "Incorrect title: " + title);
         }
 
 
@@ -198,14 +193,14 @@ public class DataTest extends BaseDataba
             crit = new Criteria();
             crit.setLimit(0);
             books = BookPeer.doSelect(crit);
-            assertEquals("List should have 0 books", 0, books.size());
+            assertEquals(0, books.size(), "List should have 0 books");
         }
 
         // check that Offset also works without limit
         crit = new Criteria();
         crit.setOffset(5);
         books = BookPeer.doSelect(crit);
-        assertEquals("List should have 95 books", 95, books.size());
+        assertEquals(95, books.size(), "List should have 95 books");
 
         // Check that limiting also works if a table with an equal column name
         // is joined. This is problematic for oracle, see TORQUE-10.
@@ -214,7 +209,7 @@ public class DataTest extends BaseDataba
         crit.setLimit(10);
         crit.setOffset(5);
         books = BookPeer.doSelectJoinAuthor(crit);
-        assertEquals("List should have 10 books", 10, books.size());
+        assertEquals(10, books.size(), "List should have 10 books");
     }
 
     /**
@@ -230,8 +225,8 @@ public class DataTest extends BaseDataba
         criteria.setLimit(1);
         criteria.setOffset(5);
         List<Book> books = BookPeer.doSelect(criteria);
-        assertTrue("List should have 1 books, not " + books.size(),
-                books.size() == 1);
+        assertTrue(books.size() == 1, 
+                "List should have 1 books, not " + books.size());
 
         criteria = new Criteria();
         criteria.setSingleRecord(true);
@@ -333,13 +328,15 @@ public class DataTest extends BaseDataba
         criteria.addAscendingOrderByColumn(AuthorPeer.NAME);
 
         List<Author> authors = AuthorPeer.doSelect(criteria);
-        assertEquals("List should contain 2 authors", 2, authors.size());
-        assertEquals("First Author's name should be \"NewName2\"",
+        assertEquals(2, authors.size(), "List should contain 2 authors");
+        assertEquals(
                 "NewName2",
-                authors.get(0).getName());
-        assertEquals("Second Author's name should be \"OtherName\"",
+                authors.get(0).getName(),
+                "First Author's name should be \"NewName2\"");
+        assertEquals(
                 "OtherName",
-                authors.get(1).getName());
+                authors.get(1).getName(),
+                "Second Author's name should be \"OtherName\"");
 
         author.setName("NewName3");
         AuthorPeer.doUpdate(author);
@@ -348,13 +345,14 @@ public class DataTest extends BaseDataba
         criteria.addAscendingOrderByColumn(AuthorPeer.NAME);
 
         authors = AuthorPeer.doSelect(criteria);
-        assertEquals("List should contain 2 authors", 2, authors.size());
-        assertEquals("First Author's name should be \"NewName3\"",
-                "NewName3",
-                authors.get(0).getName());
-        assertEquals("Second Author's name should be \"OtherName\"",
+        assertEquals(2, authors.size(), "List should contain 2 authors");
+        assertEquals("NewName3",
+                authors.get(0).getName(),
+                "First Author's name should be \"NewName3\"");
+        assertEquals(
                 "OtherName",
-                authors.get(1).getName());
+                authors.get(1).getName(),
+                "Second Author's name should be \"OtherName\"");
 
         Nopk nopk = new Nopk();
         nopk.setName("name");
@@ -658,8 +656,8 @@ public class DataTest extends BaseDataba
         criteria.where(AuthorPeer.NAME, author.getName().toLowerCase());
         criteria.setIgnoreCase(true);
         List<Author> result = AuthorPeer.doSelect(criteria);
-        assertTrue("Size of result is not 1, but " + result.size(),
-                result.size() == 1);
+        assertTrue( result.size() == 1,
+                "Size of result is not 1, but " + result.size());
 
         // LIKE treatment might be different (e.g. postgres), so check extra
         criteria = new Criteria();
@@ -669,8 +667,8 @@ public class DataTest extends BaseDataba
                 Criteria.LIKE);
         criteria.setIgnoreCase(true);
         result = AuthorPeer.doSelect(criteria);
-        assertTrue("Size of result is not 1, but " + result.size(),
-                result.size() == 1);
+        assertTrue(   result.size() == 1,
+                "Size of result is not 1, but " + result.size());
 
         // Test ignore case in criterion
         criteria = new Criteria();
@@ -689,8 +687,8 @@ public class DataTest extends BaseDataba
         // nor in other criterions
         assertFalse(criteria.isIgnoreCase());
         assertFalse(criterion2.isIgnoreCase());
-        assertTrue("Size of result is not 1, but " + result.size(),
-                result.size() == 1);
+        assertTrue( result.size() == 1,
+                "Size of result is not 1, but " + result.size());
 
 
         // Test ignore case in attached criterion
@@ -711,8 +709,8 @@ public class DataTest extends BaseDataba
         assertFalse(criteria.isIgnoreCase());
         assertFalse(criterion1.isIgnoreCase());
 
-        assertTrue("Size of result is not 1, but " + result.size(),
-                result.size() == 1);
+        assertTrue( result.size() == 1,
+                "Size of result is not 1, but " + result.size());
 
         // ignore case in "in" query
         {
@@ -723,9 +721,9 @@ public class DataTest extends BaseDataba
             criteria.setIgnoreCase(true);
 
             result = AuthorPeer.doSelect(criteria);
-            assertEquals("Expected result of size 1 but got " + result.size(),
+            assertEquals(  1,
                     result.size(),
-                    1);
+                    "Expected result of size 1 but got " + result.size());
         }
 
         // Check that case is not ignored if ignoreCase is not set
@@ -748,8 +746,8 @@ public class DataTest extends BaseDataba
             criteria = new Criteria();
             criteria.where(AuthorPeer.NAME, author.getName());
             result = AuthorPeer.doSelect(criteria);
-            assertTrue("Size of result is not 1, but " + result.size(),
-                    result.size() == 1);
+            assertTrue( result.size() == 1,
+                    "Size of result is not 1, but " + result.size());
 
             // again check LIKE treatment
             criteria = new Criteria();
@@ -758,8 +756,8 @@ public class DataTest extends BaseDataba
                     author.getName().replace('r', '%'),
                     Criteria.LIKE);
             result = AuthorPeer.doSelect(criteria);
-            assertTrue("Size of result is not 1, but " + result.size(),
-                    result.size() == 1);
+            assertTrue( result.size() == 1,
+                    "Size of result is not 1, but " + result.size());
 
             // Test different ignore cases in criterions
             criteria = new Criteria();
@@ -776,8 +774,8 @@ public class DataTest extends BaseDataba
             criteria.where(criterion1);
 
             result = AuthorPeer.doSelect(criteria);
-            assertTrue("Size of result is not 1, but " + result.size(),
-                    result.size() == 1);
+            assertTrue( result.size() == 1,
+                    "Size of result is not 1, but " + result.size());
 
             // ignore case in "in" query
             {
@@ -787,9 +785,9 @@ public class DataTest extends BaseDataba
                 criteria.where(AuthorPeer.NAME, names, Criteria.IN);
 
                 result = AuthorPeer.doSelect(criteria);
-                assertEquals("Expected result of size 1 but got " + result.size(),
+                assertEquals( 1,
                         result.size(),
-                        1);
+                        "Expected result of size 1 but got " + result.size());
             }
         }
 
@@ -812,8 +810,8 @@ public class DataTest extends BaseDataba
         criteria.setIgnoreCase(true);
         criteria.addAscendingOrderByColumn(AuthorPeer.NAME);
         result = AuthorPeer.doSelect(criteria);
-        assertTrue("Size of result is not 4, but " + result.size(),
-                result.size() == 4);
+        assertTrue(  result.size() == 4,
+                "Size of result is not 4, but " + result.size());
         assertEquals("AA", result.get(0).getName());
         assertEquals("ab", result.get(1).getName());
         assertEquals("ba", result.get(2).getName());
@@ -823,8 +821,8 @@ public class DataTest extends BaseDataba
         criteria = new Criteria();
         criteria.addAscendingOrderByColumn(AuthorPeer.NAME, true);
         result = AuthorPeer.doSelect(criteria);
-        assertTrue("Size of result is not 4, but " + result.size(),
-                result.size() == 4);
+        assertTrue( result.size() == 4,
+                "Size of result is not 4, but " + result.size());
         assertEquals(result.get(0).getName(), "AA");
         assertEquals(result.get(1).getName(), "ab");
         assertEquals(result.get(2).getName(), "ba");
@@ -1049,15 +1047,17 @@ public class DataTest extends BaseDataba
         Book bookEqual = new Book();
         bookEqual.setBookId(1000);
 
-        assertFalse("Author and Book should not be equal",
-                author.equals(book));
-        assertTrue("Book compared with itself should be equal",
-                book.equals(book));
-        assertTrue("Book compared with book with same id should be equal",
-                book.equals(bookEqual));
-        assertFalse("Book compared with book with different id "
-                + "should not be equal",
-                book.equals(bookNotEqual));
+        assertFalse(author.equals(book),
+                "Author and Book should not be equal"
+                );
+        assertTrue( book.equals(book),
+                "Book compared with itself should be equal");
+        assertTrue(book.equals(bookEqual),
+                "Book compared with book with same id should be equal");
+        assertFalse(book.equals(bookNotEqual),
+                "Book compared with book with different id "
+                + "should not be equal"
+                );
     }
 
     /**
@@ -1074,8 +1074,8 @@ public class DataTest extends BaseDataba
 
         IfcTable ifc = new IfcTable();
 
-        assertTrue("IfcTable should be an instance of TestInterface",
-                ifc instanceof TestInterface);
+        assertTrue( ifc instanceof TestInterface,
+                "IfcTable should be an instance of TestInterface");
 
         ifc.setID(1);
         ifc.setName("John Doe");
@@ -1085,34 +1085,38 @@ public class DataTest extends BaseDataba
 
         for (IfcTable ifcTable : results)
         {
-            assertTrue("IfcTablePeer.doSelect should return"
-                    + " instances of TestInterface",
-                    ifcTable instanceof TestInterface);
+            assertTrue(
+                    ifcTable instanceof TestInterface,
+                    "IfcTablePeer.doSelect should return"
+                            + " instances of TestInterface");
         }
 
         IfcTablePeerImpl peerImpl = IfcTablePeer.getIfcTablePeerImpl();
-        assertTrue("IfcTablePeerImpl should be an instance of "
-                + "TestPeerInterface",
-                peerImpl instanceof TestPeerInterface);
+        assertTrue(
+                peerImpl instanceof TestPeerInterface,
+                "IfcTablePeerImpl should be an instance of "
+                        + "TestPeerInterface");
 
         LocalIfcTable localIfc = new LocalIfcTable();
 
-        assertTrue("LocalIfcTable should be an instance of LocalTestInterface",
-                localIfc instanceof LocalTestInterface);
+        assertTrue( localIfc instanceof LocalTestInterface,
+                "LocalIfcTable should be an instance of LocalTestInterface");
 
         List<LocalIfcTable> results2 = LocalIfcTablePeer.doSelect(new Criteria());
 
         for (LocalIfcTable readLocalIfcTable : results2)
         {
-            assertTrue("IfcTable2Peer.doSelect should return"
-                    + " instances of LocalTestInterface",
-                    readLocalIfcTable instanceof LocalTestInterface);
+            assertTrue(
+                    readLocalIfcTable instanceof LocalTestInterface,
+                    "IfcTable2Peer.doSelect should return"
+                            + " instances of LocalTestInterface");
         }
 
         LocalIfcTablePeerImpl localPeerImpl = LocalIfcTablePeer.getLocalIfcTablePeerImpl();
-        assertTrue("LocalIfcTablePeerImpl should be an instance of "
-                + "LocalTestPeerInterface",
-                localPeerImpl instanceof LocalTestPeerInterface);
+        assertTrue(
+                localPeerImpl instanceof LocalTestPeerInterface,
+                "LocalIfcTablePeerImpl should be an instance of "
+                        + "LocalTestPeerInterface");
     }
 
     @Test
@@ -1153,9 +1157,9 @@ public class DataTest extends BaseDataba
                 InheritanceTestPeer.INHERITANCE_TEST,
                 null,
                 Criteria.ISNOTNULL);
-        assertEquals("InheritanceTestTable should contain 4 rows",
-                4,
-                new CountHelper().count(criteria));
+        assertEquals( 4,
+                new CountHelper().count(criteria),
+                "InheritanceTestTable should contain 4 rows");
         criteria = new Criteria();
         criteria.addAscendingOrderByColumn(
                 InheritanceTestPeer.INHERITANCE_TEST);
@@ -1211,9 +1215,10 @@ public class DataTest extends BaseDataba
                 InheritanceClassnameTestPeer.INHERITANCE_TEST,
                 null,
                 Criteria.ISNOTNULL);
-        assertEquals("InheritanceClassnameTest table should contain 3 rows",
+        assertEquals(
                 3,
-                new CountHelper().count(criteria));
+                new CountHelper().count(criteria),
+                "InheritanceClassnameTest table should contain 3 rows");
         criteria = new Criteria();
         criteria.addAscendingOrderByColumn(
                 InheritanceClassnameTestPeer.PAYLOAD);
@@ -1317,15 +1322,15 @@ public class DataTest extends BaseDataba
             Criteria criteria = new Criteria();
             criteria.where(AuthorPeer.NAME, authorNames[i]);
             List<Author> authorList = AuthorPeer.doSelect(criteria);
-            assertEquals(
-                    "AuthorList should contain one author"
-                            + " when querying for " + authorNames[i],
-                            1,
-                            authorList.size());
+            assertEquals( 1,
+                          authorList.size(),
+                          "AuthorList should contain one author"
+                                    + " when querying for " + authorNames[i]);
             Author author = authorList.get(0);
-            assertEquals("Name of author should be " + authorNames[i],
+            assertEquals(
                     authorNames[i],
-                    author.getName());
+                    author.getName(),
+                    "Name of author should be " + authorNames[i]);
         }
 
         for (Map.Entry<String, String> likeResult : likeResults.entrySet())
@@ -1348,18 +1353,18 @@ public class DataTest extends BaseDataba
                                 + likeResult.getKey(),
                                 e);
             }
-            assertEquals(
-                    "AuthorList contained " + authorList.size() + ", but should contain one author"
-                            + " when querying for " + likeResult.getKey(),
-                            1,
-                            authorList.size());
+            assertEquals( 1,
+                          authorList.size(),
+                          "AuthorList contained " + authorList.size() + ", but should contain one author"
+                                    + " when querying for " + likeResult.getKey());
             Author author = authorList.get(0);
-            assertEquals("Name of author should be "
-                    + likeResult.getValue()
-                    + " when querying for "
-                    + likeResult.getKey(),
+            assertEquals(
                     likeResult.getValue(),
-                    author.getName());
+                    author.getName(),
+                    "Name of author should be "
+                            + likeResult.getValue()
+                            + " when querying for "
+                            + likeResult.getKey());
         }
 
         // check that case insensitivity is maintained if
@@ -1370,13 +1375,14 @@ public class DataTest extends BaseDataba
         criteria.setIgnoreCase(true);
         List<Author> authorList = AuthorPeer.doSelect(criteria);
         assertEquals(
-                "AuthorList should contain one author",
                 1,
-                authorList.size());
+                authorList.size(),
+                "AuthorList should contain one author");
         Author author = authorList.get(0);
-        assertEquals("Name of author should be abc",
+        assertEquals(
                 "abc",
-                author.getName());
+                author.getName(),
+                "Name of author should be abc");
 
         // check that the escape clause (where needed) also works
         // with limit, offset and order by
@@ -1398,14 +1404,13 @@ public class DataTest extends BaseDataba
         criteria.setOffset(1);
         criteria.setLimit(1);
         authorList = AuthorPeer.doSelect(criteria);
-        assertEquals(
-                "AuthorList should contain one author",
-                1,
-                authorList.size());
+        assertEquals(1,
+                authorList.size(),
+                "AuthorList should contain one author");
         author = authorList.get(0);
-        assertEquals("Name of author should be bbc",
-                "bbc",
-                author.getName());
+        assertEquals( "bbc",
+                author.getName(),
+                "Name of author should be bbc");
     }
 
 

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/avalon/AvalonMapBuildersTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/avalon/AvalonMapBuildersTest.java?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/avalon/AvalonMapBuildersTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/avalon/AvalonMapBuildersTest.java Thu Dec  5 14:03:08 2019
@@ -19,12 +19,16 @@ package org.apache.torque.avalon;
  */
 
 import org.apache.avalon.framework.component.ComponentException;
-import org.apache.fulcrum.testcontainer.BaseUnitTest;
-import org.apache.torque.BaseDatabaseTestCase;
+import org.apache.fulcrum.testcontainer.BaseUnit5Test;
+
 import org.apache.torque.TorqueException;
+import org.apache.torque.junit5.extension.HostCallback;
 import org.apache.torque.map.DatabaseMap;
 import org.apache.torque.test.peer.AuthorPeer;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  * Testing of the correct MapBuilder handling of the Torque Avalon Component
@@ -32,7 +36,8 @@ import org.junit.jupiter.api.BeforeEach;
  * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
  * @version $Id$
  */
-public class AvalonMapBuildersTest extends BaseUnitTest
+@HostCallback
+public class AvalonMapBuildersTest extends BaseUnit5Test
 {
     private Torque torque = null;
     private org.apache.torque.TorqueInstance instance = null;
@@ -40,11 +45,9 @@ public class AvalonMapBuildersTest exten
     /**
      * Constructor for test.
      *
-     * @param testName name of the test being executed
      */
-    public AvalonMapBuildersTest(String name)
+    public AvalonMapBuildersTest()
     {
-        super( name );
 
         // trigger static constructor before Torque initialization
         AuthorPeer.getAuthorPeerImpl();
@@ -56,16 +59,16 @@ public class AvalonMapBuildersTest exten
     @BeforeEach
     public void setUp() throws Exception
     {
-        if (!org.apache.torque.Torque.isInit())
-        {
-            org.apache.torque.Torque.init(System.getProperty(
-                    BaseDatabaseTestCase.CONFIG_FILE_SYSTEM_PROPERTY));
-        }
+//        if (!org.apache.torque.Torque.isInit())
+//        {
+//            org.apache.torque.Torque.init(System.getProperty(
+//                    BaseDatabaseTestCase.CONFIG_FILE_SYSTEM_PROPERTY));
+//        }
         setConfigurationFileName("src/test/resources/TestComponentConfig.xml");
         setRoleFileName("src/test/resources/TestRoleConfig.xml");
         try
         {
-            torque = (Torque) this.resolve(Torque.ROLE);
+            torque = (Torque) this.lookup(Torque.ROLE);
         }
         catch (ComponentException e)
         {
@@ -77,6 +80,7 @@ public class AvalonMapBuildersTest exten
     /**
      * Verifies that the MapBuilder is available in the DatabaseMap.
      */
+    @Test
     public void testMapBuilder()
     {
         DatabaseMap dbMap = null;
@@ -90,8 +94,9 @@ public class AvalonMapBuildersTest exten
             fail(e.getMessage());
         }
 
-        assertTrue("Table author should be in the DatabaseMap",
-                dbMap.containsTable(AuthorPeer.TABLE_NAME));
-        assertFalse("Torque instances should be different", torque == instance);
+        assertTrue(
+                dbMap.containsTable(AuthorPeer.TABLE_NAME),
+                "Table author should be in the DatabaseMap");
+        assertFalse(torque == instance, "Torque instances should be different");
     }
 }

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallback.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallback.java?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallback.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallback.java Thu Dec  5 14:03:08 2019
@@ -27,18 +27,22 @@ import java.lang.annotation.Target;
 
 import org.junit.jupiter.api.Tag;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+
 import org.junit.jupiter.api.extension.ExtendWith;
 
 // may have ParameterizedTest in test class -> Possible configuration error
 @Test
 @Tag("host")
 @Inherited
-@Target( { ElementType.TYPE, ElementType.METHOD } )
+@Target( { ElementType.TYPE, ElementType.METHOD, ElementType.ANNOTATION_TYPE } )
 @Retention(RetentionPolicy.RUNTIME)
 @ExtendWith(HostCallbackExtension.class)
 @ExtendWith(AdapterParameterResolver.class)
 //@EnabledIfEnvironmentVariable(named = "torque.callback", matches = "host")
 public @interface HostCallback {
-
+    /**
+     * @return default adapter
+     */
+    
+    String adapterProfileFallback() default "hsqldb";
 }

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallbackExtension.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallbackExtension.java?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallbackExtension.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallbackExtension.java Thu Dec  5 14:03:08 2019
@@ -20,6 +20,7 @@ package org.apache.torque.junit5.extensi
  */
 
 import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled;
+import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated;
 
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -33,65 +34,98 @@ import org.junit.jupiter.api.extension.E
 import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
 
 /**
- * Legacy host based testing requires a database environment settings available and started.
+ * Legacy host based testing requires a database environment settings available
+ * and started.
  * 
  * @author gk
  *
  */
 public class HostCallbackExtension implements BeforeAllCallback, ExecutionCondition {
-    
-  private static final Logger log = LogManager.getLogger(HostCallbackExtension.class);
 
-  /** The system property containing the path to the configuration file. */
-  public static final String CONFIG_FILE_SYSTEM_PROPERTY
-  = "torque.configuration.file";
-
-  protected static Adapter defaultAdapter;
-  
-  public static Namespace NS = Namespace.create(DockerCallbackExtension.class);
-  
-  public boolean skip = true;
-  
-  private static final ConditionEvaluationResult ENABLED_BY_DEFAULT = enabled(
-          "HostCallbackExtension does not enable test - checking internal state only");
-  
-  @Override
-  public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
-      String actual = System.getProperty("torque.callback");
-      if (actual != null && actual.matches("host")) {
-          skip = false;
-      }
-      return ENABLED_BY_DEFAULT;
-  }
-  
-  @Override
-  public void beforeAll(ExtensionContext context) throws Exception {
-      if (skip) {
-          log.info("skipping host based environment call context, torque.callback: {} ", System.getenv("torque.callback"));    
-      } else {
-          //log.info("starting call context "+ context); 
-          setUp();
-          context.getStore(Namespace.GLOBAL).put("adapter", defaultAdapter);          
-      }
-  }
-
-  /**
-   * Initialize Torque on the first setUp().  Subclasses which override
-   * setUp() must call super.setUp() as their first action.
-   */
-  public void setUp() throws Exception
-  {
-      synchronized (HostCallbackExtension.class)
-      {
-          if (!Torque.isInit())
-          {
-              Torque.init(
-                      System.getProperty(
-                              CONFIG_FILE_SYSTEM_PROPERTY));
-          }
-      }
-      defaultAdapter = Torque.getDatabase(Torque.getDefaultDB()).getAdapter();
-  }
+    private static final String DEFAULT_TEST_PROFILE_TORQUE_PROPERTIES = "src/test/profile/%s/Torque.properties";
+
+    private static final Logger log = LogManager.getLogger(HostCallbackExtension.class);
+
+    /** The system property containing the path to the configuration file. */
+    public static final String CONFIG_FILE_SYSTEM_PROPERTY = "torque.configuration.file";
+
+    protected static Adapter defaultAdapter;
+
+    public static Namespace NS = Namespace.create(DockerCallbackExtension.class);
+
+    public boolean skip = true;
+
+    private static final ConditionEvaluationResult ENABLED_BY_DEFAULT = enabled(
+            "HostCallbackExtension does not enable test - checking internal state only");
+
+    @Override
+    public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
+        String actual = System.getProperty("torque.callback");
+        if (actual == null) {
+            actual = System.getenv("torque.callback");
+        }
+        if (actual != null) {
+            log.debug("checking host based environment call context, torque.callback: {} ",  actual);
+            if (actual.matches("host")) {
+                skip = false;
+            } 
+        }
+        return ENABLED_BY_DEFAULT;
+    }
+
+    @Override
+    public void beforeAll(ExtensionContext context) throws Exception {
+        if (!isHostCallback(context)) {
+            throw new Exception("Use @HostCallback annotation to use HostCallbackExtension. Class: "
+                    + context.getRequiredTestClass());
+        }
+        if (skip) {
+            log.info("skipping host based environment call context, torque.callback: {} ",
+                    System.getenv("torque.callback"));
+            return;
+        } else {
+            // log.info("starting call context "+ context);
+            setUp(context);
+            context.getStore(Namespace.GLOBAL).put("adapter", defaultAdapter);
+        }
+    }
+
+    /**
+     * Initialize Torque on the first setUp(). Subclasses which override setUp()
+     * must call super.setUp() as their first action.
+     */
+    public void setUp(ExtensionContext context) throws Exception {
+        String filePath = System.getProperty(CONFIG_FILE_SYSTEM_PROPERTY);
+        if (filePath == null) {
+            log.warn("Could not resolve system property: {}", CONFIG_FILE_SYSTEM_PROPERTY);
+            filePath = System.getenv(CONFIG_FILE_SYSTEM_PROPERTY);
+        }
+        if (filePath == null) {
+            filePath = getDefaultTestProfileFallback(context);
+            log.warn("Could not resolve system env/property: {}, using default: {}", CONFIG_FILE_SYSTEM_PROPERTY,
+                    filePath);
+        }
+
+        synchronized (HostCallbackExtension.class) {
+            if (!Torque.isInit()) {
+                Torque.init(filePath);
+            }
+        }
+        defaultAdapter = Torque.getDatabase(Torque.getDefaultDB()).getAdapter();
+    }
+
+    private String getDefaultTestProfileFallback(ExtensionContext context) {
+        Class<?> clazz = context.getRequiredTestClass();
+        HostCallback hostCallback = clazz.getAnnotation(HostCallback.class);
+        String adapterProfile = hostCallback.adapterProfileFallback();
+        if (adapterProfile == null) {
+            adapterProfile = "mysql";
+        }
+        return String.format(DEFAULT_TEST_PROFILE_TORQUE_PROPERTIES, adapterProfile);
+    }
+
+    private static boolean isHostCallback(ExtensionContext context) {
+        return isAnnotated(context.getRequiredTestClass(), HostCallback.class);
+    }
 
-    
 }

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/BeanConditionalContainerTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/BeanConditionalContainerTest.java?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/BeanConditionalContainerTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/BeanConditionalContainerTest.java Thu Dec  5 14:03:08 2019
@@ -22,7 +22,7 @@ package org.apache.torque.testcontainer;
 import org.apache.torque.BeanTestConditional;
 import org.apache.torque.testcontainer.junit5.extension.DockerCallback;
 
-@DockerCallback
+@DockerCallback(adapterProfileFallback="mysql")
 public class BeanConditionalContainerTest extends BeanTestConditional {
 
 }

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/DataContainerTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/DataContainerTest.java?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/DataContainerTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/DataContainerTest.java Thu Dec  5 14:03:08 2019
@@ -28,7 +28,7 @@ import org.apache.torque.testcontainer.j
  * @author <a href="mailto:gk@apache.org">Georg Kallidis</a>
  * @version $Id: DataTest.java 1869081 2019-10-28 16:17:11Z gk $
  */
-@DockerCallback
+@DockerCallback(adapterProfileFallback="mysql")
 public class DataContainerTest extends DataTest
 {
    

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/ManagerConditionalContainerTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/ManagerConditionalContainerTest.java?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/ManagerConditionalContainerTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/ManagerConditionalContainerTest.java Thu Dec  5 14:03:08 2019
@@ -22,7 +22,7 @@ package org.apache.torque.testcontainer;
 import org.apache.torque.ManagerTestConditional;
 import org.apache.torque.testcontainer.junit5.extension.DockerCallback;
 
-@DockerCallback
+@DockerCallback(adapterProfileFallback="mysql")
 public class ManagerConditionalContainerTest extends ManagerTestConditional {
 
 }

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallback.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallback.java?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallback.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallback.java Thu Dec  5 14:03:08 2019
@@ -27,7 +27,7 @@ import java.lang.annotation.Target;
 
 import org.apache.torque.junit5.extension.AdapterParameterResolver;
 import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.testcontainers.junit.jupiter.Testcontainers;
 
@@ -43,11 +43,23 @@ import org.testcontainers.junit.jupiter.
 // may have ParameterizedTest in test class -> Possible configuration error
 @Tag("DockerCallback")
 @Inherited
-@Target( { ElementType.TYPE, ElementType.METHOD } )
+@Target( { ElementType.TYPE, ElementType.METHOD, ElementType.ANNOTATION_TYPE } )
 @Retention(RetentionPolicy.RUNTIME)
 @ExtendWith(DockerCallbackExtension.class)
 @ExtendWith(AdapterParameterResolver.class)
 //@EnabledIfEnvironmentVariable(named = "torque.callback", matches = "docker")
 public @interface DockerCallback {
     String value() default "";
+    
+    String adapterProfileFallback() default "hsqldb";
+    
+    String customUrlKey() default "torque.dsfactory.bookstore.connection.url";
+    
+    String targetConfigName() default "torqueuser";
+    
+    String targetFileName() default "torque.usersettings.properties";
+    
+    boolean skipConfigurationCheck() default false;
+    
+    
 }

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallbackExtension.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallbackExtension.java?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallbackExtension.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallbackExtension.java Thu Dec  5 14:03:08 2019
@@ -1,5 +1,6 @@
 package org.apache.torque.testcontainer.junit5.extension;
 
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -19,7 +20,8 @@ package org.apache.torque.testcontainer.
  * under the License.
  */
 
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -27,6 +29,13 @@ import java.io.IOException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import org.apache.commons.configuration2.CombinedConfiguration;
+import org.apache.commons.configuration2.Configuration;
+import org.apache.commons.configuration2.PropertiesConfiguration;
+import org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder;
+import org.apache.commons.configuration2.builder.fluent.Parameters;
+import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler;
+import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.torque.Torque;
@@ -34,6 +43,8 @@ import org.apache.torque.TorqueException
 import org.apache.torque.adapter.Adapter;
 import org.junit.jupiter.api.extension.BeforeAllCallback;
 import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
+import org.junit.jupiter.api.extension.ConditionEvaluationResult;
+import org.junit.jupiter.api.extension.ExecutionCondition;
 import org.junit.jupiter.api.extension.ExtensionContext;
 import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
 import org.testcontainers.containers.GenericContainer;
@@ -43,120 +54,193 @@ import org.testcontainers.junit.jupiter.
 import org.testcontainers.junit.jupiter.Testcontainers;
 
 /**
+ * Testcontainer configuration
  * 
  * @author gk
  *
  */
 @Testcontainers
-public class DockerCallbackExtension implements BeforeAllCallback, BeforeTestExecutionCallback {
-    
+public class DockerCallbackExtension implements BeforeAllCallback, BeforeTestExecutionCallback, ExecutionCondition {
+
+    private static final String DEFAULT_TEST_PROFILE_TORQUE4_TEST_XML = "src/test/profile/%s/Torque4Test.xml";
+
     private static final String TORQUE_WRAPPER_CONFIG_SYSTEM_PROPERTY = "torque.wrapper.configuration.file";
-    
+
     // copied from src/test/profile/mysql/docker-resources/db/
     private static final String DOCKERFILE = "./target/Dockerfile";
- 
+
     private static Logger log = LogManager.getLogger();
-   
+
     private static int SERVICE_PORT = 3306;
 
     private static String DATABASE_NAME = "bookstore";
-    
+
     protected static Adapter defaultAdapter;
-    
+
     public static Namespace NS = Namespace.create(DockerCallbackExtension.class);
-    
+
+    private static final ConditionEvaluationResult ENABLED_BY_DEFAULT = enabled(
+            "DockerCallbackExtension is enabled by default - checking internal state only");
+
     @Container
-    public static GenericContainer MY_SQL_CONTAINER =   new GenericContainer<>(
-            new ImageFromDockerfile()
-            .withDockerfile(new File(DOCKERFILE).toPath())
-        ).withExposedPorts( SERVICE_PORT ) //.withStartupAttempts( 2 )
-         .withEnv(  "MYSQL_DATABASE", DATABASE_NAME )
-         .withEnv( "MYSQL_USER", "torque"  )
-         .withEnv( "MYSQL_PASSWORD", "torque" )
-         .withEnv( "MYSQL_ROOT_PASSWORD","torque" );
+    public static GenericContainer MY_SQL_CONTAINER = new GenericContainer<>(
+            new ImageFromDockerfile().withDockerfile(new File(DOCKERFILE).toPath())).withExposedPorts(SERVICE_PORT) 
+                    .withEnv("MYSQL_DATABASE", DATABASE_NAME).withEnv("MYSQL_USER", "torque")
+                    .withEnv("MYSQL_PASSWORD", "torque").withEnv("MYSQL_ROOT_PASSWORD", "torque");
+
+    @Override
+    public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
+        String actual = System.getProperty("torque.callback");
+        if (actual == null) {
+            actual = System.getenv("torque.callback");
+        }
+        if (actual != null && actual.matches("docker")) {
+        }
+        return ENABLED_BY_DEFAULT;
+    }
 
     @Override
     public void beforeAll(ExtensionContext context) throws Exception {
-        //log.info("starting call context "+ context);      
-        init();
+        // log.info("starting call context "+ context);
+
+        init(context);
         context.getStore(NS).put("container", MY_SQL_CONTAINER);
         context.getStore(Namespace.GLOBAL).put("adapter", defaultAdapter);
     }
-    
+
     @Override
     public void beforeTestExecution(ExtensionContext context) throws Exception {
-        //log.info("starting call test context "+ context);
+        // log.info("starting call test context "+ context);
     }
-    
-    private void init() throws TorqueException, UnsupportedOperationException, IOException, InterruptedException {
+
+    private void init(ExtensionContext context)
+            throws TorqueException, UnsupportedOperationException, IOException, InterruptedException {
         log.info("Starting from dockerfile: {}", DOCKERFILE);
-        //before torque init
-        MY_SQL_CONTAINER.setStartupAttempts( 3 );       
-        startDatabaseContainer();   
+        // before torque init
+        MY_SQL_CONTAINER.setStartupAttempts(3);
+        startDatabaseContainer();
         // TODO do resource filtering and read from properties
-        File targetFile = new File(System.getProperty(
-                TORQUE_WRAPPER_CONFIG_SYSTEM_PROPERTY)
-                );
+        String filePath = System.getProperty(TORQUE_WRAPPER_CONFIG_SYSTEM_PROPERTY);
+        if (filePath == null) {
+            log.warn("Could not resolve system property: {}", TORQUE_WRAPPER_CONFIG_SYSTEM_PROPERTY);
+            filePath = System.getenv(TORQUE_WRAPPER_CONFIG_SYSTEM_PROPERTY);
+        }
+        if (filePath == null) {
+            filePath = getDefaultTestProfileFallback(context);
+            log.warn("Could not resolve system env/property: {}, using default: {}",
+                    TORQUE_WRAPPER_CONFIG_SYSTEM_PROPERTY, filePath);
+        }
+        File targetFile = new File(filePath);
         Path torqueConfBase = Paths.get(targetFile.toURI()).getParent();
-        updateTorque(torqueConfBase);
         
-        synchronized (DockerCallbackExtension.class)
-        {
-            if (!Torque.isInit())
-            {
-                Torque.init(
-                        System.getProperty(
-                                TORQUE_WRAPPER_CONFIG_SYSTEM_PROPERTY));
+        if (!getSkipConfigurationCheck(context)) {
+            CombinedConfigurationBuilder combinedBuilder = new CombinedConfigurationBuilder()
+                    .configure(new Parameters().fileBased()
+                            .setFileName(filePath)
+                            .setListDelimiterHandler(new DefaultListDelimiterHandler(','))
+                   );
+            try {
+                CombinedConfiguration cc = combinedBuilder.getConfiguration();
+                String targetConfigName = getTargetConfigName(context);
+                PropertiesConfiguration innerConfRef = (PropertiesConfiguration) cc.getConfiguration(targetConfigName);
+                assertTrue(innerConfRef != null, "Could not locate target configuration with config-namen: " + targetConfigName);
+            } catch (ConfigurationException e) {
+               log.error(e.getMessage(), e);
+            }            
+        }
+        String fileName =  getTargetFileName(context);
+        String customUrlKey = getCustomUrlKey(context);
+        updateTorque(torqueConfBase, fileName, customUrlKey);
+
+        synchronized (DockerCallbackExtension.class) {
+            if (!Torque.isInit()) {
+                Torque.init(filePath);
             }
         }
         defaultAdapter = Torque.getDatabase(Torque.getDefaultDB()).getAdapter();
         log.info("using adapter: {}", defaultAdapter);
 
     }
+
+    private String getDefaultTestProfileFallback(ExtensionContext context) {
+        Class<?> clazz = context.getRequiredTestClass();
+        DockerCallback dockerCallback = clazz.getAnnotation(DockerCallback.class);
+        String adapterProfile = dockerCallback.adapterProfileFallback();
+        if (adapterProfile == null) {
+            adapterProfile = "mysql";
+        }
+        return String.format(DEFAULT_TEST_PROFILE_TORQUE4_TEST_XML, adapterProfile);
+    }
+    
+    private String getCustomUrlKey(ExtensionContext context) {
+        Class<?> clazz = context.getRequiredTestClass();
+        DockerCallback dockerCallback = clazz.getAnnotation(DockerCallback.class);
+        return dockerCallback.customUrlKey();
+    }
     
-    private static void updateTorque(Path torqueConfBase) {
-        try {      
+    private String getTargetConfigName(ExtensionContext context) {
+        Class<?> clazz = context.getRequiredTestClass();
+        DockerCallback dockerCallback = clazz.getAnnotation(DockerCallback.class);
+        return dockerCallback.targetConfigName();
+    }
+    
+    private String getTargetFileName(ExtensionContext context) {
+        Class<?> clazz = context.getRequiredTestClass();
+        DockerCallback dockerCallback = clazz.getAnnotation(DockerCallback.class);
+        return dockerCallback.targetFileName();
+    }
+    
+    private boolean getSkipConfigurationCheck(ExtensionContext context) {
+        Class<?> clazz = context.getRequiredTestClass();
+        DockerCallback dockerCallback = clazz.getAnnotation(DockerCallback.class);
+        return dockerCallback.skipConfigurationCheck();
+    }
+
+    private static void updateTorque(Path torqueConfBase, String fileName, String customUrlKey) {
+        try {
             String jdbcConnectionString = generateJdbcUrl();
-            String customUrl = "torque.dsfactory.bookstore.connection.url="+ jdbcConnectionString;
+            String customUrl = customUrlKey+"=" + jdbcConnectionString;
             // override and set mapped port in url, which is known only at runtime.
-            File file = torqueConfBase.resolve("torque.usersettings.properties").toFile();
-            try (FileOutputStream fop = new FileOutputStream(file )) {
+            File file = torqueConfBase.resolve(fileName).toFile();
+            try (FileOutputStream fop = new FileOutputStream(file)) {
                 if (!file.exists()) {
                     file.createNewFile();
                 }
-                fop.write( customUrl.getBytes() );
+                fop.write(customUrl.getBytes());
                 fop.flush();
             }
-         } catch (Exception e) {
+        } catch (Exception e) {
             fail();
-         }
+        }
     }
-    
+
     private static void startDatabaseContainer() {
-       if (!MY_SQL_CONTAINER.isRunning()) {
-          MY_SQL_CONTAINER.waitingFor(Wait.forListeningPort());
-          MY_SQL_CONTAINER.start();
-       }
+        if (!MY_SQL_CONTAINER.isRunning()) {
+            MY_SQL_CONTAINER.waitingFor(Wait.forListeningPort());
+            MY_SQL_CONTAINER.start();
+        }
     }
-    
+
     /**
      * 
      * @returns the JDBC string with mapped port binding
      */
     private static String generateJdbcUrl() {
-       startDatabaseContainer();
-       if (!MY_SQL_CONTAINER.isRunning()) { throw new RuntimeException("Could not find RUNNING database container"); }
-       
-       //MY_SQL_CONTAINER.withCreateContainerCmdModifier(modifier) //    
-       String serviceHost = MY_SQL_CONTAINER.getContainerIpAddress();
-       Integer mappedPort = MY_SQL_CONTAINER.getMappedPort(SERVICE_PORT);// e.g. 32811
-       log.info("generate jdbc url from {}, mapped Port: {}, bounded port: {}", serviceHost, mappedPort, MY_SQL_CONTAINER.getBoundPortNumbers());
-       
-       String targetJDBC = //genJDBC;
-       String.format("jdbc:mysql://%s:%d/%s?loggerLevel=OFF", serviceHost,
-                     mappedPort, DATABASE_NAME);
-       log.info( "used connect url: {}", targetJDBC);
-       return targetJDBC;
+        startDatabaseContainer();
+        if (!MY_SQL_CONTAINER.isRunning()) {
+            throw new RuntimeException("Could not find RUNNING database container");
+        }
+
+        // MY_SQL_CONTAINER.withCreateContainerCmdModifier(modifier) //
+        String serviceHost = MY_SQL_CONTAINER.getContainerIpAddress();
+        Integer mappedPort = MY_SQL_CONTAINER.getMappedPort(SERVICE_PORT);// e.g. 32811
+        log.info("generate jdbc url from {}, mapped Port: {}, bounded port: {}", serviceHost, mappedPort,
+                MY_SQL_CONTAINER.getBoundPortNumbers());
+
+        String targetJDBC = // genJDBC;
+                String.format("jdbc:mysql://%s:%d/%s?loggerLevel=OFF", serviceHost, mappedPort, DATABASE_NAME);
+        log.info("used connect url: {}", targetJDBC);
+        return targetJDBC;
     }
 
 }

Modified: db/torque/torque4/trunk/torque-test/src/test/profile/mysql/torque.usersettings.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/profile/mysql/torque.usersettings.properties?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/profile/mysql/torque.usersettings.properties (original)
+++ db/torque/torque4/trunk/torque-test/src/test/profile/mysql/torque.usersettings.properties Thu Dec  5 14:03:08 2019
@@ -1,18 +1 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-## do not change, generated!
\ No newline at end of file
+torque.dsfactory.bookstore.connection.url=jdbc:mysql://192.168.99.101:32848/bookstore?loggerLevel=OFF
\ No newline at end of file

Modified: db/torque/torque4/trunk/torque-test/src/test/resources/cache.ccf
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/resources/cache.ccf?rev=1870877&r1=1870876&r2=1870877&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/resources/cache.ccf (original)
+++ db/torque/torque4/trunk/torque-test/src/test/resources/cache.ccf Thu Dec  5 14:03:08 2019
@@ -18,16 +18,17 @@
 # Java Caching System configuration
 
 jcs.default=
-jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.default.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
 jcs.default.cacheattributes.MaxObjects=100
-jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+jcs.default.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
+
 
 jcs.region.om_Author=
-jcs.region.om_Author.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.region.om_Author.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
 jcs.region.om_Author.cacheattributes.MaxObjects=100
-jcs.region.om_Author.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+jcs.region.om_Author.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
 
 jcs.region.om_Book=
-jcs.region.om_Book.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.region.om_Book.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
 jcs.region.om_Book.cacheattributes.MaxObjects=100
-jcs.region.om_Book.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+jcs.region.om_Book.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message