Skip to content

Commit 69e5dea

Browse files
authored
Merge pull request #5 from kabir/multi-module
Configure WildFly for TCK and add workflow testing the TCK
2 parents 0c0b463 + 66866f5 commit 69e5dea

File tree

18 files changed

+406
-49
lines changed

18 files changed

+406
-49
lines changed

.github/workflows/run-tck.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build and Run TCK
2+
3+
on:
4+
push:
5+
branches:
6+
# - main
7+
pull_request:
8+
branches:
9+
# - main
10+
11+
12+
env:
13+
# Tag of the TCK
14+
TCK_VERSION: v0.2.3
15+
# Tells uv to not need a venv, and instead use system
16+
UV_SYSTEM_PYTHON: 1
17+
18+
19+
# Only run the latest job
20+
concurrency:
21+
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}'
22+
cancel-in-progress: true
23+
24+
jobs:
25+
build-and-test:
26+
name: Run TCK
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout sources
30+
uses: actions/checkout@v4
31+
- name: Checkout a2a-java
32+
uses: actions/checkout@v4
33+
with:
34+
repository: a2aproject/a2a-java
35+
path: a2a-java
36+
- name: Checkout a2a-tck
37+
uses: actions/checkout@v4
38+
with:
39+
repository: a2aproject/a2a-tck
40+
path: a2a-tck
41+
ref: ${{ env.TCK_VERSION }}
42+
- name: Set up JDK 17
43+
uses: actions/setup-java@v4
44+
with:
45+
java-version: '17'
46+
distribution: 'temurin'
47+
cache: maven
48+
- name: Build a2a-java with Maven, skipping tests
49+
run: |
50+
mvn -B install -DskipTests
51+
working-directory: a2a-java
52+
- name: Get a2a-java version and save as env var
53+
run: |
54+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
55+
echo "SDK_VERSION=${VERSION}" >> "$GITHUB_ENV"
56+
working-directory: a2a-java
57+
- name: Build the TCK server
58+
run: |
59+
mvn clean install -B -Dversion.sdk=${SDK_VERSION} -pl tck -am
60+
- name: Set up Python
61+
uses: actions/setup-python@v5
62+
with:
63+
python-version-file: "a2a-tck/pyproject.toml"
64+
- name: Install uv and Python dependencies
65+
run: |
66+
pip install uv
67+
uv pip install -e .
68+
working-directory: a2a-tck
69+
- name: Start the WildFly SUT
70+
run: |
71+
mvn wildfly:start -B -pl tck -Dstartup-timeout=120
72+
- name: Run TCK
73+
run: |
74+
./run_tck.py --sut-url http://localhost:8080 --category all --compliance-report report.json
75+
working-directory: a2a-tck
76+
- name: Start the WildFly SUT
77+
run: |
78+
mvn wildfly:shutdown
79+
80+

pom.xml

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -178,51 +178,11 @@
178178
<groupId>org.wildfly.glow</groupId>
179179
<artifactId>wildfly-glow-arquillian-plugin</artifactId>
180180
<version>1.4.1.Final</version>
181-
<configuration>
182-
<feature-packs>
183-
<feature-pack>
184-
<groupId>org.wildfly</groupId>
185-
<artifactId>wildfly-galleon-pack</artifactId>
186-
<version>${version.wildfly}</version>
187-
</feature-pack>
188-
</feature-packs>
189-
<config-name>standalone.xml</config-name>
190-
</configuration>
191-
<executions>
192-
<execution>
193-
<id>scan</id>
194-
<goals>
195-
<goal>scan</goal>
196-
</goals>
197-
<phase>test-compile</phase>
198-
</execution>
199-
</executions>
200181
</plugin>
201182
<plugin>
202183
<groupId>org.wildfly.plugins</groupId>
203184
<artifactId>wildfly-maven-plugin</artifactId>
204185
<version>5.1.3.Final</version>
205-
<configuration>
206-
<provisioning-file>${project.build.directory}/glow-scan/provisioning.xml</provisioning-file>
207-
<jboss-home>${jboss.home}</jboss-home>
208-
<provisioning-dir>${jboss.home}</provisioning-dir>
209-
<packagingScripts>
210-
<packaging-script>
211-
<scripts>
212-
<script>./src/scripts/configure_logger.cli</script>
213-
</scripts>
214-
</packaging-script>
215-
</packagingScripts>
216-
</configuration>
217-
<executions>
218-
<execution>
219-
<id>test-provisioning</id>
220-
<goals>
221-
<goal>package</goal>
222-
</goals>
223-
<phase>test-compile</phase>
224-
</execution>
225-
</executions>
226186
</plugin>
227187
<plugin>
228188
<groupId>org.apache.maven.plugins</groupId>
@@ -286,6 +246,7 @@
286246
<modules>
287247
<module>impl</module>
288248
<module>wildfly-jar</module>
249+
<module>tck</module>
289250
<module>tests/common</module>
290251
<module>tests/impl</module>
291252
<module>tests/wildfly-jar</module>

tck/pom.xml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>org.wildfly.extras.a2a</groupId>
9+
<artifactId>a2a-java-sdk-server-jakarta-parent</artifactId>
10+
<version>0.2.3.Beta2-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>a2a-java-sdk-server-jakarta-tck-wildfly</artifactId>
14+
15+
<packaging>war</packaging>
16+
17+
<name>WildFly Extras - Java A2A SDK for Jakarta - TCK - WildFly Jar</name>
18+
<description>Java SDK for the Agent2Agent Protocol (A2A) - SDK - Jakarta - TCK - WildFly Jar</description>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>${project.groupId}</groupId>
23+
<artifactId>a2a-java-sdk-server-jakarta-wildfly</artifactId>
24+
<version>${project.version}</version>
25+
<exclusions>
26+
<exclusion>
27+
<groupId>*</groupId>
28+
<artifactId>*</artifactId>
29+
</exclusion>
30+
</exclusions>
31+
</dependency>
32+
<dependency>
33+
<groupId>io.github.a2asdk</groupId>
34+
<artifactId>a2a-java-sdk-spec</artifactId>
35+
<scope>provided</scope>
36+
</dependency>
37+
<dependency>
38+
<groupId>jakarta.annotation</groupId>
39+
<artifactId>jakarta.annotation-api</artifactId>
40+
<scope>provided</scope>
41+
</dependency>
42+
<dependency>
43+
<groupId>jakarta.enterprise</groupId>
44+
<artifactId>jakarta.enterprise.cdi-api</artifactId>
45+
<scope>provided</scope>
46+
</dependency>
47+
<dependency>
48+
<groupId>jakarta.ws.rs</groupId>
49+
<artifactId>jakarta.ws.rs-api</artifactId>
50+
<scope>provided</scope>
51+
</dependency>
52+
</dependencies>
53+
<build>
54+
<plugins>
55+
<plugin>
56+
<groupId>org.wildfly.plugins</groupId>
57+
<artifactId>wildfly-maven-plugin</artifactId>
58+
<configuration>
59+
<discover-provisioning-info>
60+
</discover-provisioning-info>
61+
<jboss-home>${jboss.home}</jboss-home>
62+
<name>ROOT.war</name>
63+
<provisioning-dir>${jboss.home}</provisioning-dir>
64+
<packagingScripts>
65+
<packaging-script>
66+
<scripts>
67+
<script>./src/scripts/configure_logger.cli</script>
68+
</scripts>
69+
</packaging-script>
70+
</packagingScripts>
71+
</configuration>
72+
<executions>
73+
<execution>
74+
<id>provisioning</id>
75+
<goals>
76+
<goal>package</goal>
77+
</goals>
78+
<phase>package</phase>
79+
</execution>
80+
</executions>
81+
</plugin>
82+
</plugins>
83+
</build>
84+
</project>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package org.wildfly.extras.a2a.server.jakarta.tck;
2+
3+
import java.util.Collections;
4+
import java.util.List;
5+
6+
import jakarta.enterprise.context.ApplicationScoped;
7+
import jakarta.enterprise.inject.Produces;
8+
9+
import io.a2a.server.PublicAgentCard;
10+
import io.a2a.spec.AgentCapabilities;
11+
import io.a2a.spec.AgentCard;
12+
import io.a2a.spec.AgentSkill;
13+
14+
/**
15+
* This is a copy of the AgentCardProducer from the a2a-java SDK's tck/ module
16+
*/
17+
@ApplicationScoped
18+
public class AgentCardProducer {
19+
20+
@Produces
21+
@PublicAgentCard
22+
public AgentCard agentCard() {
23+
return new AgentCard.Builder()
24+
.name("Hello World Agent")
25+
.description("Just a hello world agent")
26+
.url("http://localhost:9999")
27+
.version("1.0.0")
28+
.documentationUrl("http://example.com/docs")
29+
.capabilities(new AgentCapabilities.Builder()
30+
.streaming(true)
31+
.pushNotifications(true)
32+
.stateTransitionHistory(true)
33+
.build())
34+
.defaultInputModes(Collections.singletonList("text"))
35+
.defaultOutputModes(Collections.singletonList("text"))
36+
.skills(Collections.singletonList(new AgentSkill.Builder()
37+
.id("hello_world")
38+
.name("Returns hello world")
39+
.description("just returns hello world")
40+
.tags(Collections.singletonList("hello world"))
41+
.examples(List.of("hi", "hello world"))
42+
.build()))
43+
.build();
44+
}
45+
}
46+
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
package org.wildfly.extras.a2a.server.jakarta.tck;
2+
3+
import jakarta.annotation.PreDestroy;
4+
import jakarta.enterprise.context.ApplicationScoped;
5+
import jakarta.enterprise.inject.Produces;
6+
7+
import io.a2a.server.agentexecution.AgentExecutor;
8+
import io.a2a.server.agentexecution.RequestContext;
9+
import io.a2a.server.events.EventQueue;
10+
import io.a2a.server.tasks.TaskUpdater;
11+
import io.a2a.spec.JSONRPCError;
12+
import io.a2a.spec.Task;
13+
import io.a2a.spec.TaskNotCancelableError;
14+
import io.a2a.spec.TaskNotFoundError;
15+
import io.a2a.spec.TaskState;
16+
import io.a2a.spec.TaskStatus;
17+
import io.a2a.spec.TaskStatusUpdateEvent;
18+
19+
/**
20+
* This is a copy of the AgentExecutorProducer from the a2a-java SDK's tck/ module
21+
*/
22+
@ApplicationScoped
23+
public class AgentExecutorProducer {
24+
25+
@Produces
26+
public AgentExecutor agentExecutor() {
27+
return new FireAndForgetAgentExecutor();
28+
}
29+
30+
private static class FireAndForgetAgentExecutor implements AgentExecutor {
31+
@Override
32+
public void execute(RequestContext context, EventQueue eventQueue) throws JSONRPCError {
33+
Task task = context.getTask();
34+
35+
if (context.getMessage().getTaskId() != null && task == null && context.getMessage().getTaskId().startsWith("non-existent")) {
36+
throw new TaskNotFoundError();
37+
}
38+
39+
if (task == null) {
40+
task = new Task.Builder()
41+
.id(context.getTaskId())
42+
.contextId(context.getContextId())
43+
.status(new TaskStatus(TaskState.SUBMITTED))
44+
.history(context.getMessage())
45+
.build();
46+
eventQueue.enqueueEvent(task);
47+
}
48+
49+
TaskUpdater updater = new TaskUpdater(context, eventQueue);
50+
51+
// Immediately set to WORKING state
52+
updater.startWork();
53+
System.out.println("====> task set to WORKING, starting background execution");
54+
55+
// Method returns immediately - task continues in background
56+
System.out.println("====> execute() method returning immediately, task running in background");
57+
}
58+
59+
@Override
60+
public void cancel(RequestContext context, EventQueue eventQueue) throws JSONRPCError {
61+
System.out.println("====> task cancel request received");
62+
Task task = context.getTask();
63+
64+
if (task.getStatus().state() == TaskState.CANCELED) {
65+
System.out.println("====> task already canceled");
66+
throw new TaskNotCancelableError();
67+
}
68+
69+
if (task.getStatus().state() == TaskState.COMPLETED) {
70+
System.out.println("====> task already completed");
71+
throw new TaskNotCancelableError();
72+
}
73+
74+
TaskUpdater updater = new TaskUpdater(context, eventQueue);
75+
updater.cancel();
76+
eventQueue.enqueueEvent(new TaskStatusUpdateEvent.Builder()
77+
.taskId(task.getId())
78+
.contextId(task.getContextId())
79+
.status(new TaskStatus(TaskState.CANCELED))
80+
.isFinal(true)
81+
.build());
82+
83+
System.out.println("====> task canceled");
84+
}
85+
86+
/**
87+
* Cleanup method for proper resource management
88+
*/
89+
@PreDestroy
90+
public void cleanup() {
91+
System.out.println("====> shutting down task executor");
92+
}
93+
}
94+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package org.wildfly.extras.a2a.server.jakarta.tck;
2+
3+
import jakarta.ws.rs.ApplicationPath;
4+
import jakarta.ws.rs.core.Application;
5+
6+
@ApplicationPath("/")
7+
public class RestApplication extends Application {
8+
}

impl/src/main/resources/META-INF/beans.xml renamed to tck/src/main/resources/META-INF/beans.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
5-
bean-discovery-mode="all">
5+
bean-discovery-mode="annotated">
66
</beans>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/subsystem=logging/logger=org.jboss.weld:add(level=DEBUG)
2+
/subsystem=logging/logger=io.a2a:add(level=DEBUG)

0 commit comments

Comments
 (0)