Skip to content

Commit

Permalink
ArC: add Lang Model TCK runner
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladicek committed Mar 7, 2023
1 parent baa5bb7 commit 72706b6
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
49 changes: 49 additions & 0 deletions independent-projects/arc/lang-model-tck-runner/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkus.arc</groupId>
<artifactId>arc-parent</artifactId>
<version>999-SNAPSHOT</version>
</parent>

<artifactId>arc-lang-model-tck-runner</artifactId>
<name>ArC - Lang Model TCK Runner</name>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${version.arquillian}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.quarkus.arc</groupId>
<artifactId>arc-arquillian</artifactId>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>cdi-tck-lang-model</artifactId>
<version>${version.cdi-tck}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit4}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.quarkus.arc.tck;

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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.quarkus.arc.tck;

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
}
}
1 change: 1 addition & 0 deletions independent-projects/arc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<module>atinject-tck-runner</module>
<module>cdi-tck-porting-pkg</module>
<module>cdi-tck-runner</module>
<module>lang-model-tck-runner</module>
</modules>

<dependencyManagement>
Expand Down

0 comments on commit 72706b6

Please sign in to comment.