diff --git a/tests/server-common/src/test/java/io/a2a/server/apps/common/AbstractA2AServerTest.java b/tests/server-common/src/test/java/io/a2a/server/apps/common/AbstractA2AServerTest.java index de1240c98..5fab9d8d7 100644 --- a/tests/server-common/src/test/java/io/a2a/server/apps/common/AbstractA2AServerTest.java +++ b/tests/server-common/src/test/java/io/a2a/server/apps/common/AbstractA2AServerTest.java @@ -1274,9 +1274,11 @@ public void testDeletePushNotificationConfigSetWithoutConfigId() throws Exceptio @Test @Timeout(value = 1, unit = TimeUnit.MINUTES) public void testNonBlockingWithMultipleMessages() throws Exception { + String multiEventTaskId = "multi-event-test-" + java.util.UUID.randomUUID(); + try { // 1. Send first non-blocking message to create task in WORKING state Message message1 = Message.builder(MESSAGE) - .taskId("multi-event-test") + .taskId(multiEventTaskId) .contextId("test-context") .parts(new TextPart("First request")) .build(); @@ -1301,7 +1303,7 @@ public void testNonBlockingWithMultipleMessages() throws Exception { assertTrue(firstTaskLatch.await(10, TimeUnit.SECONDS)); String taskId = taskIdRef.get(); assertNotNull(taskId); - assertEquals("multi-event-test", taskId); + assertEquals(multiEventTaskId, taskId); // 2. Resubscribe to task (queue should still be open) CountDownLatch resubEventLatch = new CountDownLatch(2); // artifact-2 + completion @@ -1337,7 +1339,7 @@ public void testNonBlockingWithMultipleMessages() throws Exception { // 3. Send second streaming message to same taskId Message message2 = Message.builder(MESSAGE) - .taskId("multi-event-test") // Same taskId + .taskId(multiEventTaskId) // Same taskId .contextId("test-context") .parts(new TextPart("Second request")) .build(); @@ -1411,6 +1413,9 @@ public void testNonBlockingWithMultipleMessages() throws Exception { assertEquals("artifact-2", streamArtifact.artifact().artifactId()); assertEquals("Second message artifact", ((TextPart) streamArtifact.artifact().parts().get(0)).text()); + } finally { + deleteTaskInTaskStore(multiEventTaskId); + } } @Test diff --git a/tests/server-common/src/test/java/io/a2a/server/apps/common/AgentExecutorProducer.java b/tests/server-common/src/test/java/io/a2a/server/apps/common/AgentExecutorProducer.java index a77bd30f1..8b03a68f4 100644 --- a/tests/server-common/src/test/java/io/a2a/server/apps/common/AgentExecutorProducer.java +++ b/tests/server-common/src/test/java/io/a2a/server/apps/common/AgentExecutorProducer.java @@ -27,7 +27,7 @@ public void execute(RequestContext context, EventQueue eventQueue) throws A2AErr String taskId = context.getTaskId(); // Special handling for multi-event test - if ("multi-event-test".equals(taskId)) { + if (taskId != null && taskId.startsWith("multi-event-test")) { // First call: context.getTask() == null (new task) if (context.getTask() == null) { updater.startWork();