diff --git a/independent-projects/arc/tcks/cdi-tck-runner/pom.xml b/independent-projects/arc/tcks/cdi-tck-runner/pom.xml index 9cf87fd791c069..ccbc8f951ca31e 100644 --- a/independent-projects/arc/tcks/cdi-tck-runner/pom.xml +++ b/independent-projects/arc/tcks/cdi-tck-runner/pom.xml @@ -74,6 +74,7 @@ src/test/resources/testng.xml + true ${project.build.directory}/porting-pkg false diff --git a/independent-projects/arc/tcks/cdi-tck-runner/src/test/resources/META-INF/cdi-tck.properties b/independent-projects/arc/tcks/cdi-tck-runner/src/test/resources/META-INF/cdi-tck.properties deleted file mode 100644 index c38de38628e084..00000000000000 --- a/independent-projects/arc/tcks/cdi-tck-runner/src/test/resources/META-INF/cdi-tck.properties +++ /dev/null @@ -1 +0,0 @@ -org.jboss.cdi.tck.cdiLiteMode=true diff --git a/tcks/jakarta-atinject/pom.xml b/tcks/jakarta-atinject/pom.xml new file mode 100644 index 00000000000000..ae1bf0a694d245 --- /dev/null +++ b/tcks/jakarta-atinject/pom.xml @@ -0,0 +1,88 @@ + + + quarkus-tck-parent + io.quarkus + 999-SNAPSHOT + ../pom.xml + + 4.0.0 + + quarkus-tck-jakarta-atinjecft + Quarkus - TCK - Jakarta AtInject + + + 2.0.1 + 4.13.2 + + + + + io.quarkus + quarkus-arquillian + + + io.quarkus + quarkus-arc + + + + jakarta.inject + jakarta.inject-tck + ${atinject-tck.version} + + + jakarta.inject + jakarta.inject-api + + + junit + junit + + + + + junit + junit + ${junit4.version} + + + org.jboss.arquillian.junit + arquillian-junit-container + + + + + io.quarkus + quarkus-arc-deployment + ${project.version} + pom + test + + + * + * + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + false + true + false + + false + + + + + + diff --git a/tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/AtInjectTckExtension.java b/tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/AtInjectTckExtension.java new file mode 100644 index 00000000000000..d0c7753c8983b7 --- /dev/null +++ b/tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/AtInjectTckExtension.java @@ -0,0 +1,53 @@ +package io.quarkus.tck.atinject; + +import jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension; +import jakarta.enterprise.inject.build.compatible.spi.ClassConfig; +import jakarta.enterprise.inject.build.compatible.spi.Discovery; +import jakarta.enterprise.inject.build.compatible.spi.Enhancement; +import jakarta.enterprise.inject.build.compatible.spi.MetaAnnotations; +import jakarta.enterprise.inject.build.compatible.spi.ScannedClasses; +import jakarta.enterprise.inject.literal.NamedLiteral; + +import org.atinject.tck.auto.Convertible; +import org.atinject.tck.auto.Drivers; +import org.atinject.tck.auto.DriversSeat; +import org.atinject.tck.auto.FuelTank; +import org.atinject.tck.auto.Seat; +import org.atinject.tck.auto.Tire; +import org.atinject.tck.auto.V8Engine; +import org.atinject.tck.auto.accessories.Cupholder; +import org.atinject.tck.auto.accessories.SpareTire; + +public class AtInjectTckExtension implements BuildCompatibleExtension { + @Discovery + public void discovery(ScannedClasses scan, MetaAnnotations meta) { + scan.add(Convertible.class.getName()); + scan.add(DriversSeat.class.getName()); + scan.add(FuelTank.class.getName()); + scan.add(Seat.class.getName()); + scan.add(Tire.class.getName()); + scan.add(V8Engine.class.getName()); + + scan.add(Cupholder.class.getName()); + scan.add(SpareTire.class.getName()); + } + + @Enhancement(types = Convertible.class) + public void convertible(ClassConfig clazz) { + clazz.fields() + .stream() + .filter(it -> "spareTire".equals(it.info().name())) + .forEach(it -> it.addAnnotation(Spare.class)); + } + + @Enhancement(types = DriversSeat.class) + public void driversSeat(ClassConfig clazz) { + clazz.addAnnotation(Drivers.class); + } + + @Enhancement(types = SpareTire.class) + public void spareTire(ClassConfig clazz) { + clazz.addAnnotation(NamedLiteral.of("spare")) + .addAnnotation(Spare.class); + } +} diff --git a/tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/AtInjectTest.java b/tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/AtInjectTest.java new file mode 100644 index 00000000000000..5f9753f1166463 --- /dev/null +++ b/tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/AtInjectTest.java @@ -0,0 +1,61 @@ +package io.quarkus.tck.atinject; + +import static org.junit.Assert.assertTrue; + +import java.util.Enumeration; + +import jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension; + +import org.atinject.tck.Tck; +import org.atinject.tck.auto.Car; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import io.quarkus.arc.Arc; + +@RunWith(Arquillian.class) +public class AtInjectTest { + @Deployment + public static Archive deployment() { + return ShrinkWrap.create(JavaArchive.class) + .addPackages(true, Tck.class.getPackage()) + .addClasses(AtInjectTest.class, AtInjectTckExtension.class, Spare.class) + .addAsServiceProvider(BuildCompatibleExtension.class, AtInjectTckExtension.class) + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); + } + + @Test + public void test() { + Car instance = Arc.container().instance(Car.class).get(); + + junit.framework.Test test = Tck.testsFor(instance, /* supportsStatic */ false, /* supportsPrivate */ true); + junit.framework.TestResult result = new junit.framework.TestResult(); + test.run(result); + + // this is ugly and doesn't report failures properly, but I don't see a better way + if (!result.wasSuccessful()) { + int failuresCount = 0; + Enumeration failures = result.failures(); + while (failures.hasMoreElements()) { + System.out.println(failures.nextElement()); + failuresCount++; + } + + int errorsCount = 0; + Enumeration errors = result.errors(); + while (errors.hasMoreElements()) { + System.out.println(errors.nextElement()); + errorsCount++; + } + System.out.println("Total " + failuresCount + " failures and " + errorsCount + " errors"); + } + + assertTrue(result.wasSuccessful()); + } +} diff --git a/tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/Spare.java b/tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/Spare.java new file mode 100644 index 00000000000000..188f152fb441dc --- /dev/null +++ b/tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/Spare.java @@ -0,0 +1,11 @@ +package io.quarkus.tck.atinject; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import jakarta.inject.Qualifier; + +@Qualifier +@Retention(RetentionPolicy.RUNTIME) +public @interface Spare { +} diff --git a/tcks/jakarta-cdi-lang-model/pom.xml b/tcks/jakarta-cdi-lang-model/pom.xml new file mode 100644 index 00000000000000..ace4cae2369261 --- /dev/null +++ b/tcks/jakarta-cdi-lang-model/pom.xml @@ -0,0 +1,80 @@ + + + quarkus-tck-parent + io.quarkus + 999-SNAPSHOT + ../pom.xml + + 4.0.0 + + quarkus-tck-jakarta-cdi-lang-model + Quarkus - TCK - Jakarta CDI Lang Model + + + 4.0.10 + 4.13.2 + + + + + io.quarkus + quarkus-arquillian + + + io.quarkus + quarkus-arc + + + + jakarta.enterprise + cdi-tck-lang-model + ${cdi-tck.version} + + + junit + junit + ${junit4.version} + + + org.jboss.arquillian.junit + arquillian-junit-container + + + + + io.quarkus + quarkus-arc-deployment + ${project.version} + pom + test + + + * + * + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + false + true + false + + + false + + + + + + diff --git a/tcks/jakarta-cdi-lang-model/src/test/java/io/quarkus/tck/cdi/lang/model/LangModelTckExtension.java b/tcks/jakarta-cdi-lang-model/src/test/java/io/quarkus/tck/cdi/lang/model/LangModelTckExtension.java new file mode 100644 index 00000000000000..5861c91ec6742c --- /dev/null +++ b/tcks/jakarta-cdi-lang-model/src/test/java/io/quarkus/tck/cdi/lang/model/LangModelTckExtension.java @@ -0,0 +1,23 @@ +package io.quarkus.tck.cdi.lang.model; + +import jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension; +import jakarta.enterprise.inject.build.compatible.spi.Discovery; +import jakarta.enterprise.inject.build.compatible.spi.Enhancement; +import jakarta.enterprise.inject.build.compatible.spi.ScannedClasses; +import jakarta.enterprise.lang.model.declarations.ClassInfo; + +import org.jboss.cdi.lang.model.tck.LangModelVerifier; + +public class LangModelTckExtension implements BuildCompatibleExtension { + @Discovery + public void addClass(ScannedClasses scan) { + // `LangModelVerifier` has no bean defining annotation + // and isn't discovered in annotated discovery + scan.add(LangModelVerifier.class.getName()); + } + + @Enhancement(types = LangModelVerifier.class) + public void run(ClassInfo clazz) { + LangModelVerifier.verify(clazz); + } +} diff --git a/tcks/jakarta-cdi-lang-model/src/test/java/io/quarkus/tck/cdi/lang/model/LangModelTest.java b/tcks/jakarta-cdi-lang-model/src/test/java/io/quarkus/tck/cdi/lang/model/LangModelTest.java new file mode 100644 index 00000000000000..14c8c8a8310797 --- /dev/null +++ b/tcks/jakarta-cdi-lang-model/src/test/java/io/quarkus/tck/cdi/lang/model/LangModelTest.java @@ -0,0 +1,31 @@ +package io.quarkus.tck.cdi.lang.model; + +import jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.cdi.lang.model.tck.LangModelVerifier; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class LangModelTest { + @Deployment + public static Archive deployment() { + return ShrinkWrap.create(JavaArchive.class) + .addPackage(LangModelVerifier.class.getPackage()) + .addClasses(LangModelTest.class, LangModelTckExtension.class) + .addAsServiceProvider(BuildCompatibleExtension.class, LangModelTckExtension.class) + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); + } + + @Test + public void test() { + // the test itself runs in LangModelTckExtension + // and if it fails, deployment fails + } +} diff --git a/tcks/jakarta-cdi/pom.xml b/tcks/jakarta-cdi/pom.xml new file mode 100644 index 00000000000000..db576b37d02c98 --- /dev/null +++ b/tcks/jakarta-cdi/pom.xml @@ -0,0 +1,99 @@ + + + quarkus-tck-parent + io.quarkus + 999-SNAPSHOT + ../pom.xml + + 4.0.0 + + quarkus-tck-jakarta-cdi + Quarkus - TCK - Jakarta CDI + + + 4.0.10 + + + + + io.quarkus + quarkus-arquillian + + + io.quarkus + quarkus-arc + + + io.quarkus.arc + arc-cdi-tck-porting-pkg + ${project.version} + + + jakarta.enterprise + cdi-tck-core-impl + ${cdi-tck.version} + + + + + io.quarkus + quarkus-arc-deployment + ${project.version} + pom + test + + + * + * + + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-porting-pkg + generate-test-resources + + copy-dependencies + + + io.quarkus.arc + arc-cdi-tck-porting-pkg + ${project.build.directory}/porting-pkg + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + true + ${project.build.directory}/porting-pkg + false + true + false + + + jakarta.enterprise:cdi-tck-core-impl + + + src/test/resources/testng.xml + + false + + + + + + diff --git a/tcks/jakarta-cdi/src/test/resources/testng.xml b/tcks/jakarta-cdi/src/test/resources/testng.xml new file mode 100644 index 00000000000000..04d01134aff6ca --- /dev/null +++ b/tcks/jakarta-cdi/src/test/resources/testng.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tcks/pom.xml b/tcks/pom.xml index 37c78b0af8dc2e..cab353810baaeb 100644 --- a/tcks/pom.xml +++ b/tcks/pom.xml @@ -97,6 +97,9 @@ + jakarta-atinject + jakarta-cdi + jakarta-cdi-lang-model microprofile-config microprofile-context-propagation microprofile-fault-tolerance