-
Notifications
You must be signed in to change notification settings - Fork 169
fix: allow omitted task push config id #1092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,10 +149,10 @@ public void testSetInfoAppendsToExistingConfig() { | |
| } | ||
|
|
||
| @Test | ||
| public void testSetInfoWithoutConfigId() { | ||
| public void testSetInfoWithEmptyConfigId() { | ||
| String taskId = "task1"; | ||
| TaskPushNotificationConfig initialConfig = TaskPushNotificationConfig.builder() | ||
| .id("") // No ID set | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please create a new test rather than changing this existing one. Removing
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous comment should still be addressed. |
||
| .id("") | ||
| .url("http://initial.url/callback") | ||
| .taskId(taskId) | ||
| .build(); | ||
|
|
@@ -165,7 +165,7 @@ public void testSetInfoWithoutConfigId() { | |
| assertEquals(taskId, configResult.configs().get(0).id()); | ||
|
|
||
| TaskPushNotificationConfig updatedConfig = TaskPushNotificationConfig.builder() | ||
| .id("") // No ID set | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please create a new test rather than changing this existing one.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous comment should still be addressed. |
||
| .id("") | ||
| .url("http://initial.url/callback_new") | ||
| .taskId(taskId) | ||
| .build(); | ||
|
|
@@ -178,6 +178,19 @@ public void testSetInfoWithoutConfigId() { | |
| assertEquals(updatedConfig.url(), configResult.configs().get(0).url()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testSetInfoWithNullConfigId() { | ||
| String taskId = "task_with_null_config_id"; | ||
| TaskPushNotificationConfig config = TaskPushNotificationConfig.builder() | ||
| .url("http://initial.url/callback") | ||
| .taskId(taskId) | ||
| .build(); | ||
|
|
||
| TaskPushNotificationConfig result = configStore.setInfo(config); | ||
|
|
||
| assertEquals(taskId, result.id(), "Config ID should default to taskId when null"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testGetInfoExistingConfig() { | ||
| String taskId = "task_get_exist"; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package org.a2aproject.sdk.spec; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class GetTaskPushNotificationConfigParamsTest { | ||
|
|
||
| @Test | ||
| void testConstructionAllowsOmittedConfigurationId() { | ||
| GetTaskPushNotificationConfigParams params = new GetTaskPushNotificationConfigParams("task-1"); | ||
|
|
||
| assertEquals("task-1", params.taskId()); | ||
| assertNull(params.id()); | ||
| } | ||
|
|
||
| @Test | ||
| void testBuilderAllowsOmittedConfigurationId() { | ||
| GetTaskPushNotificationConfigParams params = GetTaskPushNotificationConfigParams.builder() | ||
| .taskId("task-1") | ||
| .build(); | ||
|
|
||
| assertNull(params.id()); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package org.a2aproject.sdk.spec; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class TaskPushNotificationConfigTest { | ||
|
|
||
| @Test | ||
| void builderAllowsAnOmittedConfigurationId() { | ||
| TaskPushNotificationConfig config = TaskPushNotificationConfig.builder() | ||
| .taskId("task-123") | ||
| .url("https://example.com/callback") | ||
| .build(); | ||
|
|
||
| assertNull(config.id()); | ||
| assertEquals("task-123", config.taskId()); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a comment about this code, but
JpaDatabasePushNotificationConfigStorehas the same latent NPE, and needs fixing too.