This is an automated email from the ASF dual-hosted git repository. markt-asf pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git
commit 9971465b4b169b260f51ee7fee454377bcb09af8 Author: Mark Thomas <[email protected]> AuthorDate: Mon Jun 1 08:00:32 2026 +0100 Fix side-effects of class migration test Need to restore original class else next test run will build test JARs from migrated class causing JAR migration tests to fail. --- CHANGES.md | 1 + pom.xml | 4 ++-- src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 409a7e6..1f19192 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ ## 1.0.12 - Add Maven Wrapper Plugin to manage the Maven wrapper. (markt) - Update the Maven Wrapper and switch to 'only-script' configuration. (markt) +- Enable successful running of tests without having to clean the output directory bewteen test runs. (markt) ## 1.0.11 - Update Eclipse OSGI to 3.23.200. (dependabot/remm) diff --git a/pom.xml b/pom.xml index dbc6ec2..a99cbc9 100644 --- a/pom.xml +++ b/pom.xml @@ -161,8 +161,8 @@ <phase>process-test-classes</phase> <configuration> <target> - <jar basedir="target/test-classes" destfile="target/test-classes/cgi-api.jar" includes="**/CommonGatewayInterface*" /> - <jar basedir="target/test-classes" destfile="target/test-classes/hellocgi.jar" includes="**/HelloCGI*"> + <jar basedir="target/test-classes" destfile="target/test-classes/cgi-api.jar" includes="**/CommonGatewayInterface.class" /> + <jar basedir="target/test-classes" destfile="target/test-classes/hellocgi.jar" includes="**/HelloCGI.class"> <manifest> <attribute name="Implementation-Version" value="1.2.3" /> </manifest> diff --git a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java index 41fa2ac..c6590b3 100644 --- a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java +++ b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java @@ -26,6 +26,7 @@ import java.util.jar.JarFile; import org.apache.commons.io.FileUtils; import org.junit.After; +import org.junit.Assert; import org.junit.Assume; import org.junit.Before; import org.junit.Test; @@ -178,6 +179,8 @@ public class MigrationTest { @Test public void testMigrateClassFile() throws Exception { File classFile = new File("target/test-classes/org/apache/tomcat/jakartaee/HelloCGI.class"); + File classFileOriginal = new File("target/test-classes/org/apache/tomcat/jakartaee/HelloCGI-original.class"); + FileUtils.copyFile(classFile, classFileOriginal); Migration migration = new Migration(); migration.setSource(classFile); @@ -186,6 +189,9 @@ public class MigrationTest { Class<?> cls = Class.forName("org.apache.tomcat.jakartaee.HelloCGI"); assertEquals("jakarta.servlet.CommonGatewayInterface", cls.getSuperclass().getName()); + + Assert.assertTrue("Failed to delete migrated class file", classFile.delete()); + FileUtils.copyFile(classFileOriginal, classFile); } @Test --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
