Author: gk Date: Wed Dec 4 15:51:06 2019 New Revision: 1870836 URL: http://svn.apache.org/viewvc?rev=1870836&view=rev Log: - update surefire to 3.0.0-M4, use new notations - update tests to JUnit 5 - cleanup code duplicated in DataContainerTest.java, remove BaseDatabaseContainerTestCase.java - use extensions: host, adapter, docker, allow alternatively host or docker based callback - add more testcontainer tests - tested -Phsqldb, mysql, managers, bean
Added: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/AdapterParameterResolver.java (with props) db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/AdapterProvider.java (with props) db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallback.java (with props) db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/junit5/extension/HostCallbackExtension.java (with props) db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/BeanConditionalContainerTest.java (with props) db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/ManagerConditionalContainerTest.java (with props) db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallback.java (with props) db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerCallbackExtension.java (with props) Removed: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/BaseDatabaseContainerTestCase.java Modified: db/torque/torque4/trunk/pom.xml db/torque/torque4/trunk/torque-test/README.md 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/BeanTestConditional.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/DocsTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/JndiConfigurationTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ManagerTestConditional.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/adapter/AdapterTest.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/datatypes/BinaryTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/ByteTypeTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/ClobTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/DateTimeTimestampTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/EnumTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/LongvarbinaryTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/VarbinaryTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/GetRelatedObjectsJoinTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/GetRelatedObjectsTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/SaveTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/ValueEqualsTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/ViewTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/BaseOptimisticLockingTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/DefaultValuesFromDatabaseTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/DefaultValuesFromJavaTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/DeleteTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/DoInsertTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/DoUpdateTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/ExecuteStatementsTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/FillerTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/GroupByTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/ImplInitialisationTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/JoinTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/OptimisticLockingSelectForUpdateTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/OptimisticLockingSimpleSelectTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/QualifiedTableNameTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/RetrieveByPkTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SaveMethodsInPeerTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectInTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectSetOperationTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SetAndSaveTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/WhereClauseSubselectTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/map/DatabaseMapTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/oid/IDBrokerTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/om/OMByNameMethodsTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/sql/SkipSqlTest.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/util/BasePeerTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/CopyTestConditional.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/ExceptionMapperTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/LargeSelectTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/SummaryHelperTest.java db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/TorqueConnectionImplTest.java db/torque/torque4/trunk/torque-test/src/test/profile/mysql/docker-resources/testcontainers.properties Modified: db/torque/torque4/trunk/pom.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/pom.xml?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/pom.xml (original) +++ db/torque/torque4/trunk/pom.xml Wed Dec 4 15:51:06 2019 @@ -484,17 +484,14 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>3.0.0-M3</version> + <version>3.0.0-M4</version> <configuration> <!--default setting is forkCount=1/reuseForks=true --> <reuseForks>false</reuseForks> <forkCount>1</forkCount> - <systemProperties> - <property> - <name>derby.stream.error.file</name> - <value>target/derby.log</value> - </property> - </systemProperties> + <systemPropertyVariables> + <derby.stream.error.file>target/derby.log</derby.stream.error.file> + </systemPropertyVariables> </configuration> </plugin> <!-- hint: mvn verify -Ddependency.check.skip=false --> Modified: db/torque/torque4/trunk/torque-test/README.md URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/README.md?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/README.md (original) +++ db/torque/torque4/trunk/torque-test/README.md Wed Dec 4 15:51:06 2019 @@ -53,8 +53,9 @@ Currently only supported for mysql adapt #### OS System Adjustments -* a windows system 7 below without hyperv may require starting docker using docker-machine start <id>, environment check with docker-machine env <id> and setting it in shell. +* docker-maven-plugin needs appropriate environment set. Windows system 7 below without hyperv may require starting docker using docker-machine start <id>, environment check with docker-machine env <id> and setting it in shell. * check a running mysql daemon, stop or disable docker-maven-plugin. +* docker testcontainer reads docker-java.properties. Find it for profile mysql here: src/test/profile/mysql/docker-resources. - run it with profile: ```sh Modified: db/torque/torque4/trunk/torque-test/pom.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/pom.xml?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/pom.xml (original) +++ db/torque/torque4/trunk/torque-test/pom.xml Wed Dec 4 15:51:06 2019 @@ -141,6 +141,8 @@ <delete dir="src/main/generated-java" /> <echo message="Deleting directory target/torque" /> <delete dir="target/torque" /> + <echo message="Deleting log file torque-test.log" /> + <delete file="target/torque-test.log" /> </target> </configuration> <goals> @@ -513,22 +515,18 @@ <include>**/${torque.test.include.managers}</include> </includes> <excludes> - <exclude>**/BaseDatabaseTestCase.java</exclude> + <exclude>**/Base*.java</exclude> <exclude>**/*Container*.java</exclude> + <exclude>**/junit5/extension/**</exclude> </excludes> - <forkCount>1</forkCount> + <!--excludedGroups>docker</excludedGroups--> + <forkCount>0</forkCount> <reuseForks>false</reuseForks> - <!-- forkMode>pertest</forkMode--><!-- normally pertest, if remote debugging with mvnDebug port 8000, setting in console -DforkMode=none seems to have no effect, set here --> - <systemProperties> - <property> - <name>torque.configuration.file</name> - <value>src/test/profile/${torque.test.profileDirectory}/Torque.properties</value> - </property> - <property> - <name>derby.stream.error.file</name> - <value>target/derby.log</value> - </property> - </systemProperties> + <!-- 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"> + <torque.configuration.file>src/test/profile/${torque.test.profileDirectory}/Torque.properties</torque.configuration.file> + <torque.callback>host</torque.callback> + </systemPropertyVariables> </configuration> </plugin> @@ -1173,8 +1171,8 @@ </plugins> </build> </profile> - <!-- - mvn clean test -Pmysql,docker-testcontainer + <!-- + mvn -Pmysql,docker-testcontainer,managers,beans clean test --> <profile> <id>docker-testcontainer</id> @@ -1307,25 +1305,23 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> - <systemProperties> - <property> - <!-- file is sued, but not this configuration setting, cft. --> - <name>torque.wrapper.configuration.file</name> - <value>src/test/profile/${torque.test.profileDirectory}/Torque4Test.xml</value> - </property> - </systemProperties> + <systemPropertyVariables> + <torque.wrapper.configuration.file>src/test/profile/${torque.test.profileDirectory}/Torque4Test.xml</torque.wrapper.configuration.file> + <torque.callback>docker</torque.callback> + </systemPropertyVariables> <excludes> <exclude>**/Base*.java</exclude> + <exclude>**/junit5/extension/**</exclude> </excludes> <includes> - <include>**/DataContainerTest.java</include> + <include>**/testcontainer/**</include> </includes> + <!--groups>DockerCallback</groups--> </configuration> <executions> <execution> <id>default-test</id> <configuration> - <!--groups>docker</groups--> </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=1870836&r1=1870835&r2=1870836&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 Wed Dec 4 15:51:06 2019 @@ -1,5 +1,8 @@ package org.apache.torque; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -24,11 +27,10 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -import junit.framework.TestCase; - import org.apache.torque.adapter.Adapter; import org.apache.torque.adapter.MysqlAdapter; import org.apache.torque.criteria.Criteria; +import org.apache.torque.junit5.extension.HostCallback; import org.apache.torque.om.mapper.StringMapper; import org.apache.torque.test.dbobject.Author; import org.apache.torque.test.dbobject.Book; @@ -37,39 +39,20 @@ import org.apache.torque.test.peer.BookP import org.apache.torque.util.BasePeerImpl; import org.apache.torque.util.CountHelper; + /** * Base functionality for Test cases which use standard database setup. * * @author <a href="mailto:se...@backstagetech.com.au">Scott Eade</a> * @version $Id$ */ -public abstract class BaseDatabaseTestCase extends TestCase +@HostCallback +public abstract class BaseDatabaseTestCase { /** 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; - - /** - * Initialize Torque on the first setUp(). Subclasses which override - * setUp() must call super.setUp() as their first action. - */ - @Override - public void setUp() throws Exception - { - synchronized (BaseDatabaseTestCase.class) - { - if (!Torque.isInit()) - { - Torque.init( - System.getProperty( - CONFIG_FILE_SYSTEM_PROPERTY)); - } - } - defaultAdapter = Torque.getDatabase(Torque.getDefaultDB()).getAdapter(); - } - /** * Queries mysql for its version. * @return the version String mysql returns Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BeanTestConditional.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BeanTestConditional.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BeanTestConditional.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BeanTestConditional.java Wed Dec 4 15:51:06 2019 @@ -32,6 +32,12 @@ import org.apache.torque.test.dbobject.A import org.apache.torque.test.dbobject.Book; import org.apache.torque.test.peer.AuthorPeer; import org.apache.torque.test.peer.BookPeer; +import org.junit.jupiter.api.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + /** * Test generated bean classes. @@ -56,6 +62,7 @@ public class BeanTestConditional extends /** * tests the creation of beans from objects and vice versa */ + @Test public void testCreateBeans() throws Exception { Author author = new Author(); @@ -83,6 +90,7 @@ public class BeanTestConditional extends * tests whether it is possible to serialize/deserialize beans * @throws Exception */ + @Test public void testSerializeBeans() throws Exception { Author author = new Author(); @@ -148,6 +156,7 @@ public class BeanTestConditional extends * tests whether object relations are transferred correctly, * if two objects refer to each other */ + @Test public void testSameObjectRelations() throws Exception { Author author = new Author(); @@ -199,6 +208,7 @@ public class BeanTestConditional extends * if there is no mutual reference between objects * @throws Exception */ + @Test public void testDifferentObjectRelations() throws Exception { // create a relation chain: @@ -260,6 +270,7 @@ public class BeanTestConditional extends differentAuthor.getBooks().get(0) != book); } + @Test public void testSaves() throws Exception { Criteria criteria = new Criteria(); 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=1870836&r1=1870835&r2=1870836&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 Wed Dec 4 15:51:06 2019 @@ -27,6 +27,11 @@ 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 org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.torque.adapter.Adapter; @@ -36,6 +41,8 @@ import org.apache.torque.adapter.MssqlAd import org.apache.torque.adapter.MysqlAdapter; 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; @@ -78,6 +85,8 @@ import org.apache.torque.test.recordmapp import org.apache.torque.util.BasePeerImpl; import org.apache.torque.util.CountHelper; import org.apache.torque.util.Transaction; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.provider.ArgumentsSource; /** * Runtime tests. @@ -97,6 +106,7 @@ public class DataTest extends BaseDataba * test whether we can connect to the database at all * @throws Exception if no connection can be established */ + @Test public void testConnect() throws Exception { Connection connection = null; @@ -119,6 +129,7 @@ public class DataTest extends BaseDataba * multiple pk test (TRQ12) * @throws Exception if the test fails */ + @Test public void testMultiplePk() throws Exception { // clean table @@ -145,7 +156,9 @@ public class DataTest extends BaseDataba * * @throws Exception if the test fails */ - public void testLimitOffset() throws Exception + @Test + @ArgumentsSource(AdapterProvider.class) + public void testLimitOffset(Adapter adapter) throws Exception { cleanBookstore(); insertBookstoreData(); @@ -175,7 +188,7 @@ public class DataTest extends BaseDataba // Test limit of zero works - if (defaultAdapter instanceof DerbyAdapter || defaultAdapter instanceof HsqldbAdapter) + if (adapter instanceof DerbyAdapter || adapter instanceof HsqldbAdapter) { log.info("testLimitOffset(): " + "A limit of 0 is not supported for Derby or Hsqldb"); @@ -207,6 +220,7 @@ public class DataTest extends BaseDataba /** * Checks whether the setSingleRecord() method in criteria works */ + @Test public void testSingleRecord() throws Exception { cleanBookstore(); @@ -239,6 +253,7 @@ public class DataTest extends BaseDataba * is used. * @throws Exception if the test fails */ + @Test public void testNullSelects() throws Exception { // clean table @@ -294,6 +309,7 @@ public class DataTest extends BaseDataba * specified record. * @throws Exception if anything in the test goes wrong. */ + @Test public void testUpdate() throws Exception { cleanBookstore(); @@ -372,6 +388,7 @@ public class DataTest extends BaseDataba * test special cases in the select clause * @throws Exception if the test fails */ + @Test public void testSelectClause() throws Exception { // test double functions in select columns @@ -391,6 +408,7 @@ public class DataTest extends BaseDataba * test if a select from the "default" database works * @throws Exception (NPE) if the test fails */ + @Test public void testSelectFromDefault() throws Exception { Criteria criteria = new Criteria("default"); @@ -410,6 +428,7 @@ public class DataTest extends BaseDataba * difficult to tell from the correct one. A clean failure is much easier * to test for. */ + @Test public void testNullConnection() throws Exception { try @@ -453,6 +472,7 @@ public class DataTest extends BaseDataba * test the order by, especially in joins and with aliases * @throws Exception if the test fails */ + @Test public void testOrderBy() throws Exception { cleanBookstore(); @@ -624,6 +644,7 @@ public class DataTest extends BaseDataba * Tests whether ignoreCase works correctly * @throws Exception if the test fails */ + @Test public void testIgnoreCase() throws Exception { cleanBookstore(); @@ -814,6 +835,7 @@ public class DataTest extends BaseDataba * tests whether AsColumns produce valid SQL code * @throws Exception if the test fails */ + @Test public void testAsColumn() throws Exception { Criteria criteria = new Criteria(); @@ -829,6 +851,7 @@ public class DataTest extends BaseDataba * are handled correctly * @throws Exception if the test fails */ + @Test public void testSameColumnName() throws Exception { cleanBookstore(); @@ -874,9 +897,11 @@ public class DataTest extends BaseDataba * tests whether large primary keys are inserted and read correctly * @throws Exception if the test fails */ - public void testLargePk() throws Exception + @Test + @ArgumentsSource(AdapterProvider.class) + public void testLargePk(Adapter adapter) throws Exception { - if (defaultAdapter instanceof MssqlAdapter) { + if (adapter instanceof MssqlAdapter) { log.error("testLargePk(): " + "MSSQL does not support inserting defined PK values"); return; @@ -898,6 +923,7 @@ public class DataTest extends BaseDataba * tests whether large bigint values are inserted and read correctly * @throws Exception if the test fails */ + @Test public void testLargeValue() throws Exception { BigintTypePeer.doDelete(new Criteria()); @@ -917,6 +943,7 @@ public class DataTest extends BaseDataba * Tests the CountHelper class * @throws Exception if the test fails */ + @Test public void testCountHelper() throws Exception { cleanBookstore(); @@ -966,6 +993,7 @@ public class DataTest extends BaseDataba * also foreign keys * @throws Exception if the test fails */ + @Test public void testMultiplePrimaryForeignKey() throws Exception { ForeignKeySchemaData.clearTablesInDatabase(); @@ -992,6 +1020,7 @@ public class DataTest extends BaseDataba * during the runtime test. * @throws Exception if inserting the test data fails */ + @Test public void testSingleQuotes() throws Exception { cleanBookstore(); @@ -1005,6 +1034,7 @@ public class DataTest extends BaseDataba * Test whether equals() is working correctly * @throws Exception */ + @Test public void testEquals() throws Exception { Author author = new Author(); @@ -1035,6 +1065,7 @@ public class DataTest extends BaseDataba * returns an instance of this interface * @throws Exception if the test fails */ + @Test public void testInterface() throws Exception { Criteria criteria = new Criteria(); @@ -1084,6 +1115,7 @@ public class DataTest extends BaseDataba localPeerImpl instanceof LocalTestPeerInterface); } + @Test public void testInheritanceWithKeys() throws Exception { // make sure that the InheritanceTest table is empty before the test @@ -1145,6 +1177,7 @@ public class DataTest extends BaseDataba inheritanceObjects.get(3).getClass()); } + @Test public void testInheritanceWithClassname() throws Exception { // make sure that the InheritanceTest table is empty before the test @@ -1207,6 +1240,7 @@ public class DataTest extends BaseDataba * * @throws Exception if a problem occurs. */ + @Test public void testUnqualifiedColumnNames() throws Exception { cleanBookstore(); @@ -1221,6 +1255,7 @@ public class DataTest extends BaseDataba assertEquals(1, authors.size()); } + @Test public void testLikeClauseEscaping() throws Exception { String[] authorNames @@ -1381,6 +1416,7 @@ public class DataTest extends BaseDataba * @param fullyQualifiedColumnName the fully qualified column name, not null * @return the column name stripped from the table (and schema) prefixes */ + public static String getRawColumnName(final String fullyQualifiedColumnName) { int dotPosition = fullyQualifiedColumnName.lastIndexOf("."); Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java Wed Dec 4 15:51:06 2019 @@ -32,6 +32,15 @@ import org.apache.torque.test.dbobject.B import org.apache.torque.test.peer.AuthorPeer; import org.apache.torque.test.peer.BookPeer; import org.apache.torque.util.BasePeerImpl; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +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.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; /** * Runtime tests to make sure that the code which is supplied @@ -62,10 +71,9 @@ public class DocsTest extends BaseDataba private static Log log = LogFactory.getLog(DocsTest.class); - @Override + @BeforeEach public void setUp() throws Exception { - super.setUp(); // clean the books database Criteria criteria = new Criteria(); @@ -144,6 +152,7 @@ public class DocsTest extends BaseDataba /** * Criteria howto, section "Order by". */ + @Test public void testCriteriaOrderBy() { List<Book> books = null; @@ -184,6 +193,7 @@ public class DocsTest extends BaseDataba /** * Criteria howto, section "Order by". */ + @Test public void testCriteriaJoins() { // inner joins @@ -290,6 +300,7 @@ public class DocsTest extends BaseDataba /** * Criteria Howto, section "Distinct". */ + @Test public void testDistinct() { List<Author> bookAuthors = null; @@ -320,6 +331,7 @@ public class DocsTest extends BaseDataba /** * Criteria Howto, section "Join & Order & Distinct". */ + @Test public void testJoinOrderDistinct() { List<Author> bookAuthors = null; @@ -368,6 +380,7 @@ public class DocsTest extends BaseDataba /** * Criteria Howto, section "subselects" */ + @Test public void testSubselects() throws TorqueException { Adapter adapter Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/JndiConfigurationTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/JndiConfigurationTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/JndiConfigurationTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/JndiConfigurationTest.java Wed Dec 4 15:51:06 2019 @@ -47,6 +47,7 @@ import org.apache.torque.dsfactory.Abstr import org.apache.torque.dsfactory.DataSourceFactory; import org.apache.torque.dsfactory.JndiDataSourceFactory; import org.apache.torque.test.peer.BookPeer; +import org.junit.jupiter.api.BeforeEach; import junit.framework.TestCase; @@ -76,7 +77,7 @@ public class JndiConfigurationTest exten protected static final String JNDI_PATH = JNDI_SUBCONTEXT + "/" + "jndiTestDataSource"; - @Override + @BeforeEach public void setUp() { // super.setUp() initializes torque, but here we want to Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ManagerTestConditional.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ManagerTestConditional.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ManagerTestConditional.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/ManagerTestConditional.java Wed Dec 4 15:51:06 2019 @@ -31,6 +31,14 @@ import org.apache.torque.test.dbobject.I import org.apache.torque.test.manager.AuthorManager; import org.apache.torque.test.manager.BookManager; import org.apache.torque.test.manager.TestInterfaceManager; +import org.junit.jupiter.api.Test; + +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.Assert.assertNotNull; +import static org.junit.Assert.assertSame; /** * Runtime tests for managers and caching. @@ -44,6 +52,7 @@ public class ManagerTestConditional exte * Tests whether managers and caching work * @throws Exception if the test fails */ + @Test public void testManagers() throws Exception { cleanBookstore(); @@ -79,6 +88,7 @@ public class ManagerTestConditional exte * * @throws Exception if the test fails */ + @Test public void testGetInstances() throws Exception { cleanBookstore(); @@ -106,6 +116,7 @@ public class ManagerTestConditional exte * * @throws Exception if the test fails */ + @Test public void testGetInstancesNull() throws Exception { List<Author> authors = AuthorManager.getInstances(null); @@ -118,6 +129,7 @@ public class ManagerTestConditional exte * * @throws Exception if the test fails */ + @Test public void testGetInstancesEmpty() throws Exception { List<Author> authors @@ -129,6 +141,7 @@ public class ManagerTestConditional exte * Tests whether managers return the right interface * @throws Exception if the test fails */ + @Test public void testInterfaces() throws Exception { TestInterface ifc = TestInterfaceManager.getInstance(); Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/adapter/AdapterTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/adapter/AdapterTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/adapter/AdapterTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/adapter/AdapterTest.java Wed Dec 4 15:51:06 2019 @@ -25,6 +25,8 @@ import org.apache.torque.BaseDatabaseTes import org.apache.torque.Torque; import org.apache.torque.test.peer.AuthorPeer; import org.apache.torque.util.Transaction; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Tests methods in the adapters @@ -33,10 +35,9 @@ import org.apache.torque.util.Transactio */ public class AdapterTest extends BaseDatabaseTestCase { - @Override + @BeforeEach public void setUp() throws Exception { - super.setUp(); cleanBookstore(); insertBookstoreData(); } @@ -48,6 +49,7 @@ public class AdapterTest extends BaseDat * * @throws Exception if the test fails */ + @Test public void testLockTableThrowsNoError() throws Exception { Connection connection = null; 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=1870836&r1=1870835&r2=1870836&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 Wed Dec 4 15:51:06 2019 @@ -24,6 +24,7 @@ import org.apache.torque.BaseDatabaseTes import org.apache.torque.TorqueException; import org.apache.torque.map.DatabaseMap; import org.apache.torque.test.peer.AuthorPeer; +import org.junit.jupiter.api.BeforeEach; /** * Testing of the correct MapBuilder handling of the Torque Avalon Component @@ -52,10 +53,9 @@ public class AvalonMapBuildersTest exten instance = org.apache.torque.Torque.getInstance(); } - @Override + @BeforeEach public void setUp() throws Exception { - super.setUp(); if (!org.apache.torque.Torque.isInit()) { org.apache.torque.Torque.init(System.getProperty( Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BinaryTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BinaryTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BinaryTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BinaryTest.java Wed Dec 4 15:51:06 2019 @@ -1,5 +1,7 @@ package org.apache.torque.datatypes; +import org.apache.torque.adapter.Adapter; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -44,7 +46,7 @@ public class BinaryTest extends ByteType } @Override - public int getByteArraySize() { + public int getByteArraySize(Adapter adapter) { return 100; } Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BitTest.java Wed Dec 4 15:51:06 2019 @@ -25,14 +25,24 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.torque.BaseDatabaseTestCase; import org.apache.torque.TorqueException; +import org.apache.torque.adapter.Adapter; import org.apache.torque.adapter.DerbyAdapter; import org.apache.torque.adapter.OracleAdapter; import org.apache.torque.criteria.Criteria; +import org.apache.torque.junit5.extension.AdapterProvider; import org.apache.torque.om.StringKey; import org.apache.torque.test.dbobject.BitCompositePk; import org.apache.torque.test.dbobject.BitType; import org.apache.torque.test.peer.BitCompositePkPeer; import org.apache.torque.test.peer.BitTypePeer; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.provider.ArgumentsSource; + +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.Assert.assertNotNull; /** * Tests the data types BIT. @@ -47,9 +57,11 @@ public class BitTest extends BaseDatabas * * @throws Exception if anything in the test goes wrong. */ - public void testInsertBitPk() throws Exception + @Test + @ArgumentsSource(AdapterProvider.class) + public void testInsertBitPk(Adapter adapter) throws Exception { - if (!isBitSupported()) + if (!isBitSupported(adapter)) { // failing is "expected", so exit without error return; @@ -69,9 +81,11 @@ public class BitTest extends BaseDatabas * * @throws Exception if anything in the test goes wrong. */ - public void testSelectUsingBitPk() throws Exception + @Test + @ArgumentsSource(AdapterProvider.class) + public void testSelectUsingBitPk(Adapter adapter) throws Exception { - if (!isBitSupported()) + if (!isBitSupported(adapter)) { // failing is "expected", so exit without error return; @@ -100,9 +114,11 @@ public class BitTest extends BaseDatabas * * @throws Exception if anything in the test goes wrong. */ - public void testUpdateWithBitPk() throws Exception + @Test + @ArgumentsSource(AdapterProvider.class) + public void testUpdateWithBitPk(Adapter adapter) throws Exception { - if (!isBitSupported()) + if (!isBitSupported(adapter)) { // failing is "expected", so exit without error return; @@ -133,9 +149,11 @@ public class BitTest extends BaseDatabas * and works in criteria as expected * @throws Exception if the test fails */ - public void testReadBitValue() throws Exception + @Test + @ArgumentsSource(AdapterProvider.class) + public void testReadBitValue(Adapter adapter) throws Exception { - if (!isBitSupported()) + if (!isBitSupported(adapter)) { // failing is "expected", so exit without error return; @@ -158,9 +176,11 @@ public class BitTest extends BaseDatabas * * @throws Exception if the test fails */ - public void testSelectBitTypeByTrueValue() throws Exception + @Test + @ArgumentsSource(AdapterProvider.class) + public void testSelectBitTypeByTrueValue(Adapter adapter) throws Exception { - if (!isBitSupported()) + if (!isBitSupported(adapter)) { // failing is "expected", so exit without error return; @@ -183,9 +203,11 @@ public class BitTest extends BaseDatabas * * @throws Exception if the test fails */ - public void testSelectBitTypeByFalseValue() throws Exception + @Test + @ArgumentsSource(AdapterProvider.class) + public void testSelectBitTypeByFalseValue(Adapter adapter) throws Exception { - if (!isBitSupported()) + if (!isBitSupported(adapter)) { // failing is "expected", so exit without error return; @@ -210,10 +232,10 @@ public class BitTest extends BaseDatabas * * @return true if the type is supported, false otherwise. */ - private boolean isBitSupported() + private boolean isBitSupported(Adapter adapter) { - if (defaultAdapter instanceof OracleAdapter - || defaultAdapter instanceof DerbyAdapter) + if (adapter instanceof OracleAdapter + || adapter instanceof DerbyAdapter) { log.warn("isBitSupported(): " + "BIT is known not to work with " Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java Wed Dec 4 15:51:06 2019 @@ -32,6 +32,16 @@ import org.apache.torque.test.dbobject.B import org.apache.torque.test.peer.BintBcharTypePeer; import org.apache.torque.util.ColumnValues; import org.apache.torque.util.JdbcTypedValue; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +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.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; + /** * Tests the data types BOOLEANINT and BOOLEANCHAR. @@ -39,10 +49,10 @@ import org.apache.torque.util.JdbcTypedV */ public class BooleanIntCharTest extends BaseDatabaseTestCase { - @Override + @BeforeEach public void setUp() throws Exception { - super.setUp(); + fillTables(); } @@ -51,6 +61,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testReadBooleanIntCharTrueValue() throws Exception { BintBcharType bc @@ -81,6 +92,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testReadBooleanIntCharNullValue() throws Exception { BintBcharType bc @@ -94,6 +106,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testInsertBooleanIntCharTrueValue() throws Exception { // prepare @@ -120,6 +133,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testInsertBooleanIntCharFalseValue() throws Exception { // prepare @@ -146,6 +160,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testInserteBooleanIntCharNullValue() throws Exception { // prepare @@ -168,6 +183,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testUpdateBooleanIntCharTrueValue() throws Exception { // prepare @@ -194,6 +210,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testWriteBooleanIntCharFalseValue() throws Exception { // prepare @@ -220,6 +237,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testUpdateBooleanIntCharNullValue() throws Exception { // prepare @@ -243,6 +261,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testBooleanTrueSelect() throws Exception { Criteria criteria = new Criteria() @@ -263,6 +282,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testBooleanFalseSelect() throws Exception { Criteria criteria = new Criteria() @@ -284,6 +304,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testBooleanObjectNullSelect() throws Exception { Criteria criteria = new Criteria() @@ -302,6 +323,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testPrimitiveNullSelect() throws Exception { Criteria criteria = new Criteria() @@ -320,6 +342,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testBooleanSelectViaJoins() throws Exception { Criteria criteria = new Criteria(); @@ -346,6 +369,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testBooleanSelectInChainedCriterionsNoHits() throws Exception { // check whether complex criteria are overwritten by @@ -376,6 +400,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testBooleanSelectInChainedCriterionsUsingOr() throws Exception { Criteria criteria = new Criteria(); @@ -406,6 +431,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testCorrectBooleansInUnqualifiedColumns() throws Exception { // check whether booleans are replaced with unqualified columns @@ -463,6 +489,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoInsertBooleanTrueValue() throws Exception { // prepare @@ -500,6 +527,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoInsertNativeTrueValue() throws Exception { // prepare @@ -537,6 +565,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoInsertBooleanFalseValue() throws Exception { // prepare @@ -574,6 +603,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoInsertNativeFalseValue() throws Exception { // prepare @@ -611,6 +641,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoInsertBooleanNullValue() throws Exception { // prepare @@ -646,6 +677,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoInsertNativeNullValue() throws Exception { // prepare @@ -681,6 +713,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoUpdateBooleanTrueValue() throws Exception { // prepare @@ -718,6 +751,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoUpdateNativeTrueValue() throws Exception { // prepare @@ -755,6 +789,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoUpdateBooleanFalseValue() throws Exception { // prepare @@ -792,6 +827,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoUpdateNativeFalseValue() throws Exception { // prepare @@ -829,6 +865,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoUpdateBooleanNullValue() throws Exception { // prepare @@ -858,6 +895,7 @@ public class BooleanIntCharTest extends * * @throws Exception if the test fails */ + @Test public void testDoUpdateNativeNullValue() throws Exception { // prepare Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/ByteTypeTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/ByteTypeTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/ByteTypeTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/ByteTypeTest.java Wed Dec 4 15:51:06 2019 @@ -25,9 +25,20 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.torque.BaseDatabaseTestCase; import org.apache.torque.TorqueException; +import org.apache.torque.adapter.Adapter; import org.apache.torque.criteria.Criteria; +import org.apache.torque.junit5.extension.AdapterProvider; import org.apache.torque.om.Persistent; import org.apache.torque.util.BasePeerImpl; +import org.junit.jupiter.params.provider.ArgumentsSource; + +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.Assert.assertNull; + + /** * Tests byte data types. @@ -51,13 +62,14 @@ public abstract class ByteTypeTest<T ext * * @throws Exception if the test fails */ - public void testInsertReadByteArray() throws Exception + @ArgumentsSource(AdapterProvider.class) + public void testInsertReadByteArray(Adapter adapter) throws Exception { // prepare peer.doDelete(new Criteria()); // execute write - T written = fillAndSave(dbObject, getByteArraySize()); + T written = fillAndSave(dbObject, getByteArraySize(adapter)); // execute read List<T> readList = peer.doSelect(new Criteria()); @@ -79,14 +91,15 @@ public abstract class ByteTypeTest<T ext * * @throws Exception if the test fails */ - public void testUpdateReadByteArray() throws Exception + @ArgumentsSource(AdapterProvider.class) + public void testUpdateReadByteArray(Adapter adapter) throws Exception { // prepare peer.doDelete(new Criteria()); - fillAndSave(dbObject, getByteArraySize() / 2); + fillAndSave(dbObject, getByteArraySize(adapter) / 2); // execute write - T written = fillAndSave(dbObject, getByteArraySize()); + T written = fillAndSave(dbObject, getByteArraySize(adapter)); // execute read List<T> readList = peer.doSelect(new Criteria()); @@ -108,11 +121,12 @@ public abstract class ByteTypeTest<T ext * * @throws Exception if the test fails */ - public void testInsertReadNullByteArray() throws Exception + @ArgumentsSource(AdapterProvider.class) + public void testInsertReadNullByteArray(Adapter adapter) throws Exception { if (!canWriteNullBytes()) { log.error("database with adapter " - + defaultAdapter.getClass().getName() + + adapter.getClass().getName() + " does not support writing null bate arrays to type " + dbObject.getClass().getName()); return; @@ -180,7 +194,7 @@ public abstract class ByteTypeTest<T ext return true; } - public int getByteArraySize() { + public int getByteArraySize(Adapter adapter) { return 200000; } } Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/ClobTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/ClobTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/ClobTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/ClobTest.java Wed Dec 4 15:51:06 2019 @@ -8,6 +8,12 @@ import org.apache.torque.criteria.Criter import org.apache.torque.test.dbobject.ClobType; import org.apache.torque.test.peer.ClobTypePeer; +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.Assert.assertNull; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/DateTimeTimestampTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/DateTimeTimestampTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/DateTimeTimestampTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/DateTimeTimestampTest.java Wed Dec 4 15:51:06 2019 @@ -30,12 +30,21 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.torque.BaseDatabaseTestCase; import org.apache.torque.TorqueException; +import org.apache.torque.adapter.Adapter; import org.apache.torque.adapter.MssqlAdapter; import org.apache.torque.adapter.MysqlAdapter; import org.apache.torque.adapter.OracleAdapter; import org.apache.torque.criteria.Criteria; +import org.apache.torque.junit5.extension.AdapterProvider; import org.apache.torque.test.dbobject.DateTimeTimestampType; import org.apache.torque.test.peer.DateTimeTimestampTypePeer; +import org.junit.jupiter.params.provider.ArgumentsSource; + +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.Assert.assertNotNull; /** * Tests behavior of date, time and timestamp fields. @@ -187,9 +196,10 @@ public class DateTimeTimestampTest exten * * @throws TorqueException if a problem occurs. */ - public void testCurrentDate() throws TorqueException + @ArgumentsSource(AdapterProvider.class) + public void testCurrentDate(Adapter adapter) throws TorqueException { - if (defaultAdapter instanceof MssqlAdapter) + if (adapter instanceof MssqlAdapter) { log.warn("testCurrentDate(): " + Criteria.CURRENT_DATE @@ -212,10 +222,11 @@ public class DateTimeTimestampTest exten * * @throws TorqueException if a problem occurs. */ - public void testCurrentTime() throws TorqueException + @ArgumentsSource(AdapterProvider.class) + public void testCurrentTime(Adapter adapter) throws TorqueException { - if (defaultAdapter instanceof MssqlAdapter - || defaultAdapter instanceof OracleAdapter) + if (adapter instanceof MssqlAdapter + || adapter instanceof OracleAdapter) { log.warn("testCurrentTime(): " + Criteria.CURRENT_TIME @@ -245,9 +256,10 @@ public class DateTimeTimestampTest exten * * @throws TorqueException if a problem occurs. */ - public void testCurrentTimestamp() throws TorqueException + @ArgumentsSource(AdapterProvider.class) + public void testCurrentTimestamp(Adapter adapter) throws TorqueException { - if (defaultAdapter instanceof MssqlAdapter) + if (adapter instanceof MssqlAdapter) { log.warn("testCurrentTimestamp(): " + Criteria.CURRENT_TIMESTAMP @@ -301,9 +313,9 @@ public class DateTimeTimestampTest exten * * @throws TorqueException if a problem occurs. */ - public void testSelectWithUtilDateOnTime() throws TorqueException + public void testSelectWithUtilDateOnTime(Adapter adapter) throws TorqueException { - if (defaultAdapter instanceof MssqlAdapter) + if (adapter instanceof MssqlAdapter) { log.warn("testSelectWithUtilDateOnTime(): " + "Selecting time with a date Object will not work on MSSQL" @@ -342,9 +354,10 @@ public class DateTimeTimestampTest exten * * @throws TorqueException if a problem occurs. */ - public void testSelectWithSqlTimeOnTime() throws TorqueException + @ArgumentsSource(AdapterProvider.class) + public void testSelectWithSqlTimeOnTime(Adapter adapter) throws TorqueException { - if (defaultAdapter instanceof MssqlAdapter) + if (adapter instanceof MssqlAdapter) { log.warn("testSelectWithUtilDateOnTime(): " + "Selecting time with a time Object will not work on MSSQL" @@ -476,10 +489,11 @@ public class DateTimeTimestampTest exten * * @throws TorqueException if a problem occurs. */ - public void testSelectWithMillisecondsOnTimestampMillisecondMismatch() + @ArgumentsSource(AdapterProvider.class) + public void testSelectWithMillisecondsOnTimestampMillisecondMismatch(Adapter adapter) throws TorqueException { - if (!timestampHasMillisecondAccuracy()) + if (!timestampHasMillisecondAccuracy(adapter)) { return; } @@ -550,13 +564,13 @@ public class DateTimeTimestampTest exten DateTimeTimestampTypePeer.doDelete(new Criteria()); } - private boolean timestampHasMillisecondAccuracy() + private boolean timestampHasMillisecondAccuracy(Adapter adapter) { - if (defaultAdapter instanceof MysqlAdapter) + if (adapter instanceof MysqlAdapter) { return false; } - if (defaultAdapter instanceof MssqlAdapter) + if (adapter instanceof MssqlAdapter) { // although datetime2 has 100 nanoseconds accurary // it seems to get lost in the jtds driver. Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/EnumTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/EnumTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/EnumTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/EnumTest.java Wed Dec 4 15:51:06 2019 @@ -28,6 +28,7 @@ import org.apache.commons.logging.LogFac import org.apache.torque.BaseDatabaseTestCase; import org.apache.torque.TestEnum; import org.apache.torque.TorqueException; +import org.apache.torque.adapter.Adapter; import org.apache.torque.adapter.DerbyAdapter; import org.apache.torque.adapter.HsqldbAdapter; import org.apache.torque.adapter.MssqlAdapter; @@ -35,6 +36,7 @@ import org.apache.torque.adapter.MysqlAd import org.apache.torque.adapter.OracleAdapter; import org.apache.torque.adapter.PostgresAdapter; import org.apache.torque.criteria.Criteria; +import org.apache.torque.junit5.extension.AdapterProvider; import org.apache.torque.test.dbobject.EnumTable; import org.apache.torque.test.dbobject.IntPrimitiveColumnEnum; import org.apache.torque.test.dbobject.MyIntColumnEnum; @@ -42,6 +44,17 @@ import org.apache.torque.test.dbobject.V import org.apache.torque.test.peer.EnumTablePeer; import org.apache.torque.util.ColumnValues; import org.apache.torque.util.JdbcTypedValue; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.provider.ArgumentsSource; + +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.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; + /** * Tests the enum data types. @@ -53,10 +66,9 @@ public class EnumTest extends BaseDataba private List<EnumTable> databaseStateBeforeTest; - @Override + @BeforeEach public void setUp() throws Exception { - super.setUp(); fillTables(); } @@ -65,6 +77,7 @@ public class EnumTest extends BaseDataba * * @throws Exception if the test fails */ + @Test public void testRead() throws Exception { // prepare @@ -94,6 +107,7 @@ public class EnumTest extends BaseDataba * * @throws Exception if the test fails */ + @Test public void testUpdate() throws Exception { // prepare @@ -125,6 +139,7 @@ public class EnumTest extends BaseDataba * * @throws Exception if the test fails */ + @Test public void testSelect() throws Exception { // prepare @@ -155,7 +170,9 @@ public class EnumTest extends BaseDataba * * @throws Exception if the test fails */ - public void testInsertIllegalValue() throws Exception + @Test + @ArgumentsSource(AdapterProvider.class) + public void testInsertIllegalValue(Adapter adapter) throws Exception { // check that the normal doUpdate works ColumnValues columnValues = new ColumnValues(); @@ -179,7 +196,7 @@ public class EnumTest extends BaseDataba EnumTablePeer.doUpdate( new Criteria().where(EnumTablePeer.ID, databaseStateBeforeTest.get(0).getId()), columnValues); - if (!(defaultAdapter instanceof MysqlAdapter)) + if (!(adapter instanceof MysqlAdapter)) { fail("Exception expected"); } @@ -189,31 +206,31 @@ public class EnumTest extends BaseDataba // assert that the error is really a check violation // check different error codes which are employed by each database vendor. SQLException cause = (SQLException) e.getCause(); - if (defaultAdapter instanceof MssqlAdapter) + if (adapter instanceof MssqlAdapter) { assertEquals(547, cause.getErrorCode()); assertEquals("23000", cause.getSQLState()); } - else if (defaultAdapter instanceof OracleAdapter) + else if (adapter instanceof OracleAdapter) { assertEquals(2290, cause.getErrorCode()); assertEquals("23000", cause.getSQLState()); } - else if (defaultAdapter instanceof PostgresAdapter) + else if (adapter instanceof PostgresAdapter) { assertEquals("23514", cause.getSQLState()); } - else if (defaultAdapter instanceof DerbyAdapter) + else if (adapter instanceof DerbyAdapter) { assertEquals("23513", cause.getSQLState()); } - else if (defaultAdapter instanceof HsqldbAdapter) + else if (adapter instanceof HsqldbAdapter) { assertEquals("23513", cause.getSQLState()); } else { - logger.warn("error code and SQL code not checked for unknown adapter " + defaultAdapter.getClass()); + logger.warn("error code and SQL code not checked for unknown adapter " + adapter.getClass()); } } Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/LongvarbinaryTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/LongvarbinaryTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/LongvarbinaryTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/LongvarbinaryTest.java Wed Dec 4 15:51:06 2019 @@ -1,5 +1,7 @@ package org.apache.torque.datatypes; +import org.apache.torque.adapter.Adapter; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -45,11 +47,11 @@ public class LongvarbinaryTest extends B } @Override - public int getByteArraySize() { - if (defaultAdapter instanceof DerbyAdapter) { + public int getByteArraySize(Adapter adapter) { + if (adapter instanceof DerbyAdapter) { return 32000; // Maximum 32700 for derby } - return super.getByteArraySize(); + return super.getByteArraySize(adapter); } } Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/VarbinaryTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/VarbinaryTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/VarbinaryTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/VarbinaryTest.java Wed Dec 4 15:51:06 2019 @@ -1,5 +1,7 @@ package org.apache.torque.datatypes; +import org.apache.torque.adapter.Adapter; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -44,7 +46,7 @@ public class VarbinaryTest extends ByteT } @Override - public int getByteArraySize() { + public int getByteArraySize(Adapter adapter) { return 100; } } Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/GetRelatedObjectsJoinTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/GetRelatedObjectsJoinTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/GetRelatedObjectsJoinTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/GetRelatedObjectsJoinTest.java Wed Dec 4 15:51:06 2019 @@ -33,6 +33,17 @@ import org.apache.torque.test.peer.Multi import org.apache.torque.test.peer.MultiRefSameTablePeer; import org.apache.torque.test.peer.OIntegerPkPeer; import org.apache.torque.test.peer.PIntegerPkPeer; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +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.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertNull; /** * Tests the fjoin getter methods for related objects in the generated @@ -44,10 +55,9 @@ public class GetRelatedObjectsJoinTest e { ForeignKeySchemaData testData; - @Override + @BeforeEach public void setUp() throws Exception { - super.setUp(); ForeignKeySchemaData.clearTablesInDatabase(); testData = ForeignKeySchemaData.getDefaultTestData(); testData.save(); @@ -59,6 +69,7 @@ public class GetRelatedObjectsJoinTest e * that we can switch of silent db fetching to check whether objects * are already loaded or not. */ + @Test public void testSwitchSilentFetchingOff() throws Exception { OIntegerPk baseObject = testData.getOIntegerPkList().get(0); @@ -94,6 +105,7 @@ public class GetRelatedObjectsJoinTest e * * @throws Exception if the database fails */ + @Test public void testJoinGetter() throws Exception { OIntegerPk baseObject = testData.getOIntegerPkList().get(0); @@ -142,6 +154,7 @@ public class GetRelatedObjectsJoinTest e * * @throws Exception if the database fails */ + @Test public void testJoinGetterAfterInit() throws Exception { OIntegerPk baseObject = testData.getOIntegerPkList().get(0); @@ -192,6 +205,7 @@ public class GetRelatedObjectsJoinTest e * * @throws Exception if the database fails */ + @Test public void testJoinGetterWithOtherCriteria() throws Exception { OIntegerPk baseObject = testData.getOIntegerPkList().get(0); @@ -238,6 +252,7 @@ public class GetRelatedObjectsJoinTest e * * @throws Exception if the database fails */ + @Test public void testJoinGetterSameObject() throws Exception { OIntegerPk baseObject = testData.getOIntegerPkList().get(0); Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/GetRelatedObjectsTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/GetRelatedObjectsTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/GetRelatedObjectsTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/GetRelatedObjectsTest.java Wed Dec 4 15:51:06 2019 @@ -32,6 +32,16 @@ import org.apache.torque.test.dbobject.B import org.apache.torque.test.peer.AuthorPeer; import org.apache.torque.test.peer.BookPeer; import org.apache.torque.util.Transaction; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +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.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; + /** * Tests whether the getRelatedObjects methods works @@ -42,10 +52,9 @@ public class GetRelatedObjectsTest exten { private List<Author> authorList; - @Override + @BeforeEach public void setUp() throws Exception { - super.setUp(); cleanBookstore(); authorList = insertBookstoreData(); } @@ -56,6 +65,7 @@ public class GetRelatedObjectsTest exten * that we can switch of silent db fetching to check whether objects * are already loaded or not. */ + @Test public void testSwitchSilentFetchingOff() throws Exception { Author baseObject = authorList.get(0); @@ -86,6 +96,7 @@ public class GetRelatedObjectsTest exten * * @throws Exception if the test fails */ + @Test public void testGetRelatedObjects() throws Exception { Criteria criteria = new Criteria().where( @@ -107,6 +118,7 @@ public class GetRelatedObjectsTest exten * * @throws Exception if the test fails */ + @Test public void testGetRelatedObjectsAfterInit() throws Exception { Criteria criteria = new Criteria().where( @@ -152,6 +164,7 @@ public class GetRelatedObjectsTest exten * * @throws Exception if the test fails */ + @Test public void testGetRelatedObjectsWithOtherCriteria() throws Exception { Criteria criteria = new Criteria().where( @@ -177,6 +190,7 @@ public class GetRelatedObjectsTest exten * * @throws Exception if the test fails */ + @Test public void testGetRelatedObjectsWithCriteriaAfterInit() throws Exception { Criteria criteria = new Criteria().where( @@ -201,6 +215,7 @@ public class GetRelatedObjectsTest exten * * @throws Exception if the test fails */ + @Test public void testGetRelatedObjectsWithConnection() throws Exception { Criteria criteria = new Criteria().where( @@ -224,6 +239,7 @@ public class GetRelatedObjectsTest exten * * @throws Exception if the test fails */ + @Test public void testGetRelatedObjectsWithConnectionAfterInit() throws Exception { Criteria criteria = new Criteria().where( @@ -247,6 +263,7 @@ public class GetRelatedObjectsTest exten * * @throws Exception if the test fails */ + @Test public void testGetRelatedObjectsWithConnectionAndCriteria() throws Exception { Criteria criteria = new Criteria().where( @@ -273,6 +290,7 @@ public class GetRelatedObjectsTest exten * * @throws Exception if the test fails */ + @Test public void testGetRelatedObjectsWithConneectionAndOtherCriteria() throws Exception { Criteria criteria = new Criteria().where( @@ -300,6 +318,7 @@ public class GetRelatedObjectsTest exten * * @throws Exception if the test fails */ + @Test public void testGetRelatedObjectsWithConnectionAndCriteriaAfterInit() throws Exception { Criteria criteria = new Criteria().where( Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/SaveTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/SaveTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/SaveTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/SaveTest.java Wed Dec 4 15:51:06 2019 @@ -26,8 +26,10 @@ import org.apache.commons.logging.LogFac import org.apache.torque.BaseDatabaseTestCase; import org.apache.torque.ForeignKeySchemaData; import org.apache.torque.TorqueException; +import org.apache.torque.adapter.Adapter; import org.apache.torque.adapter.MssqlAdapter; import org.apache.torque.criteria.Criteria; +import org.apache.torque.junit5.extension.AdapterProvider; import org.apache.torque.test.dbobject.Author; import org.apache.torque.test.dbobject.Book; import org.apache.torque.test.dbobject.Nopk; @@ -36,6 +38,14 @@ import org.apache.torque.test.peer.Autho import org.apache.torque.test.peer.NopkPeer; import org.apache.torque.test.peer.OIntegerPkPeer; import org.apache.torque.util.CountHelper; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.provider.ArgumentsSource; + +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.Assert.assertNotNull; /** * Tests whether the save methods work in the db object classes. @@ -51,6 +61,7 @@ public class SaveTest extends BaseDataba * * @throws Exception if a database error occurs. */ + @Test public void testInsert() throws Exception { // prepare @@ -73,9 +84,11 @@ public class SaveTest extends BaseDataba /** * Check that an id can be set manually. */ - public void testInsertWithManualId() throws Exception + @Test + @ArgumentsSource(AdapterProvider.class) + public void testInsertWithManualId(Adapter adapter) throws Exception { - if (defaultAdapter instanceof MssqlAdapter) + if (adapter instanceof MssqlAdapter) { log.error("manual id insertion is not possible for MSSQL"); return; @@ -105,6 +118,7 @@ public class SaveTest extends BaseDataba /** * Tests that an insert works for objects without primary key. */ + @Test public void testInsertWithoutPk() throws TorqueException { // prepare @@ -133,6 +147,7 @@ public class SaveTest extends BaseDataba * is called on an object without pk which is already saved and * nothing is modified. */ + @Test public void testSaveWithoutPkNoModification() throws TorqueException { // prepare @@ -160,6 +175,7 @@ public class SaveTest extends BaseDataba * Tests that save fails if it is called on a modified object without pk * which is already saved. */ + @Test public void testSaveWithoutPkModification() throws TorqueException { // prepare @@ -192,6 +208,7 @@ public class SaveTest extends BaseDataba * * @throws Exception if a database error occurs. */ + @Test public void testUpdate() throws Exception { // prepare @@ -219,6 +236,7 @@ public class SaveTest extends BaseDataba * * @throws Exception if a database error occurs. */ + @Test public void testInsertPropagationDown() throws Exception { // prepare @@ -252,6 +270,7 @@ public class SaveTest extends BaseDataba * * @throws Exception if a database error occurs. */ + @Test public void testNoPropagationUp() throws Exception { // prepare Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/ValueEqualsTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/ValueEqualsTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/ValueEqualsTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/ValueEqualsTest.java Wed Dec 4 15:51:06 2019 @@ -21,6 +21,12 @@ package org.apache.torque.generated.data import org.apache.torque.BaseDatabaseTestCase; import org.apache.torque.test.dbobject.Book; +import org.junit.jupiter.api.Test; + + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + /** * Tests the valueEquals method in the data object classes. @@ -33,6 +39,7 @@ public class ValueEqualsTest extends Bas * Checks the valueEquals method outcome if all colums are not-null * and equal in the two objects. */ + @Test public void testAllSetAndEqual() { Book book1 = new Book(); @@ -71,6 +78,7 @@ public class ValueEqualsTest extends Bas * Checks the valueEquals method outcome if all colums are not-null * and equal in the two objects except a non-primary key column. */ + @Test public void testAllSetDifferentNonPk() { Book book1 = new Book(); @@ -90,6 +98,7 @@ public class ValueEqualsTest extends Bas * Checks the valueEquals method outcome if all colums are not-null * and equal in the two objects except a non-primary-key foreign-key column. */ + @Test public void testAllSetDifferentNonPkFk() { Book book1 = new Book(); @@ -109,6 +118,7 @@ public class ValueEqualsTest extends Bas * Checks the valueEquals method outcome if a column is null * in the two objects and all other fields are set and equal. */ + @Test public void testFieldNotSetBothNull() { Book book1 = new Book(); @@ -129,6 +139,7 @@ public class ValueEqualsTest extends Bas * Checks the valueEquals method outcome if a column is null * in only one the two objects and all other fields are set and equal. */ + @Test public void testFieldNotSetOneNull() { Book book1 = new Book(); Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/ViewTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/ViewTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/ViewTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/dataobject/ViewTest.java Wed Dec 4 15:51:06 2019 @@ -26,6 +26,16 @@ import org.apache.torque.criteria.Criter import org.apache.torque.test.dbobject.Author; import org.apache.torque.test.dbobject.BookAuthors; import org.apache.torque.test.peer.BookAuthorsPeer; +import org.junit.jupiter.api.Test; + +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.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertNull; /** * Tests whether the save methods work in the db object classes. @@ -39,6 +49,7 @@ public class ViewTest extends BaseDataba * * @throws Exception if a database error occurs. */ + @Test public void testSelect() throws Exception { // prepare Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/BaseOptimisticLockingTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/BaseOptimisticLockingTest.java?rev=1870836&r1=1870835&r2=1870836&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/BaseOptimisticLockingTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/BaseOptimisticLockingTest.java Wed Dec 4 15:51:06 2019 @@ -30,6 +30,12 @@ import org.apache.torque.OptimisticLocki import org.apache.torque.Torque; import org.apache.torque.TorqueException; import org.apache.torque.criteria.Criteria; +import org.junit.jupiter.api.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; /** * Tests whether optimistic locking works. @@ -50,6 +56,7 @@ public abstract class BaseOptimisticLock * * @throws Exception if a database error occurs. */ + @Test public void testSave() throws Exception { // prepare @@ -75,6 +82,7 @@ public abstract class BaseOptimisticLock * * @throws Exception if a database error occurs. */ + @Test public void testSaveWithConnection() throws Exception { // prepare @@ -103,6 +111,7 @@ public abstract class BaseOptimisticLock * * @throws Exception if a database error occurs. */ + @Test public void testUpdate() throws Exception { // prepare @@ -128,6 +137,7 @@ public abstract class BaseOptimisticLock * * @throws Exception if a database error occurs. */ + @Test public void testUpdateWithConnection() throws Exception { // prepare @@ -156,6 +166,7 @@ public abstract class BaseOptimisticLock * * @throws Exception if a database error occurs. */ + @Test public void testSaveTwice() throws Exception { // prepare @@ -185,6 +196,7 @@ public abstract class BaseOptimisticLock * * @throws Exception if a database error occurs. */ + @Test public void testOptimisticLockFailsOtherUpdate() throws Exception { // prepare @@ -222,6 +234,7 @@ public abstract class BaseOptimisticLock * * @throws Exception if a database error occurs. */ + @Test public void testOptimisticLockFailsOtherDelete() throws Exception { // prepare --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org