+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+type: specs.openrewrite.org/v1beta/recipe
+name: org.openrewrite.quarkus.quarkus2.JavaEEtoQuarkus2CodeMigration
+displayName: Migrate JavaEE Code to Quarkus 2
+description: Migrate Standard JavaEE Code to Quarkus 2
+recipeList:
+ # Convert some EJB annotations to CDI
+ - org.openrewrite.java.ChangeType:
+ oldFullyQualifiedTypeName: javax.ejb.Stateless
+ newFullyQualifiedTypeName: javax.enterprise.context.Dependent
+ - org.openrewrite.java.ChangeType:
+ oldFullyQualifiedTypeName: javax.ejb.Stateful
+ newFullyQualifiedTypeName: javax.enterprise.context.SessionScoped
+ - org.openrewrite.java.ChangeType:
+ oldFullyQualifiedTypeName: javax.ejb.Singleton
+ newFullyQualifiedTypeName: javax.enterprise.context.ApplicationScoped
+ - org.openrewrite.java.RemoveAnnotationAttribute:
+ annotationType: javax.ejb.EJB
+ attributeName: name
+ - org.openrewrite.java.RemoveAnnotationAttribute:
+ annotationType: javax.ejb.EJB
+ attributeName: description
+ - org.openrewrite.java.RemoveAnnotationAttribute:
+ annotationType: javax.ejb.EJB
+ attributeName: beanName
+ - org.openrewrite.java.RemoveAnnotationAttribute:
+ annotationType: javax.ejb.EJB
+ attributeName: beanInterface
+ - org.openrewrite.java.RemoveAnnotationAttribute:
+ annotationType: javax.ejb.EJB
+ attributeName: mappedName
+ - org.openrewrite.java.RemoveAnnotationAttribute:
+ annotationType: javax.ejb.EJB
+ attributeName: lookup
+ - org.openrewrite.java.ChangeType:
+ oldFullyQualifiedTypeName: javax.ejb.EJB
+ newFullyQualifiedTypeName: javax.inject.Inject
+ - org.openrewrite.java.RemoveAnnotation:
+ annotationPattern: '@javax.ejb.Local'
+
+ # Convert JPA annotations
+ - org.openrewrite.java.RemoveAnnotationAttribute:
+ annotationType: javax.persistence.PersistenceContext
+ attributeName: name
+ - org.openrewrite.java.RemoveAnnotationAttribute:
+ annotationType: javax.persistence.PersistenceContext
+ attributeName: unitName
+ - org.openrewrite.java.RemoveAnnotationAttribute:
+ annotationType: javax.persistence.PersistenceContext
+ attributeName: type
+ - org.openrewrite.java.RemoveAnnotationAttribute:
+ annotationType: javax.persistence.PersistenceContext
+ attributeName: synchronization
+ - org.openrewrite.java.RemoveAnnotationAttribute:
+ annotationType: javax.persistence.PersistenceContext
+ attributeName: properties
+ - org.openrewrite.java.ChangeType:
+ oldFullyQualifiedTypeName: javax.persistence.PersistenceContext
+ newFullyQualifiedTypeName: javax.inject.Inject
+
+ # Migrate to Java 11
+ - org.openrewrite.java.migrate.Java8toJava11
\ No newline at end of file
diff --git a/src/main/resources/META-INF/rewrite/javaee-to-quarkus-maven-dependencies.yml b/src/main/resources/META-INF/rewrite/javaee-to-quarkus-maven-dependencies.yml
new file mode 100644
index 0000000..53ba632
--- /dev/null
+++ b/src/main/resources/META-INF/rewrite/javaee-to-quarkus-maven-dependencies.yml
@@ -0,0 +1,107 @@
+#
+# Copyright 2024 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+type: specs.openrewrite.org/v1beta/recipe
+name: org.openrewrite.quarkus.quarkus2.JavaEEtoQuarkus2MavenDependencyMigration
+displayName: Migrate JavaEE Maven and Gradle Dependencies to Quarkus 2
+description: Upgrade Standard JavaEE dependencies to Quarkus 2 dependencies.
+recipeList:
+ # Add Quarkus BOM
+ - org.openrewrite.maven.AddManagedDependency:
+ groupId: io.quarkus.platform
+ artifactId: quarkus-bom
+ version: '2.x'
+ type: pom
+ scope: import
+
+ # Add Basic Quarkus Extensions
+ - org.openrewrite.java.dependencies.AddDependency:
+ groupId: io.quarkus
+ artifactId: quarkus-arc
+ - org.openrewrite.java.dependencies.AddDependency:
+ groupId: io.quarkus
+ artifactId: quarkus-resteasy
+ - org.openrewrite.java.dependencies.AddDependency:
+ groupId: io.quarkus
+ artifactId: quarkus-resteasy-jackson
+ - org.openrewrite.java.dependencies.AddDependency:
+ groupId: io.quarkus
+ artifactId: quarkus-undertow
+ - org.openrewrite.java.dependencies.AddDependency:
+ groupId: io.quarkus
+ artifactId: quarkus-hibernate-orm
+ - org.openrewrite.java.dependencies.AddDependency:
+ groupId: io.quarkus
+ artifactId: quarkus-jdbc-h2
+ - org.openrewrite.java.dependencies.AddDependency:
+ groupId: io.quarkus
+ artifactId: quarkus-junit5
+ scope: test
+ - org.openrewrite.java.dependencies.AddDependency:
+ groupId: io.rest-assured
+ artifactId: rest-assured
+ scope: test
+
+ # Add Maven Plugins
+ - org.openrewrite.maven.AddPlugin:
+ groupId: io.quarkus.platform
+ artifactId: quarkus-maven-plugin
+ version: '2.16.12.Final'
+ executions: buildgenerate-codegenerate-code-tests
+ - org.openrewrite.maven.AddPlugin:
+ groupId: org.apache.maven.plugins
+ artifactId: maven-compiler-plugin
+ version: '3.10.1'
+ configuration: -parameters
+ - org.openrewrite.maven.AddPlugin:
+ groupId: org.apache.maven.plugins
+ artifactId: maven-surefire-plugin
+ version: '3.0.0-M7'
+ configuration: org.jboss.logmanager.LogManager${maven.home}
+ - org.openrewrite.maven.AddPlugin:
+ groupId: org.apache.maven.plugins
+ artifactId: maven-failsafe-plugin
+ version: '3.0.0-M7'
+ executions: integration-testverify
+ configuration: ${project.build.directory}/${project.build.finalName}-runnerorg.jboss.logmanager.LogManager${maven.home}
+ - org.openrewrite.maven.AddProfile:
+ id: native
+ activation: native
+ properties: falsenative
+ - org.openrewrite.quarkus.ConfigureQuarkusMavenPluginWithReasonableDefaults
+ - org.openrewrite.maven.BestPractices
+
+ # Remove JavaEE dependencies
+ - org.openrewrite.java.dependencies.RemoveDependency:
+ groupId: javax*
+ artifactId: javaee-api
+ - org.openrewrite.java.dependencies.RemoveDependency:
+ groupId: javax*
+ artifactId: cdi-api
+ - org.openrewrite.java.dependencies.RemoveDependency:
+ groupId: javax*
+ artifactId: javax*
+
+ # Prep for Java 11 upgrade
+ - org.openrewrite.maven.AddProperty:
+ key: maven.compiler.source
+ value: 11
+ - org.openrewrite.maven.AddProperty:
+ key: maven.compiler.target
+ value: 11
+ - org.openrewrite.maven.ChangePackaging:
+ groupId: '*'
+ artifactId: '*'
+ packaging: jar
\ No newline at end of file
diff --git a/src/main/resources/META-INF/rewrite/javaee-to-quarkus.yml b/src/main/resources/META-INF/rewrite/javaee-to-quarkus.yml
new file mode 100644
index 0000000..68dcfe2
--- /dev/null
+++ b/src/main/resources/META-INF/rewrite/javaee-to-quarkus.yml
@@ -0,0 +1,24 @@
+#
+# Copyright 2024 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+type: specs.openrewrite.org/v1beta/recipe
+name: org.openrewrite.quarkus.quarkus2.JavaEEtoQuarkus2Migration
+displayName: Migrate JavaEE to Quarkus 2
+description: These recipes help with the migration of a JavaEE application using EJBs and Hibernate to Quarkus 2. Additional transformations like JSF, JMS, Quarkus Tests may be necessary.
+recipeList:
+ # Migrate Dependencies
+ - org.openrewrite.quarkus.quarkus2.JavaEEtoQuarkus2MavenDependencyMigration
+ # Migrate Code
+ - org.openrewrite.quarkus.quarkus2.JavaEEtoQuarkus2CodeMigration
\ No newline at end of file
From c31622fb09149575a12f1da26caaf5dc398f8d02 Mon Sep 17 00:00:00 2001
From: Adriano Machado <60320+ammachado@users.noreply.github.com>
Date: Mon, 5 Feb 2024 22:49:33 +0000
Subject: [PATCH 05/13] Updated Tests
---
...avaEEtoQuarkus2CodeTranformationsTest.java | 153 +++++++
...uarkus2MavenDependenciesMigrationTest.java | 404 ++++++++++++++++++
.../JavaEEtoQuarkus2MigrationTest.java | 145 -------
3 files changed, 557 insertions(+), 145 deletions(-)
create mode 100644 src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2CodeTranformationsTest.java
create mode 100644 src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2MavenDependenciesMigrationTest.java
delete mode 100644 src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2MigrationTest.java
diff --git a/src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2CodeTranformationsTest.java b/src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2CodeTranformationsTest.java
new file mode 100644
index 0000000..8e5e903
--- /dev/null
+++ b/src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2CodeTranformationsTest.java
@@ -0,0 +1,153 @@
+package org.openrewrite.quarkus.quarkus2;
+
+import org.junit.jupiter.api.Test;
+import org.openrewrite.DocumentExample;
+import org.openrewrite.java.JavaParser;
+import org.openrewrite.test.RecipeSpec;
+import org.openrewrite.test.RewriteTest;
+
+import static org.openrewrite.java.Assertions.java;
+
+class JavaEEtoQuarkus2CodeTranformationsTest implements RewriteTest {
+
+ @Override
+ public void defaults(RecipeSpec spec) {
+ spec.parser(JavaParser.fromJavaVersion()
+ .logCompilationWarningsAndErrors(true)
+ .classpath("javaee-api"))
+ .recipeFromResources("org.openrewrite.quarkus.quarkus2.JavaEEtoQuarkus2CodeMigration");
+ }
+
+ @Test
+ @DocumentExample
+ void javaEEtoQuarkus2CodeTransformationsTest() {
+ rewriteRun(
+ java(
+ //language=java
+ """
+ package org.acme;
+
+ import javax.ejb.EJB;
+ import javax.ejb.Local;
+ import javax.ejb.SessionContext;
+ import javax.ejb.Singleton;
+ import javax.ejb.Stateful;
+ import javax.ejb.Stateless;
+
+ import javax.annotation.Resource;
+ import javax.persistence.EntityManager;
+ import javax.persistence.PersistenceContext;
+
+ @Stateless
+ public class PingEJBSLS {
+
+ @PersistenceContext
+ private EntityManager entityManager;
+
+ @Resource
+ private SessionContext context;
+
+ @EJB
+ private PingEJBLocal pingEJBLocal;
+
+ @EJB(lookup = "java:global/PingEJBSingleton")
+ private PingEJBSingleton pingEJBSingleton;
+
+ public String getMsg() {
+
+ return "PingEJBSLS: " + pingEJBLocal.getMsg() + " " + pingEJBSingleton.getMsg();
+ }
+
+ }
+
+ @Stateful
+ @Local
+ public class PingEJBLocal {
+
+ private static int hitCount;
+
+ public String getMsg() {
+
+ return "PingEJBLocal: " + hitCount++;
+ }
+
+ }
+
+ @Singleton
+ public class PingEJBSingleton {
+
+ private static int hitCount;
+
+ @PersistenceContext
+ private EntityManager entityManager;
+
+ public String getMsg() {
+
+ return "PingEJBSingleton: " + hitCount++;
+ }
+ }
+ """,
+ //language=java
+ """
+ package org.acme;
+
+ import javax.ejb.SessionContext;
+ import javax.enterprise.context.ApplicationScoped;
+ import javax.enterprise.context.Dependent;
+ import javax.enterprise.context.SessionScoped;
+ import javax.inject.Inject;
+ import javax.annotation.Resource;
+ import javax.persistence.EntityManager;
+
+ @Dependent
+ public class PingEJBSLS {
+
+ @Inject
+ private EntityManager entityManager;
+
+ @Resource
+ private SessionContext context;
+
+ @Inject
+ private PingEJBLocal pingEJBLocal;
+
+ @Inject
+ private PingEJBSingleton pingEJBSingleton;
+
+ public String getMsg() {
+
+ return "PingEJBSLS: " + pingEJBLocal.getMsg() + " " + pingEJBSingleton.getMsg();
+ }
+
+ }
+
+ @SessionScoped
+ public class PingEJBLocal {
+
+ private static int hitCount;
+
+ public String getMsg() {
+
+ return "PingEJBLocal: " + hitCount++;
+ }
+
+ }
+
+ @ApplicationScoped
+ public class PingEJBSingleton {
+
+ private static int hitCount;
+
+ @Inject
+ private EntityManager entityManager;
+
+ public String getMsg() {
+
+ return "PingEJBSingleton: " + hitCount++;
+ }
+ }
+ """
+ )
+ );
+ }
+}
diff --git a/src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2MavenDependenciesMigrationTest.java b/src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2MavenDependenciesMigrationTest.java
new file mode 100644
index 0000000..d85d929
--- /dev/null
+++ b/src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2MavenDependenciesMigrationTest.java
@@ -0,0 +1,404 @@
+/*
+ * Copyright 2024 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-type: specs.openrewrite.org/v1beta/recipe
-name: org.openrewrite.quarkus.quarkus2.JavaEEtoQuarkus2CodeMigration
-displayName: Migrate JavaEE Code to Quarkus 2
-description: Migrate Standard JavaEE Code to Quarkus 2
-recipeList:
- # Convert some EJB annotations to CDI
- - org.openrewrite.java.ChangeType:
- oldFullyQualifiedTypeName: javax.ejb.Stateless
- newFullyQualifiedTypeName: javax.enterprise.context.Dependent
- - org.openrewrite.java.ChangeType:
- oldFullyQualifiedTypeName: javax.ejb.Stateful
- newFullyQualifiedTypeName: javax.enterprise.context.SessionScoped
- - org.openrewrite.java.ChangeType:
- oldFullyQualifiedTypeName: javax.ejb.Singleton
- newFullyQualifiedTypeName: javax.enterprise.context.ApplicationScoped
- - org.openrewrite.java.RemoveAnnotationAttribute:
- annotationType: javax.ejb.EJB
- attributeName: name
- - org.openrewrite.java.RemoveAnnotationAttribute:
- annotationType: javax.ejb.EJB
- attributeName: description
- - org.openrewrite.java.RemoveAnnotationAttribute:
- annotationType: javax.ejb.EJB
- attributeName: beanName
- - org.openrewrite.java.RemoveAnnotationAttribute:
- annotationType: javax.ejb.EJB
- attributeName: beanInterface
- - org.openrewrite.java.RemoveAnnotationAttribute:
- annotationType: javax.ejb.EJB
- attributeName: mappedName
- - org.openrewrite.java.RemoveAnnotationAttribute:
- annotationType: javax.ejb.EJB
- attributeName: lookup
- - org.openrewrite.java.ChangeType:
- oldFullyQualifiedTypeName: javax.ejb.EJB
- newFullyQualifiedTypeName: javax.inject.Inject
- - org.openrewrite.java.RemoveAnnotation:
- annotationPattern: '@javax.ejb.Local'
-
- # Convert JPA annotations
- - org.openrewrite.java.RemoveAnnotationAttribute:
- annotationType: javax.persistence.PersistenceContext
- attributeName: name
- - org.openrewrite.java.RemoveAnnotationAttribute:
- annotationType: javax.persistence.PersistenceContext
- attributeName: unitName
- - org.openrewrite.java.RemoveAnnotationAttribute:
- annotationType: javax.persistence.PersistenceContext
- attributeName: type
- - org.openrewrite.java.RemoveAnnotationAttribute:
- annotationType: javax.persistence.PersistenceContext
- attributeName: synchronization
- - org.openrewrite.java.RemoveAnnotationAttribute:
- annotationType: javax.persistence.PersistenceContext
- attributeName: properties
- - org.openrewrite.java.ChangeType:
- oldFullyQualifiedTypeName: javax.persistence.PersistenceContext
- newFullyQualifiedTypeName: javax.inject.Inject
-
- # Migrate to Java 11
- - org.openrewrite.java.migrate.Java8toJava11
\ No newline at end of file
diff --git a/src/main/resources/META-INF/rewrite/javaee-to-quarkus-maven-dependencies.yml b/src/main/resources/META-INF/rewrite/javaee-to-quarkus-maven-dependencies.yml
deleted file mode 100644
index 53ba632..0000000
--- a/src/main/resources/META-INF/rewrite/javaee-to-quarkus-maven-dependencies.yml
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# Copyright 2024 the original author or authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openrewrite.quarkus.migrate.javaee;
+
+import org.junit.jupiter.api.Test;
+import org.openrewrite.DocumentExample;
+import org.openrewrite.java.JavaParser;
+import org.openrewrite.test.RecipeSpec;
+import org.openrewrite.test.RewriteTest;
+
+import static org.openrewrite.java.Assertions.java;
+
+class JavaEEtoQuarkus2CodeTranformationsTest implements RewriteTest {
+
+ @Override
+ public void defaults(RecipeSpec spec) {
+ spec.parser(JavaParser.fromJavaVersion()
+ .logCompilationWarningsAndErrors(true)
+ .classpath("javaee-api"))
+ .recipeFromResources("org.openrewrite.quarkus.migrate.javaee.JavaEEtoQuarkus2CodeMigration");
+ }
+
+ @Test
+ @DocumentExample
+ void javaEEtoQuarkus2CodeTransformationsTest() {
+ rewriteRun(
+ java(
+ // language=java
+ """
+ package org.acme;
+
+ import javax.ejb.EJB;
+ import javax.ejb.Local;
+ import javax.ejb.SessionContext;
+ import javax.ejb.Singleton;
+ import javax.ejb.Stateful;
+ import javax.ejb.Stateless;
+
+ import javax.annotation.Resource;
+ import javax.persistence.EntityManager;
+ import javax.persistence.PersistenceContext;
+
+ @Stateless
+ public class PingEJBSLS {
+
+ @PersistenceContext
+ private EntityManager entityManager;
+
+ @Resource
+ private SessionContext context;
+
+ @EJB
+ private PingEJBLocal pingEJBLocal;
+
+ @EJB(lookup = "java:global/PingEJBSingleton")
+ private PingEJBSingleton pingEJBSingleton;
+
+ public String getMsg() {
+ return "PingEJBSLS: " + pingEJBLocal.getMsg() + " " + pingEJBSingleton.getMsg();
+ }
+
+ }
+
+ @Stateful
+ @Local
+ public class PingEJBLocal {
+
+ private static int hitCount;
+
+ public String getMsg() {
+ return "PingEJBLocal: " + hitCount++;
+ }
+
+ }
+
+ @Singleton
+ public class PingEJBSingleton {
+
+ private static int hitCount;
+
+ @PersistenceContext
+ private EntityManager entityManager;
+
+ public String getMsg() {
+ return "PingEJBSingleton: " + hitCount++;
+ }
+ }
+ """,
+ // language=java
+ """
+ package org.acme;
+
+ import javax.ejb.SessionContext;
+ import javax.enterprise.context.ApplicationScoped;
+ import javax.enterprise.context.Dependent;
+ import javax.enterprise.context.SessionScoped;
+ import javax.inject.Inject;
+ import javax.annotation.Resource;
+ import javax.persistence.EntityManager;
+
+ @Dependent
+ public class PingEJBSLS {
+
+ @Inject
+ private EntityManager entityManager;
+
+ @Resource
+ private SessionContext context;
+
+ @Inject
+ private PingEJBLocal pingEJBLocal;
+
+ @Inject
+ private PingEJBSingleton pingEJBSingleton;
+
+ public String getMsg() {
+ return "PingEJBSLS: " + pingEJBLocal.getMsg() + " " + pingEJBSingleton.getMsg();
+ }
+
+ }
+
+ @SessionScoped
+ public class PingEJBLocal {
+
+ private static int hitCount;
+
+ public String getMsg() {
+ return "PingEJBLocal: " + hitCount++;
+ }
+
+ }
+
+ @ApplicationScoped
+ public class PingEJBSingleton {
+
+ private static int hitCount;
+
+ @Inject
+ private EntityManager entityManager;
+
+ public String getMsg() {
+ return "PingEJBSingleton: " + hitCount++;
+ }
+ }
+ """
+ )
+ );
+ }
+}
diff --git a/src/test/java/org/openrewrite/quarkus/migrate/javaee/JavaEEtoQuarkus2MavenDependenciesMigrationTest.java b/src/test/java/org/openrewrite/quarkus/migrate/javaee/JavaEEtoQuarkus2MavenDependenciesMigrationTest.java
new file mode 100644
index 0000000..6d99376
--- /dev/null
+++ b/src/test/java/org/openrewrite/quarkus/migrate/javaee/JavaEEtoQuarkus2MavenDependenciesMigrationTest.java
@@ -0,0 +1,475 @@
+/*
+ * Copyright 2024 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.openrewrite.quarkus.quarkus2;
-
-import org.junit.jupiter.api.Test;
-import org.openrewrite.DocumentExample;
-import org.openrewrite.java.JavaParser;
-import org.openrewrite.test.RecipeSpec;
-import org.openrewrite.test.RewriteTest;
-
-import static org.openrewrite.java.Assertions.java;
-
-class JavaEEtoQuarkus2CodeTranformationsTest implements RewriteTest {
-
- @Override
- public void defaults(RecipeSpec spec) {
- spec.parser(JavaParser.fromJavaVersion()
- .logCompilationWarningsAndErrors(true)
- .classpath("javaee-api"))
- .recipeFromResources("org.openrewrite.quarkus.quarkus2.JavaEEtoQuarkus2CodeMigration");
- }
-
- @Test
- @DocumentExample
- void javaEEtoQuarkus2CodeTransformationsTest() {
- rewriteRun(
- java(
- // language=java
- """
- package org.acme;
-
- import javax.ejb.EJB;
- import javax.ejb.Local;
- import javax.ejb.SessionContext;
- import javax.ejb.Singleton;
- import javax.ejb.Stateful;
- import javax.ejb.Stateless;
-
- import javax.annotation.Resource;
- import javax.persistence.EntityManager;
- import javax.persistence.PersistenceContext;
-
- @Stateless
- public class PingEJBSLS {
-
- @PersistenceContext
- private EntityManager entityManager;
-
- @Resource
- private SessionContext context;
-
- @EJB
- private PingEJBLocal pingEJBLocal;
-
- @EJB(lookup = "java:global/PingEJBSingleton")
- private PingEJBSingleton pingEJBSingleton;
-
- public String getMsg() {
-
- return "PingEJBSLS: " + pingEJBLocal.getMsg() + " " + pingEJBSingleton.getMsg();
- }
-
- }
-
- @Stateful
- @Local
- public class PingEJBLocal {
-
- private static int hitCount;
-
- public String getMsg() {
-
- return "PingEJBLocal: " + hitCount++;
- }
-
- }
-
- @Singleton
- public class PingEJBSingleton {
-
- private static int hitCount;
-
- @PersistenceContext
- private EntityManager entityManager;
-
- public String getMsg() {
-
- return "PingEJBSingleton: " + hitCount++;
- }
- }
- """,
- // language=java
- """
- package org.acme;
-
- import javax.ejb.SessionContext;
- import javax.enterprise.context.ApplicationScoped;
- import javax.enterprise.context.Dependent;
- import javax.enterprise.context.SessionScoped;
- import javax.inject.Inject;
- import javax.annotation.Resource;
- import javax.persistence.EntityManager;
-
- @Dependent
- public class PingEJBSLS {
-
- @Inject
- private EntityManager entityManager;
-
- @Resource
- private SessionContext context;
-
- @Inject
- private PingEJBLocal pingEJBLocal;
-
- @Inject
- private PingEJBSingleton pingEJBSingleton;
-
- public String getMsg() {
-
- return "PingEJBSLS: " + pingEJBLocal.getMsg() + " " + pingEJBSingleton.getMsg();
- }
-
- }
-
- @SessionScoped
- public class PingEJBLocal {
-
- private static int hitCount;
-
- public String getMsg() {
-
- return "PingEJBLocal: " + hitCount++;
- }
-
- }
-
- @ApplicationScoped
- public class PingEJBSingleton {
-
- private static int hitCount;
-
- @Inject
- private EntityManager entityManager;
-
- public String getMsg() {
-
- return "PingEJBSingleton: " + hitCount++;
- }
- }
- """));
- }
-}
diff --git a/src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2MavenDependenciesMigrationTest.java b/src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2MavenDependenciesMigrationTest.java
deleted file mode 100644
index 40810f9..0000000
--- a/src/test/java/org/openrewrite/quarkus/quarkus2/JavaEEtoQuarkus2MavenDependenciesMigrationTest.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * Copyright 2024 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *