response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8));
+ if (response.statusCode() != 200) {
+ throw new RuntimeException(response.statusCode() + ": Creating task push notification config failed! " + response.body());
+ }
+ }
+
protected abstract TaskStore getTaskStore();
-
+
protected abstract InMemoryQueueManager getQueueManager();
-
+
protected abstract void setStreamingSubscribedRunnable(Runnable runnable);
-
+
private static class BreakException extends RuntimeException {
-
+
}
-}
+}
\ No newline at end of file
diff --git a/tests/server-common/src/test/java/io/a2a/server/apps/common/AgentCardProducer.java b/tests/server-common/src/test/java/io/a2a/server/apps/common/AgentCardProducer.java
index f68f44967..3354c1522 100644
--- a/tests/server-common/src/test/java/io/a2a/server/apps/common/AgentCardProducer.java
+++ b/tests/server-common/src/test/java/io/a2a/server/apps/common/AgentCardProducer.java
@@ -32,6 +32,7 @@ public AgentCard agentCard() {
.defaultInputModes(Collections.singletonList("text"))
.defaultOutputModes(Collections.singletonList("text"))
.skills(new ArrayList<>())
+ .protocolVersion("0.2.5")
.build();
}
}
diff --git a/tests/server-common/src/test/java/io/a2a/server/apps/common/TestUtilsBean.java b/tests/server-common/src/test/java/io/a2a/server/apps/common/TestUtilsBean.java
new file mode 100644
index 000000000..c65766dd8
--- /dev/null
+++ b/tests/server-common/src/test/java/io/a2a/server/apps/common/TestUtilsBean.java
@@ -0,0 +1,60 @@
+package io.a2a.server.apps.common;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+import io.a2a.server.events.QueueManager;
+import io.a2a.server.tasks.PushNotificationConfigStore;
+import io.a2a.server.tasks.TaskStore;
+import io.a2a.spec.Event;
+import io.a2a.spec.PushNotificationConfig;
+import io.a2a.spec.Task;
+
+/**
+ * Contains utilities to interact with the server side for the tests.
+ * The intent for this bean is to be exposed via REST.
+ *
+ * There is a Quarkus implementation in {@code A2ATestRoutes} which shows the contract for how to
+ * expose it via REST. For other REST frameworks, you will need to provide an implementation that works in a similar
+ * way to {@code A2ATestRoutes}.
+ */
+@ApplicationScoped
+public class TestUtilsBean {
+
+ @Inject
+ TaskStore taskStore;
+
+ @Inject
+ QueueManager queueManager;
+
+ @Inject
+ PushNotificationConfigStore pushNotificationConfigStore;
+
+ public void saveTask(Task task) {
+ taskStore.save(task);
+ }
+
+ public Task getTask(String taskId) {
+ return taskStore.get(taskId);
+ }
+
+ public void deleteTask(String taskId) {
+ taskStore.delete(taskId);
+ }
+
+ public void ensureQueue(String taskId) {
+ queueManager.createOrTap(taskId);
+ }
+
+ public void enqueueEvent(String taskId, Event event) {
+ queueManager.get(taskId).enqueueEvent(event);
+ }
+
+ public void deleteTaskPushNotificationConfig(String taskId, String configId) {
+ pushNotificationConfigStore.deleteInfo(taskId, configId);
+ }
+
+ public void saveTaskPushNotificationConfig(String taskId, PushNotificationConfig notificationConfig) {
+ pushNotificationConfigStore.setInfo(taskId, notificationConfig);
+ }
+}