-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- AtInject - CDI (Lite) - CDI Lang Model
- Loading branch information
Showing
12 changed files
with
483 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
independent-projects/arc/tcks/cdi-tck-runner/src/test/resources/META-INF/cdi-tck.properties
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>quarkus-tck-parent</artifactId> | ||
<groupId>io.quarkus</groupId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-tck-jakarta-atinjecft</artifactId> | ||
<name>Quarkus - TCK - Jakarta AtInject</name> | ||
|
||
<properties> | ||
<atinject-tck.version>2.0.1</atinject-tck.version> | ||
<junit4.version>4.13.2</junit4.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arquillian</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>jakarta.inject</groupId> | ||
<artifactId>jakarta.inject-tck</artifactId> | ||
<version>${atinject-tck.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>jakarta.inject</groupId> | ||
<artifactId>jakarta.inject-api</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit4.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.arquillian.junit</groupId> | ||
<artifactId>arquillian-junit-container</artifactId> | ||
</dependency> | ||
|
||
<!-- Minimal test dependencies to *-deployment artifacts for consistent build order --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc-deployment</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>*</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<quarkus.arc.remove-unused-beans>false</quarkus.arc.remove-unused-beans> | ||
<quarkus.arc.strict-compatibility>true</quarkus.arc.strict-compatibility> | ||
<quarkus.arc.transform-unproxyable-classes>false</quarkus.arc.transform-unproxyable-classes> | ||
</systemPropertyVariables> | ||
<reuseForks>false</reuseForks> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
53 changes: 53 additions & 0 deletions
53
tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/AtInjectTckExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/AtInjectTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<junit.framework.TestFailure> failures = result.failures(); | ||
while (failures.hasMoreElements()) { | ||
System.out.println(failures.nextElement()); | ||
failuresCount++; | ||
} | ||
|
||
int errorsCount = 0; | ||
Enumeration<junit.framework.TestFailure> errors = result.errors(); | ||
while (errors.hasMoreElements()) { | ||
System.out.println(errors.nextElement()); | ||
errorsCount++; | ||
} | ||
System.out.println("Total " + failuresCount + " failures and " + errorsCount + " errors"); | ||
} | ||
|
||
assertTrue(result.wasSuccessful()); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
tcks/jakarta-atinject/src/test/java/io/quarkus/tck/atinject/Spare.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>quarkus-tck-parent</artifactId> | ||
<groupId>io.quarkus</groupId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-tck-jakarta-cdi-lang-model</artifactId> | ||
<name>Quarkus - TCK - Jakarta CDI Lang Model</name> | ||
|
||
<properties> | ||
<cdi-tck.version>4.0.10</cdi-tck.version> | ||
<junit4.version>4.13.2</junit4.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arquillian</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>jakarta.enterprise</groupId> | ||
<artifactId>cdi-tck-lang-model</artifactId> | ||
<version>${cdi-tck.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit4.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.arquillian.junit</groupId> | ||
<artifactId>arquillian-junit-container</artifactId> | ||
</dependency> | ||
|
||
<!-- Minimal test dependencies to *-deployment artifacts for consistent build order --> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc-deployment</artifactId> | ||
<version>${project.version}</version> | ||
<type>pom</type> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>*</groupId> | ||
<artifactId>*</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<systemPropertyVariables> | ||
<quarkus.arc.remove-unused-beans>false</quarkus.arc.remove-unused-beans> | ||
<quarkus.arc.strict-compatibility>true</quarkus.arc.strict-compatibility> | ||
<quarkus.arc.transform-unproxyable-classes>false</quarkus.arc.transform-unproxyable-classes> | ||
</systemPropertyVariables> | ||
</systemPropertyVariables> | ||
<reuseForks>false</reuseForks> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
23 changes: 23 additions & 0 deletions
23
...rta-cdi-lang-model/src/test/java/io/quarkus/tck/cdi/lang/model/LangModelTckExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
tcks/jakarta-cdi-lang-model/src/test/java/io/quarkus/tck/cdi/lang/model/LangModelTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
Oops, something went wrong.