Skip to content

Commit 39bb942

Browse files
committed
ArC: add CDI TCK runner
The TCK runner contains a sizeable exclude list. It will shrink over time.
1 parent 2b0e9b4 commit 39bb942

File tree

9 files changed

+807
-0
lines changed

9 files changed

+807
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>io.quarkus.arc</groupId>
9+
<artifactId>arc-parent</artifactId>
10+
<version>999-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>arc-cdi-tck-porting-pkg</artifactId>
14+
<name>ArC - CDI TCK Porting Package</name>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>io.quarkus.arc</groupId>
19+
<artifactId>arc</artifactId>
20+
</dependency>
21+
<dependency>
22+
<groupId>jakarta.enterprise</groupId>
23+
<artifactId>cdi-tck-api</artifactId>
24+
<version>${version.cdi-tck}</version>
25+
</dependency>
26+
</dependencies>
27+
28+
</project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package io.quarkus.arc.tck.porting;
2+
3+
import org.jboss.cdi.tck.spi.Beans;
4+
5+
import io.quarkus.arc.ClientProxy;
6+
7+
public class BeansImpl implements Beans {
8+
@Override
9+
public boolean isProxy(Object o) {
10+
return o instanceof ClientProxy;
11+
}
12+
13+
@Override
14+
public byte[] passivate(Object o) {
15+
throw new UnsupportedOperationException();
16+
}
17+
18+
@Override
19+
public Object activate(byte[] bytes) {
20+
throw new UnsupportedOperationException();
21+
}
22+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package io.quarkus.arc.tck.porting;
2+
3+
import java.lang.annotation.Annotation;
4+
5+
import jakarta.enterprise.context.Dependent;
6+
import jakarta.enterprise.context.spi.Context;
7+
import jakarta.enterprise.context.spi.Contextual;
8+
import jakarta.enterprise.context.spi.CreationalContext;
9+
10+
import org.jboss.cdi.tck.spi.Contexts;
11+
12+
import io.quarkus.arc.Arc;
13+
import io.quarkus.arc.InjectableContext;
14+
import io.quarkus.arc.ManagedContext;
15+
16+
public class ContextsImpl implements Contexts<Context> {
17+
@Override
18+
public void setActive(Context context) {
19+
((ManagedContext) context).activate();
20+
}
21+
22+
@Override
23+
public void setInactive(Context context) {
24+
((ManagedContext) context).deactivate();
25+
}
26+
27+
@Override
28+
public Context getRequestContext() {
29+
return Arc.container().requestContext();
30+
}
31+
32+
@Override
33+
public Context getDependentContext() {
34+
// ArC doesn't have a context object for the dependent context, let's fake it here for now
35+
// TODO we'll likely have to implement this in ArC properly
36+
37+
return new Context() {
38+
@Override
39+
public Class<? extends Annotation> getScope() {
40+
return Dependent.class;
41+
}
42+
43+
@Override
44+
public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {
45+
throw new UnsupportedOperationException();
46+
}
47+
48+
@Override
49+
public <T> T get(Contextual<T> contextual) {
50+
throw new UnsupportedOperationException();
51+
}
52+
53+
@Override
54+
public boolean isActive() {
55+
return true;
56+
}
57+
};
58+
}
59+
60+
@Override
61+
public void destroyContext(Context context) {
62+
((InjectableContext) context).destroy();
63+
}
64+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.quarkus.arc.tck.porting;
2+
3+
import jakarta.el.ELContext;
4+
import jakarta.enterprise.inject.spi.BeanManager;
5+
6+
import org.jboss.cdi.tck.spi.EL;
7+
8+
public class ELImpl implements EL {
9+
@Override
10+
public <T> T evaluateValueExpression(BeanManager beanManager, String expression, Class<T> expectedType) {
11+
throw new UnsupportedOperationException();
12+
}
13+
14+
@Override
15+
public <T> T evaluateMethodExpression(BeanManager beanManager, String expression, Class<T> expectedType,
16+
Class<?>[] expectedParamTypes, Object[] expectedParams) {
17+
throw new UnsupportedOperationException();
18+
}
19+
20+
@Override
21+
public ELContext createELContext(BeanManager beanManager) {
22+
throw new UnsupportedOperationException();
23+
}
24+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
org.jboss.cdi.tck.spi.Beans=io.quarkus.arc.tck.porting.BeansImpl
2+
org.jboss.cdi.tck.spi.Contexts=io.quarkus.arc.tck.porting.ContextsImpl
3+
org.jboss.cdi.tck.spi.EL=io.quarkus.arc.tck.porting.ELImpl
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>io.quarkus.arc</groupId>
9+
<artifactId>arc-parent</artifactId>
10+
<version>999-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>arc-cdi-tck-runner</artifactId>
14+
<name>ArC - CDI TCK Runner</name>
15+
16+
<dependencyManagement>
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.jboss.arquillian</groupId>
20+
<artifactId>arquillian-bom</artifactId>
21+
<version>${version.arquillian}</version>
22+
<type>pom</type>
23+
<scope>import</scope>
24+
</dependency>
25+
</dependencies>
26+
</dependencyManagement>
27+
28+
<dependencies>
29+
<dependency>
30+
<groupId>io.quarkus.arc</groupId>
31+
<artifactId>arc-arquillian</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>io.quarkus.arc</groupId>
35+
<artifactId>arc-cdi-tck-porting-pkg</artifactId>
36+
</dependency>
37+
<dependency>
38+
<groupId>jakarta.enterprise</groupId>
39+
<artifactId>cdi-tck-core-impl</artifactId>
40+
<version>${version.cdi-tck}</version>
41+
</dependency>
42+
</dependencies>
43+
44+
<build>
45+
<plugins>
46+
<!-- copy the porting package JAR to a special directory before running tests -->
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-dependency-plugin</artifactId>
50+
<executions>
51+
<execution>
52+
<id>copy-porting-pkg</id>
53+
<phase>generate-test-resources</phase>
54+
<goals>
55+
<goal>copy-dependencies</goal>
56+
</goals>
57+
<configuration>
58+
<includeGroupIds>io.quarkus.arc</includeGroupIds>
59+
<includeArtifactIds>arc-cdi-tck-porting-pkg</includeArtifactIds>
60+
<outputDirectory>${project.build.directory}/porting-pkg</outputDirectory>
61+
</configuration>
62+
</execution>
63+
</executions>
64+
</plugin>
65+
<plugin>
66+
<groupId>org.apache.maven.plugins</groupId>
67+
<artifactId>maven-surefire-plugin</artifactId>
68+
<configuration>
69+
<dependenciesToScan>
70+
<dependency>jakarta.enterprise:cdi-tck-core-impl</dependency>
71+
</dependenciesToScan>
72+
<suiteXmlFiles>
73+
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
74+
</suiteXmlFiles>
75+
<systemPropertyVariables>
76+
<org.jboss.cdi.tck.libraryDirectory>${project.build.directory}/porting-pkg</org.jboss.cdi.tck.libraryDirectory>
77+
</systemPropertyVariables>
78+
<reuseForks>false</reuseForks>
79+
</configuration>
80+
</plugin>
81+
</plugins>
82+
</build>
83+
84+
</project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.jboss.cdi.tck.cdiLiteMode=true

0 commit comments

Comments
 (0)