From 9535e4eab1ec8e97f7921f86bd16826116f508a7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 30 Mar 2026 03:33:59 +0000 Subject: [PATCH 1/5] test(http-client-java): add e2e test for alternate initial verb pagination scenario Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/5fb791b0-cf8f-4ecc-8715-ade42492381d Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com> --- .../add-e2e-test-alternate-initial-verb-2026-3-30.md | 7 +++++++ .../test/java/payload/pageable/PageableTests.java | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 .chronus/changes/add-e2e-test-alternate-initial-verb-2026-3-30.md diff --git a/.chronus/changes/add-e2e-test-alternate-initial-verb-2026-3-30.md b/.chronus/changes/add-e2e-test-alternate-initial-verb-2026-3-30.md new file mode 100644 index 00000000000..ab8752390ad --- /dev/null +++ b/.chronus/changes/add-e2e-test-alternate-initial-verb-2026-3-30.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-java" +--- + +Add e2e test for ServerDrivenPagination alternate initial verb (POST) scenario in clientcore tests diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/pageable/PageableTests.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/pageable/PageableTests.java index 25f50fc64af..a15bd8a6034 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/pageable/PageableTests.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/pageable/PageableTests.java @@ -9,6 +9,7 @@ import java.util.stream.Collectors; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import payload.pageable.serverdrivenpagination.alternateinitialverb.Filter; public class PageableTests { @@ -16,6 +17,8 @@ public class PageableTests { private final ServerDrivenPaginationClient client = new PageableClientBuilder().buildServerDrivenPaginationClient(); private final ServerDrivenPaginationContinuationTokenClient tokenClient = new PageableClientBuilder().buildServerDrivenPaginationContinuationTokenClient(); + private final ServerDrivenPaginationAlternateInitialVerbClient alternateInitialVerbClient + = new PageableClientBuilder().buildServerDrivenPaginationAlternateInitialVerbClient(); @Test public void testNextLink() { @@ -101,4 +104,13 @@ public void testLinkString() { Assertions.assertEquals(List.of("1", "2", "3", "4"), pagedIterable.stream().map(Pet::getId).collect(Collectors.toList())); } + + @Test + public void testAlternateInitialVerbPost() { + PagedIterable pagedIterable = alternateInitialVerbClient.post(new Filter("foo eq bar")); + + Assertions.assertEquals(4, pagedIterable.stream().count()); + Assertions.assertEquals(List.of("1", "2", "3", "4"), + pagedIterable.stream().map(Pet::getId).collect(Collectors.toList())); + } } From 9025dcbfcb76ef1e731680296d5ba23cd73e9342 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 30 Mar 2026 04:08:38 +0000 Subject: [PATCH 2/5] test(http-client-java): add missing XML e2e tests for clientcore Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/b8f74613-6d08-4ee4-829d-77181933c800 Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com> --- .../src/test/java/payload/xml/XmlTests.java | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java index d2f5bcfbf70..85f2009415a 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java @@ -186,4 +186,148 @@ public void testXmlErrorValue() { Assertions.assertEquals("Something went wrong", errorBody.getMessage()); Assertions.assertEquals(400, errorBody.getCode()); } + + @Test + public void testModelWithRenamedProperty() { + ModelWithRenamedPropertyValueClient client + = new XmlClientBuilder().buildModelWithRenamedPropertyValueClient(); + + client.put(new ModelWithRenamedProperty("foo", "bar")); + + ModelWithRenamedProperty model = client.get(); + Assertions.assertEquals("foo", model.getTitle()); + Assertions.assertEquals("bar", model.getAuthor()); + } + + @Test + public void testModelWithNestedModel() { + ModelWithNestedModelValueClient client = new XmlClientBuilder().buildModelWithNestedModelValueClient(); + + client.put(new ModelWithNestedModel(new SimpleModel("foo", 123))); + + ModelWithNestedModel model = client.get(); + Assertions.assertEquals("foo", model.getNested().getName()); + Assertions.assertEquals(123, model.getNested().getAge()); + } + + @Test + public void testModelWithRenamedNestedModel() { + ModelWithRenamedNestedModelValueClient client + = new XmlClientBuilder().buildModelWithRenamedNestedModelValueClient(); + + client.put(new ModelWithRenamedNestedModel(new Author("foo"))); + + ModelWithRenamedNestedModel model = client.get(); + Assertions.assertEquals("foo", model.getAuthor().getName()); + } + + @Test + public void testModelWithWrappedPrimitiveCustomItemNames() { + ModelWithWrappedPrimitiveCustomItemNamesValueClient client + = new XmlClientBuilder().buildModelWithWrappedPrimitiveCustomItemNamesValueClient(); + + client.put(new ModelWithWrappedPrimitiveCustomItemNames(List.of("fiction", "classic"))); + + ModelWithWrappedPrimitiveCustomItemNames model = client.get(); + Assertions.assertEquals(List.of("fiction", "classic"), model.getTags()); + } + + @Test + public void testModelWithUnwrappedModelArray() { + ModelWithUnwrappedModelArrayValueClient client + = new XmlClientBuilder().buildModelWithUnwrappedModelArrayValueClient(); + + client.put(new ModelWithUnwrappedModelArray( + List.of(new SimpleModel("foo", 123), new SimpleModel("bar", 456)))); + + ModelWithUnwrappedModelArray model = client.get(); + Assertions.assertEquals(2, model.getItems().size()); + Assertions.assertEquals("foo", model.getItems().get(0).getName()); + Assertions.assertEquals(123, model.getItems().get(0).getAge()); + Assertions.assertEquals("bar", model.getItems().get(1).getName()); + Assertions.assertEquals(456, model.getItems().get(1).getAge()); + } + + @Test + public void testModelWithRenamedWrappedModelArray() { + ModelWithRenamedWrappedModelArrayValueClient client + = new XmlClientBuilder().buildModelWithRenamedWrappedModelArrayValueClient(); + + client.put(new ModelWithRenamedWrappedModelArray( + List.of(new SimpleModel("foo", 123), new SimpleModel("bar", 456)))); + + ModelWithRenamedWrappedModelArray model = client.get(); + Assertions.assertEquals(2, model.getItems().size()); + Assertions.assertEquals("foo", model.getItems().get(0).getName()); + Assertions.assertEquals(123, model.getItems().get(0).getAge()); + Assertions.assertEquals("bar", model.getItems().get(1).getName()); + Assertions.assertEquals(456, model.getItems().get(1).getAge()); + } + + @Test + public void testModelWithRenamedUnwrappedModelArray() { + ModelWithRenamedUnwrappedModelArrayValueClient client + = new XmlClientBuilder().buildModelWithRenamedUnwrappedModelArrayValueClient(); + + client.put(new ModelWithRenamedUnwrappedModelArray( + List.of(new SimpleModel("foo", 123), new SimpleModel("bar", 456)))); + + ModelWithRenamedUnwrappedModelArray model = client.get(); + Assertions.assertEquals(2, model.getItems().size()); + Assertions.assertEquals("foo", model.getItems().get(0).getName()); + Assertions.assertEquals(123, model.getItems().get(0).getAge()); + Assertions.assertEquals("bar", model.getItems().get(1).getName()); + Assertions.assertEquals(456, model.getItems().get(1).getAge()); + } + + @Test + public void testModelWithRenamedWrappedAndItemModelArray() { + ModelWithRenamedWrappedAndItemModelArrayValueClient client + = new XmlClientBuilder().buildModelWithRenamedWrappedAndItemModelArrayValueClient(); + + client.put(new ModelWithRenamedWrappedAndItemModelArray( + List.of(new Book("The Great Gatsby"), new Book("Les Miserables")))); + + ModelWithRenamedWrappedAndItemModelArray model = client.get(); + Assertions.assertEquals(2, model.getBooks().size()); + Assertions.assertEquals("The Great Gatsby", model.getBooks().get(0).getTitle()); + Assertions.assertEquals("Les Miserables", model.getBooks().get(1).getTitle()); + } + + @Test + public void testModelWithRenamedAttribute() { + ModelWithRenamedAttributeValueClient client + = new XmlClientBuilder().buildModelWithRenamedAttributeValueClient(); + + client.put(new ModelWithRenamedAttribute(123, "The Great Gatsby", "F. Scott Fitzgerald")); + + ModelWithRenamedAttribute model = client.get(); + Assertions.assertEquals(123, model.getId()); + Assertions.assertEquals("The Great Gatsby", model.getTitle()); + Assertions.assertEquals("F. Scott Fitzgerald", model.getAuthor()); + } + + @Test + public void testModelWithNamespace() { + ModelWithNamespaceValueClient client = new XmlClientBuilder().buildModelWithNamespaceValueClient(); + + client.put(new ModelWithNamespace(123, "The Great Gatsby")); + + ModelWithNamespace model = client.get(); + Assertions.assertEquals(123, model.getId()); + Assertions.assertEquals("The Great Gatsby", model.getTitle()); + } + + @Test + public void testModelWithNamespaceOnProperties() { + ModelWithNamespaceOnPropertiesValueClient client + = new XmlClientBuilder().buildModelWithNamespaceOnPropertiesValueClient(); + + client.put(new ModelWithNamespaceOnProperties(123, "The Great Gatsby", "F. Scott Fitzgerald")); + + ModelWithNamespaceOnProperties model = client.get(); + Assertions.assertEquals(123, model.getId()); + Assertions.assertEquals("The Great Gatsby", model.getTitle()); + Assertions.assertEquals("F. Scott Fitzgerald", model.getAuthor()); + } } From b31a9fe4dfc2142233aadab6397008bad14e2eb6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 30 Mar 2026 05:00:46 +0000 Subject: [PATCH 3/5] style(http-client-java): format XmlTests.java per Eclipse formatter rules Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/99375d93-591b-49a4-8c56-7f08c05a25cc Co-authored-by: weidongxu-microsoft <53292327+weidongxu-microsoft@users.noreply.github.com> --- .../src/test/java/payload/xml/XmlTests.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java index 85f2009415a..a0ff256647d 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java @@ -189,8 +189,7 @@ public void testXmlErrorValue() { @Test public void testModelWithRenamedProperty() { - ModelWithRenamedPropertyValueClient client - = new XmlClientBuilder().buildModelWithRenamedPropertyValueClient(); + ModelWithRenamedPropertyValueClient client = new XmlClientBuilder().buildModelWithRenamedPropertyValueClient(); client.put(new ModelWithRenamedProperty("foo", "bar")); @@ -237,8 +236,7 @@ public void testModelWithUnwrappedModelArray() { ModelWithUnwrappedModelArrayValueClient client = new XmlClientBuilder().buildModelWithUnwrappedModelArrayValueClient(); - client.put(new ModelWithUnwrappedModelArray( - List.of(new SimpleModel("foo", 123), new SimpleModel("bar", 456)))); + client.put(new ModelWithUnwrappedModelArray(List.of(new SimpleModel("foo", 123), new SimpleModel("bar", 456)))); ModelWithUnwrappedModelArray model = client.get(); Assertions.assertEquals(2, model.getItems().size()); From f41474d63673eb3101aaa624fc02fbb8406f41e6 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Mon, 30 Mar 2026 13:34:15 +0800 Subject: [PATCH 4/5] format --- .../src/test/java/payload/xml/XmlTests.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java index a0ff256647d..9a09f3fbf72 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java @@ -251,8 +251,8 @@ public void testModelWithRenamedWrappedModelArray() { ModelWithRenamedWrappedModelArrayValueClient client = new XmlClientBuilder().buildModelWithRenamedWrappedModelArrayValueClient(); - client.put(new ModelWithRenamedWrappedModelArray( - List.of(new SimpleModel("foo", 123), new SimpleModel("bar", 456)))); + client.put( + new ModelWithRenamedWrappedModelArray(List.of(new SimpleModel("foo", 123), new SimpleModel("bar", 456)))); ModelWithRenamedWrappedModelArray model = client.get(); Assertions.assertEquals(2, model.getItems().size()); @@ -267,8 +267,8 @@ public void testModelWithRenamedUnwrappedModelArray() { ModelWithRenamedUnwrappedModelArrayValueClient client = new XmlClientBuilder().buildModelWithRenamedUnwrappedModelArrayValueClient(); - client.put(new ModelWithRenamedUnwrappedModelArray( - List.of(new SimpleModel("foo", 123), new SimpleModel("bar", 456)))); + client.put( + new ModelWithRenamedUnwrappedModelArray(List.of(new SimpleModel("foo", 123), new SimpleModel("bar", 456)))); ModelWithRenamedUnwrappedModelArray model = client.get(); Assertions.assertEquals(2, model.getItems().size()); From 39542e57086713a26294ce6035ffdcbde1cf7bfd Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Mon, 30 Mar 2026 14:36:35 +0800 Subject: [PATCH 5/5] disable --- .../src/test/java/payload/xml/XmlTests.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java index 9a09f3fbf72..090e3acdb7b 100644 --- a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java +++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/test/java/payload/xml/XmlTests.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Map; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; public final class XmlTests { @@ -220,6 +221,7 @@ public void testModelWithRenamedNestedModel() { Assertions.assertEquals("foo", model.getAuthor().getName()); } + @Disabled("items array mismatch") @Test public void testModelWithWrappedPrimitiveCustomItemNames() { ModelWithWrappedPrimitiveCustomItemNamesValueClient client @@ -305,6 +307,7 @@ public void testModelWithRenamedAttribute() { Assertions.assertEquals("F. Scott Fitzgerald", model.getAuthor()); } + @Disabled("namespace mismatch") @Test public void testModelWithNamespace() { ModelWithNamespaceValueClient client = new XmlClientBuilder().buildModelWithNamespaceValueClient(); @@ -316,6 +319,7 @@ public void testModelWithNamespace() { Assertions.assertEquals("The Great Gatsby", model.getTitle()); } + @Disabled("namespace mismatch") @Test public void testModelWithNamespaceOnProperties() { ModelWithNamespaceOnPropertiesValueClient client