Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down