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 @@ -1157,7 +1157,6 @@ public TaskPushNotificationConfig onCreateTaskPushNotificationConfig(
public TaskPushNotificationConfig onGetTaskPushNotificationConfig(
GetTaskPushNotificationConfigParams params, ServerCallContext context) throws A2AError {
validateRequiredId(context, "taskId", params.taskId());
validateRequiredId(context, "id", params.id());
if (pushConfigStore == null) {
throw new UnsupportedOperationError();
}
Expand All @@ -1173,8 +1172,9 @@ public TaskPushNotificationConfig onGetTaskPushNotificationConfig(
}

String requestedConfigId = params.id();
String configId = Assert.isNullOrEmpty(requestedConfigId) ? params.taskId()
: Assert.checkNotNullParam("requestedConfigId", requestedConfigId);
String configId = requestedConfigId == null || requestedConfigId.isBlank()
? params.taskId()
: requestedConfigId;
return getTaskPushNotificationConfig(listTaskPushNotificationConfigsResult, configId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.NullAndEmptySource;
import org.junit.jupiter.params.provider.ValueSource;

/**
* Integration tests for DefaultRequestHandler focusing on AUTH_REQUIRED workflow.
Expand Down Expand Up @@ -1222,6 +1223,30 @@ void testGetTaskPushNotificationConfigDefaultsMissingIdToTaskId() throws Excepti
assertEquals("http://example.com/get-default-config-id", result.url());
}

@ParameterizedTest
@NullAndEmptySource
@ValueSource(strings = " ")
void testGetTaskPushNotificationConfigDefaultsBlankIdToTaskIdWithEffectiveCard(String configId)
throws Exception {
String taskId = "get-default-config-id-with-card";
taskStore.save(Task.builder()
.id(taskId)
.contextId("ctx-get-default-config-id-with-card")
.status(new TaskStatus(TaskState.TASK_STATE_WORKING))
.build(), false);
requestHandler.onCreateTaskPushNotificationConfig(TaskPushNotificationConfig.builder()
.taskId(taskId)
.url("http://example.com/get-default-config-id-with-card")
.build(), NULL_CONTEXT);

TaskPushNotificationConfig result = requestHandler.onGetTaskPushNotificationConfig(
new GetTaskPushNotificationConfigParams(taskId, configId),
configId == null || configId.isBlank() ? NULL_CONTEXT : contextWithEffectiveCard(true));

assertEquals(taskId, result.id());
assertEquals("http://example.com/get-default-config-id-with-card", result.url());
}

/**
* Verify that onMessageSend stores the protocol version when the request
* includes a push notification config (new task path).
Expand Down
Loading