You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "FSchumacher (via GitHub)" <gi...@apache.org> on 2023/03/25 10:35:03 UTC

[GitHub] [tomcat-jakartaee-migration] FSchumacher opened a new pull request, #45: Migrate SPI files in directories by renaming them to the jakartaee pr…

FSchumacher opened a new pull request, #45:
URL: https://github.com/apache/tomcat-jakartaee-migration/pull/45

   …efix
   
   We already rename files in JAR files, so directory handling should follow here. A more correct way to handle this, would probably be to restrict the renaming to files, that are found in META-INF/services directories, only.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [tomcat-jakartaee-migration] ebourg commented on a diff in pull request #45: Migrate SPI files in directories by renaming them to the jakartaee pr…

Posted by "ebourg (via GitHub)" <gi...@apache.org>.
ebourg commented on code in PR #45:
URL: https://github.com/apache/tomcat-jakartaee-migration/pull/45#discussion_r1148359861


##########
src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java:
##########
@@ -139,6 +139,39 @@ public void testMigrateDirectory() throws Exception {
         String migratedSource = FileUtils.readFileToString(migratedFile, StandardCharsets.UTF_8);
         assertFalse("Imports not migrated", migratedSource.contains("import javax.servlet"));
         assertTrue("Migrated imports not found", migratedSource.contains("import jakarta.servlet"));
+
+        File migratedSpiFile = new File("target/test-classes/migration/javax.enterprise.inject.spi.Extension");
+        assertTrue("SPI file has not been migrated by renaming", migratedSpiFile.exists());
+
+        String migratedSpiSource = FileUtils.readFileToString(migratedSpiFile, StandardCharsets.UTF_8);
+        assertTrue("SPI file copied with content", migratedSpiSource.contains("some.class.Reference"));
+    }
+
+    @Test
+    public void testMigrateDirectoryWithEeProfile() throws Exception {
+        File sourceDirectory = new File("src/test/resources");
+        File destinationDirectory = new File("target/test-classes/migration-ee");
+
+        Migration migration = new Migration();
+        migration.setEESpecProfile(EESpecProfiles.EE);
+        migration.setSource(sourceDirectory);
+        migration.setDestination(destinationDirectory);
+        migration.execute();
+
+        assertTrue("Destination directory not found", destinationDirectory.exists());
+
+        File migratedFile = new File(destinationDirectory, "HelloServlet.java");
+        assertTrue("Migrated file not found", migratedFile.exists());
+
+        String migratedSource = FileUtils.readFileToString(migratedFile, StandardCharsets.UTF_8);
+        assertFalse("Imports not migrated", migratedSource.contains("import javax.servlet"));
+        assertTrue("Migrated imports not found", migratedSource.contains("import jakarta.servlet"));
+
+        File migratedSpiFile = new File(destinationDirectory, "jakarta.enterprise.inject.spi.Extension");
+        assertTrue("SPI file migrated by renaming", migratedSpiFile.exists());

Review Comment:
   The assert message is missing a "not" I think: "SPI file not migrated by renaming"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [tomcat-jakartaee-migration] ebourg merged pull request #45: Migrate SPI files in directories by renaming them to the jakartaee pr…

Posted by "ebourg (via GitHub)" <gi...@apache.org>.
ebourg merged PR #45:
URL: https://github.com/apache/tomcat-jakartaee-migration/pull/45


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [tomcat-jakartaee-migration] codecov-commenter commented on pull request #45: Migrate SPI files in directories by renaming them to the jakartaee pr…

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #45:
URL: https://github.com/apache/tomcat-jakartaee-migration/pull/45#issuecomment-1483795564

   ## [Codecov](https://codecov.io/gh/apache/tomcat-jakartaee-migration/pull/45?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#45](https://codecov.io/gh/apache/tomcat-jakartaee-migration/pull/45?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (647909e) into [main](https://codecov.io/gh/apache/tomcat-jakartaee-migration/commit/0e21b054e81aba8f28a55d43f5b9252e786053b3?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0e21b05) will **not change** coverage.
   > The diff coverage is `100.00%`.
   
   ```diff
   @@            Coverage Diff            @@
   ##               main      #45   +/-   ##
   =========================================
     Coverage     72.96%   72.96%           
     Complexity      130      130           
   =========================================
     Files            14       14           
     Lines           614      614           
     Branches        104      104           
   =========================================
     Hits            448      448           
     Misses          126      126           
     Partials         40       40           
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/tomcat-jakartaee-migration/pull/45?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...in/java/org/apache/tomcat/jakartaee/Migration.java](https://codecov.io/gh/apache/tomcat-jakartaee-migration/pull/45?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3RvbWNhdC9qYWthcnRhZWUvTWlncmF0aW9uLmphdmE=) | `84.04% <100.00%> (ø)` | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [tomcat-jakartaee-migration] ebourg commented on a diff in pull request #45: Migrate SPI files in directories by renaming them to the jakartaee pr…

Posted by "ebourg (via GitHub)" <gi...@apache.org>.
ebourg commented on code in PR #45:
URL: https://github.com/apache/tomcat-jakartaee-migration/pull/45#discussion_r1148359876


##########
src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java:
##########
@@ -139,6 +139,39 @@ public void testMigrateDirectory() throws Exception {
         String migratedSource = FileUtils.readFileToString(migratedFile, StandardCharsets.UTF_8);
         assertFalse("Imports not migrated", migratedSource.contains("import javax.servlet"));
         assertTrue("Migrated imports not found", migratedSource.contains("import jakarta.servlet"));
+
+        File migratedSpiFile = new File("target/test-classes/migration/javax.enterprise.inject.spi.Extension");
+        assertTrue("SPI file has not been migrated by renaming", migratedSpiFile.exists());
+
+        String migratedSpiSource = FileUtils.readFileToString(migratedSpiFile, StandardCharsets.UTF_8);
+        assertTrue("SPI file copied with content", migratedSpiSource.contains("some.class.Reference"));
+    }
+
+    @Test
+    public void testMigrateDirectoryWithEeProfile() throws Exception {
+        File sourceDirectory = new File("src/test/resources");
+        File destinationDirectory = new File("target/test-classes/migration-ee");
+
+        Migration migration = new Migration();
+        migration.setEESpecProfile(EESpecProfiles.EE);
+        migration.setSource(sourceDirectory);
+        migration.setDestination(destinationDirectory);
+        migration.execute();
+
+        assertTrue("Destination directory not found", destinationDirectory.exists());
+
+        File migratedFile = new File(destinationDirectory, "HelloServlet.java");
+        assertTrue("Migrated file not found", migratedFile.exists());
+
+        String migratedSource = FileUtils.readFileToString(migratedFile, StandardCharsets.UTF_8);
+        assertFalse("Imports not migrated", migratedSource.contains("import javax.servlet"));
+        assertTrue("Migrated imports not found", migratedSource.contains("import jakarta.servlet"));
+
+        File migratedSpiFile = new File(destinationDirectory, "jakarta.enterprise.inject.spi.Extension");
+        assertTrue("SPI file migrated by renaming", migratedSpiFile.exists());
+
+        String migratedSpiSource = FileUtils.readFileToString(migratedSpiFile, StandardCharsets.UTF_8);
+        assertTrue("SPI file copied with content", migratedSpiSource.contains("some.class.Reference"));

Review Comment:
   Same here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [tomcat-jakartaee-migration] FSchumacher commented on a diff in pull request #45: Migrate SPI files in directories by renaming them to the jakartaee pr…

Posted by "FSchumacher (via GitHub)" <gi...@apache.org>.
FSchumacher commented on code in PR #45:
URL: https://github.com/apache/tomcat-jakartaee-migration/pull/45#discussion_r1148360532


##########
src/test/java/org/apache/tomcat/jakartaee/MigrationTest.java:
##########
@@ -139,6 +139,39 @@ public void testMigrateDirectory() throws Exception {
         String migratedSource = FileUtils.readFileToString(migratedFile, StandardCharsets.UTF_8);
         assertFalse("Imports not migrated", migratedSource.contains("import javax.servlet"));
         assertTrue("Migrated imports not found", migratedSource.contains("import jakarta.servlet"));
+
+        File migratedSpiFile = new File("target/test-classes/migration/javax.enterprise.inject.spi.Extension");
+        assertTrue("SPI file has not been migrated by renaming", migratedSpiFile.exists());
+
+        String migratedSpiSource = FileUtils.readFileToString(migratedSpiFile, StandardCharsets.UTF_8);
+        assertTrue("SPI file copied with content", migratedSpiSource.contains("some.class.Reference"));
+    }
+
+    @Test
+    public void testMigrateDirectoryWithEeProfile() throws Exception {
+        File sourceDirectory = new File("src/test/resources");
+        File destinationDirectory = new File("target/test-classes/migration-ee");
+
+        Migration migration = new Migration();
+        migration.setEESpecProfile(EESpecProfiles.EE);
+        migration.setSource(sourceDirectory);
+        migration.setDestination(destinationDirectory);
+        migration.execute();
+
+        assertTrue("Destination directory not found", destinationDirectory.exists());
+
+        File migratedFile = new File(destinationDirectory, "HelloServlet.java");
+        assertTrue("Migrated file not found", migratedFile.exists());
+
+        String migratedSource = FileUtils.readFileToString(migratedFile, StandardCharsets.UTF_8);
+        assertFalse("Imports not migrated", migratedSource.contains("import javax.servlet"));
+        assertTrue("Migrated imports not found", migratedSource.contains("import jakarta.servlet"));
+
+        File migratedSpiFile = new File(destinationDirectory, "jakarta.enterprise.inject.spi.Extension");
+        assertTrue("SPI file migrated by renaming", migratedSpiFile.exists());

Review Comment:
   Oh, yes, the other test message are *reversed*. Will update them.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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