Author: gk Date: Mon Oct 7 14:01:37 2024 New Revision: 1921162 URL: http://svn.apache.org/viewvc?rev=1921162&view=rev Log: - Update to Java 17 fulcrum-testcontainer v2.0.1, fulcrum-yaafi v2.0.1, adapt dependency from javax.jms to jakarta.jms and update derby to Java 17 v10.16.1.1), update pom version from 6.1 to 7.0-SNAPSHOT - TODO update synchronized in torque-runtime to be prepared for virtual threads in Java 21. - Add torque.om.simpleMapping (default true), which optimizes the "simple mapping" (used in recordMapperBase.vm). TORQUE-364 - Use streams in MappingStrategy, which changes method signature throwing now RuntimeException - Fix Junit Maven surefire includes - Update pom parent to apache v33, commons-lang3 to 3.17.0, mockito-core 5.13.0 - Update plugins maven-resources-plugin from 2.6 to 3.3.1, jacoco-maven-plugin to 0.8.12 - Remove coebertura plugin (already only in comments) - Add missing Test annotation in SelectTest.java - More transparent support for non default database testing; example of a dd hint for eclipse configuration in README and SelectTest.java (still not automatic yet)
Modified: db/torque/trunk/README.md db/torque/trunk/pom.xml db/torque/trunk/torque-runtime/pom.xml db/torque/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/MappingStrategy.java db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/recordMapperBase.vm db/torque/trunk/torque-test/README.md db/torque/trunk/torque-test/pom.xml db/torque/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectTest.java Modified: db/torque/trunk/README.md URL: http://svn.apache.org/viewvc/db/torque/trunk/README.md?rev=1921162&r1=1921161&r2=1921162&view=diff ============================================================================== --- db/torque/trunk/README.md (original) +++ db/torque/trunk/README.md Mon Oct 7 14:01:37 2024 @@ -24,6 +24,7 @@ - it uses velocity / groovy templates during the code generation process. ## Requirements +- Version 7 will require Java 17 - Version 6 requires Java 11. - Version 5 and 5.1 requires Java 8. - Torque 4.0 requires JDK 1.6 or higher @@ -32,7 +33,7 @@ - IDE integration -To run with eclipse skip torque Maven plugin, hich tries to generate classes from unconfigured +To run with eclipse skip torque Maven plugin, which tries to generate classes from unconfigured mvn eclipse:eclipse -Dmaven.torque.skip=true Modified: db/torque/trunk/pom.xml URL: http://svn.apache.org/viewvc/db/torque/trunk/pom.xml?rev=1921162&r1=1921161&r2=1921162&view=diff ============================================================================== --- db/torque/trunk/pom.xml (original) +++ db/torque/trunk/pom.xml Mon Oct 7 14:01:37 2024 @@ -25,14 +25,14 @@ <parent> <groupId>org.apache</groupId> <artifactId>apache</artifactId> - <version>31</version> + <version>33</version> </parent> <groupId>org.apache.torque</groupId> <artifactId>torque</artifactId> <packaging>pom</packaging> <name>Torque Maven Parent</name> - <version>6.1-SNAPSHOT</version> + <version>7.0-SNAPSHOT</version> <description>Torque parent project</description> <url>https://db.apache.org/torque/</url> @@ -366,7 +366,7 @@ <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> - <version>3.15.0</version> + <version>3.17.0</version> </dependency> <dependency> @@ -379,7 +379,7 @@ <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <!-- 5 requires java 11 --> - <version>5.11.0</version> + <version>5.13.0</version> <scope>test</scope> </dependency> @@ -387,7 +387,7 @@ <groupId>org.apache.avalon.framework</groupId> <artifactId>avalon-framework-api</artifactId> <version>4.3.1</version> - <!-- not available any more? Instead useing javax.jms --> + <!-- not available any more? Instead using jakarta.jms --> <exclusions> <exclusion> <groupId>org.apache.geronimo.specs</groupId> @@ -401,7 +401,7 @@ <artifactId>avalon-framework-impl</artifactId> <version>4.3.1</version> <scope>test</scope> - <!-- not available any more? Instead useing javax.jms --> + <!-- not available any more? Instead useing jakarta.jms --> <exclusions> <exclusion> <groupId>org.apache.geronimo.specs</groupId> @@ -443,28 +443,27 @@ <dependency> <groupId>org.apache.fulcrum</groupId> <artifactId>fulcrum-yaafi</artifactId> - <version>2.0.0</version> - <!-- this is non available any more ? Instead useing javax.jms --> + <version>2.0.1</version> + <scope>test</scope> <exclusions> <exclusion> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-jms_1.1_spec</artifactId> </exclusion> </exclusions> - <scope>test</scope> </dependency> <dependency> - <groupId>javax.jms</groupId> - <artifactId>javax.jms-api</artifactId> - <version>2.0.1</version> - <scope>test</scope> + <groupId>jakarta.jms</groupId> + <artifactId>jakarta.jms-api</artifactId> + <version>3.1.0</version> + <scope>test</scope> </dependency> <dependency> <groupId>org.xmlunit</groupId> <artifactId>xmlunit-core</artifactId> - <version>2.9.1</version> + <version>2.10.0</version> <scope>test</scope> </dependency> @@ -474,7 +473,7 @@ <version>${derby.version}</version> <scope>test</scope> </dependency> - <!-- required for derby 15 / java 11 --> + <!-- required for derby 16 / java 17 --> <dependency> <groupId>org.apache.derby</groupId> <artifactId>derbyshared</artifactId> @@ -521,7 +520,7 @@ <plugin> <groupId>com.github.spotbugs</groupId> <artifactId>spotbugs-maven-plugin</artifactId> - <version>4.8.6.2</version> + <version>4.8.6.4</version> <!--dependencies> <dependency> <groupId>com.github.spotbugs</groupId> @@ -573,7 +572,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>3.2.5</version> + <version>3.5.0</version> </plugin> <plugin> <groupId>org.owasp</groupId> @@ -583,7 +582,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> - <version>3.12.1</version> + <version>3.20.0</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -594,7 +593,6 @@ <target>${maven.compiler.target}</target> <encoding>${project.build.sourceEncoding}</encoding> <fork>${torque.compiler.fork}</fork> - <compilerVersion>${torque.compiler.compilerVersion}</compilerVersion> <executable>${torque.compiler.javac}</executable> </configuration> </plugin> @@ -668,18 +666,6 @@ </execution> </executions> </plugin> - <!-- plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>cobertura-maven-plugin</artifactId> - <version>2.7</version> - <configuration> - <formats> - <format>html</format> - <format>xml</format> - </formats> - <check/> - </configuration> - </plugin--> <plugin> <!-- runs with java 17, but not 20 --> @@ -844,7 +830,7 @@ <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> - <version>0.8.8</version> + <version>0.8.12</version> <reportSets> <reportSet> <reports> @@ -859,20 +845,19 @@ <properties> <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding> - <maven.compiler.source>11</maven.compiler.source> - <maven.compiler.target>11</maven.compiler.target> + <maven.compiler.source>17</maven.compiler.source> + <maven.compiler.target>17</maven.compiler.target> <dependency.check.skip>true</dependency.check.skip> - <junit.jupiter.version>5.10.2</junit.jupiter.version> - <junit.launcher.version>1.10.2</junit.launcher.version> + <junit.jupiter.version>5.11.0</junit.jupiter.version> + <junit.launcher.version>1.11.0</junit.launcher.version> <log4j2.version>2.23.1</log4j2.version> <torque.compiler.fork>false</torque.compiler.fork> - <torque.compiler.compilerVersion>11</torque.compiler.compilerVersion> <!--suppress UnresolvedMavenProperty --> <torque.compiler.javac>${JAVA_HOME}/bin/javac</torque.compiler.javac> - <!-- derby 10.15 requires java 9 (11), 10.16.1.1 requires java 17 --> - <derby.version>10.15.2.0</derby.version> + <!-- derby 10.16.1.1 requires java 17 --> + <derby.version>10.16.1.1</derby.version> <project.build.outputTimestamp>1715172126</project.build.outputTimestamp> Modified: db/torque/trunk/torque-runtime/pom.xml URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-runtime/pom.xml?rev=1921162&r1=1921161&r2=1921162&view=diff ============================================================================== --- db/torque/trunk/torque-runtime/pom.xml (original) +++ db/torque/trunk/torque-runtime/pom.xml Mon Oct 7 14:01:37 2024 @@ -21,7 +21,7 @@ <parent> <groupId>org.apache.torque</groupId> <artifactId>torque</artifactId> - <version>6.1-SNAPSHOT</version> + <version>7.0-SNAPSHOT</version> <relativePath>..</relativePath> </parent> @@ -75,8 +75,8 @@ </dependency> <dependency> - <groupId>javax.jms</groupId> - <artifactId>javax.jms-api</artifactId> + <groupId>jakarta.jms</groupId> + <artifactId>jakarta.jms-api</artifactId> </dependency> <dependency> @@ -109,7 +109,7 @@ <dependency> <groupId>org.apache.fulcrum</groupId> <artifactId>fulcrum-testcontainer</artifactId> - <version>2.0.0</version> + <version>2.0.1-SNAPSHOT</version> <exclusions> <exclusion> <groupId>*</groupId> @@ -118,13 +118,13 @@ </exclusions> <scope>test</scope> </dependency> - + <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> + <version>6.1.0</version> <scope>test</scope> - </dependency> + </dependency> <dependency> <groupId>org.apache.fulcrum</groupId> Modified: db/torque/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/MappingStrategy.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/MappingStrategy.java?rev=1921162&r1=1921161&r2=1921162&view=diff ============================================================================== --- db/torque/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/MappingStrategy.java (original) +++ db/torque/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/MappingStrategy.java Mon Oct 7 14:01:37 2024 @@ -93,13 +93,18 @@ public class MappingStrategy<T> { * @param result Resultset * @param instance target object * - * @throws TorqueException */ - public void execute(ResultSet result, T instance) throws TorqueException + public void execute(ResultSet result, T instance) { - for (Pair<Integer, FailableBiConsumer<ResultSet, T, TorqueException>> strategy : this.tasks) - { - strategy.getRight().accept(result, instance); - } + this.tasks.stream().forEach( strategy -> + { + try + { + strategy.getRight().accept( result, instance ); + } catch (TorqueException e) + { + throw new RuntimeException(e); + } + }); } } \ No newline at end of file Modified: db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties?rev=1921162&r1=1921161&r2=1921162&view=diff ============================================================================== --- db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties (original) +++ db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties Mon Oct 7 14:01:37 2024 @@ -81,6 +81,9 @@ torque.om.useMappingStrategy = true # If useMappingStrategy is true, perform an additiona sort in finish method. torque.om.mappingStrategySort = true +# In processRow method use simpleMapping (default true) +torque.om.simpleMapping = true + # Whether to generate methods which select at most a single record torque.om.addSelectSingleRecordMethods = true Modified: db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/recordMapperBase.vm URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/recordMapperBase.vm?rev=1921162&r1=1921161&r2=1921162&view=diff ============================================================================== --- db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/recordMapperBase.vm (original) +++ db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/recordMapperBase.vm Mon Oct 7 14:01:37 2024 @@ -116,7 +116,7 @@ public class ${baseRecordMapperClassName { this.strategy = new MappingStrategy<${dbObjectClassName}>(); } - + #if("${simpleMapping}" == "true") #set( $useSimpleMapping=1 ) #end /** * Constructs the object from the current row in the resultSet. @@ -156,7 +156,8 @@ $torqueGen.mergepoint("createDbObjectIns { ${field}.setLoading(true); #end - if (criteria == null) + // TORQUE-364 + if (criteria == null #if ($useSimpleMapping) || (criteria.getJoins().isEmpty() && criteria.getSelectColumns().size() - offset == ${basePeerClassName}.numColumns) #end) { #set ( $n = 1 ) #foreach ($columnElement in $torqueGen.getChildren("column")) @@ -169,7 +170,8 @@ $torqueGen.mergepoint("createDbObjectIns } else { - if (useMappingStrategy) { + if (useMappingStrategy) + { initStrategy(); } // try to get columns to be mapped @@ -188,6 +190,7 @@ $torqueGen.mergepoint("createDbObjectIns #set ( $setter = $columnElement.getAttribute("setter") ) #set ( $getter = $columnElement.getAttribute("getter") ) #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") ) + ${else}if (!columnsMapped.contains(${peerColumnName}_EXPRESSION ) && ${peerColumnName}_EXPRESSION.equals( column.getSqlExpression())) { Modified: db/torque/trunk/torque-test/README.md URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-test/README.md?rev=1921162&r1=1921161&r2=1921162&view=diff ============================================================================== --- db/torque/trunk/torque-test/README.md (original) +++ db/torque/trunk/torque-test/README.md Mon Oct 7 14:01:37 2024 @@ -220,15 +220,27 @@ mvn test -P<data-type>, managers,beans - Generate project/classpath by using minimal test database profile hsqldb ```sh -mvn eclipse:eclipse -P hsqldb, managers,beans +hsqldb ``` -or with Testcontainers (recommended) +or with Testcontainers ```sh mvn eclipse:eclipse -P mysql,docker-testcontainer,managers,beans ``` +If you change the database, e.g. to derbyEmbedded you have to be sure that + +- eclipse does know the right dependencies, e.g. generate with the right profile. + + mvn eclipse:eclipse -P derbyEmbedded + +- If the database is not mysql (which is the default), use in Test classes the annotation and set the database with annotation + + @HostCallback(adapterProfileFallback = "derbyEmbedded") + + allows to activate the right profile. + ### Maven Database Test with Remote Standard Socket Attachment Example: Attach example opens port 8000 per default, but forkMode is already deprecated, but change as convenient. Modified: db/torque/trunk/torque-test/pom.xml URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-test/pom.xml?rev=1921162&r1=1921161&r2=1921162&view=diff ============================================================================== --- db/torque/trunk/torque-test/pom.xml (original) +++ db/torque/trunk/torque-test/pom.xml Mon Oct 7 14:01:37 2024 @@ -38,7 +38,7 @@ <parent> <groupId>org.apache.torque</groupId> <artifactId>torque</artifactId> - <version>6.1-SNAPSHOT</version> + <version>7.0-SNAPSHOT</version> <relativePath>..</relativePath> </parent> @@ -61,6 +61,9 @@ <torque.test.testcontainer.version>1.19.7</torque.test.testcontainer.version> <!-- --> <torque.test.idmethod>native</torque.test.idmethod> + <torque.generate.drops>true</torque.generate.drops> + + <executeDrop>true</executeDrop><!-- skip --> </properties> @@ -130,7 +133,7 @@ <dependency> <groupId>org.apache.fulcrum</groupId> <artifactId>fulcrum-testcontainer</artifactId> - <version>2.0.0</version> + <version>2.0.1-SNAPSHOT</version> <exclusions> <exclusion> <groupId>*</groupId> @@ -142,13 +145,15 @@ <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> + <scope>test</scope> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> - </dependency> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> + <version>6.1.0</version> + <scope>test</scope> + </dependency> <!-- testcontainer minimal shared resources --> <dependency> @@ -244,17 +249,18 @@ <sql driver="${torque.driver}" url="${torque.database.url}" userid="${torque.database.user}" password="${torque.database.password}" errorproperty="cannot.access.book.table" failOnConnectionError="false" onerror="continue"> select count(*) from book; </sql> - <!-- if it aborts book does not exist, no need to drop, set executeDrop, which is exported, to false --> + <!-- if it aborts table book does not exist, no need to drop, set executeDrop, which is exported, to false --> <condition property="executeDrop" value="false"> <istrue value="${cannot.access.book.table}" /> </condition> - <condition property="executeDrop" value="true"> + <condition property="executeDrop"><!-- defalut is true --> <isfalse value="${cannot.access.book.table}" /> </condition> <echo message="error: ${cannot.access.book.table}: set executeDrop: ${executeDrop}" /> </target> <exportAntProperties>true</exportAntProperties> <failOnError>false</failOnError> + <skip>${executeDrop}</skip> </configuration> <goals> <goal>run</goal> @@ -328,7 +334,7 @@ </sourceExcludes> <options> <torque.database>${torque.targetDatabase}</torque.database> - <torque.sql.generate.drops>${executeDrop}</torque.sql.generate.drops> + <torque.sql.generate.drops>${torque.generate.drops}</torque.sql.generate.drops> </options> </configuration> </execution> @@ -605,6 +611,7 @@ <include>**/InheritanceClassnameTestChild*.java</include> <include>**/${torque.test.include.beans}</include> <include>**/${torque.test.include.managers}</include> + <include>**/junit5/extension/**</include> </testIncludes> <!-- TODO: remove testExcludes once SQLToAppDataRuntimeTest works --> <testExcludes> @@ -1394,7 +1401,7 @@ <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> - <version>0.44.0</version> + <version>0.45.0</version> <configuration> <filter>${docker.image.name}:${docker.image.version}</filter> </configuration> @@ -1483,7 +1490,7 @@ </plugin> <plugin> <artifactId>maven-resources-plugin</artifactId> - <version>2.6</version> + <version>3.3.1</version> <executions> <execution> <id>copy-resources</id> Modified: db/torque/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectTest.java URL: http://svn.apache.org/viewvc/db/torque/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectTest.java?rev=1921162&r1=1921161&r2=1921162&view=diff ============================================================================== --- db/torque/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectTest.java (original) +++ db/torque/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectTest.java Mon Oct 7 14:01:37 2024 @@ -27,6 +27,7 @@ import org.apache.torque.BaseDatabaseTes import org.apache.torque.TooManyRowsException; import org.apache.torque.Torque; import org.apache.torque.criteria.Criteria; +import org.apache.torque.junit5.extension.HostCallback; import org.apache.torque.om.SimpleKey; import org.apache.torque.om.mapper.CompositeMapper; import org.apache.torque.test.dbobject.Author; @@ -49,6 +50,7 @@ import static org.junit.Assert.assertNul * * @version $Id$ */ +//@HostCallback(adapterProfileFallback = "derbyEmbedded") public class SelectTest extends BaseDatabaseTestCase { private List<Author> authorList; @@ -91,6 +93,7 @@ public class SelectTest extends BaseData * * @throws Exception if the test fails */ + @Test public void testSelectIntegerAsLvalue() throws Exception { Criteria criteria = new Criteria().where( @@ -231,6 +234,7 @@ public class SelectTest extends BaseData * * @throws Exception if the test fails. */ + @Test public void testSelectOperatorIsNullOtherComparison() throws Exception { Criteria criteria = new Criteria(); @@ -328,6 +332,7 @@ public class SelectTest extends BaseData * * @throws Exception if the test fails. */ + @Test public void testSelectStreamOffset() throws Exception { Criteria criteria = new Criteria(); --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org