This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cayenne.git
commit 05fe5673ca7cbbb23c043a39480a92c1c93c789b Author: Andrus Adamchik <[email protected]> AuthorDate: Fri May 22 17:04:54 2026 -0400 fix CgenRunMcpIT cross-platform failures on Windows CRLF line endings from Jackson's DefaultPrettyPrinter and unescaped backslashes in Windows paths caused test assertions to mismatch. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --- .../org/apache/cayenne/mcp/tools/cgen/CgenRunMcpIT.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cayenne-mcp-server/src/test/java/org/apache/cayenne/mcp/tools/cgen/CgenRunMcpIT.java b/cayenne-mcp-server/src/test/java/org/apache/cayenne/mcp/tools/cgen/CgenRunMcpIT.java index 225a29889..898ac3319 100644 --- a/cayenne-mcp-server/src/test/java/org/apache/cayenne/mcp/tools/cgen/CgenRunMcpIT.java +++ b/cayenne-mcp-server/src/test/java/org/apache/cayenne/mcp/tools/cgen/CgenRunMcpIT.java @@ -129,9 +129,10 @@ public class CgenRunMcpIT { public void generatesFilesOnFirstRun() throws Exception { send(callJson(4, projectFile, "PersonMap")); - String superPath = destDir.resolve("com/example/auto/_Person.java").toAbsolutePath().toString(); - String subPath = destDir.resolve("com/example/Person.java").toAbsolutePath().toString(); - String destPath = destDir.toAbsolutePath().toString(); + // JSON-escape backslashes so Windows paths round-trip correctly through Jackson serialization + String superPath = destDir.resolve("com/example/auto/_Person.java").toAbsolutePath().toString().replace("\\", "\\\\"); + String subPath = destDir.resolve("com/example/Person.java").toAbsolutePath().toString().replace("\\", "\\\\"); + String destPath = destDir.toAbsolutePath().toString().replace("\\", "\\\\"); assertEquals(""" { @@ -171,7 +172,7 @@ public class CgenRunMcpIT { send(callJson(6, projectFile, "PersonMap")); - String destPath = destDir.toAbsolutePath().toString(); + String destPath = destDir.toAbsolutePath().toString().replace("\\", "\\\\"); assertEquals(""" { @@ -200,7 +201,10 @@ public class CgenRunMcpIT { JsonNode root = MAPPER.readTree(mcpResponse); String text = root.at("/result/content/0/text").asText(); JsonNode payload = MAPPER.readTree(text); - return MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(payload); + // Normalize CRLF → LF: Jackson's DefaultPrettyPrinter uses System.lineSeparator() + // which is \r\n on Windows, but Java text blocks always use \n. + return MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(payload) + .replace("\r\n", "\n"); } private String callJson(int id, Path project, String dataMap) {
