This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git
The following commit(s) were added to refs/heads/main by this push: new c6002b4 Add in memory test c6002b4 is described below commit c6002b4c1bebb8b6b69b569d43a8e11c8e016a27 Author: remm <r...@apache.org> AuthorDate: Thu Nov 3 16:50:17 2022 +0100 Add in memory test --- .../java/org/apache/tomcat/jakartaee/MigrationTest.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java index 9987c2e..34048bb 100644 --- a/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java +++ b/src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java @@ -156,21 +156,27 @@ public class MigrationTest { @Test public void testMigrateJarFile() throws Exception { + testMigrateJarFileInternal(false); + } + + private void testMigrateJarFileInternal(boolean zipInMemory) throws Exception { File jarFile = new File("target/test-classes/hellocgi.jar"); + File jarFileTarget = new File("target/test-classes/hellocgi-target.jar"); Migration migration = new Migration(); migration.setSource(jarFile); - migration.setDestination(jarFile); + migration.setDestination(jarFileTarget); + migration.setZipInMemory(zipInMemory); migration.execute(); File cgiapiFile = new File("target/test-classes/cgi-api.jar"); - URLClassLoader classloader = new URLClassLoader(new URL[]{jarFile.toURI().toURL(), cgiapiFile.toURI().toURL()},ClassLoader.getSystemClassLoader().getParent()); + URLClassLoader classloader = new URLClassLoader(new URL[]{jarFileTarget.toURI().toURL(), cgiapiFile.toURI().toURL()},ClassLoader.getSystemClassLoader().getParent()); Class<?> cls = Class.forName("org.apache.tomcat.jakartaee.HelloCGI", true, classloader); assertEquals("jakarta.servlet.CommonGatewayInterface", cls.getSuperclass().getName()); // check the modification of the Implementation-Version manifest attribute - try (JarFile jar = new JarFile(jarFile)) { + try (JarFile jar = new JarFile(jarFileTarget)) { String implementationVersion = jar.getManifest().getMainAttributes().getValue("Implementation-Version"); assertNotNull("Missing Implementation-Version manifest attribute", implementationVersion); assertNotEquals("Implementation-Version manifest attribute not changed", "1.2.3", implementationVersion); @@ -180,6 +186,11 @@ public class MigrationTest { assertTrue("hasConverted should be true", migration.hasConverted()); } + @Test + public void testMigrateJarFileInMemory() throws Exception { + testMigrateJarFileInternal(true); + } + @Test public void testHasConversionsThrowsWhenNotComplete() { Migration migration = new Migration(); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org