From c8db5d1228207a199352b82986c96d7c7e2a4dca Mon Sep 17 00:00:00 2001 From: bhashinee Date: Wed, 28 Feb 2024 14:46:43 +0530 Subject: [PATCH] Fix Windows test failure --- .../io/ballerina/persist/tools/BuildCodeGeneratorTest.java | 6 +++--- .../java/io/ballerina/persist/utils/BalProjectUtils.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/BuildCodeGeneratorTest.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/BuildCodeGeneratorTest.java index 9c8f0de70..526c3615b 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/BuildCodeGeneratorTest.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/BuildCodeGeneratorTest.java @@ -50,7 +50,7 @@ public void testBuildWithMysql() throws IOException, InterruptedException { @Test(enabled = true) public void testBuildWithInvalidTargetModule() throws IOException, InterruptedException { - String log = "ERROR: invalid module name : 'persist_add_1' :\n" + + String log = "ERROR: invalid module name : 'persist_add_1' :" + System.lineSeparator() + "module name should follow the template ."; Path project = TARGET_DIR.resolve("generated-sources/tool_test_build_2"); assertLogs(log, project); @@ -58,7 +58,7 @@ public void testBuildWithInvalidTargetModule() throws IOException, InterruptedEx @Test(enabled = true) public void testBuildWithInvalidCharachtersInTargetModule() throws IOException, InterruptedException { - String log = "ERROR: invalid module name : '*****' :\n" + + String log = "ERROR: invalid module name : '*****' :" + System.lineSeparator() + "module name can only contain alphanumerics, underscores and periods"; Path project = TARGET_DIR.resolve("generated-sources/tool_test_build_3"); assertLogs(log, project); @@ -69,7 +69,7 @@ public void testBuildWithInvalidLengthOfTargetModule() throws IOException, Inter String log = "ERROR: invalid module name : 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" + "ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" + - "dddddddddddddddddddddd' :\n" + + "dddddddddddddddddddddd' :" + System.lineSeparator() + "maximum length of module name is 256 characters"; Path project = TARGET_DIR.resolve("generated-sources/tool_test_build_4"); assertLogs(log, project); diff --git a/persist-cli/src/main/java/io/ballerina/persist/utils/BalProjectUtils.java b/persist-cli/src/main/java/io/ballerina/persist/utils/BalProjectUtils.java index cc1799f3f..73251de2d 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/utils/BalProjectUtils.java +++ b/persist-cli/src/main/java/io/ballerina/persist/utils/BalProjectUtils.java @@ -109,8 +109,8 @@ public static Module getEntities(Path schemaFile) throws BalException { } public static void updateToml(String sourcePath, String datastore, String module) throws BalException, IOException { - String sourceContent = "[[tool.persist]]\n" + - "options.datastore = \"" + datastore + "\"\n" + + String sourceContent = "[[tool.persist]]" + System.lineSeparator() + + "options.datastore = \"" + datastore + "\"" + System.lineSeparator() + "module = \"" + module + "\""; Path generatedCmdOutPath = Paths.get(sourcePath, TARGET_DIRECTORY, GENERATE_CMD_FILE); Utils.writeToTargetFile(sourceContent, generatedCmdOutPath.toAbsolutePath().toString());