From dd6e1f783148a472a33fd292bef046c428f926af Mon Sep 17 00:00:00 2001 From: bhashinee Date: Thu, 15 Feb 2024 10:10:58 +0530 Subject: [PATCH 01/22] Implement the Add command, revamp generate command --- examples/build.gradle | 2 +- gradle.properties | 4 +- persist-cli-tests/build.gradle | 48 ++-- ...olingInitTest.java => ToolingAddTest.java} | 30 +-- .../persist/tools/ToolingGenerateTest.java | 139 ++++++------ .../utils/GeneratedSourcesTestUtils.java | 25 ++- .../input/tool_test_db_push_1/Ballerina.toml | 2 +- .../input/tool_test_db_push_14/Ballerina.toml | 2 +- .../input/tool_test_db_push_3/Ballerina.toml | 2 +- .../input/tool_test_generate_1/Ballerina.toml | 4 - .../tool_test_generate_11/Ballerina.toml | 4 - .../tool_test_generate_12/Ballerina.toml | 4 - .../tool_test_generate_13/Ballerina.toml | 4 - .../tool_test_generate_16/Ballerina.toml | 4 - .../tool_test_generate_17/Ballerina.toml | 4 - .../tool_test_generate_19/Ballerina.toml | 4 - .../input/tool_test_generate_2/Ballerina.toml | 4 - .../tool_test_generate_22/Ballerina.toml | 4 - .../tool_test_generate_24/Ballerina.toml | 4 - .../tool_test_generate_25/Ballerina.toml | 4 - .../tool_test_generate_26/Ballerina.toml | 6 +- .../input/tool_test_generate_26/Config.toml | 2 +- .../tool_test_generate_27/Ballerina.toml | 4 - .../tool_test_generate_28/Ballerina.toml | 4 - .../tool_test_generate_29/Ballerina.toml | 4 - .../input/tool_test_generate_3/Ballerina.toml | 3 - .../tool_test_generate_30/Ballerina.toml | 4 - .../tool_test_generate_31/Ballerina.toml | 4 - .../tool_test_generate_33/Ballerina.toml | 4 - .../tool_test_generate_34/Ballerina.toml | 4 - .../tool_test_generate_35/Ballerina.toml | 4 - .../tool_test_generate_36/Ballerina.toml | 4 - .../tool_test_generate_37/Ballerina.toml | 4 - .../tool_test_generate_38/Ballerina.toml | 4 - .../tool_test_generate_39/Ballerina.toml | 4 - .../tool_test_generate_40/Ballerina.toml | 4 - .../tool_test_generate_41/Ballerina.toml | 4 - .../tool_test_generate_42/Ballerina.toml | 4 - .../tool_test_generate_43/Ballerina.toml | 4 - .../tool_test_generate_44/Ballerina.toml | 4 - .../tool_test_generate_45/Ballerina.toml | 4 - .../tool_test_generate_46/Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../input/tool_test_generate_5/Ballerina.toml | 3 - .../tool_test_generate_50/Ballerina.toml | 4 - .../tool_test_generate_51/Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../input/tool_test_generate_6/Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../tool_test_generate_64/Ballerina.toml | 4 - .../tool_test_generate_65/Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../input/tool_test_generate_7/Ballerina.toml | 3 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../input/tool_test_generate_8/Ballerina.toml | 4 - .../input/tool_test_generate_9/Ballerina.toml | 4 - .../input/tool_test_init_6/Ballerina.toml | 7 +- .../tool_test_generate_1/Ballerina.toml | 3 - .../tool_test_generate_11/Ballerina.toml | 4 - .../tool_test_generate_12/Ballerina.toml | 4 - .../tool_test_generate_13/Ballerina.toml | 4 - .../tool_test_generate_16/Ballerina.toml | 4 - .../tool_test_generate_17/Ballerina.toml | 4 - .../tool_test_generate_19/Ballerina.toml | 4 - .../tool_test_generate_2/Ballerina.toml | 3 - .../tool_test_generate_22/Ballerina.toml | 4 - .../tool_test_generate_24/Ballerina.toml | 4 - .../tool_test_generate_25/Ballerina.toml | 3 - .../tool_test_generate_26/Ballerina.toml | 6 +- .../output/tool_test_generate_26/Config.toml | 2 +- .../generated/entities/persist_client.bal | 166 ++++++++++++++ .../generated/entities/persist_db_config.bal | 12 + .../generated/entities/persist_types.bal | 69 ++++++ .../generated/entities/script.sql | 26 +++ .../tool_test_generate_27/Ballerina.toml | 4 - .../tool_test_generate_28/Ballerina.toml | 4 - .../tool_test_generate_29/Ballerina.toml | 4 - .../tool_test_generate_3/Ballerina.toml | 3 - .../tool_test_generate_30/Ballerina.toml | 4 - .../tool_test_generate_31/Ballerina.toml | 4 - .../tool_test_generate_33/Ballerina.toml | 4 - .../tool_test_generate_34/Ballerina.toml | 4 - .../tool_test_generate_35/Ballerina.toml | 4 - .../tool_test_generate_36/Ballerina.toml | 4 - .../tool_test_generate_37/Ballerina.toml | 4 - .../tool_test_generate_38/Ballerina.toml | 4 - .../tool_test_generate_39/Ballerina.toml | 4 - .../tool_test_generate_40/Ballerina.toml | 4 - .../tool_test_generate_41/Ballerina.toml | 4 - .../tool_test_generate_42/Ballerina.toml | 4 - .../tool_test_generate_43/Ballerina.toml | 4 - .../tool_test_generate_44/Ballerina.toml | 4 - .../tool_test_generate_45/Ballerina.toml | 4 - .../tool_test_generate_46/Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../tool_test_generate_5/Ballerina.toml | 3 - .../tool_test_generate_50/Ballerina.toml | 4 - .../tool_test_generate_51/Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../tool_test_generate_6/Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../tool_test_generate_64/Ballerina.toml | 4 - .../tool_test_generate_65/Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../tool_test_generate_7/Ballerina.toml | 3 - .../Ballerina.toml | 4 - .../Ballerina.toml | 4 - .../tool_test_generate_8/Ballerina.toml | 4 - .../tool_test_generate_9/Ballerina.toml | 3 - .../output/tool_test_init_1/Ballerina.toml | 7 +- .../output/tool_test_init_12/Ballerina.toml | 7 +- .../output/tool_test_init_13/Ballerina.toml | 7 +- .../output/tool_test_init_14/Ballerina.toml | 7 +- .../output/tool_test_init_3/Ballerina.toml | 7 +- .../output/tool_test_init_5/Ballerina.toml | 7 +- .../output/tool_test_init_6/Ballerina.toml | 7 +- .../output/tool_test_init_7/Ballerina.toml | 7 +- .../output/tool_test_init_9/Ballerina.toml | 7 +- .../persist/PersistToolsConstants.java | 4 + .../java/io/ballerina/persist/cmd/Add.java | 211 ++++++++++++++++++ .../io/ballerina/persist/cmd/CmdOptions.java | 75 +++++++ .../io/ballerina/persist/cmd/Generate.java | 154 +++++++++---- .../java/io/ballerina/persist/cmd/Init.java | 117 +++------- .../io/ballerina/persist/cmd/PersistCmd.java | 2 +- .../java/io/ballerina/persist/cmd/Utils.java | 120 ++++++++++ .../syntax/utils/TomlSyntaxUtils.java | 22 +- .../persist/utils/BalProjectUtils.java | 11 + 158 files changed, 1040 insertions(+), 767 deletions(-) rename persist-cli-tests/src/test/java/io/ballerina/persist/tools/{ToolingInitTest.java => ToolingAddTest.java} (92%) create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_client.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_db_config.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_types.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/script.sql create mode 100644 persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java create mode 100644 persist-cli/src/main/java/io/ballerina/persist/cmd/CmdOptions.java create mode 100644 persist-cli/src/main/java/io/ballerina/persist/cmd/Utils.java diff --git a/examples/build.gradle b/examples/build.gradle index ddc82aac1..f390a7406 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -234,7 +234,7 @@ task generateInMemoryExamples { exec { workingDir "${project.projectDir}/build/generated-examples/${example}" if (!Os.isFamily(Os.FAMILY_WINDOWS)) { - commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate" + commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --datastore=inmemory" } else { commandLine 'cmd', '/c', "${ballerinaDist}/bin/bal.bat persist generate" } diff --git a/gradle.properties b/gradle.properties index 6eaca9e3a..62b6fbedd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ org.gradle.caching=true group=io.ballerina -version=1.2.2-SNAPSHOT +version=1.2.4 #dependency versions checkstylePluginVersion=10.12.1 @@ -48,7 +48,7 @@ stdlibHttpVersion=2.10.4 stdlibSqlVersion=1.11.1 # Level 09 -stdlibPersistVersion=1.2.1-20231130-100000-cca5690 +stdlibPersistVersion=1.2.3 # Level 10 stdlibPersistSqlVersion=1.2.2-20231206-130200-881839f diff --git a/persist-cli-tests/build.gradle b/persist-cli-tests/build.gradle index f8939c710..077af26fd 100644 --- a/persist-cli-tests/build.gradle +++ b/persist-cli-tests/build.gradle @@ -236,29 +236,29 @@ task stopTestDockerContainer() { } } -task startMSSQLTestDockerContainer(type: Exec) { - if (!Os.isFamily(Os.FAMILY_WINDOWS)) { - def standardOutput = new ByteArrayOutputStream() - commandLine 'sh', '-c', 'docker run --platform linux/amd64 --rm -d --name ballerina-persist-tools-mssql -e ACCEPT_EULA=1 -e SA_PASSWORD=Test123# -p 1434:1433 -t mcr.microsoft.com/mssql/server:2019-latest' - def healthCheck = 1 - def counter = 0 - doLast { - checkExecResult(executionResult, 'Error', standardOutput) - while (healthCheck != 0 && counter < 12) { - sleep(60 * 1000) - healthCheck = checkMSSQLTestDockerContainerStatus('ballerina-persist-tools-mssql') - counter = counter + 1 - } - if (healthCheck != 0) { - throw new GradleException("Docker container 'ballerina-persist-tools-mssql' health test exceeded timeout!") - } - } - } else { - commandLine 'cmd','slmgr /dlv' - println('\n' + "Windows Instance detected") - println('\n' + "skippped starting the docker container") - } -} +//task startMSSQLTestDockerContainer(type: Exec) { +// if (!Os.isFamily(Os.FAMILY_WINDOWS)) { +// def standardOutput = new ByteArrayOutputStream() +// commandLine 'sh', '-c', 'docker run --platform linux/amd64 --rm -d --name ballerina-persist-tools-mssql -e ACCEPT_EULA=1 -e SA_PASSWORD=Test123# -p 1434:1433 -t mcr.microsoft.com/mssql/server:2019-latest' +// def healthCheck = 1 +// def counter = 0 +// doLast { +// checkExecResult(executionResult, 'Error', standardOutput) +// while (healthCheck != 0 && counter < 12) { +// sleep(60 * 1000) +// healthCheck = checkMSSQLTestDockerContainerStatus('ballerina-persist-tools-mssql') +// counter = counter + 1 +// } +// if (healthCheck != 0) { +// throw new GradleException("Docker container 'ballerina-persist-tools-mssql' health test exceeded timeout!") +// } +// } +// } else { +// commandLine 'cmd','slmgr /dlv' +// println('\n' + "Windows Instance detected") +// println('\n' + "skippped starting the docker container") +// } +//} def checkMSSQLTestDockerContainerStatus(containerName) { if (!Os.isFamily(Os.FAMILY_WINDOWS)) { @@ -414,7 +414,7 @@ jacocoTestReport { } test.dependsOn startTestDockerContainer -test.dependsOn startMSSQLTestDockerContainer +//test.dependsOn startMSSQLTestDockerContainer test.dependsOn startPostgreSQLTestDockerContainer test.dependsOn pullGSheetsDependency test.dependsOn ":persist-cli:build" diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingInitTest.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingAddTest.java similarity index 92% rename from persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingInitTest.java rename to persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingAddTest.java index 67f3985b7..fc68613b6 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingInitTest.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingAddTest.java @@ -18,7 +18,7 @@ package io.ballerina.persist.tools; -import io.ballerina.persist.cmd.Init; +import io.ballerina.persist.cmd.Add; import jdk.jfr.Description; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -40,7 +40,7 @@ /** * persist tool init command tests. */ -public class ToolingInitTest { +public class ToolingAddTest { private String persistSqlVersion; private String persistInMemoryVersion; @@ -126,29 +126,29 @@ public void testInitWithManuallyCreatedDefinitionFile() { @Test(enabled = true) public void testInitArgs() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { - Class persistClass = Class.forName("io.ballerina.persist.cmd.Init"); - Init persistCmd = (Init) persistClass.getDeclaredConstructor(String.class). + Class persistClass = Class.forName("io.ballerina.persist.cmd.Add"); + Add persistCmd = (Add) persistClass.getDeclaredConstructor(String.class). newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_11").toAbsolutePath(). toString()); new CommandLine(persistCmd).parseArgs("--help"); persistCmd.execute(); assertGeneratedSources("tool_test_init_11"); - Init persistCmd1 = (Init) persistClass.getDeclaredConstructor(String.class). + Add persistCmd1 = (Add) persistClass.getDeclaredConstructor(String.class). newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_11").toAbsolutePath(). toString()); new CommandLine(persistCmd1).parseArgs("--datastore", ""); persistCmd1.execute(); assertGeneratedSources("tool_test_init_11"); - Init persistCmd2 = (Init) persistClass.getDeclaredConstructor(String.class). + Add persistCmd2 = (Add) persistClass.getDeclaredConstructor(String.class). newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_11").toAbsolutePath(). toString()); new CommandLine(persistCmd2).parseArgs("--module", "^db"); persistCmd2.execute(); assertGeneratedSources("tool_test_init_11"); - Init persistCmd3 = (Init) persistClass.getDeclaredConstructor(String.class). + Add persistCmd3 = (Add) persistClass.getDeclaredConstructor(String.class). newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_11").toAbsolutePath(). toString()); new CommandLine(persistCmd3).parseArgs("--module", @@ -163,8 +163,8 @@ public void testInitArgs() throws ClassNotFoundException, NoSuchMethodException, public void testInitWithModuleArg() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { updateOutputBallerinaToml("tool_test_init_12"); - Class persistClass = Class.forName("io.ballerina.persist.cmd.Init"); - Init persistCmd = (Init) persistClass.getDeclaredConstructor(String.class). + Class persistClass = Class.forName("io.ballerina.persist.cmd.Add"); + Add persistCmd = (Add) persistClass.getDeclaredConstructor(String.class). newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_12").toAbsolutePath(). toString()); new CommandLine(persistCmd).parseArgs("--module", "test"); @@ -176,8 +176,8 @@ public void testInitWithModuleArg() throws ClassNotFoundException, NoSuchMethodE public void testInitWithMssql() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { updateOutputBallerinaToml("tool_test_init_13"); - Class persistClass = Class.forName("io.ballerina.persist.cmd.Init"); - Init persistCmd = (Init) persistClass.getDeclaredConstructor(String.class). + Class persistClass = Class.forName("io.ballerina.persist.cmd.Add"); + Add persistCmd = (Add) persistClass.getDeclaredConstructor(String.class). newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_13").toAbsolutePath(). toString()); new CommandLine(persistCmd).parseArgs("--datastore", "mssql"); @@ -189,8 +189,8 @@ public void testInitWithMssql() throws ClassNotFoundException, NoSuchMethodExcep public void testInitWithPostgresql() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { updateOutputBallerinaToml("tool_test_init_14"); - Class persistClass = Class.forName("io.ballerina.persist.cmd.Init"); - Init persistCmd = (Init) persistClass.getDeclaredConstructor(String.class). + Class persistClass = Class.forName("io.ballerina.persist.cmd.Add"); + Add persistCmd = (Add) persistClass.getDeclaredConstructor(String.class). newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_14").toAbsolutePath(). toString()); new CommandLine(persistCmd).parseArgs("--datastore", "postgresql"); @@ -229,8 +229,8 @@ private void executeCommand(String subDir) { Class persistClass; Path sourcePath = Paths.get(GENERATED_SOURCES_DIRECTORY, subDir); try { - persistClass = Class.forName("io.ballerina.persist.cmd.Init"); - Init persistCmd = (Init) persistClass.getDeclaredConstructor(String.class) + persistClass = Class.forName("io.ballerina.persist.cmd.Add"); + Add persistCmd = (Add) persistClass.getDeclaredConstructor(String.class) .newInstance(sourcePath.toAbsolutePath().toString()); new CommandLine(persistCmd).parseArgs("--datastore", "mysql"); persistCmd.execute(); diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java index 556ff51d4..0b1cb1e93 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java @@ -31,6 +31,7 @@ import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.assertGeneratedSources; import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.assertGeneratedSourcesNegative; import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.executeCommand; +import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.executeGenerateCommand; /** * persist tool generate command tests. @@ -40,21 +41,21 @@ public class ToolingGenerateTest { @Test(enabled = true) @Description("There is multiple entities with associations in the Ballerina project") public void testGenerateAssociatedEntities() { - executeCommand("tool_test_generate_1", GENERATE); + executeGenerateCommand("tool_test_generate_1", "mysql", "persist_generate_1"); assertGeneratedSources("tool_test_generate_1"); } @Test(enabled = true) @Description("There are multiple entities in the Ballerina project") public void testGenerateMultipleEntities() { - executeCommand("tool_test_generate_2", GENERATE); + executeGenerateCommand("tool_test_generate_2", "mysql", "persist_generate_2.entities"); assertGeneratedSources("tool_test_generate_2"); } @Test(enabled = true) @Description("There are no entities nor already generated client objects in the Ballerina project") public void testGenerateWithoutEntitiesWithoutClients() { - executeCommand("tool_test_generate_3", GENERATE); + executeGenerateCommand("tool_test_generate_3", "mysql", "persist_generate_3.entities"); assertGeneratedSources("tool_test_generate_3"); } @@ -68,113 +69,119 @@ public void testGenerateOutsideBalProject() { @Test(enabled = true) @Description("There is a generated client object and the corresponding entity is updated") public void testGenerateUpdateEntity() { - executeCommand("tool_test_generate_5", GENERATE); + executeGenerateCommand("tool_test_generate_5", "mysql", "persist_generate_5.entities"); assertGeneratedSources("tool_test_generate_5"); } @Test(enabled = true) @Description("A persist entity with all the supported fields data types") public void testGenerateAllEntityFieldTypes() { - executeCommand("tool_test_generate_6", GENERATE); + executeGenerateCommand("tool_test_generate_6", "mysql", "persist_generate_6.entities"); assertGeneratedSources("tool_test_generate_6"); } @Test(enabled = true) @Description("Use case where unsupported datatypes are used") public void testGenerateClientWithUnsupportedDataTypes() { - assertGeneratedSourcesNegative("tool_test_generate_7", GENERATE, new String[]{}); + assertGeneratedSourcesNegative("tool_test_generate_7", GENERATE, new String[]{}, "mysql", + "persist_generate_7.entities"); } @Test(enabled = true) @Description("There is only a single entity in the Ballerina project where key is a string") public void testGenerateSingleEntityWithStringKey() { - executeCommand("tool_test_generate_8", GENERATE); + executeGenerateCommand("tool_test_generate_8", "mysql", "persist_generate_8.entities"); assertGeneratedSources("tool_test_generate_8"); } @Test(enabled = true) //removed until support for multiple keys are provided @Description("There is only a single entity in the Ballerina project with two keys") public void testGenerateSingleEntityWithMultipleKeysAndAutoInc() { - executeCommand("tool_test_generate_9", GENERATE); + executeGenerateCommand("tool_test_generate_9", "mysql", "persist_generate_9.entities"); assertGeneratedSources("tool_test_generate_9"); } @Test(enabled = true) @Description("There is only a single entity in the Ballerina project and there are errors in the project") public void testGenerateSingleEntityWithErrors() { - assertGeneratedSourcesNegative("tool_test_generate_11", GENERATE, new String[]{}); + assertGeneratedSourcesNegative("tool_test_generate_11", GENERATE, new String[]{}, "mysql", + "persist_generate_11.entities"); } @Test(enabled = true) @Description("There is only a single entity in the schema with wrong import") public void testGenerateSingleEntityWithWrongImport() { - assertGeneratedSourcesNegative("tool_test_generate_12", GENERATE, new String[]{}); + assertGeneratedSourcesNegative("tool_test_generate_12", GENERATE, new String[]{}, "mysql", + "persist_generate_12.entities"); } @Test(enabled = true) @Description("There are three entities with one to one associations between each other") public void testGenerateThreeEntitiesWith1To1Associations() { - executeCommand("tool_test_generate_13", GENERATE); + executeGenerateCommand("tool_test_generate_13", "mysql", "persist_generate_13.entities"); assertGeneratedSources("tool_test_generate_13"); } @Test(enabled = true) @Description("There are three entities in two schema files") public void testGenerateThreeEntitiesWith1To1AssociationsWithChildEntityInSubModule() { - assertGeneratedSourcesNegative("tool_test_generate_15", GENERATE, new String[]{}); + assertGeneratedSourcesNegative("tool_test_generate_15", GENERATE, new String[]{}, "mysql", + "persist_generate_13.entities"); } @Test(enabled = true) @Description("There are two entities with one to many associations between each other") public void testGenerateClientsWith1ToManyAssociations() { - executeCommand("tool_test_generate_16", GENERATE); + executeGenerateCommand("tool_test_generate_16", "mysql", "persist_generate_16.entities"); assertGeneratedSources("tool_test_generate_16"); } @Test(enabled = true) @Description("There are three entities with one to many associations between each other") public void testGenerateThreeClientsWith1ToManyAssociations() { - executeCommand("tool_test_generate_17", GENERATE); + executeGenerateCommand("tool_test_generate_17", "mysql", "persist_generate_17.entities"); assertGeneratedSources("tool_test_generate_17"); } @Test(enabled = true) @Description("There are three entities with one to one associations between each other without nullable fields") public void testGenerateThreeEntitiesWith1To1AssociationsWithOutAnnotationValue() { - assertGeneratedSourcesNegative("tool_test_generate_19", GENERATE, new String[]{}); + assertGeneratedSourcesNegative("tool_test_generate_19", GENERATE, new String[]{}, "mysql", + "persist_generate_19.entities"); } @Test(enabled = true) @Description("There are two special entities with special characters in field names") public void testGenerateRelatedClientsWithSpecialCharactersInName() { - executeCommand("tool_test_generate_22", GENERATE); + executeGenerateCommand("tool_test_generate_22", "mysql", "persist_generate_22.entities"); assertGeneratedSources("tool_test_generate_22"); } @Test(enabled = true) @Description("Negative test case where init command was not run before generate command") public void testGenerateWithoutInit() { - assertGeneratedSourcesNegative("tool_test_generate_23", GENERATE, new String[]{}); + assertGeneratedSourcesNegative("tool_test_generate_23", GENERATE, new String[]{}, "mysql", + "persist_generate_23.entities"); } @Test(enabled = true) @Description("Test the generate command with entities containing byte[] fields") public void testGenerateWithByteArrays() { - executeCommand("tool_test_generate_24", GENERATE); + executeGenerateCommand("tool_test_generate_24", "mysql", "persist_generate_24.foo"); assertGeneratedSources("tool_test_generate_24"); } @Test(enabled = true) @Description("There are two entities with one to many associations between each other without relation annotation") public void testGenerateOneToManyAssociationsWithoutRelationAnnotation() { - executeCommand("tool_test_generate_25", GENERATE); + executeGenerateCommand("tool_test_generate_25", "mysql", "persist_generate_25.entities"); assertGeneratedSources("tool_test_generate_25"); } @Test(enabled = true) @Description("There are two entities with one to one associations between each other without relation annotation") public void testGenerateOneToOneAssociationsWithoutRelationAnnotation() { - executeCommand("tool_test_generate_26", GENERATE); + executeGenerateCommand("tool_test_generate_26", "mysql", "persist_generate_26.entities"); assertGeneratedSources("tool_test_generate_26"); } @@ -182,7 +189,7 @@ public void testGenerateOneToOneAssociationsWithoutRelationAnnotation() { @Description("There are three entities with one to one associations between each other with comments " + "in entity fields") public void testGenerateThreeEntitiesWith1To1AssociationsWithComments() { - executeCommand("tool_test_generate_27", GENERATE); + executeGenerateCommand("tool_test_generate_27", "mysql", "persist_generate_27.entities"); assertGeneratedSources("tool_test_generate_27"); } @@ -190,91 +197,91 @@ public void testGenerateThreeEntitiesWith1To1AssociationsWithComments() { @Description("There are three entities with one to many associations between each other with comments " + "in entity fields") public void testGenerateThreeEntitiesWith1ToManyAssociationsWithComments() { - executeCommand("tool_test_generate_28", GENERATE); + executeGenerateCommand("tool_test_generate_28", "mysql", "persist_generate_28.entities"); assertGeneratedSources("tool_test_generate_28"); } @Test(enabled = true) @Description("There is a entity inside the project with comments inside entity") public void testGenerateWithComments() { - executeCommand("tool_test_generate_29", GENERATE); + executeGenerateCommand("tool_test_generate_29", "mysql", "persist_generate_29.entities"); assertGeneratedSources("tool_test_generate_29"); } @Test(enabled = true) @Description("Test the generate command with out defining any schema files inside persist directory") public void testGenerateWithoutSchemaFile() { - executeCommand("tool_test_generate_30", GENERATE); + executeGenerateCommand("tool_test_generate_30", "mysql", "persist_generate_30.entities"); assertGeneratedSources("tool_test_generate_30"); } @Test(enabled = true) @Description("Test the generate command with empty schema file inside persist directory") public void testGenerateWithEmptySchemaFile() { - executeCommand("tool_test_generate_31", GENERATE); + executeGenerateCommand("tool_test_generate_31", "mysql", "persist_generate_31.entities"); assertGeneratedSources("tool_test_generate_31"); } @Test(enabled = true) @Description("Test the generate command without persist import in schema file") public void testGenerateWithoutPersistImport() { - executeCommand("tool_test_generate_33", GENERATE); + executeGenerateCommand("tool_test_generate_33", "mysql", "persist_generate_33.entities"); assertGeneratedSources("tool_test_generate_33"); } @Test(enabled = true) @Description("Test the generate command with optional type in schema file") public void testGenerateWithOptionalType() { - executeCommand("tool_test_generate_34", GENERATE); + executeGenerateCommand("tool_test_generate_34", "mysql", "persist_generate_34.entities"); assertGeneratedSources("tool_test_generate_34"); } @Test(enabled = true) @Description("Test the generate command in default Ballerina package") public void testGenerateInDefaultPackage() { - executeCommand("tool_test_generate_35", GENERATE); + executeGenerateCommand("tool_test_generate_35", "mysql", "persist_generate_35"); assertGeneratedSources("tool_test_generate_35"); } @Test(enabled = true) @Description("Test the generate command with escape character in entity fields, and names") public void testGenerateRelationsWithSingleQuote() { - executeCommand("tool_test_generate_36", GENERATE); + executeGenerateCommand("tool_test_generate_36", "mysql", "persist_generate_36.rainier"); assertGeneratedSources("tool_test_generate_36"); } @Test(enabled = true) @Description("Test the created sql script content for relations and byte[] type") public void testSqlGen() { - executeCommand("tool_test_generate_37", GENERATE); + executeGenerateCommand("tool_test_generate_37", "mysql", "tool_test_generate_37.entities"); assertGeneratedSources("tool_test_generate_37"); } @Test(enabled = true) @Description("Test the created sql script content with out defining any schema files inside persist directory") public void testSqlGenWithoutSchemaFile() { - executeCommand("tool_test_generate_38", GENERATE); + executeGenerateCommand("tool_test_generate_38", "mysql", "tool_test_generate_38.entities"); assertGeneratedSources("tool_test_generate_38"); } @Test(enabled = true) @Description("Test the created sql script with one to many relation entity") public void testSqlGenWithOneToManyRelationship() { - executeCommand("tool_test_generate_39", GENERATE); + executeGenerateCommand("tool_test_generate_39", "mysql", "tool_test_generate_39.entities"); assertGeneratedSources("tool_test_generate_39"); } @Test(enabled = true) @Description("Test the created sql script with optional type fields") public void testSqlGenWithOptionalTypeFields() { - executeCommand("tool_test_generate_40", GENERATE); + executeGenerateCommand("tool_test_generate_40", "mysql", "tool_test_generate_40.entities"); assertGeneratedSources("tool_test_generate_40"); } @Test(enabled = true) @Description("Test the created sql script with composite reference keys") public void testSqlGenWithCompositeReferenceKeys() { - executeCommand("tool_test_generate_41", GENERATE); + executeGenerateCommand("tool_test_generate_41", "mysql", "tool_test_generate_41.entities"); assertGeneratedSources("tool_test_generate_41"); } @@ -292,207 +299,211 @@ public void testGenerateArgs() throws ClassNotFoundException, NoSuchMethodExcept @Test(enabled = true) public void testInvalidDataStore() { - executeCommand("tool_test_generate_42", GENERATE); + executeGenerateCommand("tool_test_generate_42", "my", "tool_test_generate_42.entities"); assertGeneratedSources("tool_test_generate_42"); } @Test(enabled = true) public void testInvalidModuleName() { - executeCommand("tool_test_generate_43", GENERATE); + String invalidModuleName = "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestt" + + "esttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestt" + + "esttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestt" + + "esttesttesttesttesttesttesttest"; + executeGenerateCommand("tool_test_generate_43", "mysql", invalidModuleName); assertGeneratedSources("tool_test_generate_43"); } @Test(enabled = true) public void testInvalidModuleName1() { - executeCommand("tool_test_generate_44", GENERATE); + executeGenerateCommand("tool_test_generate_44", "mysql", ".test"); assertGeneratedSources("tool_test_generate_44"); } @Test(enabled = true) public void testInvalidModuleName2() { - executeCommand("tool_test_generate_45", GENERATE); + executeGenerateCommand("tool_test_generate_45", "mysql", "^^^"); assertGeneratedSources("tool_test_generate_45"); } @Test(enabled = true) @Description("Test the generated types for multiple association between same entities") public void testGenerateMultipleAssociationBetweenSameEntities() { - executeCommand("tool_test_generate_46", GENERATE); + executeGenerateCommand("tool_test_generate_46", "mysql", "tool_test_generate_46.entities"); assertGeneratedSources("tool_test_generate_46"); } @Test(enabled = true) @Description("There is a generated client object with in memory data source") public void testInMemoryEntity() { - executeCommand("tool_test_generate_47_in_memory", GENERATE); + executeGenerateCommand("tool_test_generate_47_in_memory", "inmemory", "persist_generate_47.entities"); assertGeneratedSources("tool_test_generate_47_in_memory"); } @Test(enabled = true) @Description("There is a generated client object with in memory data source") public void testInMemoryWithAssociatedEntity() { - executeCommand("tool_test_generate_48_in_memory", GENERATE); + executeGenerateCommand("tool_test_generate_48_in_memory", "inmemory", "persist_generate_48.entities"); assertGeneratedSources("tool_test_generate_48_in_memory"); } @Test(enabled = true) @Description("There is a generated client object with in memory data source") public void testInMemoryWithCompositeKeys() { - executeCommand("tool_test_generate_49_in_memory", GENERATE); + executeGenerateCommand("tool_test_generate_49_in_memory", "inmemory", "persist_generate_49.entities"); assertGeneratedSources("tool_test_generate_49_in_memory"); } @Test(enabled = true) @Description("There is multiple entities with multiple enums and no imports") public void testGenerateWithEnums() { - executeCommand("tool_test_generate_50", GENERATE); + executeGenerateCommand("tool_test_generate_50", "mysql", "persist_generate_50"); assertGeneratedSources("tool_test_generate_50"); } @Test(enabled = true) @Description("There is multiple entities with multiple enums and imports") public void testGenerateWithEnumsWithImports() { - executeCommand("tool_test_generate_51", GENERATE); + executeGenerateCommand("tool_test_generate_51", "mysql", "persist_generate_51"); assertGeneratedSources("tool_test_generate_51"); } @Test(enabled = true) @Description("There is multiple entities with multiple enums and imports with in memory data source") public void testGenerateWithEnumsInMemory() { - executeCommand("tool_test_generate_52_in_memory", GENERATE); + executeGenerateCommand("tool_test_generate_52_in_memory", "inmemory", "persist_generate_52.entities"); assertGeneratedSources("tool_test_generate_52_in_memory"); } @Test(enabled = true) @Description("There is an entity which is associated with multiple relations") public void testGenerateWithSameEntityMultipleRelationsInMemory() { - executeCommand("tool_test_generate_53_in_memory", GENERATE); + executeGenerateCommand("tool_test_generate_53_in_memory", "inmemory", "persist_generate_52.entities"); assertGeneratedSources("tool_test_generate_53_in_memory"); } @Test(enabled = true) @Description("There is a generated client object with google sheets data source") public void testGoogleSheet() { - executeCommand("tool_test_generate_54_gsheet", GENERATE); + executeGenerateCommand("tool_test_generate_54_gsheet", "googlesheets", "persist_generate_54.entities"); assertGeneratedSources("tool_test_generate_54_gsheet"); } @Test(enabled = true) @Description("There is a model with an entity consisting of multiple relations of the same type") public void testGenerateEntityWithMultipleRelationsSameTypeInMemory() { - executeCommand("tool_test_generate_55_in_memory", GENERATE); + executeGenerateCommand("tool_test_generate_55_in_memory", "inmemory", "persist_generate_55.entities"); assertGeneratedSources("tool_test_generate_55_in_memory"); } @Test(enabled = true) @Description("There is a model with an entity consisting of multiple relations of the same type") public void testGenerateEntityWithMultipleRelationsSameTypeGoogleSheet() { - executeCommand("tool_test_generate_56_gsheets", GENERATE); + executeGenerateCommand("tool_test_generate_56_gsheets", "googlesheets", "persist_generate_56.entities"); assertGeneratedSources("tool_test_generate_56_gsheets"); } @Test(enabled = true) @Description("There is a generated client object with google sheets data source and ENUM as field type.") public void testGoogleSheetWithEnum() { - executeCommand("tool_test_generate_57_gsheets", GENERATE); + executeGenerateCommand("tool_test_generate_57_gsheets", "googlesheets", "persist_generate_57.entities"); assertGeneratedSources("tool_test_generate_57_gsheets"); } @Test(enabled = true) @Description("There is a generated client object with mssql data source") public void testMssqlEntity() { - executeCommand("tool_test_generate_58_mssql", GENERATE); + executeGenerateCommand("tool_test_generate_58_mssql", "mssql", "persist_generate_58.entities"); assertGeneratedSources("tool_test_generate_58_mssql"); } @Test(enabled = true) @Description("There is a generated client object with postgresql data source") public void testPostgresqlEntity() { - executeCommand("tool_test_generate_66_postgresql", GENERATE); + executeGenerateCommand("tool_test_generate_66_postgresql", "postgresql", "persist_generate_66.entities"); assertGeneratedSources("tool_test_generate_66_postgresql"); } @Test(enabled = true) @Description("There is a generated client object with mssql data source") public void testMSSQLWithAssociatedEntity() { - executeCommand("tool_test_generate_59_mssql", GENERATE); + executeGenerateCommand("tool_test_generate_59_mssql", "mssql", "persist_generate_59.entities"); assertGeneratedSources("tool_test_generate_59_mssql"); } @Test(enabled = true) @Description("There is a generated client object with postgresql data source") public void testPostgreSQLWithAssociatedEntity() { - executeCommand("tool_test_generate_67_postgresql", GENERATE); + executeGenerateCommand("tool_test_generate_67_postgresql", "postgresql", "persist_generate_67.entities"); assertGeneratedSources("tool_test_generate_67_postgresql"); } @Test(enabled = true) @Description("There is a generated client object with mssql data source") public void testMSSQLWithCompositeKeys() { - executeCommand("tool_test_generate_60_mssql", GENERATE); + executeGenerateCommand("tool_test_generate_60_mssql", "mssql", "persist_generate_60.entities"); assertGeneratedSources("tool_test_generate_60_mssql"); } @Test(enabled = true) @Description("There is a generated client object with postgresql data source") public void testPostgreSQLWithCompositeKeys() { - executeCommand("tool_test_generate_68_postgresql", GENERATE); + executeGenerateCommand("tool_test_generate_68_postgresql", "postgresql", "persist_generate_68.entities"); assertGeneratedSources("tool_test_generate_68_postgresql"); } @Test(enabled = true) @Description("There is multiple entities with multiple enums and imports with mssql data source") public void testGenerateWithEnumsMSSQL() { - executeCommand("tool_test_generate_61_mssql", GENERATE); + executeGenerateCommand("tool_test_generate_61_mssql", "mssql", "persist_generate_61.entities"); assertGeneratedSources("tool_test_generate_61_mssql"); } @Test(enabled = true) @Description("There is multiple entities with multiple enums and imports with postgresql data source") public void testGenerateWithEnumsPostgresSQL() { - executeCommand("tool_test_generate_69_postgresql", GENERATE); + executeGenerateCommand("tool_test_generate_69_postgresql", "postgresql", "persist_generate_69.entities"); assertGeneratedSources("tool_test_generate_69_postgresql"); } @Test(enabled = true) @Description("There is an entity which is associated with multiple relations") public void testGenerateWithSameEntityMultipleRelationsMSSQL() { - executeCommand("tool_test_generate_62_mssql", GENERATE); + executeGenerateCommand("tool_test_generate_62_mssql", "mssql", "persist_generate_62.entities"); assertGeneratedSources("tool_test_generate_62_mssql"); } @Test(enabled = true) @Description("There is an entity which is associated with multiple relations") public void testGenerateWithSameEntityMultipleRelationsPostgresql() { - executeCommand("tool_test_generate_70_postgresql", GENERATE); + executeGenerateCommand("tool_test_generate_70_postgresql", "postgresql", "persist_generate_70.entities"); assertGeneratedSources("tool_test_generate_70_postgresql"); } @Test(enabled = true) @Description("There is a model with an entity consisting of multiple relations of the same type") public void testGenerateEntityWithMultipleRelationsSameTypeMSSQL() { - executeCommand("tool_test_generate_63_mssql", GENERATE); + executeGenerateCommand("tool_test_generate_63_mssql", "mssql", "persist_generate_63.entities"); assertGeneratedSources("tool_test_generate_63_mssql"); } @Test(enabled = true) @Description("There is a model with an entity consisting of multiple relations of the same type") public void testGenerateEntityWithMultipleRelationsSameTypePostgreSQL() { - executeCommand("tool_test_generate_71_postgresql", GENERATE); + executeGenerateCommand("tool_test_generate_71_postgresql", "postgresql", "persist_generate_71.entities"); assertGeneratedSources("tool_test_generate_71_postgresql"); } @Test(enabled = true) @Description("module name is in the shape x.y.z") public void testGenerateEntityDotSeperatedModuleNames() { - executeCommand("tool_test_generate_64", GENERATE); + executeGenerateCommand("tool_test_generate_64", "mysql", "persist_generate_64.x.y.z"); assertGeneratedSources("tool_test_generate_64"); } @Test(enabled = true) @Description("The model has multiple relations of various types") public void testGenerateEntitiesWithMultipleRelations() { - executeCommand("tool_test_generate_65", GENERATE); + executeGenerateCommand("tool_test_generate_65", "mysql", "persist_generate_65"); assertGeneratedSources("tool_test_generate_65"); } } diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java index 63abe5e56..a666ffff3 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java @@ -27,6 +27,7 @@ import io.ballerina.projects.PackageCompilation; import io.ballerina.projects.directory.BuildProject; import org.testng.Assert; +import picocli.CommandLine; import java.io.File; import java.io.IOException; @@ -101,9 +102,14 @@ public static void assertGeneratedSources(String subDir) { } } - public static void assertGeneratedSourcesNegative(String subDir, Command cmd, String[] relativeFilepaths) { + public static void assertGeneratedSourcesNegative(String subDir, Command cmd, String[] relativeFilepaths, + String... args) { Path sourceDirPath = Paths.get(GENERATED_SOURCES_DIRECTORY, subDir); - executeCommand(subDir, cmd); + if (cmd == Command.GENERATE) { + executeGenerateCommand(subDir, args); + } else { + executeCommand(subDir, cmd); + } if (cmd == Command.DB_PUSH) { Assert.assertFalse(false); } else { @@ -181,6 +187,21 @@ public static HashMap executeCommand(String subDir, Command cmd) { return new HashMap<>(); } + public static void executeGenerateCommand(String subDir, String... args) { + Class persistClass; + Path sourcePath = Paths.get(GENERATED_SOURCES_DIRECTORY, subDir); + try { + persistClass = Class.forName("io.ballerina.persist.cmd.Generate"); + Generate persistCmd = (Generate) persistClass.getDeclaredConstructor(String.class) + .newInstance(sourcePath.toAbsolutePath().toString()); + new CommandLine(persistCmd).parseArgs("--datastore", args[0], "--module", args[1]); + persistCmd.execute(); + } catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException + | InvocationTargetException e) { + errStream.println(e.getMessage()); + } + } + private static List listFiles(Path path) { try (Stream walk = Files.walk(path)) { return walk != null ? walk.filter(Files::isRegularFile).collect(Collectors.toList()) : new ArrayList<>(); diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml index c113fb6c0..25535c5af 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml @@ -7,7 +7,7 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] +[tool.persist] datastore = "mysql" module = "tool_test_db_push_1.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml index d08a5329a..d84f218ed 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml @@ -7,7 +7,7 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] +[tool.persist] datastore = "mysql" module = "tool_test_db_push_14.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml index d6069b6f3..d0c009385 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml @@ -4,7 +4,7 @@ name = "tool_test_db_push_3" version = "0.1.0" distribution = "2201.3.0" -[persist] +[tool.persist] datastore = "mysql" module = "tool_test_db_push_3.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_1/Ballerina.toml index ff53bab82..bcaf2f8f5 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_1/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_1" - diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_11/Ballerina.toml index daf185404..e80a65491 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_11/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_11/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true - -[persist] -datastore = "mysql" -module = "persist_generate_11.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_12/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_12/Ballerina.toml index 9c2f4a08f..3390ba1a9 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_12/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_12/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true - -[persist] -datastore = "mysql" -module = "persist_generate_12.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_13/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_13/Ballerina.toml index 1808efe8f..53b6f2ace 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_13/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_13/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_13.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_16/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_16/Ballerina.toml index 1585e110a..1623e234f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_16/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_16/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_16.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_17/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_17/Ballerina.toml index bf397f9f6..ca3222eaa 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_17/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_17/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_17.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_19/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_19/Ballerina.toml index 2e333d1de..be09b6350 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_19/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_19/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_19.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_2/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_2/Ballerina.toml index fddd99490..249b898db 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_2/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_2/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_2.entities" - diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_22/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_22/Ballerina.toml index a17363c06..9bb9838dd 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_22/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_22/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_22.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_24/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_24/Ballerina.toml index 55b16ec92..0e371b424 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_24/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_24/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_24.foo" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_25/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_25/Ballerina.toml index bdc897f12..aa553179a 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_25/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_25/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_25.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_26/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_26/Ballerina.toml index 71dea8036..23f6a3a16 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_26/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_26/Ballerina.toml @@ -1,12 +1,8 @@ [package] org = "foo" -name = "persist_generate_22" +name = "persist_generate_26" version = "0.1.0" distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_26.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_26/Config.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_26/Config.toml index 0a846f2ce..e93d93468 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_26/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_26/Config.toml @@ -1,4 +1,4 @@ -[persist_generate_22.entities] +[persist_generate_26.entities] host = "localhost" port = 3306 user = "root" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_27/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_27/Ballerina.toml index c44584f1f..f34c457bc 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_27/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_27/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_27.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_28/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_28/Ballerina.toml index f4687c315..4bcae7584 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_28/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_28/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_28.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_29/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_29/Ballerina.toml index 67c4082b1..6fcf69b17 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_29/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_29/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_29.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_3/Ballerina.toml index e6c822d67..547b45580 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_3/Ballerina.toml @@ -7,6 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_3.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_30/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_30/Ballerina.toml index a608d5def..cf1c691ee 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_30/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_30/Ballerina.toml @@ -3,7 +3,3 @@ org = "foo" name = "persist_generate_30" version = "0.1.0" distribution = "2201.3.0" - -[persist] -datastore = "mysql" -module = "persist_generate_30.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_31/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_31/Ballerina.toml index 07fe56f69..b8c46c619 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_31/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_31/Ballerina.toml @@ -3,7 +3,3 @@ org = "foo" name = "persist_generate_31" version = "0.1.0" distribution = "2201.3.0" - -[persist] -datastore = "mysql" -module = "persist_generate_31.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_33/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_33/Ballerina.toml index 62255b6cc..f4906b295 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_33/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_33/Ballerina.toml @@ -3,7 +3,3 @@ org = "foo" name = "tool_test_generate_33" version = "0.1.0" distribution = "2201.3.0" - -[persist] -datastore = "mysql" -module = "tool_test_generate_33.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_34/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_34/Ballerina.toml index ee652a8f0..b8766b127 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_34/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_34/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_34.entities" - diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_35/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_35/Ballerina.toml index 80de2d270..b1f1ca6dd 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_35/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_35/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_35" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_36/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_36/Ballerina.toml index 6e34194ee..f27ec1ed1 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_36/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_36/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_36.rainier" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_37/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_37/Ballerina.toml index cce4d95d1..58862bd09 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_37/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_37/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_generate_37.entities" - diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_38/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_38/Ballerina.toml index 26c866206..772580017 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_38/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_38/Ballerina.toml @@ -3,7 +3,3 @@ org = "foo" name = "tool_test_generate_38" version = "0.1.0" distribution = "2201.3.0" - -[persist] -datastore = "mysql" -module = "tool_test_generate_38.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_39/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_39/Ballerina.toml index beb368501..307fa68b7 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_39/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_39/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.4.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "tool_test_generate_39.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_40/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_40/Ballerina.toml index df5108497..be9b97025 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_40/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_40/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_generate_40.entities" - diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_41/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_41/Ballerina.toml index b4c6e7899..9d4c1c969 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_41/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_41/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "tool_test_generate_41.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_42/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_42/Ballerina.toml index 8c605f666..4588bac5e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_42/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_42/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "my" -module = "tool_test_generate_42.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_43/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_43/Ballerina.toml index 86368aa00..2af7ffecf 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_43/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_43/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_44/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_44/Ballerina.toml index 953c6dff6..13f82546b 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_44/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_44/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = ".test" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_45/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_45/Ballerina.toml index aaf8d3c20..2d0429d5c 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_45/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_45/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "^^^" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_46/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_46/Ballerina.toml index f47310a02..5345faafd 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_46/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_46/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "tool_test_generate_46.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_47_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_47_in_memory/Ballerina.toml index 74199b3f5..d31266eb9 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_47_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_47_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_47.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_48_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_48_in_memory/Ballerina.toml index 5d43e93b2..bfe6af446 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_48_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_48_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_48.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_49_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_49_in_memory/Ballerina.toml index 62797d838..3a0f46289 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_49_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_49_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_49.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/Ballerina.toml index dc4bd510c..a793dba44 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/Ballerina.toml @@ -7,6 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_5.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_50/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_50/Ballerina.toml index bf1d8e4b2..059272f5c 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_50/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_50/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_50" - diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_51/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_51/Ballerina.toml index a9e9b9097..4becdaa64 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_51/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_51/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_51" - diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_52_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_52_in_memory/Ballerina.toml index 89bedfe90..4f4125e60 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_52_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_52_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_52.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_53_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_53_in_memory/Ballerina.toml index 89bedfe90..4f4125e60 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_53_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_53_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_52.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_54_gsheet/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_54_gsheet/Ballerina.toml index 85c8c86c2..420e1668d 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_54_gsheet/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_54_gsheet/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "googlesheets" -module = "persist_generate_54.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_55_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_55_in_memory/Ballerina.toml index eec6258f7..44dc93d9a 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_55_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_55_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_55.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_56_gsheets/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_56_gsheets/Ballerina.toml index 08144aa3b..cde86b055 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_56_gsheets/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_56_gsheets/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "googlesheets" -module = "persist_generate_56.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_57_gsheets/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_57_gsheets/Ballerina.toml index 134df282e..70181221d 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_57_gsheets/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_57_gsheets/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "googlesheets" -module = "persist_generate_57.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_58_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_58_mssql/Ballerina.toml index 0ca96ce15..00bdc5c97 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_58_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_58_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_58.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_59_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_59_mssql/Ballerina.toml index 35c202692..dae2dcf06 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_59_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_59_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_59.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_6/Ballerina.toml index 8d8024f81..f0f8b241d 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_6/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_6.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_60_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_60_mssql/Ballerina.toml index 19d280229..98356bbaf 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_60_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_60_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_60.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_61_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_61_mssql/Ballerina.toml index 32d5f1397..03c17bde0 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_61_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_61_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_61.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_62_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_62_mssql/Ballerina.toml index e1c484e81..04c2eac16 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_62_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_62_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_62.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_63_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_63_mssql/Ballerina.toml index 10e042a32..5915d250a 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_63_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_63_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_63.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_64/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_64/Ballerina.toml index 482acd83e..abdaf9d2f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_64/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_64/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_64.x.y.z" - diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_65/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_65/Ballerina.toml index 0b7fa8d00..00de15201 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_65/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_65/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_65" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_66_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_66_postgresql/Ballerina.toml index c713a6195..aef3dee4b 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_66_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_66_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_66.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_67_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_67_postgresql/Ballerina.toml index 4a8bd52b4..0026cd374 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_67_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_67_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_67.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_68_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_68_postgresql/Ballerina.toml index 5ea6bfed2..4494ad040 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_68_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_68_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_68.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_69_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_69_postgresql/Ballerina.toml index dc7d1c56f..6ef2f1d6e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_69_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_69_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_69.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_7/Ballerina.toml index db55d1407..9b0c5039e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_7/Ballerina.toml @@ -7,6 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_7.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_70_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_70_postgresql/Ballerina.toml index 0917b2c5d..5a812940b 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_70_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_70_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_70.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_71_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_71_postgresql/Ballerina.toml index 7f7606c1e..d3b063c56 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_71_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_71_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_71.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_8/Ballerina.toml index ac1cf861d..46f2573cc 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_8/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_8.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_9/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_9/Ballerina.toml index f69ac68cc..0eda558ee 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_9/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_9/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_9.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/Ballerina.toml index 0fa6900a9..c679d2720 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/Ballerina.toml @@ -7,7 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persist_init_6_old" +[tool.persist] +id = "persist_init_6" +options.datastore = "mysql" +targetModule = "persist_init_6_old" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/Ballerina.toml index ff53bab82..c5616ce55 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/Ballerina.toml @@ -7,7 +7,4 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_1" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/Ballerina.toml index daf185404..e80a65491 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true - -[persist] -datastore = "mysql" -module = "persist_generate_11.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/Ballerina.toml index 9c2f4a08f..3390ba1a9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true - -[persist] -datastore = "mysql" -module = "persist_generate_12.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Ballerina.toml index 1808efe8f..53b6f2ace 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_13.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/Ballerina.toml index 1585e110a..1623e234f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_16.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/Ballerina.toml index bf397f9f6..ca3222eaa 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_17.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/Ballerina.toml index 2e333d1de..be09b6350 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_19.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/Ballerina.toml index fddd99490..5a394a700 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/Ballerina.toml @@ -7,7 +7,4 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_2.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/Ballerina.toml index a17363c06..9bb9838dd 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_22.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/Ballerina.toml index 55b16ec92..0e371b424 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_24.foo" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/Ballerina.toml index bdc897f12..1d07b3cc9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/Ballerina.toml @@ -7,6 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_25.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Ballerina.toml index 71dea8036..23f6a3a16 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Ballerina.toml @@ -1,12 +1,8 @@ [package] org = "foo" -name = "persist_generate_22" +name = "persist_generate_26" version = "0.1.0" distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_26.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml index 0a846f2ce..e93d93468 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml @@ -1,4 +1,4 @@ -[persist_generate_22.entities] +[persist_generate_26.entities] host = "localhost" port = 3306 user = "root" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_client.bal new file mode 100644 index 000000000..5916eb0bf --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_client.bal @@ -0,0 +1,166 @@ +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is an auto-generated file by Ballerina persistence layer for model. +// It should not be modified by hand. +import ballerina/jballerina.java; +import ballerina/persist; +import ballerina/sql; +import ballerinax/mysql; +import ballerinax/mysql.driver as _; +import ballerinax/persist.sql as psql; + +const MEDICAL_NEED = "medicalneeds"; +const MEDICAL_ITEM = "medicalitems"; + +public isolated client class Client { + *persist:AbstractPersistClient; + + private final mysql:Client dbClient; + + private final map persistClients; + + private final record {|psql:SQLMetadata...;|} & readonly metadata = { + [MEDICAL_NEED] : { + entityName: "MedicalNeed", + tableName: "MedicalNeed", + fieldMetadata: { + 'record: {columnName: "record"}, + itemItemId: {columnName: "itemItemId"}, + beneficiaryId: {columnName: "beneficiaryId"}, + 'time: {columnName: "time"}, + urgency: {columnName: "urgency"}, + quantity: {columnName: "quantity"}, + "item.itemId": {relation: {entityName: "item", refField: "itemId"}}, + "item.string": {relation: {entityName: "item", refField: "string"}}, + "item.type": {relation: {entityName: "item", refField: "type"}}, + "item.unit": {relation: {entityName: "item", refField: "unit"}} + }, + keyFields: ["record"], + joinMetadata: {item: {entity: MedicalItem, fieldName: "item", refTable: "MedicalItem", refColumns: ["itemId"], joinColumns: ["itemItemId"], 'type: psql:ONE_TO_ONE}} + }, + [MEDICAL_ITEM] : { + entityName: "MedicalItem", + tableName: "MedicalItem", + fieldMetadata: { + itemId: {columnName: "itemId"}, + 'string: {columnName: "string"}, + 'type: {columnName: "type"}, + unit: {columnName: "unit"}, + "need.record": {relation: {entityName: "need", refField: "record"}}, + "need.itemItemId": {relation: {entityName: "need", refField: "itemItemId"}}, + "need.beneficiaryId": {relation: {entityName: "need", refField: "beneficiaryId"}}, + "need.time": {relation: {entityName: "need", refField: "time"}}, + "need.urgency": {relation: {entityName: "need", refField: "urgency"}}, + "need.quantity": {relation: {entityName: "need", refField: "quantity"}} + }, + keyFields: ["itemId"], + joinMetadata: {need: {entity: MedicalNeed, fieldName: "need", refTable: "MedicalNeed", refColumns: ["itemItemId"], joinColumns: ["itemId"], 'type: psql:ONE_TO_ONE}} + } + }; + + public isolated function init() returns persist:Error? { + mysql:Client|error dbClient = new (host = host, user = user, password = password, database = database, port = port, options = connectionOptions); + if dbClient is error { + return error(dbClient.message()); + } + self.dbClient = dbClient; + self.persistClients = { + [MEDICAL_NEED] : check new (dbClient, self.metadata.get(MEDICAL_NEED), psql:MYSQL_SPECIFICS), + [MEDICAL_ITEM] : check new (dbClient, self.metadata.get(MEDICAL_ITEM), psql:MYSQL_SPECIFICS) + }; + } + + isolated resource function get medicalneeds(MedicalNeedTargetType targetType = <>, sql:ParameterizedQuery whereClause = ``, sql:ParameterizedQuery orderByClause = ``, sql:ParameterizedQuery limitClause = ``, sql:ParameterizedQuery groupByClause = ``) returns stream = @java:Method { + 'class: "io.ballerina.stdlib.persist.sql.datastore.MySQLProcessor", + name: "query" + } external; + + isolated resource function get medicalneeds/[int 'record](MedicalNeedTargetType targetType = <>) returns targetType|persist:Error = @java:Method { + 'class: "io.ballerina.stdlib.persist.sql.datastore.MySQLProcessor", + name: "queryOne" + } external; + + isolated resource function post medicalneeds(MedicalNeedInsert[] data) returns int[]|persist:Error { + psql:SQLClient sqlClient; + lock { + sqlClient = self.persistClients.get(MEDICAL_NEED); + } + _ = check sqlClient.runBatchInsertQuery(data); + return from MedicalNeedInsert inserted in data + select inserted.'record; + } + + isolated resource function put medicalneeds/[int 'record](MedicalNeedUpdate value) returns MedicalNeed|persist:Error { + psql:SQLClient sqlClient; + lock { + sqlClient = self.persistClients.get(MEDICAL_NEED); + } + _ = check sqlClient.runUpdateQuery('record, value); + return self->/medicalneeds/['record].get(); + } + + isolated resource function delete medicalneeds/[int 'record]() returns MedicalNeed|persist:Error { + MedicalNeed result = check self->/medicalneeds/['record].get(); + psql:SQLClient sqlClient; + lock { + sqlClient = self.persistClients.get(MEDICAL_NEED); + } + _ = check sqlClient.runDeleteQuery('record); + return result; + } + + isolated resource function get medicalitems(MedicalItemTargetType targetType = <>, sql:ParameterizedQuery whereClause = ``, sql:ParameterizedQuery orderByClause = ``, sql:ParameterizedQuery limitClause = ``, sql:ParameterizedQuery groupByClause = ``) returns stream = @java:Method { + 'class: "io.ballerina.stdlib.persist.sql.datastore.MySQLProcessor", + name: "query" + } external; + + isolated resource function get medicalitems/[int itemId](MedicalItemTargetType targetType = <>) returns targetType|persist:Error = @java:Method { + 'class: "io.ballerina.stdlib.persist.sql.datastore.MySQLProcessor", + name: "queryOne" + } external; + + isolated resource function post medicalitems(MedicalItemInsert[] data) returns int[]|persist:Error { + psql:SQLClient sqlClient; + lock { + sqlClient = self.persistClients.get(MEDICAL_ITEM); + } + _ = check sqlClient.runBatchInsertQuery(data); + return from MedicalItemInsert inserted in data + select inserted.itemId; + } + + isolated resource function put medicalitems/[int itemId](MedicalItemUpdate value) returns MedicalItem|persist:Error { + psql:SQLClient sqlClient; + lock { + sqlClient = self.persistClients.get(MEDICAL_ITEM); + } + _ = check sqlClient.runUpdateQuery(itemId, value); + return self->/medicalitems/[itemId].get(); + } + + isolated resource function delete medicalitems/[int itemId]() returns MedicalItem|persist:Error { + MedicalItem result = check self->/medicalitems/[itemId].get(); + psql:SQLClient sqlClient; + lock { + sqlClient = self.persistClients.get(MEDICAL_ITEM); + } + _ = check sqlClient.runDeleteQuery(itemId); + return result; + } + + remote isolated function queryNativeSQL(sql:ParameterizedQuery sqlQuery, typedesc rowType = <>) returns stream = @java:Method { + 'class: "io.ballerina.stdlib.persist.sql.datastore.MySQLProcessor" + } external; + + remote isolated function executeNativeSQL(sql:ParameterizedQuery sqlQuery) returns psql:ExecutionResult|persist:Error = @java:Method { + 'class: "io.ballerina.stdlib.persist.sql.datastore.MySQLProcessor" + } external; + + public isolated function close() returns persist:Error? { + error? result = self.dbClient.close(); + if result is error { + return error(result.message()); + } + return result; + } +} + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_db_config.bal new file mode 100644 index 000000000..aedfe37e0 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_db_config.bal @@ -0,0 +1,12 @@ +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is an auto-generated file by Ballerina persistence layer. +// It should not be modified by hand. +import ballerinax/mysql; + +configurable int port = ?; +configurable string host = ?; +configurable string user = ?; +configurable string database = ?; +configurable string password = ?; +configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_types.bal new file mode 100644 index 000000000..8ecdd2e0b --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_types.bal @@ -0,0 +1,69 @@ +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is an auto-generated file by Ballerina persistence layer for model. +// It should not be modified by hand. +import ballerina/time; + +public type MedicalNeed record {| + readonly int 'record; + int itemItemId; + int beneficiaryId; + time:Civil 'time; + string urgency; + int quantity; +|}; + +public type MedicalNeedOptionalized record {| + int 'record?; + int itemItemId?; + int beneficiaryId?; + time:Civil 'time?; + string urgency?; + int quantity?; +|}; + +public type MedicalNeedWithRelations record {| + *MedicalNeedOptionalized; + MedicalItemOptionalized item?; +|}; + +public type MedicalNeedTargetType typedesc; + +public type MedicalNeedInsert MedicalNeed; + +public type MedicalNeedUpdate record {| + int itemItemId?; + int beneficiaryId?; + time:Civil 'time?; + string urgency?; + int quantity?; +|}; + +public type MedicalItem record {| + readonly int itemId; + string 'string; + string 'type; + string unit; +|}; + +public type MedicalItemOptionalized record {| + int itemId?; + string 'string?; + string 'type?; + string unit?; +|}; + +public type MedicalItemWithRelations record {| + *MedicalItemOptionalized; + MedicalNeedOptionalized need?; +|}; + +public type MedicalItemTargetType typedesc; + +public type MedicalItemInsert MedicalItem; + +public type MedicalItemUpdate record {| + string 'string?; + string 'type?; + string unit?; +|}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/script.sql new file mode 100644 index 000000000..ec4672b8a --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/script.sql @@ -0,0 +1,26 @@ +-- AUTO-GENERATED FILE. + +-- This file is an auto-generated file by Ballerina persistence layer for model. +-- Please verify the generated scripts and execute them against the target DB server. + +DROP TABLE IF EXISTS `MedicalNeed`; +DROP TABLE IF EXISTS `MedicalItem`; + +CREATE TABLE `MedicalItem` ( + `itemId` INT NOT NULL, + `string` VARCHAR(191) NOT NULL, + `type` VARCHAR(191) NOT NULL, + `unit` VARCHAR(191) NOT NULL, + PRIMARY KEY(`itemId`) +); + +CREATE TABLE `MedicalNeed` ( + `record` INT NOT NULL, + `beneficiaryId` INT NOT NULL, + `time` DATETIME NOT NULL, + `urgency` VARCHAR(191) NOT NULL, + `quantity` INT NOT NULL, + `itemItemId` INT UNIQUE NOT NULL, + FOREIGN KEY(`itemItemId`) REFERENCES `MedicalItem`(`itemId`), + PRIMARY KEY(`record`) +); diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Ballerina.toml index c44584f1f..f34c457bc 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_27.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml index f4687c315..4bcae7584 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_28.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Ballerina.toml index 67c4082b1..6fcf69b17 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_29.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/Ballerina.toml index e6c822d67..547b45580 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/Ballerina.toml @@ -7,6 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_3.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_30/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_30/Ballerina.toml index a608d5def..cf1c691ee 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_30/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_30/Ballerina.toml @@ -3,7 +3,3 @@ org = "foo" name = "persist_generate_30" version = "0.1.0" distribution = "2201.3.0" - -[persist] -datastore = "mysql" -module = "persist_generate_30.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Ballerina.toml index 07fe56f69..b8c46c619 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Ballerina.toml @@ -3,7 +3,3 @@ org = "foo" name = "persist_generate_31" version = "0.1.0" distribution = "2201.3.0" - -[persist] -datastore = "mysql" -module = "persist_generate_31.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/Ballerina.toml index 62255b6cc..f4906b295 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/Ballerina.toml @@ -3,7 +3,3 @@ org = "foo" name = "tool_test_generate_33" version = "0.1.0" distribution = "2201.3.0" - -[persist] -datastore = "mysql" -module = "tool_test_generate_33.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/Ballerina.toml index ee652a8f0..b8766b127 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_34.entities" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/Ballerina.toml index 80de2d270..b1f1ca6dd 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_35" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Ballerina.toml index 6e34194ee..f27ec1ed1 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_36.rainier" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/Ballerina.toml index cce4d95d1..58862bd09 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_generate_37.entities" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_38/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_38/Ballerina.toml index 26c866206..772580017 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_38/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_38/Ballerina.toml @@ -3,7 +3,3 @@ org = "foo" name = "tool_test_generate_38" version = "0.1.0" distribution = "2201.3.0" - -[persist] -datastore = "mysql" -module = "tool_test_generate_38.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/Ballerina.toml index beb368501..307fa68b7 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.4.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "tool_test_generate_39.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/Ballerina.toml index df5108497..be9b97025 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_generate_40.entities" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml index b4c6e7899..9d4c1c969 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "tool_test_generate_41.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_42/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_42/Ballerina.toml index 8c605f666..4588bac5e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_42/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_42/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "my" -module = "tool_test_generate_42.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_43/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_43/Ballerina.toml index 86368aa00..2af7ffecf 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_43/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_43/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_44/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_44/Ballerina.toml index 953c6dff6..13f82546b 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_44/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_44/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = ".test" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_45/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_45/Ballerina.toml index aaf8d3c20..2d0429d5c 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_45/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_45/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "^^^" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/Ballerina.toml index f47310a02..5345faafd 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "tool_test_generate_46.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/Ballerina.toml index 74199b3f5..d31266eb9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_47.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/Ballerina.toml index 5d43e93b2..bfe6af446 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_48.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/Ballerina.toml index 62797d838..3a0f46289 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_49.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Ballerina.toml index dc4bd510c..a793dba44 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Ballerina.toml @@ -7,6 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_5.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Ballerina.toml index ee4710a08..20ee7fdc9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_50" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Ballerina.toml index e8260e54f..288c9f7b5 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_51" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/Ballerina.toml index 89bedfe90..4f4125e60 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_52.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/Ballerina.toml index 89bedfe90..4f4125e60 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_52.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Ballerina.toml index 85c8c86c2..420e1668d 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "googlesheets" -module = "persist_generate_54.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/Ballerina.toml index eec6258f7..44dc93d9a 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "inmemory" -module = "persist_generate_55.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Ballerina.toml index 08144aa3b..cde86b055 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "googlesheets" -module = "persist_generate_56.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/Ballerina.toml index 134df282e..70181221d 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "googlesheets" -module = "persist_generate_57.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/Ballerina.toml index 0ca96ce15..00bdc5c97 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_58.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/Ballerina.toml index 35c202692..dae2dcf06 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_59.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/Ballerina.toml index 8d8024f81..f0f8b241d 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_6.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/Ballerina.toml index 19d280229..98356bbaf 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_60.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/Ballerina.toml index 32d5f1397..03c17bde0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_61.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/Ballerina.toml index e1c484e81..04c2eac16 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_62.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/Ballerina.toml index 10e042a32..5915d250a 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mssql" -module = "persist_generate_63.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/Ballerina.toml index 482acd83e..abdaf9d2f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/Ballerina.toml @@ -7,7 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_64.x.y.z" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Ballerina.toml index 0b7fa8d00..00de15201 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_65" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Ballerina.toml index c713a6195..aef3dee4b 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_66.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/Ballerina.toml index 4a8bd52b4..0026cd374 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_67.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/Ballerina.toml index 5ea6bfed2..4494ad040 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_68.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/Ballerina.toml index dc7d1c56f..6ef2f1d6e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_69.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/Ballerina.toml index db55d1407..9b0c5039e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/Ballerina.toml @@ -7,6 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_7.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/Ballerina.toml index 0917b2c5d..5a812940b 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_70.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/Ballerina.toml index 7f7606c1e..d3b063c56 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "postgresql" -module = "persist_generate_71.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/Ballerina.toml index ac1cf861d..46f2573cc 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/Ballerina.toml @@ -6,7 +6,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false - -[persist] -datastore = "mysql" -module = "persist_generate_8.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/Ballerina.toml index f69ac68cc..20f4df2be 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/Ballerina.toml @@ -7,6 +7,3 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_9.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/Ballerina.toml index d14ab9157..494196ba8 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/Ballerina.toml @@ -14,9 +14,10 @@ value = 2 array = [ [1, 0], [0, 1] ] -[persist] -datastore = "mysql" -module = "persist_init_1" +[tool.persist] +id = "generate-db-client" +targetModule = "persist_init_1" +options.datastore = "mysql" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_12/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_12/Ballerina.toml index d9557b83c..fc751956b 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_12/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_12/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true -[persist] -datastore = "inmemory" -module = "persist_init_12.test" +[tool.persist] +id = "generate-db-client" +targetModule = "persist_init_12.test" +options.datastore = "inmemory" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_13/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_13/Ballerina.toml index 9ccad9bfc..ec75e8ba7 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_13/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_13/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mssql" -module = "persist_init_13" +[tool.persist] +id = "generate-db-client" +targetModule = "persist_init_13" +options.datastore = "mssql" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_14/Ballerina.toml index 0bc629ca4..eb4b4d955 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_14/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_14/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true -[persist] -datastore = "postgresql" -module = "persist_init_14" +[tool.persist] +id = "generate-db-client" +targetModule = "persist_init_14" +options.datastore = "postgresql" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/Ballerina.toml index d8ba5c664..d0538ef4f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/Ballerina.toml @@ -14,9 +14,10 @@ value = 2 array = [ [1, 0], [0, 1] ] -[persist] -datastore = "mysql" -module = "persist_init_3" +[tool.persist] +id = "generate-db-client" +targetModule = "persist_init_3" +options.datastore = "mysql" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/Ballerina.toml index 6bcb85451..bd0fb0642 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/Ballerina.toml @@ -14,9 +14,10 @@ user = "root" password = "test123" database = "persistdb" -[persist] -datastore = "mysql" -module = "persist_init_5" +[tool.persist] +id = "generate-db-client" +targetModule = "persist_init_5" +options.datastore = "mysql" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/Ballerina.toml index 0fa6900a9..1f553968b 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/Ballerina.toml @@ -7,7 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persist_init_6_old" +[tool.persist] +id = "persist_init_6" +targetModule = "persist_init_6_old" +options.datastore = "mysql" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/Ballerina.toml index 9177a551d..38807ee7f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persist_init_7" +[tool.persist] +id = "generate-db-client" +targetModule = "persist_init_7" +options.datastore = "mysql" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_9/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_9/Ballerina.toml index 01746409d..ba7bed59c 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_9/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_9/Ballerina.toml @@ -14,9 +14,10 @@ value = 2 array = [ [1, 0], [0, 1] ] -[persist] -datastore = "mysql" -module = "persist_init_9" +[tool.persist] +id = "generate-db-client" +targetModule = "persist_init_9" +options.datastore = "mysql" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java b/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java index 7e033d50c..757b1dcff 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java +++ b/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java @@ -48,6 +48,10 @@ private PersistToolsConstants() {} public static final String SQL_SCHEMA_FILE = "script.sql"; public static final String GOOGLE_SHEETS_SCHEMA_FILE = "script.gs"; public static final String PERSIST_DIRECTORY = "persist"; + public static final String TARGET_DIRECTORY = "target"; + public static final String GENERATE_CMD_FILE = "generatecmd.toml"; + public static final String PERSIST_TOOL_CONFIG = "tool.persist"; + public static final String GENERATED_DIRECTORY = "generated"; public static final String MIGRATIONS = "migrations"; public static final String BALLERINA_MYSQL_DRIVER_NAME = "ballerinax/mysql.driver"; public static final String BALLERINA_MSSQL_DRIVER_NAME = "ballerinax/mssql.driver"; diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java new file mode 100644 index 000000000..a11d26c6d --- /dev/null +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.persist.cmd; + +import io.ballerina.cli.BLauncherCmd; +import io.ballerina.persist.BalException; +import io.ballerina.persist.PersistToolsConstants; +import io.ballerina.persist.nodegenerator.syntax.utils.TomlSyntaxUtils; +import io.ballerina.projects.util.ProjectUtils; +import picocli.CommandLine; + +import java.io.IOException; +import java.io.PrintStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static io.ballerina.persist.PersistToolsConstants.PERSIST_DIRECTORY; +import static io.ballerina.persist.PersistToolsConstants.SUPPORTED_DB_PROVIDERS; +import static io.ballerina.persist.nodegenerator.syntax.constants.BalSyntaxConstants.BAL_EXTENSION; +import static io.ballerina.projects.util.ProjectConstants.BALLERINA_TOML; + +@CommandLine.Command( + name = "add", + description = "Initialize the persistence layer in the Ballerina project.") +public class Add implements BLauncherCmd { + + private static final PrintStream errStream = System.err; + + private final String sourcePath; + + private static final String COMMAND_IDENTIFIER = "persist-add"; + + @CommandLine.Option(names = {"-h", "--help"}, hidden = true) + private boolean helpFlag; + + @CommandLine.Option(names = {"--datastore"}) + private String datastore; + + @CommandLine.Option(names = {"--module"}) + private String module; + + @CommandLine.Option(names = {"--id"}, description = "ID for the generated Ballerina client") + private String id; + + // TODO: Check if we need this command line option + @CommandLine.Option(names = {"-p", "--package"}, description = "Location for the Ballerina package") + private String packagePath; + + public Add() { + this(""); + } + + public Add(String sourcePath) { + this.sourcePath = sourcePath; + } + + @Override + public void execute() { + String packageName; + if (helpFlag) { + String commandUsageInfo = BLauncherCmd.getCommandUsageInfo(getName()); + errStream.println(commandUsageInfo); + return; + } + if (datastore == null) { + datastore = PersistToolsConstants.SupportedDataSources.IN_MEMORY_TABLE; + } else if (!SUPPORTED_DB_PROVIDERS.contains(datastore)) { + errStream.printf("ERROR: the persist layer supports one of data stores: %s" + + ". but found '%s' datasource.%n", Arrays.toString(SUPPORTED_DB_PROVIDERS.toArray()), datastore); + return; + } + try { + packageName = TomlSyntaxUtils.readPackageName(this.sourcePath); + } catch (BalException e) { + errStream.println(e.getMessage()); + return; + } + if (module == null) { + module = packageName; + } else { + module = module.replaceAll("\"", ""); + } + if (!ProjectUtils.validateModuleName(module)) { + errStream.println("ERROR: invalid module name : '" + module + "' :\n" + + "module name can only contain alphanumerics, underscores and periods"); + return; + } else if (!ProjectUtils.validateNameLength(module)) { + errStream.println("ERROR: invalid module name : '" + module + "' :\n" + + "maximum length of module name is 256 characters"); + return; + } + if (!module.equals(packageName)) { + module = String.format("%s.%s", packageName.replaceAll("\"", ""), module); + } + try { + Path projectPath = Paths.get(sourcePath); + validateBallerinaProject(projectPath); + createDefaultClientId(); + String syntaxTree = TomlSyntaxUtils.updateBallerinaToml(Paths.get(this.sourcePath, BALLERINA_TOML), module, + datastore, id); + Utils.writeOutputString(syntaxTree, + Paths.get(this.sourcePath, BALLERINA_TOML).toAbsolutePath().toString()); + Path persistDirPath = Paths.get(this.sourcePath, PERSIST_DIRECTORY); + if (!Files.exists(persistDirPath)) { + try { + Files.createDirectory(persistDirPath.toAbsolutePath()); + } catch (IOException e) { + errStream.println("ERROR: failed to create the persist directory. " + e.getMessage()); + return; + } + } + List schemaFiles; + try (Stream stream = Files.list(persistDirPath)) { + schemaFiles = stream.filter(file -> !Files.isDirectory(file)) + .map(Path::getFileName) + .filter(Objects::nonNull) + .filter(file -> file.toString().toLowerCase(Locale.ENGLISH).endsWith(BAL_EXTENSION)) + .map(file -> file.toString().replace(BAL_EXTENSION, "")) + .collect(Collectors.toList()); + } catch (IOException e) { + errStream.println("ERROR: failed to list model definition files in the persist directory. " + + e.getMessage()); + return; + } + if (schemaFiles.size() > 1) { + errStream.println("ERROR: the persist directory allows only one model definition file, " + + "but contains many files."); + return; + } + if (schemaFiles.size() == 0) { + try { + Utils.generateSchemaBalFile(persistDirPath); + } catch (BalException e) { + errStream.println("ERROR: failed to create the model definition file in persist directory. " + + e.getMessage()); + return; + } + } + } catch (BalException | IOException e) { + errStream.printf("ERROR: failed to generate types and client for the definition file(%s). %s%n", + "Ballerina.toml", e.getMessage()); + } + } + + @Override + public String getName() { + return "add"; + } + + @Override + public void printLongDesc(StringBuilder stringBuilder) { + + } + + @Override + public void printUsage(StringBuilder stringBuilder) { + + } + + @Override + public void setParentCmdParser(CommandLine commandLine) { + + } + + private static void validateBallerinaProject(Path projectPath) throws BalException { + Optional ballerinaToml = Optional.empty(); + try (Stream stream = Files.list(projectPath)) { + ballerinaToml = stream.filter(file -> !Files.isDirectory(file)) + .map(Path::getFileName) + .filter(Objects::nonNull) + .filter(file -> BALLERINA_TOML.equals(file.toString())) + .findFirst(); + } catch (IOException e) { + errStream.printf("ERROR: Invalid Ballerina package", projectPath.toAbsolutePath(), e.getMessage()); + } + if (ballerinaToml.isEmpty()) { + throw new BalException(String.format("ERROR: invalid Ballerina package directory: %s, " + + "cannot find 'Ballerina.toml' file.%n", projectPath.toAbsolutePath())); + } + } + + private void createDefaultClientId() { + if (id == null || id.isBlank()) { + id = "generate-db-client"; + } + } +} diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/CmdOptions.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/CmdOptions.java new file mode 100644 index 000000000..9c4304815 --- /dev/null +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/CmdOptions.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.persist.cmd; + +/** + * This builder class for contains the all the option for use CLI. + */ +public class CmdOptions { + private final String outputModule; + private final String id; + private final String datastore; + + private CmdOptions(CmdOptionsBuilder builder) { + this.outputModule = builder.outputModule; + this.id = builder.id; + this.datastore = builder.datastore; + } + + public String getOutputModule() { + return outputModule; + } + + public String getId() { + return id; + } + + public String getDatastore() { + return datastore; + } + + /** + * CMD options builder class. + */ + public static class CmdOptionsBuilder { + private String outputModule; + private String id; + private String datastore; + + public CmdOptionsBuilder withOutputModule(String outputModule) { + this.outputModule = outputModule; + return this; + } + + public CmdOptionsBuilder withId(String id) { + this.id = id; + return this; + } + + public CmdOptionsBuilder withDatastore(String datastore) { + this.datastore = datastore; + return this; + } + + public CmdOptions build() { + return new CmdOptions(this); + } + } +} + diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java index 638072431..006d03006 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java @@ -26,6 +26,13 @@ import io.ballerina.persist.nodegenerator.syntax.utils.TomlSyntaxUtils; import io.ballerina.persist.utils.BalProjectUtils; import io.ballerina.projects.util.ProjectUtils; +import io.ballerina.toml.syntax.tree.DocumentMemberDeclarationNode; +import io.ballerina.toml.syntax.tree.DocumentNode; +import io.ballerina.toml.syntax.tree.NodeList; +import io.ballerina.toml.syntax.tree.SyntaxTree; +import io.ballerina.toml.syntax.tree.TableNode; +import io.ballerina.tools.text.TextDocument; +import io.ballerina.tools.text.TextDocuments; import picocli.CommandLine; import java.io.IOException; @@ -34,7 +41,8 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; -import java.util.HashMap; + +import static io.ballerina.persist.PersistToolsConstants.PERSIST_DIRECTORY; /** * This Class implements the `persist generate` command in Ballerina persist-tool. @@ -65,10 +73,15 @@ public Generate(String sourcePath) { @CommandLine.Option(names = {"-h", "--help"}, hidden = true) private boolean helpFlag; + @CommandLine.Option(names = {"--module"}) + private String module; + + @CommandLine.Option(names = {"--datastore"}) + private String datastore; + @Override public void execute() { Path generatedSourceDirPath = Paths.get(this.sourcePath, BalSyntaxConstants.GENERATED_SOURCE_DIRECTORY); - String datastore; Module entityModule; Path schemaFilePath; String packageName; @@ -78,6 +91,13 @@ public void execute() { errStream.println(commandUsageInfo); return; } + if (datastore == null) { + errStream.println("ERROR: datastore is required"); + return; + } + if (module == null) { + module = "generated"; + } Path projectPath = Paths.get(sourcePath); try { BalProjectUtils.validateBallerinaProject(projectPath); @@ -93,46 +113,77 @@ public void execute() { return; } + boolean hasPersistConfig; try { - HashMap ballerinaTomlConfig = TomlSyntaxUtils.readBallerinaTomlConfig( - Paths.get(this.sourcePath, "Ballerina.toml")); - moduleNameWithPackageName = ballerinaTomlConfig.get("module").trim(); - if (!moduleNameWithPackageName.equals(packageName)) { - if (!moduleNameWithPackageName.startsWith(packageName + ".")) { - errStream.println("ERROR: invalid module name : '" + ballerinaTomlConfig.get("module") + "' :\n" + - "module name should follow the template ."); - return; - } - String moduleName = moduleNameWithPackageName.replace(packageName + ".", ""); - if (!ProjectUtils.validateModuleName(moduleName)) { - errStream.println("ERROR: invalid module name : '" + moduleName + "' :\n" + - "module name can only contain alphanumerics, underscores and periods"); - return; - } else if (!ProjectUtils.validateNameLength(moduleName)) { - errStream.println("ERROR: invalid module name : '" + moduleName + "' :\n" + - "maximum length of module name is 256 characters"); - return; - } - generatedSourceDirPath = generatedSourceDirPath.resolve(moduleName); - } - datastore = ballerinaTomlConfig.get("datastore").trim(); - if (!PersistToolsConstants.SUPPORTED_DB_PROVIDERS.contains(datastore)) { - errStream.printf("ERROR: the persist layer supports one of data stores: %s" + - ". but found '%s' datasource.%n", - Arrays.toString(PersistToolsConstants.SUPPORTED_DB_PROVIDERS.toArray()), datastore); + hasPersistConfig = hasPersistConfig(Paths.get(this.sourcePath, "Ballerina.toml")); + } catch (BalException e) { + errStream.printf("ERROR: The project does not contain a toml file"); + return; + } + // Check if there are previous persist configurations. + if (hasPersistConfig) { + errStream.println("The behavior of the `bal persist generate` command has been updated starting " + + "from Ballerina update 09."); + errStream.println("You now have the following options for code generation:"); + errStream.println(System.lineSeparator() + "- `bal persist add --datastore --module `" + + ": This command adds an entry to \"Ballerina.toml\" to integrate code generation with the " + + "package build process."); + errStream.println("- `bal persist generate --datastore --module `: This command " + + "performs a one-time generation of the client."); + errStream.println(System.lineSeparator() + "If you choose to proceed with the `bal persist generate` " + + "command, please follow these steps:"); + errStream.println(System.lineSeparator() + "1. Remove the [persist] configuration in the " + + "\"Ballerina.toml\" file."); + errStream.println("2. Delete any previously generated source files, if they exist."); + errStream.println("3. Re-execute the `bal persist generate --datastore --module `" + + " command."); + errStream.println(System.lineSeparator() + "If you have any questions or need further assistance, refer" + + " to the updated documentation."); + return; + } +// moduleNameWithPackageName = packageName; +// if (!module.equals(packageName)) { +// if (!ProjectUtils.validateModuleName(module)) { +// errStream.println("ERROR: invalid module name : '" + module + "' :\n" + +// "module name can only contain alphanumerics, underscores and periods"); +// return; +// } else if (!ProjectUtils.validateNameLength(module)) { +// errStream.println("ERROR: invalid module name : '" + module + "' :\n" + +// "maximum length of module name is 256 characters"); +// return; +// } +// } + moduleNameWithPackageName = module; + if (!moduleNameWithPackageName.equals(packageName)) { + if (!moduleNameWithPackageName.startsWith(packageName + ".")) { + errStream.println("ERROR: invalid module name : '" + module + "' :\n" + + "module name should follow the template ."); return; } - if (Files.isDirectory(Paths.get(sourcePath, PersistToolsConstants.PERSIST_DIRECTORY, - PersistToolsConstants.MIGRATIONS)) && - !datastore.equals(PersistToolsConstants.SupportedDataSources.MYSQL_DB)) { - errStream.println("ERROR: regenerating the client with a different datastore after executing " + - "the migrate command is not permitted. please remove the migrations directory within the " + - "persist directory and try executing the command again."); + String moduleName = moduleNameWithPackageName.replace(packageName + ".", ""); + if (!ProjectUtils.validateModuleName(moduleName)) { + errStream.println("ERROR: invalid module name : '" + moduleName + "' :\n" + + "module name can only contain alphanumerics, underscores and periods"); + return; + } else if (!ProjectUtils.validateNameLength(moduleName)) { + errStream.println("ERROR: invalid module name : '" + moduleName + "' :\n" + + "maximum length of module name is 256 characters"); return; } - } catch (BalException e) { - errStream.printf("ERROR: failed to generate types and client for the definition file(%s). %s%n", - "Ballerina.toml", e.getMessage()); + generatedSourceDirPath = generatedSourceDirPath.resolve(moduleName); + } + if (!PersistToolsConstants.SUPPORTED_DB_PROVIDERS.contains(datastore)) { + errStream.printf("ERROR: the persist layer supports one of data stores: %s" + + ". but found '%s' datasource.%n", + Arrays.toString(PersistToolsConstants.SUPPORTED_DB_PROVIDERS.toArray()), datastore); + return; + } + if (Files.isDirectory(Paths.get(sourcePath, PersistToolsConstants.PERSIST_TOOL_CONFIG, + PersistToolsConstants.MIGRATIONS)) && + !datastore.equals(PersistToolsConstants.SupportedDataSources.MYSQL_DB)) { + errStream.println("ERROR: regenerating the client with a different datastore after executing " + + "the migrate command is not permitted. please remove the migrations directory within the " + + "persist directory and try executing the command again."); return; } @@ -150,6 +201,7 @@ public void execute() { } try { + BalProjectUtils.updateToml(sourcePath, datastore, module); BalProjectUtils.validateSchemaFile(schemaFilePath); Module module = BalProjectUtils.getEntities(schemaFilePath); if (module.getEntityMap().isEmpty()) { @@ -158,7 +210,7 @@ public void execute() { return; } entityModule = module; - } catch (BalException e) { + } catch (BalException | IOException e) { errStream.printf("ERROR: failed to generate types and client for the definition file(%s). %s%n", schemaFilePath.getFileName(), e.getMessage()); return; @@ -193,7 +245,7 @@ public void execute() { datastore, e.getMessage())); return; } - errStream.println("Persist client and entity types generated successfully in the ./generated directory."); + errStream.println("Persist client and entity types generated successfully in the " + module + " directory."); } @Override @@ -217,4 +269,28 @@ public void printUsage(StringBuilder stringBuilder) { stringBuilder.append(" ballerina " + PersistToolsConstants.COMPONENT_IDENTIFIER + " generate"). append(System.lineSeparator()); } + + public static boolean hasPersistConfig(Path configPath) throws BalException { + TextDocument configDocument = null; + try { + configDocument = TextDocuments.from(Files.readString(configPath)); + } catch (IOException e) { + errStream.println("ERROR: failed to read the toml file: " + e.getMessage()); + } + SyntaxTree syntaxTree = SyntaxTree.from(configDocument); + DocumentNode rootNote = syntaxTree.rootNode(); + NodeList nodeList = rootNote.members(); + boolean dbConfigExists = false; + for (DocumentMemberDeclarationNode member : nodeList) { + if (member instanceof TableNode) { + TableNode node = (TableNode) member; + String tableName = node.identifier().toSourceCode().trim(); + if (tableName.equals(PERSIST_DIRECTORY)) { + dbConfigExists = true; + break; + } + } + } + return dbConfigExists; + } } diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Init.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Init.java index f0c704196..5eb0b38fc 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Init.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Init.java @@ -18,30 +18,14 @@ package io.ballerina.persist.cmd; import io.ballerina.cli.BLauncherCmd; -import io.ballerina.compiler.syntax.tree.AbstractNodeFactory; -import io.ballerina.compiler.syntax.tree.ImportDeclarationNode; -import io.ballerina.compiler.syntax.tree.ModuleMemberDeclarationNode; -import io.ballerina.compiler.syntax.tree.ModulePartNode; -import io.ballerina.compiler.syntax.tree.NodeFactory; -import io.ballerina.compiler.syntax.tree.NodeList; -import io.ballerina.compiler.syntax.tree.NodeParser; -import io.ballerina.compiler.syntax.tree.SyntaxTree; -import io.ballerina.compiler.syntax.tree.Token; import io.ballerina.persist.BalException; import io.ballerina.persist.PersistToolsConstants; import io.ballerina.persist.nodegenerator.syntax.constants.BalSyntaxConstants; -import io.ballerina.persist.nodegenerator.syntax.utils.TomlSyntaxUtils; import io.ballerina.projects.util.ProjectUtils; -import io.ballerina.tools.text.TextDocument; -import io.ballerina.tools.text.TextDocuments; -import org.ballerinalang.formatter.core.Formatter; -import org.ballerinalang.formatter.core.FormatterException; import picocli.CommandLine; import java.io.IOException; import java.io.PrintStream; -import java.io.PrintWriter; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -55,12 +39,10 @@ import static io.ballerina.persist.PersistToolsConstants.COMPONENT_IDENTIFIER; import static io.ballerina.persist.PersistToolsConstants.MIGRATIONS; import static io.ballerina.persist.PersistToolsConstants.PERSIST_DIRECTORY; -import static io.ballerina.persist.PersistToolsConstants.SCHEMA_FILE_NAME; import static io.ballerina.persist.PersistToolsConstants.SUPPORTED_DB_PROVIDERS; import static io.ballerina.persist.nodegenerator.syntax.constants.BalSyntaxConstants.BAL_EXTENSION; import static io.ballerina.persist.nodegenerator.syntax.utils.TomlSyntaxUtils.readPackageName; import static io.ballerina.persist.utils.BalProjectUtils.validateBallerinaProject; -import static io.ballerina.projects.util.ProjectConstants.BALLERINA_TOML; /** * Class to implement "persist init" command for ballerina. @@ -152,16 +134,16 @@ public void execute() { "maximum length of module name is 256 characters"); return; } - try { - String moduleName = packageName; - if (!module.equals(packageName)) { - moduleName = String.format("%s.%s", packageName.replaceAll("\"", ""), module); - } - updateBallerinaToml(moduleName, datastore); - } catch (BalException e) { - errStream.println("ERROR: failed to add persist configurations in the toml file. " + e.getMessage()); - return; - } +// try { +// String moduleName = packageName; +// if (!module.equals(packageName)) { +// moduleName = String.format("%s.%s", packageName.replaceAll("\"", ""), module); +// } +// updateBallerinaToml(moduleName, datastore); +// } catch (BalException e) { +// errStream.println("ERROR: failed to add persist configurations in the toml file. " + e.getMessage()); +// return; +// } Path persistDirPath = Paths.get(this.sourcePath, PERSIST_DIRECTORY); if (!Files.exists(persistDirPath)) { @@ -192,14 +174,13 @@ public void execute() { } if (schemaFiles.size() == 0) { try { - generateSchemaBalFile(persistDirPath); + Utils.generateSchemaBalFile(persistDirPath); } catch (BalException e) { errStream.println("ERROR: failed to create the model definition file in persist directory. " + e.getMessage()); return; } } - errStream.println("Initialized the package for persistence."); errStream.println(System.lineSeparator() + "Next steps:"); @@ -209,46 +190,27 @@ public void execute() { } - private void generateSchemaBalFile(Path persistPath) throws BalException { - try { - String configTree = generateSchemaSyntaxTree(); - writeOutputString(configTree, persistPath.resolve(SCHEMA_FILE_NAME + BAL_EXTENSION) - .toAbsolutePath().toString()); - } catch (Exception e) { - throw new BalException(e.getMessage()); - } - } - - private void updateBallerinaToml(String module, String datastore) throws BalException { - try { - String syntaxTree = TomlSyntaxUtils.updateBallerinaToml( - Paths.get(this.sourcePath, BALLERINA_TOML), module, datastore); - writeOutputString(syntaxTree, - Paths.get(this.sourcePath, BALLERINA_TOML).toAbsolutePath().toString()); - } catch (Exception e) { - throw new BalException("could not update the Ballerina.toml with persist configurations. " + - e.getMessage()); - } - } - - private void writeOutputString(String content, String outPath) throws Exception { - Path pathToFile = Paths.get(outPath); - Path parentDirectory = pathToFile.getParent(); - if (Objects.nonNull(parentDirectory)) { - if (!Files.exists(parentDirectory)) { - try { - Files.createDirectories(parentDirectory); - } catch (IOException e) { - throw new BalException( - String.format("could not create the parent directories of output path %s. %s", - parentDirectory, e.getMessage())); - } - } - try (PrintWriter writer = new PrintWriter(outPath, StandardCharsets.UTF_8)) { - writer.println(content); - } - } - } +// private void generateSchemaBalFile(Path persistPath) throws BalException { +// try { +// String configTree = generateSchemaSyntaxTree(); +// writeOutputString(configTree, persistPath.resolve(SCHEMA_FILE_NAME + BAL_EXTENSION) +// .toAbsolutePath().toString()); +// } catch (Exception e) { +// throw new BalException(e.getMessage()); +// } +// } + +// private void updateBallerinaToml(String module, String datastore) throws BalException { +// try { +// String syntaxTree = TomlSyntaxUtils.updateBallerinaToml( +// Paths.get(this.sourcePath, BALLERINA_TOML), module, datastore, ""); +// writeOutputString(syntaxTree, +// Paths.get(this.sourcePath, BALLERINA_TOML).toAbsolutePath().toString()); +// } catch (Exception e) { +// throw new BalException("could not update the Ballerina.toml with persist configurations. " + +// e.getMessage()); +// } +// } @Override public void setParentCmdParser(CommandLine parentCmdParser) { @@ -269,19 +231,4 @@ public void printUsage(StringBuilder stringBuilder) { stringBuilder.append(" ballerina " + COMPONENT_IDENTIFIER + " init").append(System.lineSeparator()); } - - private static String generateSchemaSyntaxTree() throws FormatterException { - NodeList imports = AbstractNodeFactory.createEmptyNodeList(); - NodeList moduleMembers = AbstractNodeFactory.createEmptyNodeList(); - - imports = imports.add(NodeParser.parseImportDeclaration("import ballerina/persist as _;")); - Token eofToken = AbstractNodeFactory.createIdentifierToken(BalSyntaxConstants.EMPTY_STRING); - ModulePartNode modulePartNode = NodeFactory.createModulePartNode(imports, moduleMembers, eofToken); - TextDocument textDocument = TextDocuments.from(BalSyntaxConstants.EMPTY_STRING); - SyntaxTree balTree = SyntaxTree.from(textDocument); - - // output cannot be SyntaxTree as it will overlap with Toml Syntax Tree in Init - // Command - return Formatter.format(balTree.modifyWith(modulePartNode).toSourceCode()); - } } diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCmd.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCmd.java index 8964ecc50..91a2cd1aa 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCmd.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCmd.java @@ -34,7 +34,7 @@ @CommandLine.Command( name = "persist", description = "generate database configurations.", - subcommands = {Init.class, Generate.class, Push.class, Migrate.class} + subcommands = {Init.class, Generate.class, Push.class, Migrate.class, Add.class} ) public class PersistCmd implements BLauncherCmd { diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Utils.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Utils.java new file mode 100644 index 000000000..191b77395 --- /dev/null +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Utils.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.persist.cmd; + +import io.ballerina.compiler.syntax.tree.AbstractNodeFactory; +import io.ballerina.compiler.syntax.tree.ImportDeclarationNode; +import io.ballerina.compiler.syntax.tree.ModuleMemberDeclarationNode; +import io.ballerina.compiler.syntax.tree.ModulePartNode; +import io.ballerina.compiler.syntax.tree.NodeFactory; +import io.ballerina.compiler.syntax.tree.NodeList; +import io.ballerina.compiler.syntax.tree.NodeParser; +import io.ballerina.compiler.syntax.tree.SyntaxTree; +import io.ballerina.compiler.syntax.tree.Token; +import io.ballerina.persist.BalException; +import io.ballerina.persist.nodegenerator.syntax.constants.BalSyntaxConstants; +import io.ballerina.tools.text.TextDocument; +import io.ballerina.tools.text.TextDocuments; +import org.ballerinalang.formatter.core.Formatter; +import org.ballerinalang.formatter.core.FormatterException; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Objects; + +import static io.ballerina.persist.PersistToolsConstants.SCHEMA_FILE_NAME; +import static io.ballerina.persist.nodegenerator.syntax.constants.BalSyntaxConstants.BAL_EXTENSION; + +public class Utils { + public static void generateSchemaBalFile(Path persistPath) throws BalException { + try { + String configTree = generateSchemaSyntaxTree(); + writeOutputString(configTree, persistPath.resolve(SCHEMA_FILE_NAME + BAL_EXTENSION) + .toAbsolutePath().toString()); + } catch (Exception e) { + throw new BalException(e.getMessage()); + } + } + + public static void writeOutputString(String content, String outPath) throws BalException, IOException { + Path pathToFile = Paths.get(outPath); + Path parentDirectory = pathToFile.getParent(); + if (Objects.nonNull(parentDirectory)) { + if (!Files.exists(parentDirectory)) { + try { + Files.createDirectories(parentDirectory); + } catch (IOException e) { + throw new BalException( + String.format("could not create the parent directories of output path %s. %s", + parentDirectory, e.getMessage())); + } + } + try (PrintWriter writer = new PrintWriter(outPath, StandardCharsets.UTF_8)) { + writer.println(content); + } + } + } + + public static void writeToTargetFile(String content, String outPath) throws BalException, IOException { + Path pathToFile = Paths.get(outPath); + Path parentDirectory = pathToFile.getParent(); + if (Objects.nonNull(parentDirectory)) { + if (!Files.exists(parentDirectory)) { + try { + Files.createDirectories(parentDirectory); + } catch (IOException e) { + throw new BalException( + String.format("could not create the parent directories of output path %s. %s", + parentDirectory, e.getMessage())); + } + } + File file = new File(pathToFile.toString()); + if (!file.exists()) { + boolean fileCreated = file.createNewFile(); + if (!fileCreated) { + throw new BalException( + String.format("Could not create the file in the output path %s.", outPath)); + } + } + try (PrintWriter writer = new PrintWriter(outPath, StandardCharsets.UTF_8)) { + writer.println(content); + } + } + } + + public static String generateSchemaSyntaxTree() throws FormatterException { + NodeList imports = AbstractNodeFactory.createEmptyNodeList(); + NodeList moduleMembers = AbstractNodeFactory.createEmptyNodeList(); + + imports = imports.add(NodeParser.parseImportDeclaration("import ballerina/persist as _;")); + Token eofToken = AbstractNodeFactory.createIdentifierToken(BalSyntaxConstants.EMPTY_STRING); + ModulePartNode modulePartNode = NodeFactory.createModulePartNode(imports, moduleMembers, eofToken); + TextDocument textDocument = TextDocuments.from(BalSyntaxConstants.EMPTY_STRING); + SyntaxTree balTree = SyntaxTree.from(textDocument); + + // output cannot be SyntaxTree as it will overlap with Toml Syntax Tree in Init + // Command + return Formatter.format(balTree.modifyWith(modulePartNode).toSourceCode()); + } +} diff --git a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java index 286982ca4..6ae196e81 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java +++ b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java @@ -113,7 +113,7 @@ public static HashMap readBallerinaTomlConfig(Path configPath) t if (member instanceof TableNode) { TableNode node = (TableNode) member; String tableName = node.identifier().toSourceCode().trim(); - if (tableName.equals(PersistToolsConstants.PERSIST_DIRECTORY)) { + if (tableName.equals(PersistToolsConstants.PERSIST_TOOL_CONFIG)) { dbConfigExists = true; for (KeyValueNode field : node.fields()) { persistConfig.put(field.identifier().toSourceCode().trim(), @@ -126,7 +126,7 @@ public static HashMap readBallerinaTomlConfig(Path configPath) t if (!dbConfigExists) { throw new BalException("the persist config doesn't exist in the Ballerina.toml. " + "add [persist] table with persist configurations."); - } else if (!persistConfig.containsKey("module") || !persistConfig.containsKey("datastore")) { + } else if (!persistConfig.containsKey("targetModule") || !persistConfig.containsKey("options.datastore")) { throw new BalException("the persist configurations does not exist under [persist] table."); } return persistConfig; @@ -167,8 +167,8 @@ public static String readPackageName(String sourcePath) throws BalException { /** * Method to update the Ballerina.toml with database configurations and persist dependency. */ - public static String updateBallerinaToml(Path configPath, String module, String datasource) throws IOException, - BalException { + public static String updateBallerinaToml(Path configPath, String module, String datasource, String id) + throws IOException, BalException { NodeList moduleMembers = AbstractNodeFactory.createEmptyNodeList(); Path fileNamePath = configPath.getFileName(); TextDocument configDocument = TextDocuments.from(Files.readString(configPath)); @@ -182,14 +182,13 @@ public static String updateBallerinaToml(Path configPath, String module, String SyntaxTree syntaxTree = SyntaxTree.from(configDocument, fileNamePath.toString()); DocumentNode rootNote = syntaxTree.rootNode(); NodeList nodeList = rootNote.members(); - for (DocumentMemberDeclarationNode member : nodeList) { boolean dependencyExists = false; if (member instanceof KeyValueNode) { moduleMembers = moduleMembers.add(member); } else if (member instanceof TableNode) { TableNode node = (TableNode) member; - if (node.identifier().toSourceCode().trim().equals(PersistToolsConstants.PERSIST_DIRECTORY)) { + if (node.identifier().toSourceCode().trim().equals(PersistToolsConstants.PERSIST_TOOL_CONFIG)) { throw new BalException("persist configuration already exists in the Ballerina.toml. " + "remove the existing configuration and try again."); } else { @@ -218,8 +217,8 @@ public static String updateBallerinaToml(Path configPath, String module, String } moduleMembers = BalProjectUtils.addNewLine(moduleMembers, 1); moduleMembers = moduleMembers.add(SampleNodeGenerator.createTable( - PersistToolsConstants.PERSIST_DIRECTORY, null)); - moduleMembers = populateBallerinaNodeList(moduleMembers, module, datasource); + PersistToolsConstants.PERSIST_TOOL_CONFIG, null)); + moduleMembers = populateBallerinaNodeList(moduleMembers, module, datasource, id); moduleMembers = BalProjectUtils.addNewLine(moduleMembers, 1); moduleMembers = moduleMembers.add(SampleNodeGenerator.createTableArray( BalSyntaxConstants.PERSIST_DEPENDENCY, null)); @@ -232,9 +231,10 @@ public static String updateBallerinaToml(Path configPath, String module, String } private static NodeList populateBallerinaNodeList( - NodeList moduleMembers, String module, String dataStore) { - moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("datastore", dataStore, null)); - moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("module", module, null)); + NodeList moduleMembers, String module, String dataStore, String id) { + moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("id", id, null)); + moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("targetModule", module, null)); + moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("options.datastore", dataStore, null)); return moduleMembers; } 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 5b9f0a8a5..665d3b66c 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 @@ -38,6 +38,7 @@ import io.ballerina.compiler.syntax.tree.TypeDescriptorNode; import io.ballerina.persist.BalException; import io.ballerina.persist.PersistToolsConstants; +import io.ballerina.persist.cmd.Utils; import io.ballerina.persist.models.Entity; import io.ballerina.persist.models.EntityField; import io.ballerina.persist.models.Enum; @@ -71,6 +72,8 @@ import java.util.stream.Stream; import static io.ballerina.compiler.syntax.tree.SyntaxKind.QUALIFIED_NAME_REFERENCE; +import static io.ballerina.persist.PersistToolsConstants.GENERATE_CMD_FILE; +import static io.ballerina.persist.PersistToolsConstants.TARGET_DIRECTORY; import static io.ballerina.projects.util.ProjectConstants.BALLERINA_TOML; /** @@ -105,6 +108,14 @@ 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" + + "module = \"" + module + "\""; + Path generatedCmdOutPath = Paths.get(sourcePath, TARGET_DIRECTORY, GENERATE_CMD_FILE); + Utils.writeToTargetFile(sourceContent, generatedCmdOutPath.toAbsolutePath().toString()); + } + public static void validateSchemaFile(Path schemaPath) throws BalException { BuildOptions.BuildOptionsBuilder buildOptionsBuilder = BuildOptions.builder(); buildOptionsBuilder.setOffline(true); From d1046d097c0e27c1840166c82b1436827b0e4698 Mon Sep 17 00:00:00 2001 From: bhashinee Date: Tue, 20 Feb 2024 11:02:05 +0530 Subject: [PATCH 02/22] Fix the test cases --- gradle.properties | 3 +- .../persist/tools/BuildCodeGeneratorTest.java | 4 + .../persist/tools/ToolingAddTest.java | 76 ++++---- .../Ballerina.toml | 2 +- .../main.bal | 0 .../Ballerina.toml | 2 +- .../main.bal | 0 .../persist/entities$# -.bal | 0 .../Ballerina.toml | 2 +- .../main.bal | 0 .../persist/model.bal | 0 .../Ballerina.toml | 2 +- .../main.bal | 0 .../persist/model.bal | 0 .../tool_test_add_13}/Ballerina.toml | 2 +- .../main.bal | 0 .../persist/model.bal | 0 .../Ballerina.toml | 2 +- .../main.bal | 0 .../persist/model.bal | 0 .../Ballerina.toml | 2 +- .../Config.toml | 0 .../generated/database_configuration.bal | 0 .../main.bal | 0 .../persist/persist_init_2.bal | 0 .../persist/test.bal | 0 .../Ballerina.toml | 2 +- .../Config.toml | 0 .../entities.bal | 0 .../generated/database_configuration.bal | 0 .../main.bal | 0 .../persist/model.bal | 0 .../readme.md | 0 .../Ballerina.toml | 2 +- .../Config.toml | 0 .../generated/database_configuration.bal | 0 .../main.bal | 0 .../persist/model.bal | 0 .../tool_test_add_6}/Ballerina.toml | 8 +- .../Config.toml | 0 .../generated/database_configuration.bal | 0 .../main.bal | 0 .../persist/model.bal | 0 .../input/tool_test_add_7/Ballerina.toml | 8 + .../Config.toml | 0 .../main.bal | 0 .../persist/model.bal | 0 .../input/tool_test_add_8/Ballerina.toml | 8 + .../main.bal | 0 .../tool_test_add_9}/Ballerina.toml | 2 +- .../main.bal | 0 .../persist/model.bal | 0 .../input/tool_test_db_push_1/Ballerina.toml | 7 +- .../input/tool_test_db_push_10/Ballerina.toml | 7 +- .../input/tool_test_db_push_11/Ballerina.toml | 7 +- .../input/tool_test_db_push_12/Ballerina.toml | 7 +- .../input/tool_test_db_push_13/Ballerina.toml | 7 +- .../input/tool_test_db_push_14/Ballerina.toml | 7 +- .../input/tool_test_db_push_15/Ballerina.toml | 7 +- .../input/tool_test_db_push_16/Ballerina.toml | 7 +- .../input/tool_test_db_push_17/Ballerina.toml | 7 +- .../input/tool_test_db_push_18/Ballerina.toml | 7 +- .../input/tool_test_db_push_19/Ballerina.toml | 7 +- .../input/tool_test_db_push_20/Ballerina.toml | 7 +- .../input/tool_test_db_push_21/Ballerina.toml | 7 +- .../input/tool_test_db_push_22/Ballerina.toml | 7 +- .../input/tool_test_db_push_23/Ballerina.toml | 7 +- .../input/tool_test_db_push_24/Ballerina.toml | 7 +- .../input/tool_test_db_push_25/Ballerina.toml | 7 +- .../input/tool_test_db_push_26/Ballerina.toml | 7 +- .../input/tool_test_db_push_27/Ballerina.toml | 7 +- .../input/tool_test_db_push_28/Ballerina.toml | 7 +- .../tool_test_db_push_29_mssql/Ballerina.toml | 7 +- .../input/tool_test_db_push_3/Ballerina.toml | 7 +- .../tool_test_db_push_30_mssql/Ballerina.toml | 7 +- .../tool_test_db_push_31_mssql/Ballerina.toml | 7 +- .../Ballerina.toml | 7 +- .../Ballerina.toml | 7 +- .../Ballerina.toml | 7 +- .../input/tool_test_db_push_4/Ballerina.toml | 7 +- .../input/tool_test_db_push_5/Ballerina.toml | 7 +- .../input/tool_test_db_push_7/Ballerina.toml | 7 +- .../input/tool_test_db_push_8/Ballerina.toml | 8 +- .../tool_test_generate_10/Ballerina.toml | 6 +- .../tool_test_generate_14/Ballerina.toml | 6 +- .../tool_test_generate_15/Ballerina.toml | 12 +- .../tool_test_generate_18/Ballerina.toml | 6 +- .../tool_test_generate_20/Ballerina.toml | 6 +- .../tool_test_generate_21/Ballerina.toml | 6 +- .../tool_test_generate_32/Ballerina.toml | 6 +- .../input/tool_test_init_11/Ballerina.toml | 8 - .../input/tool_test_init_13/Ballerina.toml | 8 - .../input/tool_test_init_14/Ballerina.toml | 8 - .../input/tool_test_migrate_1/Ballerina.toml | 7 +- .../input/tool_test_migrate_10/Ballerina.toml | 7 +- .../input/tool_test_migrate_11/Ballerina.toml | 7 +- .../input/tool_test_migrate_2/Ballerina.toml | 7 +- .../input/tool_test_migrate_3/Ballerina.toml | 7 +- .../input/tool_test_migrate_4/Ballerina.toml | 7 +- .../input/tool_test_migrate_5/Ballerina.toml | 7 +- .../input/tool_test_migrate_6/Ballerina.toml | 7 +- .../input/tool_test_migrate_7/Ballerina.toml | 7 +- .../input/tool_test_migrate_8/Ballerina.toml | 7 +- .../input/tool_test_migrate_9/Ballerina.toml | 7 +- .../Ballerina.toml | 7 +- .../main.bal | 0 .../persist/model.bal | 0 .../tool_test_add_10}/Ballerina.toml | 2 +- .../main.bal | 0 .../persist/entities$# -.bal | 0 .../output/tool_test_add_11/Ballerina.toml | 8 + .../main.bal | 0 .../persist/model.bal | 0 .../Ballerina.toml | 7 +- .../main.bal | 0 .../persist/model.bal | 0 .../Ballerina.toml | 7 +- .../main.bal | 0 .../persist/model.bal | 0 .../Ballerina.toml | 7 +- .../main.bal | 0 .../persist/model.bal | 0 .../Ballerina.toml | 2 +- .../Config.toml | 0 .../generated/database_configuration.bal | 0 .../main.bal | 0 .../persist/persist_init_2.bal | 0 .../persist/test.bal | 0 .../Ballerina.toml | 7 +- .../Config.toml | 0 .../entities.bal | 0 .../generated/database_configuration.bal | 0 .../main.bal | 0 .../persist/model.bal | 0 .../readme.md | 0 .../Ballerina.toml | 7 +- .../Config.toml | 0 .../generated/database_configuration.bal | 0 .../main.bal | 0 .../persist/model.bal | 0 .../tool_test_add_6}/Ballerina.toml | 8 +- .../Config.toml | 0 .../generated/database_configuration.bal | 0 .../main.bal | 0 .../persist/model.bal | 0 .../Ballerina.toml | 7 +- .../Config.toml | 0 .../main.bal | 0 .../persist/model.bal | 0 .../output/tool_test_add_8/Ballerina.toml | 8 + .../main.bal | 0 .../Ballerina.toml | 7 +- .../main.bal | 0 .../persist/model.bal | 0 .../output/tool_test_db_push_1/Ballerina.toml | 7 +- .../tool_test_db_push_10/Ballerina.toml | 7 +- .../tool_test_db_push_11/Ballerina.toml | 7 +- .../tool_test_db_push_12/Ballerina.toml | 7 +- .../tool_test_db_push_13/Ballerina.toml | 7 +- .../tool_test_db_push_14/Ballerina.toml | 7 +- .../tool_test_db_push_15/Ballerina.toml | 7 +- .../tool_test_db_push_16/Ballerina.toml | 7 +- .../tool_test_db_push_17/Ballerina.toml | 7 +- .../tool_test_db_push_18/Ballerina.toml | 7 +- .../tool_test_db_push_19/Ballerina.toml | 7 +- .../tool_test_db_push_20/Ballerina.toml | 7 +- .../tool_test_db_push_21/Ballerina.toml | 7 +- .../tool_test_db_push_22/Ballerina.toml | 7 +- .../tool_test_db_push_23/Ballerina.toml | 7 +- .../tool_test_db_push_24/Ballerina.toml | 7 +- .../tool_test_db_push_25/Ballerina.toml | 7 +- .../tool_test_db_push_26/Ballerina.toml | 7 +- .../tool_test_db_push_27/Ballerina.toml | 7 +- .../tool_test_db_push_28/Ballerina.toml | 7 +- .../tool_test_db_push_29_mssql/Ballerina.toml | 7 +- .../output/tool_test_db_push_3/Ballerina.toml | 7 +- .../tool_test_db_push_30_mssql/Ballerina.toml | 7 +- .../tool_test_db_push_31_mssql/Ballerina.toml | 7 +- .../Ballerina.toml | 7 +- .../Ballerina.toml | 7 +- .../Ballerina.toml | 7 +- .../output/tool_test_db_push_4/Ballerina.toml | 7 +- .../output/tool_test_db_push_5/Ballerina.toml | 7 +- .../output/tool_test_db_push_7/Ballerina.toml | 7 +- .../output/tool_test_db_push_8/Ballerina.toml | 8 +- .../tool_test_generate_10/Ballerina.toml | 2 +- .../tool_test_generate_14/Ballerina.toml | 2 +- .../tool_test_generate_15/Ballerina.toml | 4 +- .../tool_test_generate_18/Ballerina.toml | 2 +- .../tool_test_generate_20/Ballerina.toml | 2 +- .../tool_test_generate_21/Ballerina.toml | 2 +- .../generated/entities/persist_client.bal | 8 +- .../tool_test_generate_32/Ballerina.toml | 2 +- .../output/tool_test_init_11/Ballerina.toml | 8 - .../output/tool_test_migrate_1/Ballerina.toml | 7 +- .../tool_test_migrate_10/Ballerina.toml | 7 +- .../tool_test_migrate_11/Ballerina.toml | 7 +- .../output/tool_test_migrate_2/Ballerina.toml | 7 +- .../output/tool_test_migrate_3/Ballerina.toml | 7 +- .../output/tool_test_migrate_4/Ballerina.toml | 7 +- .../output/tool_test_migrate_5/Ballerina.toml | 7 +- .../output/tool_test_migrate_6/Ballerina.toml | 7 +- .../output/tool_test_migrate_7/Ballerina.toml | 7 +- .../output/tool_test_migrate_8/Ballerina.toml | 7 +- .../output/tool_test_migrate_9/Ballerina.toml | 7 +- .../persist/PersistToolsConstants.java | 1 + .../io/ballerina/persist/cmd/Generate.java | 10 +- .../io/ballerina/persist/cmd/Migrate.java | 2 +- .../persist/cmd/PersistCodeGeneratorTool.java | 171 ++++++++++++++++++ .../java/io/ballerina/persist/cmd/Push.java | 8 +- .../syntax/utils/TomlSyntaxUtils.java | 19 +- .../persist/utils/BalProjectUtils.java | 2 +- ...rina.projects.buildtools.CodeGeneratorTool | 1 + .../resources/persist-options-schema.json | 10 + .../src/main/resources/version.properties | 6 +- 215 files changed, 707 insertions(+), 428 deletions(-) create mode 100644 persist-cli-tests/src/test/java/io/ballerina/persist/tools/BuildCodeGeneratorTest.java rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_1 => tool_test_add_1}/Ballerina.toml (92%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_1 => tool_test_add_1}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_3 => tool_test_add_10}/Ballerina.toml (88%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_10 => tool_test_add_10}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_10 => tool_test_add_10}/persist/entities$# -.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_7 => tool_test_add_11}/Ballerina.toml (82%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_11 => tool_test_add_11}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_11 => tool_test_add_11}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_8 => tool_test_add_12}/Ballerina.toml (82%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_12 => tool_test_add_12}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_12 => tool_test_add_12}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/{output/tool_test_init_8 => input/tool_test_add_13}/Ballerina.toml (82%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_13 => tool_test_add_13}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_13 => tool_test_add_13}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_12 => tool_test_add_14}/Ballerina.toml (81%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_14 => tool_test_add_14}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_14 => tool_test_add_14}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_2 => tool_test_add_2}/Ballerina.toml (90%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_2 => tool_test_add_2}/Config.toml (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_2 => tool_test_add_2}/generated/database_configuration.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_2 => tool_test_add_2}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_2 => tool_test_add_2}/persist/persist_init_2.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_2 => tool_test_add_2}/persist/test.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_9 => tool_test_add_3}/Ballerina.toml (88%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_3 => tool_test_add_3}/Config.toml (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_3 => tool_test_add_3}/entities.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_3 => tool_test_add_3}/generated/database_configuration.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_3 => tool_test_add_3}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_3 => tool_test_add_3}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_4 => tool_test_add_4}/readme.md (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_5 => tool_test_add_5}/Ballerina.toml (90%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_5 => tool_test_add_5}/Config.toml (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_5 => tool_test_add_5}/generated/database_configuration.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_5 => tool_test_add_5}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_5 => tool_test_add_5}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/{output/tool_test_init_6 => input/tool_test_add_6}/Ballerina.toml (59%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_6 => tool_test_add_6}/Config.toml (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_6 => tool_test_add_6}/generated/database_configuration.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_6 => tool_test_add_6}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_6 => tool_test_add_6}/persist/model.bal (100%) create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/Ballerina.toml rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_7 => tool_test_add_7}/Config.toml (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_7 => tool_test_add_7}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_7 => tool_test_add_7}/persist/model.bal (100%) create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_add_8/Ballerina.toml rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_8 => tool_test_add_8}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/{output/tool_test_init_10 => input/tool_test_add_9}/Ballerina.toml (88%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_9 => tool_test_add_9}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/{tool_test_init_9 => tool_test_add_9}/persist/model.bal (100%) delete mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_init_11/Ballerina.toml delete mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_init_13/Ballerina.toml delete mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_init_14/Ballerina.toml rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_9 => tool_test_add_1}/Ballerina.toml (81%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_1 => tool_test_add_1}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_1 => tool_test_add_1}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/{input/tool_test_init_10 => output/tool_test_add_10}/Ballerina.toml (88%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_10 => tool_test_add_10}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_10 => tool_test_add_10}/persist/entities$# -.bal (100%) create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_add_11/Ballerina.toml rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_11 => tool_test_add_11}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_11 => tool_test_add_11}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_12 => tool_test_add_12}/Ballerina.toml (75%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_12 => tool_test_add_12}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_12 => tool_test_add_12}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_13 => tool_test_add_13}/Ballerina.toml (76%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_13 => tool_test_add_13}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_13 => tool_test_add_13}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_14 => tool_test_add_14}/Ballerina.toml (77%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_14 => tool_test_add_14}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_14 => tool_test_add_14}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_2 => tool_test_add_2}/Ballerina.toml (90%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_2 => tool_test_add_2}/Config.toml (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_2 => tool_test_add_2}/generated/database_configuration.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_2 => tool_test_add_2}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_2 => tool_test_add_2}/persist/persist_init_2.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_2 => tool_test_add_2}/persist/test.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_1 => tool_test_add_3}/Ballerina.toml (81%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_3 => tool_test_add_3}/Config.toml (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_3 => tool_test_add_3}/entities.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_3 => tool_test_add_3}/generated/database_configuration.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_3 => tool_test_add_3}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_3 => tool_test_add_3}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_4 => tool_test_add_4}/readme.md (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_5 => tool_test_add_5}/Ballerina.toml (83%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_5 => tool_test_add_5}/Config.toml (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_5 => tool_test_add_5}/generated/database_configuration.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_5 => tool_test_add_5}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_5 => tool_test_add_5}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/{input/tool_test_init_6 => output/tool_test_add_6}/Ballerina.toml (59%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_6 => tool_test_add_6}/Config.toml (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_6 => tool_test_add_6}/generated/database_configuration.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_6 => tool_test_add_6}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_6 => tool_test_add_6}/persist/model.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_7 => tool_test_add_7}/Ballerina.toml (77%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_7 => tool_test_add_7}/Config.toml (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_7 => tool_test_add_7}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_7 => tool_test_add_7}/persist/model.bal (100%) create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_add_8/Ballerina.toml rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_8 => tool_test_add_8}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_3 => tool_test_add_9}/Ballerina.toml (81%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_9 => tool_test_add_9}/main.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/{tool_test_init_9 => tool_test_add_9}/persist/model.bal (100%) delete mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_init_11/Ballerina.toml create mode 100644 persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java create mode 100644 persist-cli/src/main/resources/META-INF/services/io.ballerina.projects.buildtools.CodeGeneratorTool create mode 100644 persist-cli/src/main/resources/persist-options-schema.json diff --git a/gradle.properties b/gradle.properties index 80db26700..1b0ee2006 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,8 @@ mySqlDriverVersion=8.0.29 mssqlDriverVersion=11.2.3.jre17 postgresqlDriverVersion=42.6.0 -ballerinaLangVersion=2201.9.0-20240208-103300-0823dc95 +ballerinaLangVersion=2201.9.0-20240216-054100-84e1bc71 +#ballerinaLangVersion=2201.8.3 # Level 01 stdlibIoVersion=1.6.0 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 new file mode 100644 index 000000000..6227cbb5c --- /dev/null +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/BuildCodeGeneratorTest.java @@ -0,0 +1,4 @@ +package io.ballerina.persist.tools; + +public class BuildCodeGeneratorTest { +} diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingAddTest.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingAddTest.java index fc68613b6..534d08656 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingAddTest.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingAddTest.java @@ -38,7 +38,7 @@ import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.assertGeneratedSourcesNegative; /** - * persist tool init command tests. + * persist tool add command tests. */ public class ToolingAddTest { @@ -66,136 +66,136 @@ public void findLatestPersistVersion() { @Test(enabled = true) @Description("When the project is not initiated") public void testInit() { - updateOutputBallerinaToml("tool_test_init_1"); - executeCommand("tool_test_init_1"); - assertGeneratedSources("tool_test_init_1"); + updateOutputBallerinaToml("tool_test_add_1"); + executeCommand("tool_test_add_1"); + assertGeneratedSources("tool_test_add_1"); } @Test(enabled = true) @Description("When there is an already initiated configs and there is an uninitiated schema") public void testInitUpdateConfigWithNewDbConfigurations() { - assertGeneratedSourcesNegative("tool_test_init_2", INIT, new String[]{}); + assertGeneratedSourcesNegative("tool_test_add_2", INIT, new String[]{}); } @Test(enabled = true) @Description("When there is a database config files inside the directories and there are missing database " + "configurations") public void testsInitUpdateConfigWithPartialyInitiatedFiles() { - updateOutputBallerinaToml("tool_test_init_3"); - executeCommand("tool_test_init_3"); - assertGeneratedSources("tool_test_init_3"); + updateOutputBallerinaToml("tool_test_add_3"); + executeCommand("tool_test_add_3"); + assertGeneratedSources("tool_test_add_3"); } @Test(enabled = true) @Description("When the init command is executed outside a Ballerina project") public void testsInitOutsideBalProject() { - assertGeneratedSourcesNegative("tool_test_init_4", INIT, new String[]{"Config.toml"}); + assertGeneratedSourcesNegative("tool_test_add_4", INIT, new String[]{"Config.toml"}); } @Test(enabled = true) @Description("When the configs are already updated") public void testsInitUpdateConfigWithUpdatedDbConfigurations() { - updateOutputBallerinaToml("tool_test_init_5"); - executeCommand("tool_test_init_5"); - assertGeneratedSources("tool_test_init_5"); + updateOutputBallerinaToml("tool_test_add_5"); + executeCommand("tool_test_add_5"); + assertGeneratedSources("tool_test_add_5"); } @Test(enabled = true) @Description("Running init on a already initialized project") public void testInitAlreadyInitializedProject() { - executeCommand("tool_test_init_6"); - assertGeneratedSources("tool_test_init_6"); + executeCommand("tool_test_add_6"); + assertGeneratedSources("tool_test_add_6"); } @Test(enabled = true) @Description("Running init on a already initialized project with database configurations missing") public void testInitAlreadyInitializedProjectWithOutPersistConfiguration() { - updateOutputBallerinaToml("tool_test_init_7"); - executeCommand("tool_test_init_7"); - assertGeneratedSources("tool_test_init_7"); + updateOutputBallerinaToml("tool_test_add_7"); + executeCommand("tool_test_add_7"); + assertGeneratedSources("tool_test_add_7"); } @Test(enabled = true) @Description("Running init on a project with manually created definition file") public void testInitWithManuallyCreatedDefinitionFile() { - updateOutputBallerinaToml("tool_test_init_9"); - executeCommand("tool_test_init_9"); - assertGeneratedSources("tool_test_init_9"); + updateOutputBallerinaToml("tool_test_add_9"); + executeCommand("tool_test_add_9"); + assertGeneratedSources("tool_test_add_9"); } @Test(enabled = true) - public void testInitArgs() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, + public void testAddArgs() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { Class persistClass = Class.forName("io.ballerina.persist.cmd.Add"); Add persistCmd = (Add) persistClass.getDeclaredConstructor(String.class). - newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_11").toAbsolutePath(). + newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_add_11").toAbsolutePath(). toString()); new CommandLine(persistCmd).parseArgs("--help"); persistCmd.execute(); - assertGeneratedSources("tool_test_init_11"); + assertGeneratedSources("tool_test_add_11"); Add persistCmd1 = (Add) persistClass.getDeclaredConstructor(String.class). - newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_11").toAbsolutePath(). + newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_add_11").toAbsolutePath(). toString()); new CommandLine(persistCmd1).parseArgs("--datastore", ""); persistCmd1.execute(); - assertGeneratedSources("tool_test_init_11"); + assertGeneratedSources("tool_test_add_11"); Add persistCmd2 = (Add) persistClass.getDeclaredConstructor(String.class). - newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_11").toAbsolutePath(). + newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_add_11").toAbsolutePath(). toString()); new CommandLine(persistCmd2).parseArgs("--module", "^db"); persistCmd2.execute(); - assertGeneratedSources("tool_test_init_11"); + assertGeneratedSources("tool_test_add_11"); Add persistCmd3 = (Add) persistClass.getDeclaredConstructor(String.class). - newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_11").toAbsolutePath(). + newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_add_11").toAbsolutePath(). toString()); new CommandLine(persistCmd3).parseArgs("--module", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); persistCmd3.execute(); - assertGeneratedSources("tool_test_init_11"); + assertGeneratedSources("tool_test_add_11"); } @Test public void testInitWithModuleArg() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { - updateOutputBallerinaToml("tool_test_init_12"); + updateOutputBallerinaToml("tool_test_add_12"); Class persistClass = Class.forName("io.ballerina.persist.cmd.Add"); Add persistCmd = (Add) persistClass.getDeclaredConstructor(String.class). - newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_12").toAbsolutePath(). + newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_add_12").toAbsolutePath(). toString()); new CommandLine(persistCmd).parseArgs("--module", "test"); persistCmd.execute(); - assertGeneratedSources("tool_test_init_12"); + assertGeneratedSources("tool_test_add_12"); } @Test(enabled = true) public void testInitWithMssql() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { - updateOutputBallerinaToml("tool_test_init_13"); + updateOutputBallerinaToml("tool_test_add_13"); Class persistClass = Class.forName("io.ballerina.persist.cmd.Add"); Add persistCmd = (Add) persistClass.getDeclaredConstructor(String.class). - newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_13").toAbsolutePath(). + newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_add_13").toAbsolutePath(). toString()); new CommandLine(persistCmd).parseArgs("--datastore", "mssql"); persistCmd.execute(); - assertGeneratedSources("tool_test_init_13"); + assertGeneratedSources("tool_test_add_13"); } @Test public void testInitWithPostgresql() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { - updateOutputBallerinaToml("tool_test_init_14"); + updateOutputBallerinaToml("tool_test_add_14"); Class persistClass = Class.forName("io.ballerina.persist.cmd.Add"); Add persistCmd = (Add) persistClass.getDeclaredConstructor(String.class). - newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_init_14").toAbsolutePath(). + newInstance(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_add_14").toAbsolutePath(). toString()); new CommandLine(persistCmd).parseArgs("--datastore", "postgresql"); persistCmd.execute(); - assertGeneratedSources("tool_test_init_14"); + assertGeneratedSources("tool_test_add_14"); } private void updateOutputBallerinaToml(String fileName) { diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_1/Ballerina.toml similarity index 92% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_1/Ballerina.toml index a80aa8ca4..5dde7bf48 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_1/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_1" +name = "persist_add_1" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_1/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_1/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_10/Ballerina.toml similarity index 88% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_10/Ballerina.toml index 888184332..3eb43c4f5 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_10/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_3" +name = "persist_add_10" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_10/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_10/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_10/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_10/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_10/persist/entities$# -.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_10/persist/entities$# -.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_10/persist/entities$# -.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_10/persist/entities$# -.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_11/Ballerina.toml similarity index 82% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_7/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_11/Ballerina.toml index 192eaabb0..444eb74aa 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_11/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_7" +name = "persist_add_11" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_11/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_11/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_11/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_11/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_11/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_11/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_11/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_11/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_12/Ballerina.toml similarity index 82% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_8/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_12/Ballerina.toml index b3e41fa87..0613126e3 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_12/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_8" +name = "persist_add_12" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_12/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_12/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_12/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_12/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_12/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_12/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_12/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_12/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_13/Ballerina.toml similarity index 82% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_8/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_13/Ballerina.toml index b3e41fa87..2936df63d 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_13/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_8" +name = "persist_add_13" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_13/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_13/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_13/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_13/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_13/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_13/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_13/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_13/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_12/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_14/Ballerina.toml similarity index 81% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_12/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_14/Ballerina.toml index 35d3ea317..a986dabc4 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_12/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_14/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_12" +name = "persist_add_14" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_14/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_14/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_14/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_14/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_14/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_14/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_14/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_14/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/Ballerina.toml similarity index 90% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/Ballerina.toml index b186410a4..447325b32 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_2" +name = "persist_add_2" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/Config.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/Config.toml similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/Config.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/Config.toml diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/generated/database_configuration.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/generated/database_configuration.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/generated/database_configuration.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/generated/database_configuration.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/persist/persist_init_2.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/persist/persist_init_2.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/persist/persist_init_2.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/persist/persist_init_2.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/persist/test.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/persist/test.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_2/persist/test.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_2/persist/test.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_9/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/Ballerina.toml similarity index 88% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_9/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/Ballerina.toml index 072a7b150..1dd15861a 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_9/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_9" +name = "persist_add_3" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/Config.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/Config.toml similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/Config.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/Config.toml diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/entities.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/entities.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/entities.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/entities.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/generated/database_configuration.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/generated/database_configuration.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/generated/database_configuration.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/generated/database_configuration.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_3/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_3/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_4/readme.md b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_4/readme.md similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_4/readme.md rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_4/readme.md diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/Ballerina.toml similarity index 90% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_5/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/Ballerina.toml index 93cc8255e..ba7bd747e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_5" +name = "persist_add_5" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_5/Config.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/Config.toml similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_5/Config.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/Config.toml diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_5/generated/database_configuration.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/generated/database_configuration.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_5/generated/database_configuration.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/generated/database_configuration.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_5/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_5/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_5/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_5/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/Ballerina.toml similarity index 59% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/Ballerina.toml index 1f553968b..418815dae 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/Ballerina.toml @@ -1,14 +1,14 @@ [package] org = "foo" -name = "persist_init_6" +name = "persist_add_6" version = "0.1.0" distribution = "2201.3.0" [build-options] observabilityIncluded = true -[tool.persist] -id = "persist_init_6" -targetModule = "persist_init_6_old" +[[tool.persist]] +id = "persist_add_6" options.datastore = "mysql" +targetModule = "persist_add_6_old" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/Config.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/Config.toml similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/Config.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/Config.toml diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/generated/database_configuration.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/generated/database_configuration.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/generated/database_configuration.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/generated/database_configuration.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/Ballerina.toml new file mode 100644 index 000000000..1f1a7078a --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/Ballerina.toml @@ -0,0 +1,8 @@ +[package] +org = "foo" +name = "persist_add_7" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_7/Config.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/Config.toml similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_7/Config.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/Config.toml diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_7/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_7/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_7/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_7/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_8/Ballerina.toml new file mode 100644 index 000000000..e5961adca --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_8/Ballerina.toml @@ -0,0 +1,8 @@ +[package] +org = "foo" +name = "persist_add_8" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_8/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_8/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_8/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_8/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_9/Ballerina.toml similarity index 88% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_10/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_9/Ballerina.toml index 41fbbcdd4..67b473c39 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_9/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_10" +name = "persist_add_9" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_9/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_9/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_9/main.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_9/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_9/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_9/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_9/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_add_9/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml index 25535c5af..31d4d882d 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[tool.persist] -datastore = "mysql" -module = "tool_test_db_push_1.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_1.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_10/Ballerina.toml index 66ec9db0c..b32df7413 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_10/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_10" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mysql" -module = "tool_test_db_push_10.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_10.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_11/Ballerina.toml index 735ba0072..e3c769077 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_11/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_11/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_11.persist" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_11.persist" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_12/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_12/Ballerina.toml index 29d2a05ee..051cee1bc 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_12/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_12/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_12.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_12.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_13/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_13/Ballerina.toml index fdde8929e..cd554c132 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_13/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_13/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_13.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_13.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml index d84f218ed..4648d37df 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[tool.persist] -datastore = "mysql" -module = "tool_test_db_push_14.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_14.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_15/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_15/Ballerina.toml index 4a9b14adb..2a6d8cefb 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_15/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_15/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_15.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_15.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_16/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_16/Ballerina.toml index 8700e4efd..78d4a7e33 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_16/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_16/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.4.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_16.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_16.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_17/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_17/Ballerina.toml index 41753662a..f0d7d3eec 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_17/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_17/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_17.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_17.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_18/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_18/Ballerina.toml index 20efddf31..7044f7b07 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_18/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_18/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_18.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_18.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_19/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_19/Ballerina.toml index 4f7e046f9..7eacc06be 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_19/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_19/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_19.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_19.entities" [persist.model.storage] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_20/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_20/Ballerina.toml index 7e7b24070..295808da1 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_20/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_20/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_20.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_20.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_21/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_21/Ballerina.toml index 468d317db..2ca52d90f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_21/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_21/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_21.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_21.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_22/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_22/Ballerina.toml index e328e8742..b2a9e76b3 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_22/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_22/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_22.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_22.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_23/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_23/Ballerina.toml index 9351766ed..c3f092848 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_23/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_23/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_23.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_23.entities" [persist.model.storage.mysql] diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_24/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_24/Ballerina.toml index 3311bb6f9..218639c45 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_24/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_24/Ballerina.toml @@ -7,6 +7,7 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "tool_test_db_push_24.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_24.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_25/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_25/Ballerina.toml index b2686f64e..8b4c8749a 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_25/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_25/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_25.rainier" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_25.rainier" [persist.model.storage.mysql] port = 3307 diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_26/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_26/Ballerina.toml index b9c8cf551..d866ae7cf 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_26/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_26/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_26" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_26" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_27/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_27/Ballerina.toml index d62e16788..52176f811 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_27/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_27/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_27.rainier" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_27.rainier" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_28/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_28/Ballerina.toml index 4024a771a..85d9cf43e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_28/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_28/Ballerina.toml @@ -7,6 +7,7 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "inmemory" -module = "tool_test_db_push_28.rainier" +[[tool.persist]] +id = "persist" +options.datastore = "inmemory" +targetModule = "tool_test_db_push_28.rainier" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_29_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_29_mssql/Ballerina.toml index 3ab1124cf..67ac941f1 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_29_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_29_mssql/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mssql" -module = "tool_test_db_push_29.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mssql" +targetModule = "tool_test_db_push_29.entities" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml index d0c009385..85c31eae6 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_3" version = "0.1.0" distribution = "2201.3.0" -[tool.persist] -datastore = "mysql" -module = "tool_test_db_push_3.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_3.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_30_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_30_mssql/Ballerina.toml index c61081d83..bcf5bbd1b 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_30_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_30_mssql/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_30" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mssql" -module = "tool_test_db_push_30.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mssql" +targetModule = "tool_test_db_push_30.entities" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_31_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_31_mssql/Ballerina.toml index 16ed45404..02f392118 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_31_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_31_mssql/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_31" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mssql" -module = "tool_test_db_push_31.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mssql" +targetModule = "tool_test_db_push_31.entities" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_32_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_32_postgresql/Ballerina.toml index 46e28df72..f5130f39c 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_32_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_32_postgresql/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "postgresql" -module = "tool_test_db_push_32.entities" +[[tool.persist]] +id = "persist" +options.datastore = "postgresql" +targetModule = "tool_test_db_push_32.entities" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_33_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_33_postgresql/Ballerina.toml index 6871e6da9..75bf566a0 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_33_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_33_postgresql/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "postgresql" -module = "tool_test_db_push_33.entities" +[[tool.persist]] +id = "persist" +options.datastore = "postgresql" +targetModule = "tool_test_db_push_33.entities" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_34_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_34_postgresql/Ballerina.toml index b6d8ea0b3..0ddeda8fa 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_34_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_34_postgresql/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_34" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "postgresql" -module = "tool_test_db_push_34.entities" +[[tool.persist]] +id = "persist" +options.datastore = "postgresql" +targetModule = "tool_test_db_push_34.entities" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_4/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_4/Ballerina.toml index 01635b243..74108b1e7 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_4/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_4/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_4" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mysql" -module = "tool_test_db_push_4" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_4" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_5/Ballerina.toml index 5e4d20e06..b35b88cad 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_5/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_5" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mysql" -module = "tool_test_db_push_5.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_5.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_7/Ballerina.toml index 67bd6758b..25a3c164e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_7/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_7.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_7.entities" [persist.model.storage.mysql] host = "local" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_8/Ballerina.toml index 7f36fbecf..ba951abbd 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_8/Ballerina.toml @@ -10,9 +10,11 @@ name="persist" version="0.1.0" repository="local" -[persist] -datastore = "mysql" -module = "tool_test_db_push_8.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_8.entities" +filePath = "xx" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_10/Ballerina.toml index 89ba61e39..dcc098bc8 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_10/Ballerina.toml @@ -7,6 +7,6 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_10.entities" +[[tool.persist]] +options.datastore = "mysql" +targetModule = "persist_generate_10.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_14/Ballerina.toml index 3c523f7f4..d0931cbf8 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_14/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_14/Ballerina.toml @@ -7,6 +7,6 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_14.entities" +[[tool.persist]] +options.datastore = "mysql" +targetModule = "persist_generate_14.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_15/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_15/Ballerina.toml index 4127f2874..2a398f852 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_15/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_15/Ballerina.toml @@ -7,10 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_15.entities1" +[[tool.persist]] +options.datastore = "mysql" +targetModule = "persist_generate_15.entities1" -[persist] -datastore = "mysql" -module = "persist_generate_15.entities" +[[tool.persist]] +options.datastore = "mysql" +targetModule = "persist_generate_15.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_18/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_18/Ballerina.toml index 41fb9587d..3431a7680 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_18/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_18/Ballerina.toml @@ -7,6 +7,6 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_18.entities" +[[tool.persist]] +options.datastore = "mysql" +targetModule = "persist_generate_18.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_20/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_20/Ballerina.toml index e062c2f05..0563e85fd 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_20/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_20/Ballerina.toml @@ -7,6 +7,6 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_20.entities" +[[tool.persist]] +options.datastore = "mysql" +targetModule = "persist_generate_20.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_21/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_21/Ballerina.toml index 3413d6bd4..4fd1681da 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_21/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_21/Ballerina.toml @@ -7,6 +7,6 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "persist_generate_21.entities" +[[tool.persist]] +options.datastore = "mysql" +targetModule = "persist_generate_21.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_32/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_32/Ballerina.toml index e3cd5e926..3c22531bf 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_32/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_32/Ballerina.toml @@ -4,6 +4,6 @@ name = "persist_generate_32" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mysql" -module = "persist_generate_32.entities" +[[tool.persist]] +options.datastore = "mysql" +targetModule = "persist_generate_32.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_11/Ballerina.toml deleted file mode 100644 index 597d1bde4..000000000 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_11/Ballerina.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -org = "foo" -name = "persist_init_11" -version = "0.1.0" -distribution = "2201.3.0" - -[build-options] -observabilityIncluded = true diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_13/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_13/Ballerina.toml deleted file mode 100644 index faec4f020..000000000 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_13/Ballerina.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -org = "foo" -name = "persist_init_13" -version = "0.1.0" -distribution = "2201.3.0" - -[build-options] -observabilityIncluded = true diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_14/Ballerina.toml deleted file mode 100644 index 571749365..000000000 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_14/Ballerina.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -org = "foo" -name = "persist_init_14" -version = "0.1.0" -distribution = "2201.3.0" - -[build-options] -observabilityIncluded = true diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_1/Ballerina.toml index 635c8b0c5..8f0ef7835 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_1/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest6" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest6" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_10/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_10/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_11/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_11/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_11/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_2/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_2/Ballerina.toml index 635c8b0c5..8f0ef7835 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_2/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_2/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest6" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest6" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_3/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_3/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_4/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_4/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_4/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_4/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_5/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_5/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_6/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_6/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_7/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_7/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_8/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_8/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_9/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_9/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_9/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_9/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_9/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_1/Ballerina.toml similarity index 81% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_9/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_1/Ballerina.toml index ba7bed59c..f221c4e5b 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_9/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_1/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_9" +name = "persist_add_1" version = "0.1.0" distribution = "2201.3.0" @@ -14,10 +14,11 @@ value = 2 array = [ [1, 0], [0, 1] ] -[tool.persist] +[[tool.persist]] id = "generate-db-client" -targetModule = "persist_init_9" +targetModule = "persist_add_1" options.datastore = "mysql" +filePath = "x" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_1/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_1/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_1/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_1/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_10/Ballerina.toml similarity index 88% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_10/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_10/Ballerina.toml index 41fbbcdd4..3eb43c4f5 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_10/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_10" +name = "persist_add_10" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_10/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_10/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_10/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_10/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_10/persist/entities$# -.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_10/persist/entities$# -.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_10/persist/entities$# -.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_10/persist/entities$# -.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_11/Ballerina.toml new file mode 100644 index 000000000..444eb74aa --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_11/Ballerina.toml @@ -0,0 +1,8 @@ +[package] +org = "foo" +name = "persist_add_11" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_11/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_11/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_11/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_11/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_11/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_11/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_11/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_11/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_12/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_12/Ballerina.toml similarity index 75% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_12/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_12/Ballerina.toml index fc751956b..2e7f37725 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_12/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_12/Ballerina.toml @@ -1,16 +1,17 @@ [package] org = "foo" -name = "persist_init_12" +name = "persist_add_12" version = "0.1.0" distribution = "2201.3.0" [build-options] observabilityIncluded = true -[tool.persist] +[[tool.persist]] id = "generate-db-client" -targetModule = "persist_init_12.test" +targetModule = "persist_add_12.test" options.datastore = "inmemory" +filePath = "x" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_12/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_12/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_12/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_12/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_12/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_12/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_12/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_12/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_13/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_13/Ballerina.toml similarity index 76% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_13/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_13/Ballerina.toml index ec75e8ba7..1b6b5ab98 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_13/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_13/Ballerina.toml @@ -1,16 +1,17 @@ [package] org = "foo" -name = "persist_init_13" +name = "persist_add_13" version = "0.1.0" distribution = "2201.3.0" [build-options] observabilityIncluded = true -[tool.persist] +[[tool.persist]] id = "generate-db-client" -targetModule = "persist_init_13" +targetModule = "persist_add_13" options.datastore = "mssql" +filePath = "x" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_13/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_13/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_13/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_13/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_13/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_13/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_13/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_13/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_14/Ballerina.toml similarity index 77% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_14/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_14/Ballerina.toml index eb4b4d955..8f0f47d33 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_14/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_14/Ballerina.toml @@ -1,16 +1,17 @@ [package] org = "foo" -name = "persist_init_14" +name = "persist_add_14" version = "0.1.0" distribution = "2201.3.0" [build-options] observabilityIncluded = true -[tool.persist] +[[tool.persist]] id = "generate-db-client" -targetModule = "persist_init_14" +targetModule = "persist_add_14" options.datastore = "postgresql" +filePath = "x" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_14/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_14/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_14/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_14/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_14/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_14/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_14/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_14/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/Ballerina.toml similarity index 90% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/Ballerina.toml index b186410a4..447325b32 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_2" +name = "persist_add_2" version = "0.1.0" distribution = "2201.3.0" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/Config.toml similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/Config.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/Config.toml diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/generated/database_configuration.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/generated/database_configuration.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/generated/database_configuration.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/generated/database_configuration.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/persist/persist_init_2.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/persist/persist_init_2.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/persist/persist_init_2.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/persist/persist_init_2.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/persist/test.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/persist/test.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_2/persist/test.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/persist/test.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/Ballerina.toml similarity index 81% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/Ballerina.toml index 494196ba8..8e8e227bf 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_1" +name = "persist_add_3" version = "0.1.0" distribution = "2201.3.0" @@ -14,10 +14,11 @@ value = 2 array = [ [1, 0], [0, 1] ] -[tool.persist] +[[tool.persist]] id = "generate-db-client" -targetModule = "persist_init_1" +targetModule = "persist_add_3" options.datastore = "mysql" +filePath = "x" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/Config.toml similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/Config.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/Config.toml diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/entities.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/entities.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/entities.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/entities.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/generated/database_configuration.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/generated/database_configuration.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/generated/database_configuration.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/generated/database_configuration.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_4/readme.md b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_4/readme.md similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_4/readme.md rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_4/readme.md diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/Ballerina.toml similarity index 83% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/Ballerina.toml index bd0fb0642..91a8f8455 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_5" +name = "persist_add_5" version = "0.1.0" distribution = "2201.3.0" @@ -14,10 +14,11 @@ user = "root" password = "test123" database = "persistdb" -[tool.persist] +[[tool.persist]] id = "generate-db-client" -targetModule = "persist_init_5" +targetModule = "persist_add_5" options.datastore = "mysql" +filePath = "x" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/Config.toml similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/Config.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/Config.toml diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/generated/database_configuration.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/generated/database_configuration.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/generated/database_configuration.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/generated/database_configuration.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_5/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/Ballerina.toml similarity index 59% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/Ballerina.toml index c679d2720..418815dae 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/Ballerina.toml @@ -1,14 +1,14 @@ [package] org = "foo" -name = "persist_init_6" +name = "persist_add_6" version = "0.1.0" distribution = "2201.3.0" [build-options] observabilityIncluded = true -[tool.persist] -id = "persist_init_6" +[[tool.persist]] +id = "persist_add_6" options.datastore = "mysql" -targetModule = "persist_init_6_old" +targetModule = "persist_add_6_old" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/Config.toml similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/Config.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/Config.toml diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/generated/database_configuration.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/generated/database_configuration.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/generated/database_configuration.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/generated/database_configuration.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_6/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/Ballerina.toml similarity index 77% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/Ballerina.toml index 38807ee7f..5fe63d7bc 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/Ballerina.toml @@ -1,16 +1,17 @@ [package] org = "foo" -name = "persist_init_7" +name = "persist_add_7" version = "0.1.0" distribution = "2201.3.0" [build-options] observabilityIncluded = true -[tool.persist] +[[tool.persist]] id = "generate-db-client" -targetModule = "persist_init_7" +targetModule = "persist_add_7" options.datastore = "mysql" +filePath = "x" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/Config.toml similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/Config.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/Config.toml diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_7/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_8/Ballerina.toml new file mode 100644 index 000000000..e5961adca --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_8/Ballerina.toml @@ -0,0 +1,8 @@ +[package] +org = "foo" +name = "persist_add_8" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_8/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_8/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_8/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_8/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_9/Ballerina.toml similarity index 81% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/Ballerina.toml rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_9/Ballerina.toml index d0538ef4f..9b8dbb57a 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_9/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "foo" -name = "persist_init_3" +name = "persist_add_9" version = "0.1.0" distribution = "2201.3.0" @@ -14,10 +14,11 @@ value = 2 array = [ [1, 0], [0, 1] ] -[tool.persist] +[[tool.persist]] id = "generate-db-client" -targetModule = "persist_init_3" +targetModule = "persist_add_9" options.datastore = "mysql" +filePath = "x" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_9/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_9/main.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_9/main.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_9/main.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_9/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_9/persist/model.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_init_9/persist/model.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_add_9/persist/model.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_1/Ballerina.toml index c113fb6c0..31d4d882d 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_1/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_1.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_1.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_10/Ballerina.toml index 66ec9db0c..b32df7413 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_10/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_10" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mysql" -module = "tool_test_db_push_10.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_10.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_11/Ballerina.toml index 735ba0072..e3c769077 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_11/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_11/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_11.persist" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_11.persist" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_12/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_12/Ballerina.toml index 29d2a05ee..051cee1bc 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_12/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_12/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_12.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_12.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_13/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_13/Ballerina.toml index fdde8929e..cd554c132 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_13/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_13/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_13.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_13.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_14/Ballerina.toml index d08a5329a..4648d37df 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_14/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_14/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_14.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_14.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_15/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_15/Ballerina.toml index 4a9b14adb..2a6d8cefb 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_15/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_15/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_15.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_15.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_16/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_16/Ballerina.toml index 8700e4efd..78d4a7e33 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_16/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_16/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.4.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_16.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_16.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_17/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_17/Ballerina.toml index 41753662a..f0d7d3eec 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_17/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_17/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_17.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_17.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_18/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_18/Ballerina.toml index 20efddf31..7044f7b07 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_18/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_18/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_18.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_18.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_19/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_19/Ballerina.toml index 4f7e046f9..7eacc06be 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_19/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_19/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_19.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_19.entities" [persist.model.storage] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/Ballerina.toml index 7e7b24070..295808da1 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_20.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_20.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_21/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_21/Ballerina.toml index 468d317db..2ca52d90f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_21/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_21/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_21.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_21.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_22/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_22/Ballerina.toml index e328e8742..b2a9e76b3 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_22/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_22/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_22.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_22.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_23/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_23/Ballerina.toml index 9351766ed..c3f092848 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_23/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_23/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_23.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_23.entities" [persist.model.storage.mysql] diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_24/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_24/Ballerina.toml index 3311bb6f9..218639c45 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_24/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_24/Ballerina.toml @@ -7,6 +7,7 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "tool_test_db_push_24.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_24.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_25/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_25/Ballerina.toml index b2686f64e..8b4c8749a 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_25/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_25/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_25.rainier" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_25.rainier" [persist.model.storage.mysql] port = 3307 diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_26/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_26/Ballerina.toml index b9c8cf551..d866ae7cf 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_26/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_26/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_26" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_26" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_27/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_27/Ballerina.toml index d62e16788..52176f811 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_27/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_27/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_27.rainier" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_27.rainier" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_28/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_28/Ballerina.toml index 4024a771a..85d9cf43e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_28/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_28/Ballerina.toml @@ -7,6 +7,7 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "inmemory" -module = "tool_test_db_push_28.rainier" +[[tool.persist]] +id = "persist" +options.datastore = "inmemory" +targetModule = "tool_test_db_push_28.rainier" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_29_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_29_mssql/Ballerina.toml index 3ab1124cf..67ac941f1 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_29_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_29_mssql/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mssql" -module = "tool_test_db_push_29.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mssql" +targetModule = "tool_test_db_push_29.entities" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_3/Ballerina.toml index d6069b6f3..85c31eae6 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_3/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_3" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mysql" -module = "tool_test_db_push_3.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_3.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_30_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_30_mssql/Ballerina.toml index c61081d83..bcf5bbd1b 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_30_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_30_mssql/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_30" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mssql" -module = "tool_test_db_push_30.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mssql" +targetModule = "tool_test_db_push_30.entities" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_31_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_31_mssql/Ballerina.toml index 16ed45404..02f392118 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_31_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_31_mssql/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_31" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mssql" -module = "tool_test_db_push_31.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mssql" +targetModule = "tool_test_db_push_31.entities" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_32_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_32_postgresql/Ballerina.toml index 46e28df72..f5130f39c 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_32_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_32_postgresql/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "postgresql" -module = "tool_test_db_push_32.entities" +[[tool.persist]] +id = "persist" +options.datastore = "postgresql" +targetModule = "tool_test_db_push_32.entities" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_33_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_33_postgresql/Ballerina.toml index 6871e6da9..75bf566a0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_33_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_33_postgresql/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "postgresql" -module = "tool_test_db_push_33.entities" +[[tool.persist]] +id = "persist" +options.datastore = "postgresql" +targetModule = "tool_test_db_push_33.entities" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_34_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_34_postgresql/Ballerina.toml index b6d8ea0b3..0ddeda8fa 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_34_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_34_postgresql/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_34" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "postgresql" -module = "tool_test_db_push_34.entities" +[[tool.persist]] +id = "persist" +options.datastore = "postgresql" +targetModule = "tool_test_db_push_34.entities" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_4/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_4/Ballerina.toml index 01635b243..74108b1e7 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_4/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_4/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_4" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mysql" -module = "tool_test_db_push_4" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_4" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_5/Ballerina.toml index 5e4d20e06..b35b88cad 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_5/Ballerina.toml @@ -4,9 +4,10 @@ name = "tool_test_db_push_5" version = "0.1.0" distribution = "2201.3.0" -[persist] -datastore = "mysql" -module = "tool_test_db_push_5.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_5.entities" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_7/Ballerina.toml index 67bd6758b..25a3c164e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_7/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] -datastore = "mysql" -module = "tool_test_db_push_7.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_7.entities" [persist.model.storage.mysql] host = "local" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_8/Ballerina.toml index 7f36fbecf..ba951abbd 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_8/Ballerina.toml @@ -10,9 +10,11 @@ name="persist" version="0.1.0" repository="local" -[persist] -datastore = "mysql" -module = "tool_test_db_push_8.entities" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "tool_test_db_push_8.entities" +filePath = "xx" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_10/Ballerina.toml index 89ba61e39..dd9b2cc23 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_10/Ballerina.toml @@ -8,5 +8,5 @@ distribution = "2201.3.0" observabilityIncluded = false [persist] -datastore = "mysql" +options.datastore = "mysql" module = "persist_generate_10.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_14/Ballerina.toml index 3c523f7f4..2baf84d53 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_14/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_14/Ballerina.toml @@ -8,5 +8,5 @@ distribution = "2201.3.0" observabilityIncluded = false [persist] -datastore = "mysql" +options.datastore = "mysql" module = "persist_generate_14.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_15/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_15/Ballerina.toml index 4127f2874..647a0b92b 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_15/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_15/Ballerina.toml @@ -8,9 +8,9 @@ distribution = "2201.3.0" observabilityIncluded = false [persist] -datastore = "mysql" +options.datastore = "mysql" module = "persist_generate_15.entities1" [persist] -datastore = "mysql" +options.datastore = "mysql" module = "persist_generate_15.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_18/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_18/Ballerina.toml index 41fb9587d..2294792b2 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_18/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_18/Ballerina.toml @@ -8,5 +8,5 @@ distribution = "2201.3.0" observabilityIncluded = false [persist] -datastore = "mysql" +options.datastore = "mysql" module = "persist_generate_18.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_20/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_20/Ballerina.toml index e062c2f05..5616aef17 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_20/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_20/Ballerina.toml @@ -8,5 +8,5 @@ distribution = "2201.3.0" observabilityIncluded = false [persist] -datastore = "mysql" +options.datastore = "mysql" module = "persist_generate_20.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_21/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_21/Ballerina.toml index 3413d6bd4..7243b2040 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_21/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_21/Ballerina.toml @@ -8,5 +8,5 @@ distribution = "2201.3.0" observabilityIncluded = false [persist] -datastore = "mysql" +options.datastore = "mysql" module = "persist_generate_21.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_client.bal index 5916eb0bf..313169721 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_client.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_client.bal @@ -19,7 +19,7 @@ public isolated client class Client { private final map persistClients; private final record {|psql:SQLMetadata...;|} & readonly metadata = { - [MEDICAL_NEED] : { + [MEDICAL_NEED]: { entityName: "MedicalNeed", tableName: "MedicalNeed", fieldMetadata: { @@ -37,7 +37,7 @@ public isolated client class Client { keyFields: ["record"], joinMetadata: {item: {entity: MedicalItem, fieldName: "item", refTable: "MedicalItem", refColumns: ["itemId"], joinColumns: ["itemItemId"], 'type: psql:ONE_TO_ONE}} }, - [MEDICAL_ITEM] : { + [MEDICAL_ITEM]: { entityName: "MedicalItem", tableName: "MedicalItem", fieldMetadata: { @@ -64,8 +64,8 @@ public isolated client class Client { } self.dbClient = dbClient; self.persistClients = { - [MEDICAL_NEED] : check new (dbClient, self.metadata.get(MEDICAL_NEED), psql:MYSQL_SPECIFICS), - [MEDICAL_ITEM] : check new (dbClient, self.metadata.get(MEDICAL_ITEM), psql:MYSQL_SPECIFICS) + [MEDICAL_NEED]: check new (dbClient, self.metadata.get(MEDICAL_NEED), psql:MYSQL_SPECIFICS), + [MEDICAL_ITEM]: check new (dbClient, self.metadata.get(MEDICAL_ITEM), psql:MYSQL_SPECIFICS) }; } diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_32/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_32/Ballerina.toml index e3cd5e926..f0d8c4ff5 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_32/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_32/Ballerina.toml @@ -5,5 +5,5 @@ version = "0.1.0" distribution = "2201.3.0" [persist] -datastore = "mysql" +options.datastore = "mysql" module = "persist_generate_32.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_11/Ballerina.toml deleted file mode 100644 index 597d1bde4..000000000 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_11/Ballerina.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -org = "foo" -name = "persist_init_11" -version = "0.1.0" -distribution = "2201.3.0" - -[build-options] -observabilityIncluded = true diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_1/Ballerina.toml index 00baaef1d..55d9dcc86 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_1/Ballerina.toml @@ -7,7 +7,8 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest6" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest6" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_10/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_10/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_11/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_11/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_11/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_2/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_2/Ballerina.toml index 635c8b0c5..8f0ef7835 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_2/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_2/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest6" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest6" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_3/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_3/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_4/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_4/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_4/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_4/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_5/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_5/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_6/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_6/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_7/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_7/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_8/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_8/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_9/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_9/Ballerina.toml index 4c2116c04..b3cefe14f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_9/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_9/Ballerina.toml @@ -7,9 +7,10 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = true -[persist] -datastore = "mysql" -module = "persistTest7" +[[tool.persist]] +id = "persist" +options.datastore = "mysql" +targetModule = "persistTest7" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java b/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java index 757b1dcff..77af31620 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java +++ b/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java @@ -52,6 +52,7 @@ private PersistToolsConstants() {} public static final String GENERATE_CMD_FILE = "generatecmd.toml"; public static final String PERSIST_TOOL_CONFIG = "tool.persist"; public static final String GENERATED_DIRECTORY = "generated"; + public static final String TARGET_MODULE = "targetModule"; public static final String MIGRATIONS = "migrations"; public static final String BALLERINA_MYSQL_DRIVER_NAME = "ballerinax/mysql.driver"; public static final String BALLERINA_MSSQL_DRIVER_NAME = "ballerinax/mssql.driver"; diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java index 006d03006..86264a82e 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java @@ -153,14 +153,14 @@ public void execute() { // return; // } // } - moduleNameWithPackageName = module; - if (!moduleNameWithPackageName.equals(packageName)) { - if (!moduleNameWithPackageName.startsWith(packageName + ".")) { +// moduleNameWithPackageName = module; + if (!module.equals(packageName)) { + if (!module.startsWith(packageName + ".")) { errStream.println("ERROR: invalid module name : '" + module + "' :\n" + "module name should follow the template ."); return; } - String moduleName = moduleNameWithPackageName.replace(packageName + ".", ""); + String moduleName = module.replace(packageName + ".", ""); if (!ProjectUtils.validateModuleName(moduleName)) { errStream.println("ERROR: invalid module name : '" + moduleName + "' :\n" + "module name can only contain alphanumerics, underscores and periods"); @@ -225,7 +225,7 @@ public void execute() { } } SourceGenerator sourceCreator = new SourceGenerator(sourcePath, generatedSourceDirPath, - moduleNameWithPackageName, entityModule); + module, entityModule); try { switch (datastore) { case PersistToolsConstants.SupportedDataSources.MYSQL_DB: diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Migrate.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Migrate.java index 14f921db3..787f67200 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Migrate.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Migrate.java @@ -107,7 +107,7 @@ public void execute() { try { HashMap ballerinaTomlConfig = TomlSyntaxUtils.readBallerinaTomlConfig( Paths.get(this.sourcePath, "Ballerina.toml")); - String dataStore = ballerinaTomlConfig.get("datastore").trim(); + String dataStore = ballerinaTomlConfig.get("options.datastore").trim(); if (!dataStore.equals(PersistToolsConstants.SupportedDataSources.MYSQL_DB)) { errStream.printf("ERROR: unsupported data store: expected: 'mysql' but found: '%s'%n", dataStore); return; diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java new file mode 100644 index 000000000..9b46281c8 --- /dev/null +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.persist.cmd; + +import io.ballerina.persist.BalException; +import io.ballerina.persist.PersistToolsConstants; +import io.ballerina.persist.models.Module; +import io.ballerina.persist.nodegenerator.SourceGenerator; +import io.ballerina.persist.nodegenerator.syntax.constants.BalSyntaxConstants; +import io.ballerina.persist.nodegenerator.syntax.utils.TomlSyntaxUtils; +import io.ballerina.persist.utils.BalProjectUtils; +import io.ballerina.projects.buildtools.CodeGeneratorTool; +import io.ballerina.projects.buildtools.ToolContext; +import io.ballerina.projects.util.ProjectUtils; + +import java.io.IOException; +import java.io.PrintStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.HashMap; + +import static io.ballerina.persist.PersistToolsConstants.TARGET_MODULE; + +public class PersistCodeGeneratorTool implements CodeGeneratorTool { + + private static final PrintStream errStream = System.err; + + private final String sourcePath; + + public PersistCodeGeneratorTool() { + this(""); + } + + public PersistCodeGeneratorTool(String sourcePath) { + this.sourcePath = sourcePath; + } + + @Override + public void execute(ToolContext toolContext) { + String datastore; + Module entityModule; + Path schemaFilePath; + String packageName; + String targetModule; + Path generatedSourceDirPath = Paths.get(this.sourcePath, BalSyntaxConstants.GENERATED_SOURCE_DIRECTORY); + + Path projectPath = Paths.get(sourcePath); + try { + BalProjectUtils.validateBallerinaProject(projectPath); + } catch (BalException e) { + errStream.println(e.getMessage()); + return; + } + + try { + packageName = TomlSyntaxUtils.readPackageName(this.sourcePath); + } catch (BalException e) { + errStream.println(e.getMessage()); + return; + } + + try { + schemaFilePath = BalProjectUtils.getSchemaFilePath(this.sourcePath); + } catch (BalException e) { + errStream.println(e.getMessage()); + return; + } + + try { + HashMap ballerinaTomlConfig = TomlSyntaxUtils.readBallerinaTomlConfig( + Paths.get(this.sourcePath, "Ballerina.toml")); + targetModule = ballerinaTomlConfig.get(TARGET_MODULE).trim(); + if (!targetModule.equals(packageName)) { + if (!targetModule.startsWith(packageName + ".")) { + errStream.println("ERROR: invalid module name : '" + ballerinaTomlConfig.get(TARGET_MODULE) + + "' :\n" + "module name should follow the template ."); + return; + } + String moduleName = targetModule.replace(packageName + ".", ""); + if (!ProjectUtils.validateModuleName(moduleName)) { + errStream.println("ERROR: invalid module name : '" + moduleName + "' :\n" + + "module name can only contain alphanumerics, underscores and periods"); + return; + } else if (!ProjectUtils.validateNameLength(moduleName)) { + errStream.println("ERROR: invalid module name : '" + moduleName + "' :\n" + + "maximum length of module name is 256 characters"); + return; + } + generatedSourceDirPath = generatedSourceDirPath.resolve(moduleName); + } + datastore = ballerinaTomlConfig.get("options.datastore").trim(); + if (!PersistToolsConstants.SUPPORTED_DB_PROVIDERS.contains(datastore)) { + errStream.printf("ERROR: the persist layer supports one of data stores: %s" + + ". but found '%s' datasource.%n", + Arrays.toString(PersistToolsConstants.SUPPORTED_DB_PROVIDERS.toArray()), datastore); + return; + } + if (Files.isDirectory(Paths.get(sourcePath, PersistToolsConstants.PERSIST_DIRECTORY, + PersistToolsConstants.MIGRATIONS)) && + !datastore.equals(PersistToolsConstants.SupportedDataSources.MYSQL_DB)) { + errStream.println("ERROR: regenerating the client with a different datastore after executing " + + "the migrate command is not permitted. please remove the migrations directory within the " + + "persist directory and try executing the command again."); + return; + } + entityModule = BalProjectUtils.getEntities(schemaFilePath); + if (entityModule.getEntityMap().isEmpty()) { + errStream.printf("ERROR: the model definition file(%s) does not contain any entity definition.%n", + schemaFilePath.getFileName()); + return; + } + } catch (BalException e) { + errStream.printf("ERROR: failed to generate types and client for the definition file(%s). %s%n", + "Ballerina.toml", e.getMessage()); + return; + } + if (!Files.exists(generatedSourceDirPath)) { + try { + Files.createDirectories(generatedSourceDirPath.toAbsolutePath()); + } catch (IOException e) { + errStream.println("ERROR: failed to create the generated directory. " + e.getMessage()); + return; + } + } + SourceGenerator sourceCreator = new SourceGenerator(sourcePath, generatedSourceDirPath, + targetModule, entityModule); + try { + switch (datastore) { + case PersistToolsConstants.SupportedDataSources.MYSQL_DB: + case PersistToolsConstants.SupportedDataSources.MSSQL_DB: + case PersistToolsConstants.SupportedDataSources.POSTGRESQL_DB: + sourceCreator.createDbSources(datastore); + break; + case PersistToolsConstants.SupportedDataSources.GOOGLE_SHEETS: + sourceCreator.createGSheetSources(); + break; + default: + sourceCreator.createInMemorySources(); + break; + } + } catch (BalException e) { + errStream.printf(BalSyntaxConstants.ERROR_MSG, datastore, e.getMessage()); + return; + } + errStream.println("Persist client and entity types generated successfully in the " + targetModule + + " directory."); + } + + @Override + public String toolName() { + return "persist"; + } +} diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Push.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Push.java index 91177224f..f524b7efa 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Push.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Push.java @@ -137,7 +137,7 @@ public void execute() { try { HashMap ballerinaTomlConfig = TomlSyntaxUtils.readBallerinaTomlConfig( Paths.get(this.sourcePath, "Ballerina.toml")); - this.datastore = ballerinaTomlConfig.get("datastore").trim(); + this.datastore = ballerinaTomlConfig.get("options.datastore").trim(); } catch (BalException e) { errStream.printf("ERROR: failed to locate Ballerina.toml: %s%n", e.getMessage()); @@ -210,13 +210,13 @@ public void execute() { generatedSourceDirPath = Paths.get(this.sourcePath, BalSyntaxConstants.GENERATED_SOURCE_DIRECTORY); HashMap persistConfig = readBallerinaTomlConfig( Paths.get(this.sourcePath, "Ballerina.toml")); - if (!persistConfig.get("module").equals(packageName)) { - if (!persistConfig.get("module").startsWith(packageName + ".")) { + if (!persistConfig.get("targetModule").equals(packageName)) { + if (!persistConfig.get("targetModule").startsWith(packageName + ".")) { errStream.println("ERROR: invalid module name : '" + persistConfig.get("module") + "' :\n" + "module name should follow the template ."); return; } - submodule = persistConfig.get("module").split("\\.")[1]; + submodule = persistConfig.get("targetModule").split("\\.")[1]; if (!ProjectUtils.validateModuleName(submodule)) { errStream.println("ERROR: invalid module name : '" + submodule + "' :\n" + "module name can only contain alphanumerics, underscores and periods"); diff --git a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java index 6ae196e81..6c53dd270 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java +++ b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java @@ -110,8 +110,7 @@ public static HashMap readBallerinaTomlConfig(Path configPath) t boolean dbConfigExists = false; HashMap persistConfig = new HashMap<>(); for (DocumentMemberDeclarationNode member : nodeList) { - if (member instanceof TableNode) { - TableNode node = (TableNode) member; + if (member instanceof TableArrayNode node) { String tableName = node.identifier().toSourceCode().trim(); if (tableName.equals(PersistToolsConstants.PERSIST_TOOL_CONFIG)) { dbConfigExists = true; @@ -186,17 +185,12 @@ public static String updateBallerinaToml(Path configPath, String module, String boolean dependencyExists = false; if (member instanceof KeyValueNode) { moduleMembers = moduleMembers.add(member); - } else if (member instanceof TableNode) { - TableNode node = (TableNode) member; + } else if (member instanceof TableArrayNode) { + TableArrayNode node = (TableArrayNode) member; if (node.identifier().toSourceCode().trim().equals(PersistToolsConstants.PERSIST_TOOL_CONFIG)) { throw new BalException("persist configuration already exists in the Ballerina.toml. " + "remove the existing configuration and try again."); - } else { - moduleMembers = moduleMembers.add(member); - } - } else if (member instanceof TableArrayNode) { - TableArrayNode tableArray = (TableArrayNode) member; - if (tableArray.identifier().toSourceCode().trim().equals("platform.java17.dependency")) { + } else if (node.identifier().toSourceCode().trim().equals("platform.java17.dependency")) { NodeList fields = ((TableArrayNode) member).fields(); for (KeyValueNode field : fields) { String value = field.value().toSourceCode().trim(); @@ -213,10 +207,12 @@ public static String updateBallerinaToml(Path configPath, String module, String if (!dependencyExists) { moduleMembers = moduleMembers.add(member); } + } else { + moduleMembers = moduleMembers.add(member); } } moduleMembers = BalProjectUtils.addNewLine(moduleMembers, 1); - moduleMembers = moduleMembers.add(SampleNodeGenerator.createTable( + moduleMembers = moduleMembers.add(SampleNodeGenerator.createTableArray( PersistToolsConstants.PERSIST_TOOL_CONFIG, null)); moduleMembers = populateBallerinaNodeList(moduleMembers, module, datasource, id); moduleMembers = BalProjectUtils.addNewLine(moduleMembers, 1); @@ -235,6 +231,7 @@ private static NodeList populateBallerinaNodeList moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("id", id, null)); moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("targetModule", module, null)); moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("options.datastore", dataStore, null)); + moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("filePath", "x", null)); return moduleMembers; } 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 665d3b66c..cc1799f3f 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,7 +109,7 @@ 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" + + String sourceContent = "[[tool.persist]]\n" + "options.datastore = \"" + datastore + "\"\n" + "module = \"" + module + "\""; Path generatedCmdOutPath = Paths.get(sourcePath, TARGET_DIRECTORY, GENERATE_CMD_FILE); diff --git a/persist-cli/src/main/resources/META-INF/services/io.ballerina.projects.buildtools.CodeGeneratorTool b/persist-cli/src/main/resources/META-INF/services/io.ballerina.projects.buildtools.CodeGeneratorTool new file mode 100644 index 000000000..b0d41bc67 --- /dev/null +++ b/persist-cli/src/main/resources/META-INF/services/io.ballerina.projects.buildtools.CodeGeneratorTool @@ -0,0 +1 @@ +io.ballerina.persist.cmd.PersistCodeGeneratorTool \ No newline at end of file diff --git a/persist-cli/src/main/resources/persist-options-schema.json b/persist-cli/src/main/resources/persist-options-schema.json new file mode 100644 index 000000000..abc25334b --- /dev/null +++ b/persist-cli/src/main/resources/persist-options-schema.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "datastore": { + "type": "string" + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/persist-cli/src/main/resources/version.properties b/persist-cli/src/main/resources/version.properties index 22e655c24..26b6fd44e 100644 --- a/persist-cli/src/main/resources/version.properties +++ b/persist-cli/src/main/resources/version.properties @@ -1,4 +1,4 @@ version = ${project.version} -persistSqlVersion = ${project.persistSqlNativeVersion} -persistInMemoryVersion = ${project.persistInMemoryNativeVersion} -persistGoogleSheetsVersion = ${project.persistGoogleSheetsNativeVersion} +persistSqlVersion = 1.2.2-SNAPSHOT +persistInMemoryVersion = 1.2.0 +persistGoogleSheetsVersion = 1.2.0 From 0c732ed9584f5b31d31067ff53e1d718bf45229b Mon Sep 17 00:00:00 2001 From: bhashinee Date: Wed, 21 Feb 2024 12:39:06 +0530 Subject: [PATCH 03/22] Add tests for build command --- persist-cli-tests/build.gradle | 46 +++--- .../persist/tools/BuildCodeGeneratorTest.java | 137 ++++++++++++++++++ .../persist/tools/ToolingAddTest.java | 10 +- .../utils/GeneratedSourcesTestUtils.java | 9 +- .../input/tool_test_build_1/Ballerina.toml | 26 ++++ .../test-src/input/tool_test_build_1/main.bal | 21 +++ .../input/tool_test_build_1/persist/model.bal | 61 ++++++++ .../input/tool_test_build_2/Ballerina.toml | 26 ++++ .../test-src/input/tool_test_build_2/main.bal | 21 +++ .../input/tool_test_build_2/persist/model.bal | 17 +++ .../input/tool_test_build_3/Ballerina.toml | 19 +++ .../test-src/input/tool_test_build_3/main.bal | 21 +++ .../input/tool_test_build_3/persist/model.bal | 17 +++ .../input/tool_test_build_4/Ballerina.toml | 19 +++ .../test-src/input/tool_test_build_4/main.bal | 21 +++ .../input/tool_test_build_4/persist/model.bal | 17 +++ .../input/tool_test_build_5/Ballerina.toml | 19 +++ .../test-src/input/tool_test_build_5/main.bal | 21 +++ .../input/tool_test_build_5/persist/model.bal | 17 +++ .../input/tool_test_build_6/Ballerina.toml | 19 +++ .../test-src/input/tool_test_build_6/main.bal | 21 +++ .../input/tool_test_build_6/persist/model.bal | 17 +++ .../io/ballerina/persist/cmd/Generate.java | 13 -- .../persist/cmd/PersistCodeGeneratorTool.java | 7 +- 24 files changed, 576 insertions(+), 46 deletions(-) create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/Ballerina.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/main.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/persist/model.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/Ballerina.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/main.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/persist/model.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/Ballerina.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/main.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/persist/model.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/Ballerina.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/main.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/persist/model.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/Ballerina.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/main.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/persist/model.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/Ballerina.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/main.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/persist/model.bal diff --git a/persist-cli-tests/build.gradle b/persist-cli-tests/build.gradle index 077af26fd..ea59d9710 100644 --- a/persist-cli-tests/build.gradle +++ b/persist-cli-tests/build.gradle @@ -236,29 +236,29 @@ task stopTestDockerContainer() { } } -//task startMSSQLTestDockerContainer(type: Exec) { -// if (!Os.isFamily(Os.FAMILY_WINDOWS)) { -// def standardOutput = new ByteArrayOutputStream() -// commandLine 'sh', '-c', 'docker run --platform linux/amd64 --rm -d --name ballerina-persist-tools-mssql -e ACCEPT_EULA=1 -e SA_PASSWORD=Test123# -p 1434:1433 -t mcr.microsoft.com/mssql/server:2019-latest' -// def healthCheck = 1 -// def counter = 0 -// doLast { -// checkExecResult(executionResult, 'Error', standardOutput) -// while (healthCheck != 0 && counter < 12) { -// sleep(60 * 1000) -// healthCheck = checkMSSQLTestDockerContainerStatus('ballerina-persist-tools-mssql') -// counter = counter + 1 -// } -// if (healthCheck != 0) { -// throw new GradleException("Docker container 'ballerina-persist-tools-mssql' health test exceeded timeout!") -// } -// } -// } else { -// commandLine 'cmd','slmgr /dlv' -// println('\n' + "Windows Instance detected") -// println('\n' + "skippped starting the docker container") -// } -//} +task startMSSQLTestDockerContainer(type: Exec) { + if (!Os.isFamily(Os.FAMILY_WINDOWS)) { + def standardOutput = new ByteArrayOutputStream() + commandLine 'sh', '-c', 'docker run --platform linux/amd64 --rm -d --name ballerina-persist-tools-mssql -e ACCEPT_EULA=1 -e SA_PASSWORD=Test123# -p 1434:1433 -t mcr.microsoft.com/mssql/server:2019-latest' + def healthCheck = 1 + def counter = 0 + doLast { + checkExecResult(executionResult, 'Error', standardOutput) + while (healthCheck != 0 && counter < 12) { + sleep(60 * 1000) + healthCheck = checkMSSQLTestDockerContainerStatus('ballerina-persist-tools-mssql') + counter = counter + 1 + } + if (healthCheck != 0) { + throw new GradleException("Docker container 'ballerina-persist-tools-mssql' health test exceeded timeout!") + } + } + } else { + commandLine 'cmd','slmgr /dlv' + println('\n' + "Windows Instance detected") + println('\n' + "skippped starting the docker container") + } +} def checkMSSQLTestDockerContainerStatus(containerName) { if (!Os.isFamily(Os.FAMILY_WINDOWS)) { 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 6227cbb5c..0fea4abd6 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 @@ -1,4 +1,141 @@ package io.ballerina.persist.tools; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * persist tool in `bal build` command tests. + */ public class BuildCodeGeneratorTest { + public static final Path TARGET_DIR = Paths.get(System.getProperty("user.dir"), "build"); + public static final Path TEST_DISTRIBUTION_PATH = TARGET_DIR.resolve("ballerina-distribution"); + public static final Path RESOURCES_PATH = TARGET_DIR.resolve("resources/test"); + + @Test(enabled = true) + public void testBuildWithMysql() throws IOException, InterruptedException { + String log = "Persist client and entity types generated successfully in " + + "the persist_build_1 directory."; + Path project = TARGET_DIR.resolve("generated-sources/tool_test_build_1"); + assertLogs(log, project); + } + + @Test(enabled = true) + public void testBuildWithInvalidTargetModule() throws IOException, InterruptedException { + String log = "ERROR: invalid module name : 'persist_add_1' :\n" + + "module name should follow the template ."; + Path project = TARGET_DIR.resolve("generated-sources/tool_test_build_2"); + assertLogs(log, project); + } + + @Test(enabled = true) + public void testBuildWithInvalidCharachtersInTargetModule() throws IOException, InterruptedException { + String log = "ERROR: invalid module name : '*****' :\n" + + "module name can only contain alphanumerics, underscores and periods"; + Path project = TARGET_DIR.resolve("generated-sources/tool_test_build_3"); + assertLogs(log, project); + } + + @Test(enabled = true) + public void testBuildWithInvalidLengthOfTargetModule() throws IOException, InterruptedException { + String log = "ERROR: invalid module name : 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + + "aaaaaaaaaaaaaaaaaaaaaaaaddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" + + "ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" + + "dddddddddddddddddddddd' :\n" + + "maximum length of module name is 256 characters"; + Path project = TARGET_DIR.resolve("generated-sources/tool_test_build_4"); + assertLogs(log, project); + } + + @Test(enabled = true) + public void testBuildWithInvalidDataSource() throws IOException, InterruptedException { + String log = "ERROR: the persist layer supports one of data stores:"; + Path project = TARGET_DIR.resolve("generated-sources/tool_test_build_5"); + assertContainLogs(log, project); + } + + @Test(enabled = true) + public void testBuildWithoutEntities() throws IOException, InterruptedException { + String log = "ERROR: the model definition file(model.bal) does not contain any entity definition."; + Path project = TARGET_DIR.resolve("generated-sources/tool_test_build_6"); + assertLogs(log, project); + } + + private void assertLogs(String log, Path project) throws IOException, InterruptedException { + List buildArgs = new LinkedList<>(); + Process process = executeRun(TEST_DISTRIBUTION_PATH.toString(), project, buildArgs); + InputStream success = process.getErrorStream(); + try (BufferedReader br = new BufferedReader(new InputStreamReader(success, "UTF-8"))) { + Stream logLines = br.lines(); + String generatedLog = logLines.collect(Collectors.joining(System.lineSeparator())); + Assert.assertEquals(generatedLog, log); + logLines.close(); + } + } + + private void assertContainLogs(String log, Path project) throws IOException, InterruptedException { + List buildArgs = new LinkedList<>(); + Process process = executeRun(TEST_DISTRIBUTION_PATH.toString(), project, buildArgs); + InputStream success = process.getErrorStream(); + try (BufferedReader br = new BufferedReader(new InputStreamReader(success, "UTF-8"))) { + Stream logLines = br.lines(); + String generatedLog = logLines.collect(Collectors.joining(System.lineSeparator())); + Assert.assertTrue(generatedLog.contains(log)); + logLines.close(); + } + } + + /** + * Ballerina run command. + */ + public static Process executeRun(String distributionName, Path sourceDirectory, + List args) throws IOException, InterruptedException { + args.add(0, "build"); + Process process = getProcessBuilderResults(distributionName, sourceDirectory, args); + process.waitFor(); + return process; + } + + /** + * Get Process from given arguments. + * @param distributionName The name of the distribution. + * @param sourceDirectory The directory where the sources files are location. + * @param args The arguments to be passed to the build command. + * @return process + * @throws IOException Error executing build command. + */ + public static Process getProcessBuilderResults(String distributionName, Path sourceDirectory, List args) + throws IOException { + String balFile = "bal"; + + if (System.getProperty("os.name").startsWith("Windows")) { + balFile = "bal.bat"; + } + args.add(0, TEST_DISTRIBUTION_PATH.resolve(distributionName).resolve("bin").resolve(balFile).toString()); + ProcessBuilder pb = new ProcessBuilder(args); + pb.directory(sourceDirectory.toFile()); + return pb.start(); + } + +// public static Process getProcessBuilderResults(String distributionName, Path sourceDirectory, List args) +// throws IOException { + +// if (System.getProperty("os.name").startsWith("Windows")) { +// balFile = "bal.bat"; +// } +// args.add(0, TEST_DISTRIBUTION_PATH.resolve(distributionName).resolve("bin").resolve(balFile).toString()); +// ProcessBuilder pb = new ProcessBuilder(args); +// pb.directory(sourceDirectory.toFile()); +// return pb.start(); +// } } diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingAddTest.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingAddTest.java index 534d08656..ede9cb3dd 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingAddTest.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingAddTest.java @@ -33,7 +33,7 @@ import java.nio.file.Paths; import java.util.Properties; -import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.Command.INIT; +import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.Command.ADD; import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.assertGeneratedSources; import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.assertGeneratedSourcesNegative; @@ -65,7 +65,7 @@ public void findLatestPersistVersion() { @Test(enabled = true) @Description("When the project is not initiated") - public void testInit() { + public void testAdd() { updateOutputBallerinaToml("tool_test_add_1"); executeCommand("tool_test_add_1"); assertGeneratedSources("tool_test_add_1"); @@ -73,8 +73,8 @@ public void testInit() { @Test(enabled = true) @Description("When there is an already initiated configs and there is an uninitiated schema") - public void testInitUpdateConfigWithNewDbConfigurations() { - assertGeneratedSourcesNegative("tool_test_add_2", INIT, new String[]{}); + public void testAddUpdateConfigWithNewDbConfigurations() { + assertGeneratedSourcesNegative("tool_test_add_2", ADD, new String[]{}); } @Test(enabled = true) @@ -89,7 +89,7 @@ public void testsInitUpdateConfigWithPartialyInitiatedFiles() { @Test(enabled = true) @Description("When the init command is executed outside a Ballerina project") public void testsInitOutsideBalProject() { - assertGeneratedSourcesNegative("tool_test_add_4", INIT, new String[]{"Config.toml"}); + assertGeneratedSourcesNegative("tool_test_add_4", ADD, new String[]{"Config.toml"}); } @Test(enabled = true) diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java index a666ffff3..805571266 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java @@ -18,6 +18,7 @@ package io.ballerina.persist.tools.utils; +import io.ballerina.persist.cmd.Add; import io.ballerina.persist.cmd.Generate; import io.ballerina.persist.cmd.Init; import io.ballerina.persist.cmd.Migrate; @@ -53,7 +54,7 @@ public class GeneratedSourcesTestUtils { * Represents persist commands. */ public enum Command { - INIT, + ADD, GENERATE, DB_PUSH, MIGRATE @@ -158,9 +159,9 @@ public static HashMap executeCommand(String subDir, Command cmd) { Class persistClass; Path sourcePath = Paths.get(GENERATED_SOURCES_DIRECTORY, subDir); try { - if (cmd == Command.INIT) { - persistClass = Class.forName("io.ballerina.persist.cmd.Init"); - Init persistCmd = (Init) persistClass.getDeclaredConstructor(String.class) + if (cmd == Command.ADD) { + persistClass = Class.forName("io.ballerina.persist.cmd.Add"); + Add persistCmd = (Add) persistClass.getDeclaredConstructor(String.class) .newInstance(sourcePath.toAbsolutePath().toString()); persistCmd.execute(); } else if (cmd == Command.GENERATE) { diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/Ballerina.toml new file mode 100644 index 000000000..04cbc8a6b --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/Ballerina.toml @@ -0,0 +1,26 @@ +[package] +org = "foo" +name = "persist_build_1" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true + +[[arraytable]] +value = 1 +[[arraytable]] +value = 2 + +array = [ [1, 0], [0, 1] ] + +[[tool.persist]] +id = "generate-db-client" +targetModule = "persist_build_1" +options.datastore = "mysql" +filePath = "x" + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.1" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/main.bal new file mode 100644 index 000000000..3fc27193c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/main.bal @@ -0,0 +1,21 @@ +// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/io; + +public function main() { + io:println("hello"); +} diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/persist/model.bal new file mode 100644 index 000000000..33677d14a --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_1/persist/model.bal @@ -0,0 +1,61 @@ +// Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/time; +import ballerina/persist as _; +import ballerina/constraint; + +// Defines the entity type with the entity identity + +type Employee record {| + readonly string empNo; + string firstName; + string lastName; + time:Date birthDate; + string gender; + time:Date hireDate; + + Department department; + Workspace? workspace; +|}; + +type Workspace record {| + readonly string workspaceId; + string workspaceType; + + Building location; + Employee employee; +|}; + +type Building record {| + readonly string buildingCode; + string city; + string state; + string country; + string postalCode; + + Workspace[] workspaces; +|}; + +type Department record {| + @constraint:String { + maxLength: 10 + } + readonly string deptNo; + string deptName; + + Employee[] employees; +|}; diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/Ballerina.toml new file mode 100644 index 000000000..da1e36097 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/Ballerina.toml @@ -0,0 +1,26 @@ +[package] +org = "foo" +name = "persist_build_1" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true + +[[arraytable]] +value = 1 +[[arraytable]] +value = 2 + +array = [ [1, 0], [0, 1] ] + +[[tool.persist]] +id = "generate-db-client" +targetModule = "persist_add_1" +options.datastore = "mysql" +filePath = "x" + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.1" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/main.bal new file mode 100644 index 000000000..3fc27193c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/main.bal @@ -0,0 +1,21 @@ +// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/io; + +public function main() { + io:println("hello"); +} diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/persist/model.bal new file mode 100644 index 000000000..98e11d28b --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_2/persist/model.bal @@ -0,0 +1,17 @@ +// Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/persist as _; diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/Ballerina.toml new file mode 100644 index 000000000..a1069fbb8 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/Ballerina.toml @@ -0,0 +1,19 @@ +[package] +org = "foo" +name = "persist_build_3" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true + +[[tool.persist]] +id = "generate-db-client" +targetModule = "persist_build_3.*****" +options.datastore = "mysql" +filePath = "x" + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.1" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/main.bal new file mode 100644 index 000000000..3fc27193c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/main.bal @@ -0,0 +1,21 @@ +// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/io; + +public function main() { + io:println("hello"); +} diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/persist/model.bal new file mode 100644 index 000000000..98e11d28b --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_3/persist/model.bal @@ -0,0 +1,17 @@ +// Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/persist as _; diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/Ballerina.toml new file mode 100644 index 000000000..45c164bac --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/Ballerina.toml @@ -0,0 +1,19 @@ +[package] +org = "foo" +name = "persist_build_4" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true + +[[tool.persist]] +id = "generate-db-client" +targetModule = "persist_build_4.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" +options.datastore = "mysql" +filePath = "x" + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.1" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/main.bal new file mode 100644 index 000000000..3fc27193c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/main.bal @@ -0,0 +1,21 @@ +// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/io; + +public function main() { + io:println("hello"); +} diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/persist/model.bal new file mode 100644 index 000000000..98e11d28b --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_4/persist/model.bal @@ -0,0 +1,17 @@ +// Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/persist as _; diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/Ballerina.toml new file mode 100644 index 000000000..4bacbe4d5 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/Ballerina.toml @@ -0,0 +1,19 @@ +[package] +org = "foo" +name = "persist_build_5" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true + +[[tool.persist]] +id = "generate-db-client" +targetModule = "persist_build_5.ddl" +options.datastore = "mysqls" +filePath = "x" + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.1" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/main.bal new file mode 100644 index 000000000..3fc27193c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/main.bal @@ -0,0 +1,21 @@ +// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/io; + +public function main() { + io:println("hello"); +} diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/persist/model.bal new file mode 100644 index 000000000..98e11d28b --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_5/persist/model.bal @@ -0,0 +1,17 @@ +// Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/persist as _; diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/Ballerina.toml new file mode 100644 index 000000000..2c5a30986 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/Ballerina.toml @@ -0,0 +1,19 @@ +[package] +org = "foo" +name = "persist_build_6" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true + +[[tool.persist]] +id = "generate-db-client" +targetModule = "persist_build_6" +options.datastore = "mysql" +filePath = "x" + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.1" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/main.bal new file mode 100644 index 000000000..3fc27193c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/main.bal @@ -0,0 +1,21 @@ +// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/io; + +public function main() { + io:println("hello"); +} diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/persist/model.bal new file mode 100644 index 000000000..98e11d28b --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_build_6/persist/model.bal @@ -0,0 +1,17 @@ +// Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/persist as _; diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java index 86264a82e..107b98182 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java @@ -141,19 +141,6 @@ public void execute() { " to the updated documentation."); return; } -// moduleNameWithPackageName = packageName; -// if (!module.equals(packageName)) { -// if (!ProjectUtils.validateModuleName(module)) { -// errStream.println("ERROR: invalid module name : '" + module + "' :\n" + -// "module name can only contain alphanumerics, underscores and periods"); -// return; -// } else if (!ProjectUtils.validateNameLength(module)) { -// errStream.println("ERROR: invalid module name : '" + module + "' :\n" + -// "maximum length of module name is 256 characters"); -// return; -// } -// } -// moduleNameWithPackageName = module; if (!module.equals(packageName)) { if (!module.startsWith(packageName + ".")) { errStream.println("ERROR: invalid module name : '" + module + "' :\n" + diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java index 9b46281c8..11e3adc43 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java @@ -62,7 +62,7 @@ public void execute(ToolContext toolContext) { String targetModule; Path generatedSourceDirPath = Paths.get(this.sourcePath, BalSyntaxConstants.GENERATED_SOURCE_DIRECTORY); - Path projectPath = Paths.get(sourcePath); + Path projectPath = toolContext.currentPackage().project().sourceRoot(); try { BalProjectUtils.validateBallerinaProject(projectPath); } catch (BalException e) { @@ -121,6 +121,11 @@ public void execute(ToolContext toolContext) { "persist directory and try executing the command again."); return; } + if (datastore.equals(PersistToolsConstants.SupportedDataSources.GOOGLE_SHEETS)) { + errStream.printf(BalSyntaxConstants.EXPERIMENTAL_NOTICE, "The support for Google Sheets data store " + + "is currently an experimental feature, and its behavior may be subject to change in future " + + "releases." + System.lineSeparator()); + } entityModule = BalProjectUtils.getEntities(schemaFilePath); if (entityModule.getEntityMap().isEmpty()) { errStream.printf("ERROR: the model definition file(%s) does not contain any entity definition.%n", From ee45daa0ed980ccfa89d9c6ae039edef3e98222e Mon Sep 17 00:00:00 2001 From: bhashinee Date: Thu, 22 Feb 2024 10:37:11 +0530 Subject: [PATCH 04/22] Copy the persist cli jar to test distribution to run build tests --- persist-cli-tests/build.gradle | 8 ++++++++ .../persist/tools/BuildCodeGeneratorTest.java | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/persist-cli-tests/build.gradle b/persist-cli-tests/build.gradle index ea59d9710..9c030473e 100644 --- a/persist-cli-tests/build.gradle +++ b/persist-cli-tests/build.gradle @@ -123,6 +123,7 @@ task copyStdlibs() { doLast { configurations.ballerinaStdLibs.resolvedConfiguration.resolvedArtifacts.each { artifact -> def artifactExtractedPath = "${project.buildDir}/extracted-stdlibs/" + artifact.name + "-zip" + def persistCliJar = "${project.rootDir}/persist-cli/build/libs/persist-cli-${project.version}.jar" copy { into ballerinaDist into("repo/bala") { @@ -142,6 +143,13 @@ task copyStdlibs() { from "${artifactExtractedPath}/cache" } } + copy { + def testDistribution = "${project.rootDir}/persist-cli-tests/build/ballerina-distribution" + into testDistribution + into("bre/lib") { + from "${persistCliJar}" + } + } } } } 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 0fea4abd6..e7eff4cf0 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 @@ -7,6 +7,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Paths; import java.util.LinkedList; @@ -20,7 +21,6 @@ public class BuildCodeGeneratorTest { public static final Path TARGET_DIR = Paths.get(System.getProperty("user.dir"), "build"); public static final Path TEST_DISTRIBUTION_PATH = TARGET_DIR.resolve("ballerina-distribution"); - public static final Path RESOURCES_PATH = TARGET_DIR.resolve("resources/test"); @Test(enabled = true) public void testBuildWithMysql() throws IOException, InterruptedException { @@ -74,8 +74,8 @@ public void testBuildWithoutEntities() throws IOException, InterruptedException private void assertLogs(String log, Path project) throws IOException, InterruptedException { List buildArgs = new LinkedList<>(); Process process = executeRun(TEST_DISTRIBUTION_PATH.toString(), project, buildArgs); - InputStream success = process.getErrorStream(); - try (BufferedReader br = new BufferedReader(new InputStreamReader(success, "UTF-8"))) { + InputStream outStream = process.getErrorStream(); + try (BufferedReader br = new BufferedReader(new InputStreamReader(outStream, StandardCharsets.UTF_8))) { Stream logLines = br.lines(); String generatedLog = logLines.collect(Collectors.joining(System.lineSeparator())); Assert.assertEquals(generatedLog, log); @@ -86,8 +86,8 @@ private void assertLogs(String log, Path project) throws IOException, Interrupte private void assertContainLogs(String log, Path project) throws IOException, InterruptedException { List buildArgs = new LinkedList<>(); Process process = executeRun(TEST_DISTRIBUTION_PATH.toString(), project, buildArgs); - InputStream success = process.getErrorStream(); - try (BufferedReader br = new BufferedReader(new InputStreamReader(success, "UTF-8"))) { + InputStream outStream = process.getErrorStream(); + try (BufferedReader br = new BufferedReader(new InputStreamReader(outStream, StandardCharsets.UTF_8))) { Stream logLines = br.lines(); String generatedLog = logLines.collect(Collectors.joining(System.lineSeparator())); Assert.assertTrue(generatedLog.contains(log)); From 820dbe00a3a7f97a99fe41b88c308b3c33d450f5 Mon Sep 17 00:00:00 2001 From: bhashinee Date: Wed, 28 Feb 2024 09:23:36 +0530 Subject: [PATCH 05/22] Refactor the code --- gradle.properties | 5 +- persist-cli-tests/build.gradle | 2 +- .../persist/tools/BuildCodeGeneratorTest.java | 30 +++-- .../persist/tools/ToolingGenerateTest.java | 114 +++++++++--------- .../input/tool_test_build_1/Ballerina.toml | 2 +- .../input/tool_test_build_2/Ballerina.toml | 2 +- .../input/tool_test_build_3/Ballerina.toml | 2 +- .../input/tool_test_build_4/Ballerina.toml | 2 +- .../input/tool_test_build_5/Ballerina.toml | 2 +- .../input/tool_test_build_6/Ballerina.toml | 2 +- .../output/tool_test_add_1/Ballerina.toml | 2 +- .../output/tool_test_add_12/Ballerina.toml | 2 +- .../output/tool_test_add_13/Ballerina.toml | 2 +- .../output/tool_test_add_14/Ballerina.toml | 2 +- .../output/tool_test_add_3/Ballerina.toml | 2 +- .../output/tool_test_add_5/Ballerina.toml | 2 +- .../test-src/output/tool_test_add_5/main.bal | 2 +- .../test-src/output/tool_test_add_6/main.bal | 2 +- .../output/tool_test_add_7/Ballerina.toml | 2 +- .../test-src/output/tool_test_add_7/main.bal | 2 +- .../output/tool_test_add_9/Ballerina.toml | 2 +- .../persist/PersistToolsConstants.java | 2 +- .../java/io/ballerina/persist/cmd/Add.java | 6 +- .../io/ballerina/persist/cmd/Generate.java | 45 ++++--- .../java/io/ballerina/persist/cmd/Init.java | 32 ----- .../persist/cmd/PersistCodeGeneratorTool.java | 24 ++-- .../java/io/ballerina/persist/cmd/Utils.java | 3 - .../syntax/utils/TomlSyntaxUtils.java | 2 +- ...rina.projects.buildtools.CodeGeneratorTool | 2 +- .../resources/persist-options-schema.json | 2 +- .../src/main/resources/version.properties | 6 +- 31 files changed, 132 insertions(+), 177 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1b0ee2006..45b332371 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ org.gradle.caching=true group=io.ballerina -version=1.2.4 +version=1.3.0-SNAPSHOT #dependency versions checkstylePluginVersion=10.12.1 @@ -17,7 +17,6 @@ mssqlDriverVersion=11.2.3.jre17 postgresqlDriverVersion=42.6.0 ballerinaLangVersion=2201.9.0-20240216-054100-84e1bc71 -#ballerinaLangVersion=2201.8.3 # Level 01 stdlibIoVersion=1.6.0 @@ -49,7 +48,7 @@ stdlibHttpVersion=2.10.4 stdlibSqlVersion=1.11.1 # Level 09 -stdlibPersistVersion=1.2.3 +stdlibPersistVersion=1.2.1 # Level 10 stdlibPersistSqlVersion=1.2.2-20231206-130200-881839f diff --git a/persist-cli-tests/build.gradle b/persist-cli-tests/build.gradle index 9c030473e..9247b8032 100644 --- a/persist-cli-tests/build.gradle +++ b/persist-cli-tests/build.gradle @@ -422,7 +422,7 @@ jacocoTestReport { } test.dependsOn startTestDockerContainer -//test.dependsOn startMSSQLTestDockerContainer +test.dependsOn startMSSQLTestDockerContainer test.dependsOn startPostgreSQLTestDockerContainer test.dependsOn pullGSheetsDependency test.dependsOn ":persist-cli:build" 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 e7eff4cf0..9c8f0de70 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 @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package io.ballerina.persist.tools; import org.testng.Assert; @@ -126,16 +144,4 @@ public static Process getProcessBuilderResults(String distributionName, Path sou pb.directory(sourceDirectory.toFile()); return pb.start(); } - -// public static Process getProcessBuilderResults(String distributionName, Path sourceDirectory, List args) -// throws IOException { - -// if (System.getProperty("os.name").startsWith("Windows")) { -// balFile = "bal.bat"; -// } -// args.add(0, TEST_DISTRIBUTION_PATH.resolve(distributionName).resolve("bin").resolve(balFile).toString()); -// ProcessBuilder pb = new ProcessBuilder(args); -// pb.directory(sourceDirectory.toFile()); -// return pb.start(); -// } } diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java index 0b1cb1e93..0516e5d44 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java @@ -48,14 +48,14 @@ public void testGenerateAssociatedEntities() { @Test(enabled = true) @Description("There are multiple entities in the Ballerina project") public void testGenerateMultipleEntities() { - executeGenerateCommand("tool_test_generate_2", "mysql", "persist_generate_2.entities"); + executeGenerateCommand("tool_test_generate_2", "mysql", "entities"); assertGeneratedSources("tool_test_generate_2"); } @Test(enabled = true) @Description("There are no entities nor already generated client objects in the Ballerina project") public void testGenerateWithoutEntitiesWithoutClients() { - executeGenerateCommand("tool_test_generate_3", "mysql", "persist_generate_3.entities"); + executeGenerateCommand("tool_test_generate_3", "mysql", "entities"); assertGeneratedSources("tool_test_generate_3"); } @@ -69,14 +69,14 @@ public void testGenerateOutsideBalProject() { @Test(enabled = true) @Description("There is a generated client object and the corresponding entity is updated") public void testGenerateUpdateEntity() { - executeGenerateCommand("tool_test_generate_5", "mysql", "persist_generate_5.entities"); + executeGenerateCommand("tool_test_generate_5", "mysql", "entities"); assertGeneratedSources("tool_test_generate_5"); } @Test(enabled = true) @Description("A persist entity with all the supported fields data types") public void testGenerateAllEntityFieldTypes() { - executeGenerateCommand("tool_test_generate_6", "mysql", "persist_generate_6.entities"); + executeGenerateCommand("tool_test_generate_6", "mysql", "entities"); assertGeneratedSources("tool_test_generate_6"); } @@ -84,20 +84,20 @@ public void testGenerateAllEntityFieldTypes() { @Description("Use case where unsupported datatypes are used") public void testGenerateClientWithUnsupportedDataTypes() { assertGeneratedSourcesNegative("tool_test_generate_7", GENERATE, new String[]{}, "mysql", - "persist_generate_7.entities"); + "entities"); } @Test(enabled = true) @Description("There is only a single entity in the Ballerina project where key is a string") public void testGenerateSingleEntityWithStringKey() { - executeGenerateCommand("tool_test_generate_8", "mysql", "persist_generate_8.entities"); + executeGenerateCommand("tool_test_generate_8", "mysql", "entities"); assertGeneratedSources("tool_test_generate_8"); } @Test(enabled = true) //removed until support for multiple keys are provided @Description("There is only a single entity in the Ballerina project with two keys") public void testGenerateSingleEntityWithMultipleKeysAndAutoInc() { - executeGenerateCommand("tool_test_generate_9", "mysql", "persist_generate_9.entities"); + executeGenerateCommand("tool_test_generate_9", "mysql", "entities"); assertGeneratedSources("tool_test_generate_9"); } @@ -105,20 +105,20 @@ public void testGenerateSingleEntityWithMultipleKeysAndAutoInc() { @Description("There is only a single entity in the Ballerina project and there are errors in the project") public void testGenerateSingleEntityWithErrors() { assertGeneratedSourcesNegative("tool_test_generate_11", GENERATE, new String[]{}, "mysql", - "persist_generate_11.entities"); + "entities"); } @Test(enabled = true) @Description("There is only a single entity in the schema with wrong import") public void testGenerateSingleEntityWithWrongImport() { assertGeneratedSourcesNegative("tool_test_generate_12", GENERATE, new String[]{}, "mysql", - "persist_generate_12.entities"); + "entities"); } @Test(enabled = true) @Description("There are three entities with one to one associations between each other") public void testGenerateThreeEntitiesWith1To1Associations() { - executeGenerateCommand("tool_test_generate_13", "mysql", "persist_generate_13.entities"); + executeGenerateCommand("tool_test_generate_13", "mysql", "entities"); assertGeneratedSources("tool_test_generate_13"); } @@ -126,20 +126,20 @@ public void testGenerateThreeEntitiesWith1To1Associations() { @Description("There are three entities in two schema files") public void testGenerateThreeEntitiesWith1To1AssociationsWithChildEntityInSubModule() { assertGeneratedSourcesNegative("tool_test_generate_15", GENERATE, new String[]{}, "mysql", - "persist_generate_13.entities"); + "entities"); } @Test(enabled = true) @Description("There are two entities with one to many associations between each other") public void testGenerateClientsWith1ToManyAssociations() { - executeGenerateCommand("tool_test_generate_16", "mysql", "persist_generate_16.entities"); + executeGenerateCommand("tool_test_generate_16", "mysql", "entities"); assertGeneratedSources("tool_test_generate_16"); } @Test(enabled = true) @Description("There are three entities with one to many associations between each other") public void testGenerateThreeClientsWith1ToManyAssociations() { - executeGenerateCommand("tool_test_generate_17", "mysql", "persist_generate_17.entities"); + executeGenerateCommand("tool_test_generate_17", "mysql", "entities"); assertGeneratedSources("tool_test_generate_17"); } @@ -147,13 +147,13 @@ public void testGenerateThreeClientsWith1ToManyAssociations() { @Description("There are three entities with one to one associations between each other without nullable fields") public void testGenerateThreeEntitiesWith1To1AssociationsWithOutAnnotationValue() { assertGeneratedSourcesNegative("tool_test_generate_19", GENERATE, new String[]{}, "mysql", - "persist_generate_19.entities"); + "entities"); } @Test(enabled = true) @Description("There are two special entities with special characters in field names") public void testGenerateRelatedClientsWithSpecialCharactersInName() { - executeGenerateCommand("tool_test_generate_22", "mysql", "persist_generate_22.entities"); + executeGenerateCommand("tool_test_generate_22", "mysql", "entities"); assertGeneratedSources("tool_test_generate_22"); } @@ -161,27 +161,27 @@ public void testGenerateRelatedClientsWithSpecialCharactersInName() { @Description("Negative test case where init command was not run before generate command") public void testGenerateWithoutInit() { assertGeneratedSourcesNegative("tool_test_generate_23", GENERATE, new String[]{}, "mysql", - "persist_generate_23.entities"); + "entities"); } @Test(enabled = true) @Description("Test the generate command with entities containing byte[] fields") public void testGenerateWithByteArrays() { - executeGenerateCommand("tool_test_generate_24", "mysql", "persist_generate_24.foo"); + executeGenerateCommand("tool_test_generate_24", "mysql", "foo"); assertGeneratedSources("tool_test_generate_24"); } @Test(enabled = true) @Description("There are two entities with one to many associations between each other without relation annotation") public void testGenerateOneToManyAssociationsWithoutRelationAnnotation() { - executeGenerateCommand("tool_test_generate_25", "mysql", "persist_generate_25.entities"); + executeGenerateCommand("tool_test_generate_25", "mysql", "entities"); assertGeneratedSources("tool_test_generate_25"); } @Test(enabled = true) @Description("There are two entities with one to one associations between each other without relation annotation") public void testGenerateOneToOneAssociationsWithoutRelationAnnotation() { - executeGenerateCommand("tool_test_generate_26", "mysql", "persist_generate_26.entities"); + executeGenerateCommand("tool_test_generate_26", "mysql", "entities"); assertGeneratedSources("tool_test_generate_26"); } @@ -189,7 +189,7 @@ public void testGenerateOneToOneAssociationsWithoutRelationAnnotation() { @Description("There are three entities with one to one associations between each other with comments " + "in entity fields") public void testGenerateThreeEntitiesWith1To1AssociationsWithComments() { - executeGenerateCommand("tool_test_generate_27", "mysql", "persist_generate_27.entities"); + executeGenerateCommand("tool_test_generate_27", "mysql", "entities"); assertGeneratedSources("tool_test_generate_27"); } @@ -197,42 +197,42 @@ public void testGenerateThreeEntitiesWith1To1AssociationsWithComments() { @Description("There are three entities with one to many associations between each other with comments " + "in entity fields") public void testGenerateThreeEntitiesWith1ToManyAssociationsWithComments() { - executeGenerateCommand("tool_test_generate_28", "mysql", "persist_generate_28.entities"); + executeGenerateCommand("tool_test_generate_28", "mysql", "entities"); assertGeneratedSources("tool_test_generate_28"); } @Test(enabled = true) @Description("There is a entity inside the project with comments inside entity") public void testGenerateWithComments() { - executeGenerateCommand("tool_test_generate_29", "mysql", "persist_generate_29.entities"); + executeGenerateCommand("tool_test_generate_29", "mysql", "entities"); assertGeneratedSources("tool_test_generate_29"); } @Test(enabled = true) @Description("Test the generate command with out defining any schema files inside persist directory") public void testGenerateWithoutSchemaFile() { - executeGenerateCommand("tool_test_generate_30", "mysql", "persist_generate_30.entities"); + executeGenerateCommand("tool_test_generate_30", "mysql", "entities"); assertGeneratedSources("tool_test_generate_30"); } @Test(enabled = true) @Description("Test the generate command with empty schema file inside persist directory") public void testGenerateWithEmptySchemaFile() { - executeGenerateCommand("tool_test_generate_31", "mysql", "persist_generate_31.entities"); + executeGenerateCommand("tool_test_generate_31", "mysql", "entities"); assertGeneratedSources("tool_test_generate_31"); } @Test(enabled = true) @Description("Test the generate command without persist import in schema file") public void testGenerateWithoutPersistImport() { - executeGenerateCommand("tool_test_generate_33", "mysql", "persist_generate_33.entities"); + executeGenerateCommand("tool_test_generate_33", "mysql", "entities"); assertGeneratedSources("tool_test_generate_33"); } @Test(enabled = true) @Description("Test the generate command with optional type in schema file") public void testGenerateWithOptionalType() { - executeGenerateCommand("tool_test_generate_34", "mysql", "persist_generate_34.entities"); + executeGenerateCommand("tool_test_generate_34", "mysql", "entities"); assertGeneratedSources("tool_test_generate_34"); } @@ -246,42 +246,42 @@ public void testGenerateInDefaultPackage() { @Test(enabled = true) @Description("Test the generate command with escape character in entity fields, and names") public void testGenerateRelationsWithSingleQuote() { - executeGenerateCommand("tool_test_generate_36", "mysql", "persist_generate_36.rainier"); + executeGenerateCommand("tool_test_generate_36", "mysql", "rainier"); assertGeneratedSources("tool_test_generate_36"); } @Test(enabled = true) @Description("Test the created sql script content for relations and byte[] type") public void testSqlGen() { - executeGenerateCommand("tool_test_generate_37", "mysql", "tool_test_generate_37.entities"); + executeGenerateCommand("tool_test_generate_37", "mysql", "entities"); assertGeneratedSources("tool_test_generate_37"); } @Test(enabled = true) @Description("Test the created sql script content with out defining any schema files inside persist directory") public void testSqlGenWithoutSchemaFile() { - executeGenerateCommand("tool_test_generate_38", "mysql", "tool_test_generate_38.entities"); + executeGenerateCommand("tool_test_generate_38", "mysql", "entities"); assertGeneratedSources("tool_test_generate_38"); } @Test(enabled = true) @Description("Test the created sql script with one to many relation entity") public void testSqlGenWithOneToManyRelationship() { - executeGenerateCommand("tool_test_generate_39", "mysql", "tool_test_generate_39.entities"); + executeGenerateCommand("tool_test_generate_39", "mysql", "entities"); assertGeneratedSources("tool_test_generate_39"); } @Test(enabled = true) @Description("Test the created sql script with optional type fields") public void testSqlGenWithOptionalTypeFields() { - executeGenerateCommand("tool_test_generate_40", "mysql", "tool_test_generate_40.entities"); + executeGenerateCommand("tool_test_generate_40", "mysql", "entities"); assertGeneratedSources("tool_test_generate_40"); } @Test(enabled = true) @Description("Test the created sql script with composite reference keys") public void testSqlGenWithCompositeReferenceKeys() { - executeGenerateCommand("tool_test_generate_41", "mysql", "tool_test_generate_41.entities"); + executeGenerateCommand("tool_test_generate_41", "mysql", "entities"); assertGeneratedSources("tool_test_generate_41"); } @@ -299,7 +299,7 @@ public void testGenerateArgs() throws ClassNotFoundException, NoSuchMethodExcept @Test(enabled = true) public void testInvalidDataStore() { - executeGenerateCommand("tool_test_generate_42", "my", "tool_test_generate_42.entities"); + executeGenerateCommand("tool_test_generate_42", "my", "entities"); assertGeneratedSources("tool_test_generate_42"); } @@ -315,7 +315,7 @@ public void testInvalidModuleName() { @Test(enabled = true) public void testInvalidModuleName1() { - executeGenerateCommand("tool_test_generate_44", "mysql", ".test"); + executeGenerateCommand("tool_test_generate_44", "mysql", ".."); - return; - } - String moduleName = module.replace(packageName + ".", ""); - if (!ProjectUtils.validateModuleName(moduleName)) { - errStream.println("ERROR: invalid module name : '" + moduleName + "' :\n" + - "module name can only contain alphanumerics, underscores and periods"); - return; - } else if (!ProjectUtils.validateNameLength(moduleName)) { - errStream.println("ERROR: invalid module name : '" + moduleName + "' :\n" + - "maximum length of module name is 256 characters"); - return; - } - generatedSourceDirPath = generatedSourceDirPath.resolve(moduleName); + generatedSourceDirPath = generatedSourceDirPath.resolve(module); } + if (!PersistToolsConstants.SUPPORTED_DB_PROVIDERS.contains(datastore)) { errStream.printf("ERROR: the persist layer supports one of data stores: %s" + ". but found '%s' datasource.%n", @@ -188,7 +187,7 @@ public void execute() { } try { - BalProjectUtils.updateToml(sourcePath, datastore, module); + BalProjectUtils.updateToml(sourcePath, datastore, moduleNameWithPackage); BalProjectUtils.validateSchemaFile(schemaFilePath); Module module = BalProjectUtils.getEntities(schemaFilePath); if (module.getEntityMap().isEmpty()) { @@ -198,7 +197,7 @@ public void execute() { } entityModule = module; } catch (BalException | IOException e) { - errStream.printf("ERROR: failed to generate types and client for the definition file(%s). %s%n", + errStream.printf("ERROR: Failed to generate types and client for the definition file(%s). %s%n", schemaFilePath.getFileName(), e.getMessage()); return; } @@ -212,7 +211,7 @@ public void execute() { } } SourceGenerator sourceCreator = new SourceGenerator(sourcePath, generatedSourceDirPath, - module, entityModule); + moduleNameWithPackage, entityModule); try { switch (datastore) { case PersistToolsConstants.SupportedDataSources.MYSQL_DB: diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Init.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Init.java index 5eb0b38fc..e37dd1a8c 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Init.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Init.java @@ -134,16 +134,6 @@ public void execute() { "maximum length of module name is 256 characters"); return; } -// try { -// String moduleName = packageName; -// if (!module.equals(packageName)) { -// moduleName = String.format("%s.%s", packageName.replaceAll("\"", ""), module); -// } -// updateBallerinaToml(moduleName, datastore); -// } catch (BalException e) { -// errStream.println("ERROR: failed to add persist configurations in the toml file. " + e.getMessage()); -// return; -// } Path persistDirPath = Paths.get(this.sourcePath, PERSIST_DIRECTORY); if (!Files.exists(persistDirPath)) { @@ -190,28 +180,6 @@ public void execute() { } -// private void generateSchemaBalFile(Path persistPath) throws BalException { -// try { -// String configTree = generateSchemaSyntaxTree(); -// writeOutputString(configTree, persistPath.resolve(SCHEMA_FILE_NAME + BAL_EXTENSION) -// .toAbsolutePath().toString()); -// } catch (Exception e) { -// throw new BalException(e.getMessage()); -// } -// } - -// private void updateBallerinaToml(String module, String datastore) throws BalException { -// try { -// String syntaxTree = TomlSyntaxUtils.updateBallerinaToml( -// Paths.get(this.sourcePath, BALLERINA_TOML), module, datastore, ""); -// writeOutputString(syntaxTree, -// Paths.get(this.sourcePath, BALLERINA_TOML).toAbsolutePath().toString()); -// } catch (Exception e) { -// throw new BalException("could not update the Ballerina.toml with persist configurations. " + -// e.getMessage()); -// } -// } - @Override public void setParentCmdParser(CommandLine parentCmdParser) { } diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java index 11e3adc43..a96f20d8f 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java @@ -43,16 +43,6 @@ public class PersistCodeGeneratorTool implements CodeGeneratorTool { private static final PrintStream errStream = System.err; - private final String sourcePath; - - public PersistCodeGeneratorTool() { - this(""); - } - - public PersistCodeGeneratorTool(String sourcePath) { - this.sourcePath = sourcePath; - } - @Override public void execute(ToolContext toolContext) { String datastore; @@ -60,9 +50,9 @@ public void execute(ToolContext toolContext) { Path schemaFilePath; String packageName; String targetModule; - Path generatedSourceDirPath = Paths.get(this.sourcePath, BalSyntaxConstants.GENERATED_SOURCE_DIRECTORY); Path projectPath = toolContext.currentPackage().project().sourceRoot(); + Path generatedSourceDirPath = Paths.get(projectPath.toString(), BalSyntaxConstants.GENERATED_SOURCE_DIRECTORY); try { BalProjectUtils.validateBallerinaProject(projectPath); } catch (BalException e) { @@ -71,14 +61,14 @@ public void execute(ToolContext toolContext) { } try { - packageName = TomlSyntaxUtils.readPackageName(this.sourcePath); + packageName = TomlSyntaxUtils.readPackageName(projectPath.toString()); } catch (BalException e) { errStream.println(e.getMessage()); return; } try { - schemaFilePath = BalProjectUtils.getSchemaFilePath(this.sourcePath); + schemaFilePath = BalProjectUtils.getSchemaFilePath(projectPath.toString()); } catch (BalException e) { errStream.println(e.getMessage()); return; @@ -86,7 +76,7 @@ public void execute(ToolContext toolContext) { try { HashMap ballerinaTomlConfig = TomlSyntaxUtils.readBallerinaTomlConfig( - Paths.get(this.sourcePath, "Ballerina.toml")); + Paths.get(projectPath.toString(), "Ballerina.toml")); targetModule = ballerinaTomlConfig.get(TARGET_MODULE).trim(); if (!targetModule.equals(packageName)) { if (!targetModule.startsWith(packageName + ".")) { @@ -113,7 +103,7 @@ public void execute(ToolContext toolContext) { Arrays.toString(PersistToolsConstants.SUPPORTED_DB_PROVIDERS.toArray()), datastore); return; } - if (Files.isDirectory(Paths.get(sourcePath, PersistToolsConstants.PERSIST_DIRECTORY, + if (Files.isDirectory(Paths.get(projectPath.toString(), PersistToolsConstants.PERSIST_DIRECTORY, PersistToolsConstants.MIGRATIONS)) && !datastore.equals(PersistToolsConstants.SupportedDataSources.MYSQL_DB)) { errStream.println("ERROR: regenerating the client with a different datastore after executing " + @@ -133,7 +123,7 @@ public void execute(ToolContext toolContext) { return; } } catch (BalException e) { - errStream.printf("ERROR: failed to generate types and client for the definition file(%s). %s%n", + errStream.printf("ERROR: Failed to generate types and client for the definition file(%s). %s%n", "Ballerina.toml", e.getMessage()); return; } @@ -145,7 +135,7 @@ public void execute(ToolContext toolContext) { return; } } - SourceGenerator sourceCreator = new SourceGenerator(sourcePath, generatedSourceDirPath, + SourceGenerator sourceCreator = new SourceGenerator(projectPath.toString(), generatedSourceDirPath, targetModule, entityModule); try { switch (datastore) { diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Utils.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Utils.java index 191b77395..18bb5b72a 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Utils.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Utils.java @@ -112,9 +112,6 @@ public static String generateSchemaSyntaxTree() throws FormatterException { ModulePartNode modulePartNode = NodeFactory.createModulePartNode(imports, moduleMembers, eofToken); TextDocument textDocument = TextDocuments.from(BalSyntaxConstants.EMPTY_STRING); SyntaxTree balTree = SyntaxTree.from(textDocument); - - // output cannot be SyntaxTree as it will overlap with Toml Syntax Tree in Init - // Command return Formatter.format(balTree.modifyWith(modulePartNode).toSourceCode()); } } diff --git a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java index 6c53dd270..ea31699fb 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java +++ b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java @@ -231,7 +231,7 @@ private static NodeList populateBallerinaNodeList moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("id", id, null)); moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("targetModule", module, null)); moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("options.datastore", dataStore, null)); - moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("filePath", "x", null)); + moduleMembers = moduleMembers.add(SampleNodeGenerator.createStringKV("filePath", "persist/model.bal", null)); return moduleMembers; } diff --git a/persist-cli/src/main/resources/META-INF/services/io.ballerina.projects.buildtools.CodeGeneratorTool b/persist-cli/src/main/resources/META-INF/services/io.ballerina.projects.buildtools.CodeGeneratorTool index b0d41bc67..84586f9eb 100644 --- a/persist-cli/src/main/resources/META-INF/services/io.ballerina.projects.buildtools.CodeGeneratorTool +++ b/persist-cli/src/main/resources/META-INF/services/io.ballerina.projects.buildtools.CodeGeneratorTool @@ -1 +1 @@ -io.ballerina.persist.cmd.PersistCodeGeneratorTool \ No newline at end of file +io.ballerina.persist.cmd.PersistCodeGeneratorTool diff --git a/persist-cli/src/main/resources/persist-options-schema.json b/persist-cli/src/main/resources/persist-options-schema.json index abc25334b..2cc3e9e4a 100644 --- a/persist-cli/src/main/resources/persist-options-schema.json +++ b/persist-cli/src/main/resources/persist-options-schema.json @@ -7,4 +7,4 @@ } }, "additionalProperties": false -} \ No newline at end of file +} diff --git a/persist-cli/src/main/resources/version.properties b/persist-cli/src/main/resources/version.properties index 26b6fd44e..22e655c24 100644 --- a/persist-cli/src/main/resources/version.properties +++ b/persist-cli/src/main/resources/version.properties @@ -1,4 +1,4 @@ version = ${project.version} -persistSqlVersion = 1.2.2-SNAPSHOT -persistInMemoryVersion = 1.2.0 -persistGoogleSheetsVersion = 1.2.0 +persistSqlVersion = ${project.persistSqlNativeVersion} +persistInMemoryVersion = ${project.persistInMemoryNativeVersion} +persistGoogleSheetsVersion = ${project.persistGoogleSheetsNativeVersion} From fef0e47212fc0d5bb3f6bb0346f758ca7a88f8ed Mon Sep 17 00:00:00 2001 From: bhashinee Date: Wed, 28 Feb 2024 10:21:34 +0530 Subject: [PATCH 06/22] Fix failing test cases --- .../src/test/resources/test-src/input/tool_test_add_5/main.bal | 2 +- .../src/test/resources/test-src/input/tool_test_add_6/main.bal | 2 +- .../src/test/resources/test-src/input/tool_test_add_7/main.bal | 2 +- .../test-src/output/tool_test_generate_1/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_11/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_12/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_13/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_16/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_17/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_19/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_2/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_22/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_24/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_25/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_26/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_27/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_28/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_29/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_3/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_31/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_33/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_34/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_35/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_36/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_37/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_39/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_40/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_41/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_46/target/Persist.toml | 3 +++ .../output/tool_test_generate_47_in_memory/target/Persist.toml | 3 +++ .../output/tool_test_generate_48_in_memory/target/Persist.toml | 3 +++ .../output/tool_test_generate_49_in_memory/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_5/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_50/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_51/target/Persist.toml | 3 +++ .../output/tool_test_generate_52_in_memory/target/Persist.toml | 3 +++ .../output/tool_test_generate_53_in_memory/target/Persist.toml | 3 +++ .../output/tool_test_generate_54_gsheet/target/Persist.toml | 3 +++ .../output/tool_test_generate_55_in_memory/target/Persist.toml | 3 +++ .../output/tool_test_generate_56_gsheets/target/Persist.toml | 3 +++ .../output/tool_test_generate_57_gsheets/target/Persist.toml | 3 +++ .../output/tool_test_generate_58_mssql/target/Persist.toml | 3 +++ .../output/tool_test_generate_59_mssql/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_6/target/Persist.toml | 3 +++ .../output/tool_test_generate_60_mssql/target/Persist.toml | 3 +++ .../output/tool_test_generate_61_mssql/target/Persist.toml | 3 +++ .../output/tool_test_generate_62_mssql/target/Persist.toml | 3 +++ .../output/tool_test_generate_63_mssql/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_64/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_65/target/Persist.toml | 3 +++ .../tool_test_generate_66_postgresql/target/Persist.toml | 3 +++ .../tool_test_generate_67_postgresql/target/Persist.toml | 3 +++ .../tool_test_generate_68_postgresql/target/Persist.toml | 3 +++ .../tool_test_generate_69_postgresql/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_7/target/Persist.toml | 3 +++ .../tool_test_generate_70_postgresql/target/Persist.toml | 3 +++ .../tool_test_generate_71_postgresql/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_8/target/Persist.toml | 3 +++ .../test-src/output/tool_test_generate_9/target/Persist.toml | 3 +++ 59 files changed, 171 insertions(+), 3 deletions(-) create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/target/Persist.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/target/Persist.toml diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/main.bal index 3fc27193c..1cf0710e5 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/main.bal +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_5/main.bal @@ -1,4 +1,4 @@ -// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. // // WSO2 LLC. licenses this file to you under the Apache License, // Version 2.0 (the "License"); you may not use this file except diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/main.bal index 3fc27193c..1cf0710e5 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/main.bal +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/main.bal @@ -1,4 +1,4 @@ -// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. // // WSO2 LLC. licenses this file to you under the Apache License, // Version 2.0 (the "License"); you may not use this file except diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/main.bal index 3fc27193c..1cf0710e5 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/main.bal +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_7/main.bal @@ -1,4 +1,4 @@ -// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. // // WSO2 LLC. licenses this file to you under the Apache License, // Version 2.0 (the "License"); you may not use this file except diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/target/Persist.toml new file mode 100644 index 000000000..9a10e65ff --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_1" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/target/Persist.toml new file mode 100644 index 000000000..de142cb84 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_11.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/target/Persist.toml new file mode 100644 index 000000000..302999691 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_12.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/target/Persist.toml new file mode 100644 index 000000000..d44520d3c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_13.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/target/Persist.toml new file mode 100644 index 000000000..1c0550fac --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_16.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/target/Persist.toml new file mode 100644 index 000000000..1774a301f --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_17.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/target/Persist.toml new file mode 100644 index 000000000..b817049b7 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_19.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/target/Persist.toml new file mode 100644 index 000000000..2d2838786 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_2.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/target/Persist.toml new file mode 100644 index 000000000..7ed1ad51f --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_22.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/target/Persist.toml new file mode 100644 index 000000000..cda594516 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_24.foo" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/target/Persist.toml new file mode 100644 index 000000000..6a1b5ef99 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_25.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/target/Persist.toml new file mode 100644 index 000000000..ca0e0ea1c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_26.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/target/Persist.toml new file mode 100644 index 000000000..1ef096b31 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_27.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/target/Persist.toml new file mode 100644 index 000000000..cc7a996bc --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_28.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/target/Persist.toml new file mode 100644 index 000000000..cdc5ddcc7 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_29.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/target/Persist.toml new file mode 100644 index 000000000..49df2f544 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_3.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/target/Persist.toml new file mode 100644 index 000000000..dd4dee36a --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_31.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/target/Persist.toml new file mode 100644 index 000000000..27bbd06bb --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "tool_test_generate_33.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/target/Persist.toml new file mode 100644 index 000000000..f6dfb1ab5 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_34.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/target/Persist.toml new file mode 100644 index 000000000..9efc285ab --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_35" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/target/Persist.toml new file mode 100644 index 000000000..f1a88cf1f --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_36.rainier" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/target/Persist.toml new file mode 100644 index 000000000..0bfd6a131 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "tool_test_generate_37.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/target/Persist.toml new file mode 100644 index 000000000..f4e4d915d --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "tool_test_generate_39.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/target/Persist.toml new file mode 100644 index 000000000..b37988ca4 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "tool_test_generate_40.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/target/Persist.toml new file mode 100644 index 000000000..c931f6aae --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "tool_test_generate_41.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/target/Persist.toml new file mode 100644 index 000000000..889d4f938 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "tool_test_generate_46.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/target/Persist.toml new file mode 100644 index 000000000..8d74043cf --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "inmemory" +module = "persist_generate_47.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/target/Persist.toml new file mode 100644 index 000000000..563d9f271 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "inmemory" +module = "persist_generate_48.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/target/Persist.toml new file mode 100644 index 000000000..4ec75eb59 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "inmemory" +module = "persist_generate_49.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/target/Persist.toml new file mode 100644 index 000000000..4febfcfb4 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_5.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/target/Persist.toml new file mode 100644 index 000000000..0ad7f0cfd --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_50" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/target/Persist.toml new file mode 100644 index 000000000..9c01c6c17 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_51" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/target/Persist.toml new file mode 100644 index 000000000..3af509b83 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "inmemory" +module = "persist_generate_52.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/target/Persist.toml new file mode 100644 index 000000000..3af509b83 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "inmemory" +module = "persist_generate_52.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/target/Persist.toml new file mode 100644 index 000000000..1d0dd8b9a --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "googlesheets" +module = "persist_generate_54.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/target/Persist.toml new file mode 100644 index 000000000..6f04b497d --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "inmemory" +module = "persist_generate_55.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/target/Persist.toml new file mode 100644 index 000000000..02d8f1afa --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "googlesheets" +module = "persist_generate_56.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/target/Persist.toml new file mode 100644 index 000000000..8bb9097a7 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "googlesheets" +module = "persist_generate_57.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/target/Persist.toml new file mode 100644 index 000000000..7db616504 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mssql" +module = "persist_generate_58.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/target/Persist.toml new file mode 100644 index 000000000..18186d459 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mssql" +module = "persist_generate_59.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/target/Persist.toml new file mode 100644 index 000000000..898369e8b --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_6.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/target/Persist.toml new file mode 100644 index 000000000..e3b551ed5 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mssql" +module = "persist_generate_60.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/target/Persist.toml new file mode 100644 index 000000000..0504d5185 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mssql" +module = "persist_generate_61.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/target/Persist.toml new file mode 100644 index 000000000..88eef66f5 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mssql" +module = "persist_generate_62.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/target/Persist.toml new file mode 100644 index 000000000..882a16c0c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mssql" +module = "persist_generate_63.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/target/Persist.toml new file mode 100644 index 000000000..e17f4bdd3 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_64.x.y.z" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/target/Persist.toml new file mode 100644 index 000000000..372f24f49 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_65" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/target/Persist.toml new file mode 100644 index 000000000..095491185 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "postgresql" +module = "persist_generate_66.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/target/Persist.toml new file mode 100644 index 000000000..f0f5a2d16 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "postgresql" +module = "persist_generate_67.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/target/Persist.toml new file mode 100644 index 000000000..fa525c57c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "postgresql" +module = "persist_generate_68.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/target/Persist.toml new file mode 100644 index 000000000..bed560b98 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "postgresql" +module = "persist_generate_69.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/target/Persist.toml new file mode 100644 index 000000000..f0db17faa --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_7.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/target/Persist.toml new file mode 100644 index 000000000..c1456492a --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "postgresql" +module = "persist_generate_70.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/target/Persist.toml new file mode 100644 index 000000000..62d66ea94 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "postgresql" +module = "persist_generate_71.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/target/Persist.toml new file mode 100644 index 000000000..5a04392e6 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_8.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/target/Persist.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/target/Persist.toml new file mode 100644 index 000000000..51d42fd56 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/target/Persist.toml @@ -0,0 +1,3 @@ +[[tool.persist]] +options.datastore = "mysql" +module = "persist_generate_9.entities" From 1bf5b9f454ca45f810abd0a20a54f3514f4dd578 Mon Sep 17 00:00:00 2001 From: bhashinee Date: Wed, 28 Feb 2024 12:48:21 +0530 Subject: [PATCH 07/22] Fix test failures --- examples/build.gradle | 12 +++--- .../output/tool_test_add_1/Ballerina.toml | 1 + .../output/tool_test_add_12/Ballerina.toml | 1 + .../output/tool_test_add_13/Ballerina.toml | 1 + .../output/tool_test_add_14/Ballerina.toml | 1 + .../output/tool_test_add_2/Ballerina.toml | 12 ++++++ .../output/tool_test_add_3/Ballerina.toml | 1 + .../output/tool_test_add_5/Ballerina.toml | 1 + .../output/tool_test_add_7/Ballerina.toml | 1 + .../output/tool_test_add_9/Ballerina.toml | 1 + .../tool_test_generate_20/Ballerina.toml | 12 ++++++ .../tool_test_generate_20/Config.toml | 6 +++ .../tool_test_generate_20/main.bal | 21 ++++++++++ .../tool_test_generate_20/persist/model.bal | 38 +++++++++++++++++++ .../tool_test_generate_1/Ballerina.toml | 4 ++ .../generated/persist_db_config.bal | 3 +- .../tool_test_generate_10/Ballerina.toml | 4 +- .../tool_test_generate_11/Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_12/Ballerina.toml | 6 +++ .../tool_test_generate_13/Ballerina.toml | 6 +++ .../output/tool_test_generate_13/Config.toml | 1 + .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_14/Ballerina.toml | 4 +- .../tool_test_generate_15/Ballerina.toml | 8 ++-- .../tool_test_generate_16/Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_17/Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_18/Ballerina.toml | 4 +- .../tool_test_generate_19/Ballerina.toml | 6 +++ .../tool_test_generate_2/Ballerina.toml | 4 ++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_20/Ballerina.toml | 4 +- .../tool_test_generate_21/Ballerina.toml | 4 +- .../tool_test_generate_22/Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_24/Ballerina.toml | 6 +++ .../generated/foo/persist_db_config.bal | 3 +- .../tool_test_generate_25/Ballerina.toml | 5 +++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_26/Ballerina.toml | 6 +++ .../output/tool_test_generate_26/Config.toml | 1 + .../tool_test_generate_27/Ballerina.toml | 6 +++ .../output/tool_test_generate_27/Config.toml | 1 + .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_28/Ballerina.toml | 6 +++ .../output/tool_test_generate_28/Config.toml | 1 + .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_29/Ballerina.toml | 6 +++ .../output/tool_test_generate_29/Config.toml | 1 + .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_3/Ballerina.toml | 5 +++ .../tool_test_generate_31/Ballerina.toml | 6 +++ .../output/tool_test_generate_31/Config.toml | 1 - .../tool_test_generate_32/Ballerina.toml | 4 +- .../tool_test_generate_33/Ballerina.toml | 6 +++ .../tool_test_generate_34/Ballerina.toml | 5 +++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_35/Ballerina.toml | 6 +++ .../generated/persist_db_config.bal | 3 +- .../tool_test_generate_36/Ballerina.toml | 6 +++ .../output/tool_test_generate_36/Config.toml | 1 + .../generated/rainier/persist_db_config.bal | 3 +- .../tool_test_generate_37/Ballerina.toml | 5 +++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_39/Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_40/Ballerina.toml | 5 +++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_41/Ballerina.toml | 6 +++ .../output/tool_test_generate_41/Config.toml | 1 + .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_46/Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_46/persist/model.bal | 2 +- .../Ballerina.toml | 6 +++ .../Ballerina.toml | 6 +++ .../Ballerina.toml | 6 +++ .../tool_test_generate_5/Ballerina.toml | 5 +++ .../output/tool_test_generate_5/Config.toml | 1 + .../tool_test_generate_50/Ballerina.toml | 6 +++ .../output/tool_test_generate_50/Config.toml | 2 + .../generated/persist_db_config.bal | 3 +- .../tool_test_generate_51/Ballerina.toml | 6 +++ .../output/tool_test_generate_51/Config.toml | 2 + .../generated/persist_db_config.bal | 3 +- .../Ballerina.toml | 6 +++ .../Ballerina.toml | 6 +++ .../Ballerina.toml | 6 +++ .../tool_test_generate_54_gsheet/Config.toml | 2 + .../entities/persist_sheet_config.bal | 1 + .../Ballerina.toml | 6 +++ .../Ballerina.toml | 6 +++ .../tool_test_generate_56_gsheets/Config.toml | 1 + .../Ballerina.toml | 6 +++ .../Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 2 - .../Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 2 - .../tool_test_generate_6/Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 3 +- .../Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 2 - .../Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 2 - .../Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 2 - .../Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 2 - .../tool_test_generate_64/Ballerina.toml | 5 +++ .../generated/x.y.z/persist_db_config.bal | 2 - .../tool_test_generate_65/Ballerina.toml | 6 +++ .../output/tool_test_generate_65/Config.toml | 1 + .../Ballerina.toml | 6 +++ .../Config.toml | 1 + .../Ballerina.toml | 6 +++ .../Ballerina.toml | 6 +++ .../Ballerina.toml | 6 +++ .../tool_test_generate_7/Ballerina.toml | 5 +++ .../Ballerina.toml | 6 +++ .../Ballerina.toml | 6 +++ .../tool_test_generate_8/Ballerina.toml | 6 +++ .../generated/entities/persist_db_config.bal | 3 +- .../tool_test_generate_9/Ballerina.toml | 5 +++ .../generated/entities/persist_db_config.bal | 2 - .../java/io/ballerina/persist/cmd/Add.java | 2 +- .../io/ballerina/persist/cmd/Generate.java | 5 +++ .../syntax/utils/TomlSyntaxUtils.java | 16 ++++---- .../src/main/resources/version.properties | 6 +-- 130 files changed, 503 insertions(+), 99 deletions(-) create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/Ballerina.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/Config.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/main.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/persist/model.bal diff --git a/examples/build.gradle b/examples/build.gradle index f390a7406..477d782cf 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -141,7 +141,7 @@ task initDbExamples { delete "${project.projectDir}/build/generated-examples/${example}/generated" workingDir "${project.projectDir}/build/generated-examples/${example}" if (!Os.isFamily(Os.FAMILY_WINDOWS)) { - commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist init --module=entities --datastore=mysql" + commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --module entities --datastore mysql" } else { commandLine 'cmd', 'slmgr /dlv' println('\n' + "Windows Instance detected") @@ -164,9 +164,9 @@ task initInMemoryExamples { exec { workingDir "${project.projectDir}/build/generated-examples/${example}" if (!Os.isFamily(Os.FAMILY_WINDOWS)) { - commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist init --module=entities" + commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --module entities --datastore inmemory" } else { - commandLine 'cmd', '/c', "${ballerinaDist}/bin/bal.bat persist init --module=entities" + commandLine 'cmd', '/c', "${ballerinaDist}/bin/bal.bat persist generate --module entities --datastore inmemory" } } } catch (Exception e) { @@ -211,7 +211,7 @@ task generateDbExamples { exec { workingDir "${project.projectDir}/build/generated-examples/${example}" if (!Os.isFamily(Os.FAMILY_WINDOWS)) { - commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate" + commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --module entities --datastore inmemory" } else { commandLine 'cmd', 'slmgr /dlv' println('\n' + "Windows Instance detected") @@ -234,9 +234,9 @@ task generateInMemoryExamples { exec { workingDir "${project.projectDir}/build/generated-examples/${example}" if (!Os.isFamily(Os.FAMILY_WINDOWS)) { - commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --datastore=inmemory" + commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --datastore inmemory --module entities" } else { - commandLine 'cmd', '/c', "${ballerinaDist}/bin/bal.bat persist generate" + commandLine 'cmd', '/c', "${ballerinaDist}/bin/bal.bat persist generate --datastore inmemory --module entities" } } } catch (Exception e) { diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_1/Ballerina.toml index 4b724310f..bcf02d120 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_1/Ballerina.toml @@ -24,3 +24,4 @@ filePath = "persist/model.bal" groupId = "io.ballerina.stdlib" artifactId = "persist.sql-native" version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_12/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_12/Ballerina.toml index f7600d7f9..8d4490066 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_12/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_12/Ballerina.toml @@ -17,3 +17,4 @@ filePath = "persist/model.bal" groupId = "io.ballerina.stdlib" artifactId = "persist.inmemory-native" version = "1.2.0" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_13/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_13/Ballerina.toml index a85e3b34d..5dd8e8347 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_13/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_13/Ballerina.toml @@ -17,3 +17,4 @@ filePath = "persist/model.bal" groupId = "io.ballerina.stdlib" artifactId = "persist.sql-native" version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_14/Ballerina.toml index bd111bcd0..222a211c3 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_14/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_14/Ballerina.toml @@ -17,3 +17,4 @@ filePath = "persist/model.bal" groupId = "io.ballerina.stdlib" artifactId = "persist.sql-native" version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/Ballerina.toml index 447325b32..2b76a3d4e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_2/Ballerina.toml @@ -13,3 +13,15 @@ port = 3306 user = "root" password = "" database = "" + +[[tool.persist]] +id = "generate-db-client" +targetModule = "persist_add_2" +options.datastore = "inmemory" +filePath = "persist/model.bal" + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.inmemory-native" +version = "1.2.0" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/Ballerina.toml index f435d51c7..78925aca6 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_3/Ballerina.toml @@ -24,3 +24,4 @@ filePath = "persist/model.bal" groupId = "io.ballerina.stdlib" artifactId = "persist.sql-native" version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/Ballerina.toml index 7fe439372..e20d3bdcf 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_5/Ballerina.toml @@ -24,3 +24,4 @@ filePath = "persist/model.bal" groupId = "io.ballerina.stdlib" artifactId = "persist.sql-native" version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/Ballerina.toml index 1660a7ad6..adb2ed3c3 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_7/Ballerina.toml @@ -17,3 +17,4 @@ filePath = "persist/model.bal" groupId = "io.ballerina.stdlib" artifactId = "persist.sql-native" version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_9/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_9/Ballerina.toml index 10897d569..5b7be2e31 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_9/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_9/Ballerina.toml @@ -24,3 +24,4 @@ filePath = "persist/model.bal" groupId = "io.ballerina.stdlib" artifactId = "persist.sql-native" version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/Ballerina.toml new file mode 100644 index 000000000..0563e85fd --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/Ballerina.toml @@ -0,0 +1,12 @@ +[package] +org = "foo" +name = "persist_generate_20" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = false + +[[tool.persist]] +options.datastore = "mysql" +targetModule = "persist_generate_20.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/Config.toml new file mode 100644 index 000000000..08202deaf --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/Config.toml @@ -0,0 +1,6 @@ +[persist_generate_20.entities] +host = "localhost" +port = 3307 +user = "root" +password = "Test123#" +database = "persist" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/main.bal new file mode 100644 index 000000000..3fc27193c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/main.bal @@ -0,0 +1,21 @@ +// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/io; + +public function main() { + io:println("hello"); +} diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/persist/model.bal new file mode 100644 index 000000000..8df1dc675 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/persist/model.bal @@ -0,0 +1,38 @@ +// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/persist as _; + +public type Company record {| + readonly int id; + string name; + Employee[] employee; +|}; + +public type Employee record {| + readonly int id; + string name; + + Company company; + Vehicle[] vehicles; +|}; + +public type Vehicle record {| + readonly int model; + string name; + + Employee employee; +|}; diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/Ballerina.toml index c5616ce55..30e847435 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/Ballerina.toml @@ -7,4 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_10/Ballerina.toml index dd9b2cc23..dcc098bc8 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_10/Ballerina.toml @@ -7,6 +7,6 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] +[[tool.persist]] options.datastore = "mysql" -module = "persist_generate_10.entities" +targetModule = "persist_generate_10.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/Ballerina.toml index e80a65491..2ef2b4ee8 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/Ballerina.toml index 3390ba1a9..0fc20dcb1 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_12/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = true + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Ballerina.toml index 53b6f2ace..30b3b2a60 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Config.toml index 67d90e6a9..363146c90 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Config.toml @@ -12,3 +12,4 @@ user = "root" password = "" database = "" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_14/Ballerina.toml index 2baf84d53..d0931cbf8 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_14/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_14/Ballerina.toml @@ -7,6 +7,6 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] +[[tool.persist]] options.datastore = "mysql" -module = "persist_generate_14.entities" +targetModule = "persist_generate_14.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_15/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_15/Ballerina.toml index 647a0b92b..2a398f852 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_15/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_15/Ballerina.toml @@ -7,10 +7,10 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] +[[tool.persist]] options.datastore = "mysql" -module = "persist_generate_15.entities1" +targetModule = "persist_generate_15.entities1" -[persist] +[[tool.persist]] options.datastore = "mysql" -module = "persist_generate_15.entities" +targetModule = "persist_generate_15.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/Ballerina.toml index 1623e234f..8172ddf33 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/Ballerina.toml index ca3222eaa..9f7173789 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_18/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_18/Ballerina.toml index 2294792b2..3431a7680 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_18/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_18/Ballerina.toml @@ -7,6 +7,6 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] +[[tool.persist]] options.datastore = "mysql" -module = "persist_generate_18.entities" +targetModule = "persist_generate_18.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/Ballerina.toml index be09b6350..d1fc68bd4 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_19/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/Ballerina.toml index 5a394a700..8784cd577 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/Ballerina.toml @@ -7,4 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_20/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_20/Ballerina.toml index 5616aef17..0563e85fd 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_20/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_20/Ballerina.toml @@ -7,6 +7,6 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] +[[tool.persist]] options.datastore = "mysql" -module = "persist_generate_20.entities" +targetModule = "persist_generate_20.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_21/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_21/Ballerina.toml index 7243b2040..4fd1681da 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_21/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_21/Ballerina.toml @@ -7,6 +7,6 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false -[persist] +[[tool.persist]] options.datastore = "mysql" -module = "persist_generate_21.entities" +targetModule = "persist_generate_21.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/Ballerina.toml index 9bb9838dd..bf036e223 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/Ballerina.toml index 0e371b424..44da7dfa8 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/Ballerina.toml index 1d07b3cc9..646ed499b 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/Ballerina.toml @@ -7,3 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Ballerina.toml index 23f6a3a16..4e0f7ffb2 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml index e93d93468..d4c816b73 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml @@ -4,3 +4,4 @@ port = 3306 user = "root" password = "" database = "" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Ballerina.toml index f34c457bc..39360d132 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Config.toml index 4e363d996..293f1a68f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Config.toml @@ -12,3 +12,4 @@ user = "root" password = "" database = "" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml index 4bcae7584..1f68c3dce 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Config.toml index e8a9b44ec..5fa20ddc6 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Config.toml @@ -12,3 +12,4 @@ user = "root" password = "" database = "" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Ballerina.toml index 6fcf69b17..96b1d7757 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Config.toml index da50fdb68..5029da3b8 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Config.toml @@ -12,3 +12,4 @@ user = "root" password = "" database = "" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/Ballerina.toml index 547b45580..72d20c777 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_3/Ballerina.toml @@ -7,3 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Ballerina.toml index b8c46c619..1604a44e7 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Ballerina.toml @@ -3,3 +3,9 @@ org = "foo" name = "persist_generate_31" version = "0.1.0" distribution = "2201.3.0" + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Config.toml index abcecfed1..ee679e431 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Config.toml @@ -4,4 +4,3 @@ port = 3307 user = "root" password = "Test123#" database = "persist" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_32/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_32/Ballerina.toml index f0d8c4ff5..3c22531bf 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_32/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_32/Ballerina.toml @@ -4,6 +4,6 @@ name = "persist_generate_32" version = "0.1.0" distribution = "2201.3.0" -[persist] +[[tool.persist]] options.datastore = "mysql" -module = "persist_generate_32.entities" +targetModule = "persist_generate_32.entities" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/Ballerina.toml index f4906b295..533f74b94 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_33/Ballerina.toml @@ -3,3 +3,9 @@ org = "foo" name = "tool_test_generate_33" version = "0.1.0" distribution = "2201.3.0" + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/Ballerina.toml index b8766b127..9445ff3c8 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/Ballerina.toml @@ -7,3 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/Ballerina.toml index b1f1ca6dd..49675c385 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Ballerina.toml index f27ec1ed1..126a69c89 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Config.toml index 2bd7cc9df..019da85d0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Config.toml @@ -4,3 +4,4 @@ port = 3307 user = "root" password = "Test123#" database = "persist" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/Ballerina.toml index 58862bd09..e2e6379d4 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/Ballerina.toml @@ -7,3 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/Ballerina.toml index 307fa68b7..871fc0f21 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.4.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/Ballerina.toml index be9b97025..addb95eaa 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/Ballerina.toml @@ -7,3 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml index 9d4c1c969..b519364ac 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Config.toml index 2cbe265a3..3088d3472 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Config.toml @@ -4,3 +4,4 @@ port = 3307 user = "root" password = "Test123#" database = "persist" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/Ballerina.toml index 5345faafd..3d350f143 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/persist/model.bal index 6f9191658..cdd5bba9e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/persist/model.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/persist/model.bal @@ -40,4 +40,4 @@ type Follower record {| time:Civil created_date; User leader; User follower; -|}; \ No newline at end of file +|}; diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/Ballerina.toml index d31266eb9..2ee8e94c0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.inmemory-native" +version = "1.2.0" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/Ballerina.toml index bfe6af446..ed3905116 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.inmemory-native" +version = "1.2.0" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/Ballerina.toml index 3a0f46289..0a905c31e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.inmemory-native" +version = "1.2.0" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Ballerina.toml index a793dba44..1c5578aa3 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Ballerina.toml @@ -7,3 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Config.toml index 71c3b04d0..53bf5ce49 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Config.toml @@ -7,3 +7,4 @@ database = "" [persist_generate_5.connectionOptions.ssl] allowPublicKeyRetrieval=true + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Ballerina.toml index 20ee7fdc9..2a7521436 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Config.toml index facd7f2d6..1c0791772 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Config.toml @@ -4,3 +4,5 @@ port = 3306 user = "root" password = "" database = "" + + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Ballerina.toml index 288c9f7b5..9540f31b3 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Config.toml index fc52a0189..28d9113e8 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Config.toml @@ -4,3 +4,5 @@ port = 3306 user = "root" password = "" database = "" + + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/Ballerina.toml index 4f4125e60..75ec55eb4 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.inmemory-native" +version = "1.2.0" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/Ballerina.toml index 4f4125e60..75ec55eb4 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.inmemory-native" +version = "1.2.0" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Ballerina.toml index 420e1668d..d2aa00801 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.googlesheets-native" +version = "1.2.0" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Config.toml index 3e735304a..3848d0377 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Config.toml @@ -3,3 +3,5 @@ spreadsheetId = "" clientId = "" clientSecret = "" refreshToken = "" + + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/persist_sheet_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/persist_sheet_config.bal index c01cc4faf..3322dc8f4 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/persist_sheet_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/persist_sheet_config.bal @@ -7,3 +7,4 @@ configurable string clientId = ?; configurable string clientSecret = ?; configurable string refreshToken = ?; configurable string spreadsheetId = ?; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/Ballerina.toml index 44dc93d9a..be3c1edb1 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.inmemory-native" +version = "1.2.0" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Ballerina.toml index cde86b055..d3d9247fe 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.googlesheets-native" +version = "1.2.0" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Config.toml index 34078132e..10521c14b 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Config.toml @@ -4,3 +4,4 @@ clientId = "" clientSecret = "" refreshToken = "" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/Ballerina.toml index 70181221d..e4dd976aa 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.googlesheets-native" +version = "1.2.0" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/Ballerina.toml index 00bdc5c97..8fa674026 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/persist_db_config.bal index 74bb82b31..c802c2ef9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mssql; configurable int port = ?; diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/Ballerina.toml index dae2dcf06..b19545429 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/persist_db_config.bal index 74bb82b31..c802c2ef9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mssql; configurable int port = ?; diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/Ballerina.toml index f0f8b241d..c13552957 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/Ballerina.toml index 98356bbaf..60586195d 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/persist_db_config.bal index 74bb82b31..c802c2ef9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mssql; configurable int port = ?; diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/Ballerina.toml index 03c17bde0..dd99d228e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/persist_db_config.bal index 74bb82b31..c802c2ef9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mssql; configurable int port = ?; diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/Ballerina.toml index 04c2eac16..55b5ade6e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/persist_db_config.bal index 74bb82b31..c802c2ef9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mssql; configurable int port = ?; diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/Ballerina.toml index 5915d250a..ee4c8fb72 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/persist_db_config.bal index 74bb82b31..c802c2ef9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mssql; configurable int port = ?; diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/Ballerina.toml index abdaf9d2f..e65815451 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/Ballerina.toml @@ -7,3 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/persist_db_config.bal index 05bde0c27..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Ballerina.toml index 00de15201..c2c243183 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Config.toml index 9449e5337..5878ea161 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Config.toml @@ -5,3 +5,4 @@ user = "root" password = "" database = "" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Ballerina.toml index aef3dee4b..adb5fbbc6 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Config.toml index 3dc7a00fb..a5d3e5cd1 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Config.toml @@ -5,3 +5,4 @@ user = "postgres" password = "" database = "" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/Ballerina.toml index 0026cd374..fb42c5247 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/Ballerina.toml index 4494ad040..3ceb7cc47 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.5.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/Ballerina.toml index 6ef2f1d6e..a666f9bf5 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/Ballerina.toml index 9b0c5039e..86cf13ab2 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_7/Ballerina.toml @@ -7,3 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/Ballerina.toml index 5a812940b..4b7ac96e8 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/Ballerina.toml index d3b063c56..c9b0cbb1f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/Ballerina.toml index 46f2573cc..912e3c449 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/Ballerina.toml @@ -6,3 +6,9 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false + +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/persist_db_config.bal index 8afe6b032..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; @@ -11,3 +9,4 @@ configurable string user = ?; configurable string database = ?; configurable string password = ?; configurable mysql:Options & readonly connectionOptions = {}; + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/Ballerina.toml index 20f4df2be..9ab05bab9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/Ballerina.toml @@ -7,3 +7,8 @@ distribution = "2201.3.0" [build-options] observabilityIncluded = false +[[platform.java17.dependency]] +groupId = "io.ballerina.stdlib" +artifactId = "persist.sql-native" +version = "1.2.2-SNAPSHOT" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/persist_db_config.bal index 05bde0c27..aedfe37e0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/persist_db_config.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/persist_db_config.bal @@ -1,8 +1,6 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. - // This file is an auto-generated file by Ballerina persistence layer. // It should not be modified by hand. - import ballerinax/mysql; configurable int port = ?; diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java index e0bf4773d..60e8610df 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java @@ -117,7 +117,7 @@ public void execute() { validateBallerinaProject(projectPath); createDefaultClientId(); String syntaxTree = TomlSyntaxUtils.updateBallerinaToml(Paths.get(this.sourcePath, BALLERINA_TOML), module, - datastore, id); + datastore, false, id); Utils.writeOutputString(syntaxTree, Paths.get(this.sourcePath, BALLERINA_TOML).toAbsolutePath().toString()); Path persistDirPath = Paths.get(this.sourcePath, PERSIST_DIRECTORY); diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java index 157db0fc8..2bd63158a 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java @@ -43,6 +43,7 @@ import java.util.Arrays; import static io.ballerina.persist.PersistToolsConstants.PERSIST_DIRECTORY; +import static io.ballerina.projects.util.ProjectConstants.BALLERINA_TOML; /** * This Class implements the `persist generate` command in Ballerina persist-tool. @@ -188,6 +189,10 @@ public void execute() { try { BalProjectUtils.updateToml(sourcePath, datastore, moduleNameWithPackage); + String syntaxTree = TomlSyntaxUtils.updateBallerinaToml(Paths.get(this.sourcePath, BALLERINA_TOML), module, + datastore, true); + Utils.writeOutputString(syntaxTree, + Paths.get(this.sourcePath, BALLERINA_TOML).toAbsolutePath().toString()); BalProjectUtils.validateSchemaFile(schemaFilePath); Module module = BalProjectUtils.getEntities(schemaFilePath); if (module.getEntityMap().isEmpty()) { diff --git a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java index ea31699fb..cba2783c7 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java +++ b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/utils/TomlSyntaxUtils.java @@ -124,7 +124,7 @@ public static HashMap readBallerinaTomlConfig(Path configPath) t } if (!dbConfigExists) { throw new BalException("the persist config doesn't exist in the Ballerina.toml. " + - "add [persist] table with persist configurations."); + "add [tool.persist] table with persist configurations."); } else if (!persistConfig.containsKey("targetModule") || !persistConfig.containsKey("options.datastore")) { throw new BalException("the persist configurations does not exist under [persist] table."); } @@ -166,8 +166,8 @@ public static String readPackageName(String sourcePath) throws BalException { /** * Method to update the Ballerina.toml with database configurations and persist dependency. */ - public static String updateBallerinaToml(Path configPath, String module, String datasource, String id) - throws IOException, BalException { + public static String updateBallerinaToml(Path configPath, String module, String datasource, + boolean generateCmd, String... id) throws IOException, BalException { NodeList moduleMembers = AbstractNodeFactory.createEmptyNodeList(); Path fileNamePath = configPath.getFileName(); TextDocument configDocument = TextDocuments.from(Files.readString(configPath)); @@ -212,10 +212,12 @@ public static String updateBallerinaToml(Path configPath, String module, String } } moduleMembers = BalProjectUtils.addNewLine(moduleMembers, 1); - moduleMembers = moduleMembers.add(SampleNodeGenerator.createTableArray( - PersistToolsConstants.PERSIST_TOOL_CONFIG, null)); - moduleMembers = populateBallerinaNodeList(moduleMembers, module, datasource, id); - moduleMembers = BalProjectUtils.addNewLine(moduleMembers, 1); + if (!generateCmd) { + moduleMembers = moduleMembers.add(SampleNodeGenerator.createTableArray( + PersistToolsConstants.PERSIST_TOOL_CONFIG, null)); + moduleMembers = populateBallerinaNodeList(moduleMembers, module, datasource, id[0]); + moduleMembers = BalProjectUtils.addNewLine(moduleMembers, 1); + } moduleMembers = moduleMembers.add(SampleNodeGenerator.createTableArray( BalSyntaxConstants.PERSIST_DEPENDENCY, null)); moduleMembers = populatePersistDependency(moduleMembers, artifactId, datasource); diff --git a/persist-cli/src/main/resources/version.properties b/persist-cli/src/main/resources/version.properties index 22e655c24..26b6fd44e 100644 --- a/persist-cli/src/main/resources/version.properties +++ b/persist-cli/src/main/resources/version.properties @@ -1,4 +1,4 @@ version = ${project.version} -persistSqlVersion = ${project.persistSqlNativeVersion} -persistInMemoryVersion = ${project.persistInMemoryNativeVersion} -persistGoogleSheetsVersion = ${project.persistGoogleSheetsNativeVersion} +persistSqlVersion = 1.2.2-SNAPSHOT +persistInMemoryVersion = 1.2.0 +persistGoogleSheetsVersion = 1.2.0 From c8db5d1228207a199352b82986c96d7c7e2a4dca Mon Sep 17 00:00:00 2001 From: bhashinee Date: Wed, 28 Feb 2024 14:46:43 +0530 Subject: [PATCH 08/22] 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()); From 1001c416c373b9508815a0ea8fcf36e699d7898d Mon Sep 17 00:00:00 2001 From: bhashinee Date: Wed, 28 Feb 2024 17:42:16 +0530 Subject: [PATCH 09/22] Refactor the code --- examples/build.gradle | 12 +- .../persist/tools/BuildCodeGeneratorTest.java | 42 ++-- .../tool_test_generate_20/persist/model.bal | 2 +- .../persist/PersistToolsConstants.java | 2 + .../java/io/ballerina/persist/cmd/Add.java | 147 ++++++-------- .../persist/cmd/PersistCodeGeneratorTool.java | 180 +++++++++--------- 6 files changed, 167 insertions(+), 218 deletions(-) diff --git a/examples/build.gradle b/examples/build.gradle index 477d782cf..2e5f3dcd3 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -141,7 +141,7 @@ task initDbExamples { delete "${project.projectDir}/build/generated-examples/${example}/generated" workingDir "${project.projectDir}/build/generated-examples/${example}" if (!Os.isFamily(Os.FAMILY_WINDOWS)) { - commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --module entities --datastore mysql" + commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --module=entities --datastore=mysql" } else { commandLine 'cmd', 'slmgr /dlv' println('\n' + "Windows Instance detected") @@ -164,9 +164,9 @@ task initInMemoryExamples { exec { workingDir "${project.projectDir}/build/generated-examples/${example}" if (!Os.isFamily(Os.FAMILY_WINDOWS)) { - commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --module entities --datastore inmemory" + commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --module=entities --datastore=inmemory" } else { - commandLine 'cmd', '/c', "${ballerinaDist}/bin/bal.bat persist generate --module entities --datastore inmemory" + commandLine 'cmd', '/c', "${ballerinaDist}/bin/bal.bat persist generate --module=entities --datastore=inmemory" } } } catch (Exception e) { @@ -211,7 +211,7 @@ task generateDbExamples { exec { workingDir "${project.projectDir}/build/generated-examples/${example}" if (!Os.isFamily(Os.FAMILY_WINDOWS)) { - commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --module entities --datastore inmemory" + commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --module=entities --datastore=inmemory" } else { commandLine 'cmd', 'slmgr /dlv' println('\n' + "Windows Instance detected") @@ -234,9 +234,9 @@ task generateInMemoryExamples { exec { workingDir "${project.projectDir}/build/generated-examples/${example}" if (!Os.isFamily(Os.FAMILY_WINDOWS)) { - commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --datastore inmemory --module entities" + commandLine 'sh', '-c', "${ballerinaDist}/bin/bal persist generate --datastore=inmemory --module=entities" } else { - commandLine 'cmd', '/c', "${ballerinaDist}/bin/bal.bat persist generate --datastore inmemory --module entities" + commandLine 'cmd', '/c', "${ballerinaDist}/bin/bal.bat persist generate --datastore=inmemory --module=entities" } } } catch (Exception e) { 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 526c3615b..3f13d1a05 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 @@ -23,7 +23,6 @@ import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.nio.file.Path; @@ -89,49 +88,36 @@ public void testBuildWithoutEntities() throws IOException, InterruptedException assertLogs(log, project); } - private void assertLogs(String log, Path project) throws IOException, InterruptedException { + private String collectLogOutput(Path project) throws IOException, InterruptedException { List buildArgs = new LinkedList<>(); - Process process = executeRun(TEST_DISTRIBUTION_PATH.toString(), project, buildArgs); - InputStream outStream = process.getErrorStream(); - try (BufferedReader br = new BufferedReader(new InputStreamReader(outStream, StandardCharsets.UTF_8))) { + Process process = executeBuild(TEST_DISTRIBUTION_PATH.toString(), project, buildArgs); + try (BufferedReader br = new BufferedReader(new InputStreamReader(process.getErrorStream(), + StandardCharsets.UTF_8))) { Stream logLines = br.lines(); String generatedLog = logLines.collect(Collectors.joining(System.lineSeparator())); - Assert.assertEquals(generatedLog, log); logLines.close(); + return generatedLog; } } + private void assertLogs(String log, Path project) throws IOException, InterruptedException { + String generatedLog = collectLogOutput(project); + Assert.assertEquals(generatedLog, log); + } + private void assertContainLogs(String log, Path project) throws IOException, InterruptedException { - List buildArgs = new LinkedList<>(); - Process process = executeRun(TEST_DISTRIBUTION_PATH.toString(), project, buildArgs); - InputStream outStream = process.getErrorStream(); - try (BufferedReader br = new BufferedReader(new InputStreamReader(outStream, StandardCharsets.UTF_8))) { - Stream logLines = br.lines(); - String generatedLog = logLines.collect(Collectors.joining(System.lineSeparator())); - Assert.assertTrue(generatedLog.contains(log)); - logLines.close(); - } + String generatedLog = collectLogOutput(project); + Assert.assertTrue(generatedLog.contains(log)); } - /** - * Ballerina run command. - */ - public static Process executeRun(String distributionName, Path sourceDirectory, - List args) throws IOException, InterruptedException { + public static Process executeBuild(String distributionName, Path sourceDirectory, + List args) throws IOException, InterruptedException { args.add(0, "build"); Process process = getProcessBuilderResults(distributionName, sourceDirectory, args); process.waitFor(); return process; } - /** - * Get Process from given arguments. - * @param distributionName The name of the distribution. - * @param sourceDirectory The directory where the sources files are location. - * @param args The arguments to be passed to the build command. - * @return process - * @throws IOException Error executing build command. - */ public static Process getProcessBuilderResults(String distributionName, Path sourceDirectory, List args) throws IOException { String balFile = "bal"; diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/persist/model.bal index 8df1dc675..a6ff8b376 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/persist/model.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/tool_test_generate_20/persist/model.bal @@ -1,4 +1,4 @@ -// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. // // WSO2 LLC. licenses this file to you under the Apache License, // Version 2.0 (the "License"); you may not use this file except diff --git a/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java b/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java index 354ee4939..d8e142694 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java +++ b/persist-cli/src/main/java/io/ballerina/persist/PersistToolsConstants.java @@ -26,6 +26,8 @@ */ public class PersistToolsConstants { + public static final String BAL_PERSIST_ADD_CMD = "add"; + private PersistToolsConstants() {} public static final String COMPONENT_IDENTIFIER = "persist"; diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java index 60e8610df..dade23c0c 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java @@ -34,13 +34,13 @@ import java.util.List; import java.util.Locale; import java.util.Objects; -import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; +import static io.ballerina.persist.PersistToolsConstants.BAL_PERSIST_ADD_CMD; +import static io.ballerina.persist.nodegenerator.syntax.constants.BalSyntaxConstants.BAL_EXTENSION; import static io.ballerina.persist.PersistToolsConstants.PERSIST_DIRECTORY; import static io.ballerina.persist.PersistToolsConstants.SUPPORTED_DB_PROVIDERS; -import static io.ballerina.persist.nodegenerator.syntax.constants.BalSyntaxConstants.BAL_EXTENSION; import static io.ballerina.projects.util.ProjectConstants.BALLERINA_TOML; @CommandLine.Command( @@ -52,8 +52,6 @@ public class Add implements BLauncherCmd { private final String sourcePath; - private static final String COMMAND_IDENTIFIER = "persist-add"; - @CommandLine.Option(names = {"-h", "--help"}, hidden = true) private boolean helpFlag; @@ -76,126 +74,95 @@ public Add(String sourcePath) { @Override public void execute() { - String packageName; if (helpFlag) { String commandUsageInfo = BLauncherCmd.getCommandUsageInfo(getName()); errStream.println(commandUsageInfo); return; } - if (datastore == null) { - datastore = PersistToolsConstants.SupportedDataSources.IN_MEMORY_TABLE; - } else if (!SUPPORTED_DB_PROVIDERS.contains(datastore)) { - errStream.printf("ERROR: the persist layer supports one of data stores: %s" + - ". but found '%s' datasource.%n", Arrays.toString(SUPPORTED_DB_PROVIDERS.toArray()), datastore); - return; - } try { - packageName = TomlSyntaxUtils.readPackageName(this.sourcePath); - } catch (BalException e) { - errStream.println(e.getMessage()); - return; - } - if (module == null) { - module = packageName; - } else { - module = module.replaceAll("\"", ""); - } - if (!ProjectUtils.validateModuleName(module)) { - errStream.println("ERROR: invalid module name : '" + module + "' :\n" + - "module name can only contain alphanumerics, underscores and periods"); - return; - } else if (!ProjectUtils.validateNameLength(module)) { - errStream.println("ERROR: invalid module name : '" + module + "' :\n" + - "maximum length of module name is 256 characters"); - return; - } - if (!module.equals(packageName)) { - module = String.format("%s.%s", packageName.replaceAll("\"", ""), module); - } - try { - Path projectPath = Paths.get(sourcePath); - validateBallerinaProject(projectPath); + validateDatastore(); + validateAndProcessModule(); createDefaultClientId(); String syntaxTree = TomlSyntaxUtils.updateBallerinaToml(Paths.get(this.sourcePath, BALLERINA_TOML), module, datastore, false, id); Utils.writeOutputString(syntaxTree, - Paths.get(this.sourcePath, BALLERINA_TOML).toAbsolutePath().toString()); - Path persistDirPath = Paths.get(this.sourcePath, PERSIST_DIRECTORY); - if (!Files.exists(persistDirPath)) { - try { - Files.createDirectory(persistDirPath.toAbsolutePath()); - } catch (IOException e) { - errStream.println("ERROR: failed to create the persist directory. " + e.getMessage()); - return; - } - } - List schemaFiles; - try (Stream stream = Files.list(persistDirPath)) { - schemaFiles = stream.filter(file -> !Files.isDirectory(file)) - .map(Path::getFileName) - .filter(Objects::nonNull) - .filter(file -> file.toString().toLowerCase(Locale.ENGLISH).endsWith(BAL_EXTENSION)) - .map(file -> file.toString().replace(BAL_EXTENSION, "")) - .collect(Collectors.toList()); - } catch (IOException e) { - errStream.println("ERROR: failed to list model definition files in the persist directory. " - + e.getMessage()); - return; - } - if (schemaFiles.size() > 1) { - errStream.println("ERROR: the persist directory allows only one model definition file, " + - "but contains many files."); - return; - } - if (schemaFiles.size() == 0) { - try { - Utils.generateSchemaBalFile(persistDirPath); - } catch (BalException e) { - errStream.println("ERROR: failed to create the model definition file in persist directory. " - + e.getMessage()); - return; - } - } + Paths.get(sourcePath, BALLERINA_TOML).toAbsolutePath().toString()); + createPersistDirectoryIfNotExists(); + createDefaultSchemaBalFile(); } catch (BalException | IOException e) { - errStream.printf("ERROR: Failed to generate types and client for the definition file(%s). %s%n", - "Ballerina.toml", e.getMessage()); + errStream.printf("ERROR: %s%n", e.getMessage()); } } @Override public String getName() { - return "add"; + return BAL_PERSIST_ADD_CMD; } @Override public void printLongDesc(StringBuilder stringBuilder) { - } @Override public void printUsage(StringBuilder stringBuilder) { - } @Override public void setParentCmdParser(CommandLine commandLine) { + } + + private void validateDatastore() throws BalException { + if (datastore == null) { + datastore = PersistToolsConstants.SupportedDataSources.IN_MEMORY_TABLE; + } else if (!SUPPORTED_DB_PROVIDERS.contains(datastore)) { + throw new BalException(String.format("the persist layer supports one of data stores: %s" + + ". but found '%s' datasource.", Arrays.toString(SUPPORTED_DB_PROVIDERS.toArray()), datastore)); + } + } + + private void validateAndProcessModule() throws BalException { + String packageName; + try { + packageName = TomlSyntaxUtils.readPackageName(sourcePath); + } catch (BalException e) { + throw new BalException(e.getMessage()); + } + module = module == null ? packageName : module.replaceAll("\"", ""); + if (!ProjectUtils.validateModuleName(module)) { + throw new BalException(String.format("invalid module name : '%s' :" + System.lineSeparator() + + "module name can only contain alphanumerics, underscores and periods", module)); + } else if (!ProjectUtils.validateNameLength(module)) { + throw new BalException(String.format("invalid module name : '%s' :" + System.lineSeparator() + + "maximum length of module name is 256 characters", module)); + } + if (!module.equals(packageName)) { + module = String.format("%s.%s", packageName.replaceAll("\"", ""), module); + } + } + private void createPersistDirectoryIfNotExists() throws IOException { + Path persistDirPath = Paths.get(sourcePath, PERSIST_DIRECTORY); + if (!Files.exists(persistDirPath)) { + Files.createDirectory(persistDirPath.toAbsolutePath()); + } } - private static void validateBallerinaProject(Path projectPath) throws BalException { - Optional ballerinaToml = Optional.empty(); - try (Stream stream = Files.list(projectPath)) { - ballerinaToml = stream.filter(file -> !Files.isDirectory(file)) + private void createDefaultSchemaBalFile() throws IOException, BalException { + List schemaFiles; + try (Stream stream = Files.list(Paths.get(sourcePath, PERSIST_DIRECTORY))) { + schemaFiles = stream.filter(file -> !Files.isDirectory(file)) .map(Path::getFileName) .filter(Objects::nonNull) - .filter(file -> BALLERINA_TOML.equals(file.toString())) - .findFirst(); - } catch (IOException e) { - errStream.printf("ERROR: Invalid Ballerina package", projectPath.toAbsolutePath(), e.getMessage()); + .filter(file -> file.toString().toLowerCase(Locale.ENGLISH).endsWith(BAL_EXTENSION)) + .map(file -> file.toString().replace(BAL_EXTENSION, "")) + .collect(Collectors.toList()); + } + if (schemaFiles.size() > 1) { + throw new BalException("the persist directory allows only one model definition file, " + + "but contains many files."); } - if (ballerinaToml.isEmpty()) { - throw new BalException(String.format("ERROR: invalid Ballerina package directory: %s, " + - "cannot find 'Ballerina.toml' file.%n", projectPath.toAbsolutePath())); + if (schemaFiles.isEmpty()) { + Utils.generateSchemaBalFile(Paths.get(sourcePath, PERSIST_DIRECTORY)); } } diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java index a96f20d8f..a22acd402 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java @@ -38,6 +38,7 @@ import java.util.HashMap; import static io.ballerina.persist.PersistToolsConstants.TARGET_MODULE; +import static io.ballerina.projects.util.ProjectConstants.BALLERINA_TOML; public class PersistCodeGeneratorTool implements CodeGeneratorTool { @@ -55,112 +56,105 @@ public void execute(ToolContext toolContext) { Path generatedSourceDirPath = Paths.get(projectPath.toString(), BalSyntaxConstants.GENERATED_SOURCE_DIRECTORY); try { BalProjectUtils.validateBallerinaProject(projectPath); - } catch (BalException e) { - errStream.println(e.getMessage()); - return; - } - - try { packageName = TomlSyntaxUtils.readPackageName(projectPath.toString()); - } catch (BalException e) { - errStream.println(e.getMessage()); - return; + schemaFilePath = BalProjectUtils.getSchemaFilePath(projectPath.toString()); + HashMap ballerinaTomlConfig = TomlSyntaxUtils.readBallerinaTomlConfig( + Paths.get(projectPath.toString(), BALLERINA_TOML)); + targetModule = ballerinaTomlConfig.get(TARGET_MODULE).trim(); + datastore = ballerinaTomlConfig.get("options.datastore").trim(); + validateDatastore(datastore); + validateTargetModule(targetModule, packageName, ballerinaTomlConfig); + validatePersistDirectory(datastore, projectPath); + validateExperimentalFeatures(datastore); + entityModule = BalProjectUtils.getEntities(schemaFilePath); + validateEntityModule(entityModule, schemaFilePath); + createGeneratedSourceDirIfNotExists(generatedSourceDirPath); + generateSources(datastore, entityModule, targetModule, projectPath, generatedSourceDirPath); + errStream.println("Persist client and entity types generated successfully in the " + targetModule + + " directory."); + } catch (BalException | IOException e) { + errStream.printf("ERROR: %s%n", e.getMessage()); } + } - try { - schemaFilePath = BalProjectUtils.getSchemaFilePath(projectPath.toString()); - } catch (BalException e) { - errStream.println(e.getMessage()); - return; + @Override + public String toolName() { + return "persist"; + } + + private void validateDatastore(String datastore) throws BalException { + if (!PersistToolsConstants.SUPPORTED_DB_PROVIDERS.contains(datastore)) { + throw new BalException(String.format("the persist layer supports one of data stores: %s" + + ". but found '%s' datasource.", Arrays.toString(PersistToolsConstants.SUPPORTED_DB_PROVIDERS + .toArray()), datastore)); } + } - try { - HashMap ballerinaTomlConfig = TomlSyntaxUtils.readBallerinaTomlConfig( - Paths.get(projectPath.toString(), "Ballerina.toml")); - targetModule = ballerinaTomlConfig.get(TARGET_MODULE).trim(); - if (!targetModule.equals(packageName)) { - if (!targetModule.startsWith(packageName + ".")) { - errStream.println("ERROR: invalid module name : '" + ballerinaTomlConfig.get(TARGET_MODULE) - + "' :\n" + "module name should follow the template ."); - return; - } - String moduleName = targetModule.replace(packageName + ".", ""); - if (!ProjectUtils.validateModuleName(moduleName)) { - errStream.println("ERROR: invalid module name : '" + moduleName + "' :\n" + - "module name can only contain alphanumerics, underscores and periods"); - return; - } else if (!ProjectUtils.validateNameLength(moduleName)) { - errStream.println("ERROR: invalid module name : '" + moduleName + "' :\n" + - "maximum length of module name is 256 characters"); - return; - } - generatedSourceDirPath = generatedSourceDirPath.resolve(moduleName); - } - datastore = ballerinaTomlConfig.get("options.datastore").trim(); - if (!PersistToolsConstants.SUPPORTED_DB_PROVIDERS.contains(datastore)) { - errStream.printf("ERROR: the persist layer supports one of data stores: %s" + - ". but found '%s' datasource.%n", - Arrays.toString(PersistToolsConstants.SUPPORTED_DB_PROVIDERS.toArray()), datastore); - return; - } - if (Files.isDirectory(Paths.get(projectPath.toString(), PersistToolsConstants.PERSIST_DIRECTORY, - PersistToolsConstants.MIGRATIONS)) && - !datastore.equals(PersistToolsConstants.SupportedDataSources.MYSQL_DB)) { - errStream.println("ERROR: regenerating the client with a different datastore after executing " + - "the migrate command is not permitted. please remove the migrations directory within the " + - "persist directory and try executing the command again."); - return; - } - if (datastore.equals(PersistToolsConstants.SupportedDataSources.GOOGLE_SHEETS)) { - errStream.printf(BalSyntaxConstants.EXPERIMENTAL_NOTICE, "The support for Google Sheets data store " + - "is currently an experimental feature, and its behavior may be subject to change in future " + - "releases." + System.lineSeparator()); + private void validateTargetModule(String targetModule, String packageName, HashMap config) + throws BalException { + if (!targetModule.equals(packageName)) { + if (!targetModule.startsWith(packageName + ".")) { + throw new BalException("invalid module name : '" + targetModule + + "' :\n" + "module name should follow the template ."); } - entityModule = BalProjectUtils.getEntities(schemaFilePath); - if (entityModule.getEntityMap().isEmpty()) { - errStream.printf("ERROR: the model definition file(%s) does not contain any entity definition.%n", - schemaFilePath.getFileName()); - return; + String moduleName = targetModule.replace(packageName + ".", ""); + if (!ProjectUtils.validateModuleName(moduleName)) { + throw new BalException("invalid module name : '" + moduleName + "' :" + System.lineSeparator() + + "module name can only contain alphanumerics, underscores and periods"); + } else if (!ProjectUtils.validateNameLength(moduleName)) { + throw new BalException("invalid module name : '" + moduleName + "' :" + System.lineSeparator() + + "maximum length of module name is 256 characters"); } - } catch (BalException e) { - errStream.printf("ERROR: Failed to generate types and client for the definition file(%s). %s%n", - "Ballerina.toml", e.getMessage()); - return; } + } + + private void validatePersistDirectory(String datastore, Path projectPath) throws BalException { + if (Files.isDirectory(Paths.get(projectPath.toString(), PersistToolsConstants.PERSIST_DIRECTORY, + PersistToolsConstants.MIGRATIONS)) && + !datastore.equals(PersistToolsConstants.SupportedDataSources.MYSQL_DB)) { + throw new BalException("regenerating the client with a different datastore after executing " + + "the migrate command is not permitted. please remove the migrations directory within the " + + "persist directory and try executing the command again."); + } + } + + private void validateExperimentalFeatures(String datastore) { + if (datastore.equals(PersistToolsConstants.SupportedDataSources.GOOGLE_SHEETS)) { + errStream.printf(BalSyntaxConstants.EXPERIMENTAL_NOTICE, "The support for Google Sheets data store " + + "is currently an experimental feature, and its behavior may be subject to change in future " + + "releases." + System.lineSeparator()); + } + } + + private void validateEntityModule(Module entityModule, Path schemaFilePath) throws BalException { + if (entityModule.getEntityMap().isEmpty()) { + throw new BalException(String.format("the model definition file(%s) does not contain any " + + "entity definition.", schemaFilePath.getFileName())); + } + } + + private void createGeneratedSourceDirIfNotExists(Path generatedSourceDirPath) throws IOException { if (!Files.exists(generatedSourceDirPath)) { - try { Files.createDirectories(generatedSourceDirPath.toAbsolutePath()); - } catch (IOException e) { - errStream.println("ERROR: failed to create the generated directory. " + e.getMessage()); - return; - } } + } + + private void generateSources(String datastore, Module entityModule, String targetModule, Path projectPath, + Path generatedSourceDirPath) throws BalException { SourceGenerator sourceCreator = new SourceGenerator(projectPath.toString(), generatedSourceDirPath, targetModule, entityModule); - try { - switch (datastore) { - case PersistToolsConstants.SupportedDataSources.MYSQL_DB: - case PersistToolsConstants.SupportedDataSources.MSSQL_DB: - case PersistToolsConstants.SupportedDataSources.POSTGRESQL_DB: - sourceCreator.createDbSources(datastore); - break; - case PersistToolsConstants.SupportedDataSources.GOOGLE_SHEETS: - sourceCreator.createGSheetSources(); - break; - default: - sourceCreator.createInMemorySources(); - break; - } - } catch (BalException e) { - errStream.printf(BalSyntaxConstants.ERROR_MSG, datastore, e.getMessage()); - return; + switch (datastore) { + case PersistToolsConstants.SupportedDataSources.MYSQL_DB: + case PersistToolsConstants.SupportedDataSources.MSSQL_DB: + case PersistToolsConstants.SupportedDataSources.POSTGRESQL_DB: + sourceCreator.createDbSources(datastore); + break; + case PersistToolsConstants.SupportedDataSources.GOOGLE_SHEETS: + sourceCreator.createGSheetSources(); + break; + default: + sourceCreator.createInMemorySources(); + break; } - errStream.println("Persist client and entity types generated successfully in the " + targetModule + - " directory."); - } - - @Override - public String toolName() { - return "persist"; } } From 78f386f4c202eaa81c93d05dc5d5946e761983fa Mon Sep 17 00:00:00 2001 From: bhashinee Date: Thu, 29 Feb 2024 09:58:00 +0530 Subject: [PATCH 10/22] Add the help command --- changelog.md | 1 + .../persist/cmd/PersistCodeGeneratorTool.java | 39 ++++++++++--------- .../cli-help/ballerina-persist-add.help | 32 +++++++++++++++ .../cli-help/ballerina-persist-init.help | 14 +------ 4 files changed, 54 insertions(+), 32 deletions(-) create mode 100644 persist-cli/src/main/resources/cli-help/ballerina-persist-add.help diff --git a/changelog.md b/changelog.md index f14373969..4b4d400e3 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - [Added support for PostgreSQL as a datasource](https://github.com/ballerina-platform/ballerina-standard-library/issues/5829) +- [Integrate the persist code generation to the bal build command](https://github.com/ballerina-platform/ballerina-library/issues/5784) ## [1.2.1] - 2021-11-21 diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java index a22acd402..2a6e1057f 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java @@ -63,7 +63,16 @@ public void execute(ToolContext toolContext) { targetModule = ballerinaTomlConfig.get(TARGET_MODULE).trim(); datastore = ballerinaTomlConfig.get("options.datastore").trim(); validateDatastore(datastore); - validateTargetModule(targetModule, packageName, ballerinaTomlConfig); + if (!targetModule.equals(packageName)) { + if (!targetModule.startsWith(packageName + ".")) { + errStream.println("ERROR: invalid module name : '" + ballerinaTomlConfig.get(TARGET_MODULE) + + "' :" + System.lineSeparator() + "module name should follow the template ."); + return; + } + String moduleName = targetModule.replace(packageName + ".", ""); + validateModuleName(moduleName); + generatedSourceDirPath = generatedSourceDirPath.resolve(moduleName); + } validatePersistDirectory(datastore, projectPath); validateExperimentalFeatures(datastore); entityModule = BalProjectUtils.getEntities(schemaFilePath); @@ -77,6 +86,16 @@ public void execute(ToolContext toolContext) { } } + private void validateModuleName(String moduleName) throws BalException { + if (!ProjectUtils.validateModuleName(moduleName)) { + throw new BalException("invalid module name : '" + moduleName + "' :" + System.lineSeparator() + + "module name can only contain alphanumerics, underscores and periods"); + } else if (!ProjectUtils.validateNameLength(moduleName)) { + throw new BalException("invalid module name : '" + moduleName + "' :" + System.lineSeparator() + + "maximum length of module name is 256 characters"); + } + } + @Override public String toolName() { return "persist"; @@ -90,24 +109,6 @@ private void validateDatastore(String datastore) throws BalException { } } - private void validateTargetModule(String targetModule, String packageName, HashMap config) - throws BalException { - if (!targetModule.equals(packageName)) { - if (!targetModule.startsWith(packageName + ".")) { - throw new BalException("invalid module name : '" + targetModule - + "' :\n" + "module name should follow the template ."); - } - String moduleName = targetModule.replace(packageName + ".", ""); - if (!ProjectUtils.validateModuleName(moduleName)) { - throw new BalException("invalid module name : '" + moduleName + "' :" + System.lineSeparator() + - "module name can only contain alphanumerics, underscores and periods"); - } else if (!ProjectUtils.validateNameLength(moduleName)) { - throw new BalException("invalid module name : '" + moduleName + "' :" + System.lineSeparator() + - "maximum length of module name is 256 characters"); - } - } - } - private void validatePersistDirectory(String datastore, Path projectPath) throws BalException { if (Files.isDirectory(Paths.get(projectPath.toString(), PersistToolsConstants.PERSIST_DIRECTORY, PersistToolsConstants.MIGRATIONS)) && diff --git a/persist-cli/src/main/resources/cli-help/ballerina-persist-add.help b/persist-cli/src/main/resources/cli-help/ballerina-persist-add.help new file mode 100644 index 000000000..d1d0ed075 --- /dev/null +++ b/persist-cli/src/main/resources/cli-help/ballerina-persist-add.help @@ -0,0 +1,32 @@ +NAME + bal persist add - Initialize the Ballerina package for persistence. + +SYNOPSIS + bal persist add [--module ] + [--datastore ] + [<-h> | <--help>] + +DESCRIPTION + This command will create a new directory named 'persist' in the project directory. The 'persist' directory will + contain empty model definition file which can be used to define the data model of the Ballerina project. + This will also add persist configuration to the Ballerina.toml file. + +OPTIONS + --module + The name of the module to initialize the persistence layer. If not specified, the default module will be used. + --datastore + The type of the datastore to be used for persistence. + The supported datastores are 'inmemory', 'mysql', 'mssql', 'postgresql', and 'googlesheets'. + If not specified, the 'inmemory' datastore will be used as the default. + -h, --help + Print the usage details of all commands. + +EXAMPLES + Print the usage details of the `bal persist add` command. + $ bal persist add --help + + Initialize the Ballerina package for persistence with the default module. + $ bal persist add --datastore mysql + + Initialize the Ballerina package for persistence with the 'db' module. + $ bal persist add --module db --datastore mysql diff --git a/persist-cli/src/main/resources/cli-help/ballerina-persist-init.help b/persist-cli/src/main/resources/cli-help/ballerina-persist-init.help index 9a1763953..f39ede0b0 100644 --- a/persist-cli/src/main/resources/cli-help/ballerina-persist-init.help +++ b/persist-cli/src/main/resources/cli-help/ballerina-persist-init.help @@ -2,22 +2,13 @@ NAME bal persist init - Initialize the Ballerina package for persistence. SYNOPSIS - bal persist init [--module ] - [--datastore ] - [<-h> | <--help>] + bal persist init [<-h> | <--help>] DESCRIPTION This command will create a new directory named 'persist' in the project directory. The 'persist' directory will contain empty model definition file which can be used to define the data model of the Ballerina project. - This will also add persist configuration to the Ballerina.toml file. OPTIONS - --module - The name of the module to initialize the persistence layer. If not specified, the default module will be used. - --datastore - The type of the datastore to be used for persistence. - The supported datastores are 'inmemory', 'mysql', 'mssql', 'postgresql', and 'googlesheets'. - If not specified, the 'inmemory' datastore will be used as the default. -h, --help Print the usage details of all commands. @@ -27,6 +18,3 @@ EXAMPLES Initialize the Ballerina package for persistence with the default module. $ bal persist init - - Initialize the Ballerina package for persistence with the 'db' module. - $ bal persist init --module db From ace68e6c2cc75f76c2f7b0e2cab3ba02f8ac05b5 Mon Sep 17 00:00:00 2001 From: bhashinee Date: Thu, 29 Feb 2024 10:07:06 +0530 Subject: [PATCH 11/22] Update the changelog --- .../io/ballerina/persist/cmd/PersistCodeGeneratorTool.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java index 2a6e1057f..01569f97f 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java @@ -66,7 +66,8 @@ public void execute(ToolContext toolContext) { if (!targetModule.equals(packageName)) { if (!targetModule.startsWith(packageName + ".")) { errStream.println("ERROR: invalid module name : '" + ballerinaTomlConfig.get(TARGET_MODULE) - + "' :" + System.lineSeparator() + "module name should follow the template ."); + + "' :" + System.lineSeparator() + "module name should follow the template " + + "."); return; } String moduleName = targetModule.replace(packageName + ".", ""); From ac9d1b97b2d1000209cddfac8ee0157acff6dffe Mon Sep 17 00:00:00 2001 From: bhashinee Date: Thu, 29 Feb 2024 10:17:55 +0530 Subject: [PATCH 12/22] Rename a function --- .../io/ballerina/persist/cmd/CmdOptions.java | 75 ------------------- .../persist/cmd/PersistCodeGeneratorTool.java | 4 +- 2 files changed, 2 insertions(+), 77 deletions(-) delete mode 100644 persist-cli/src/main/java/io/ballerina/persist/cmd/CmdOptions.java diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/CmdOptions.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/CmdOptions.java deleted file mode 100644 index 9c4304815..000000000 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/CmdOptions.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package io.ballerina.persist.cmd; - -/** - * This builder class for contains the all the option for use CLI. - */ -public class CmdOptions { - private final String outputModule; - private final String id; - private final String datastore; - - private CmdOptions(CmdOptionsBuilder builder) { - this.outputModule = builder.outputModule; - this.id = builder.id; - this.datastore = builder.datastore; - } - - public String getOutputModule() { - return outputModule; - } - - public String getId() { - return id; - } - - public String getDatastore() { - return datastore; - } - - /** - * CMD options builder class. - */ - public static class CmdOptionsBuilder { - private String outputModule; - private String id; - private String datastore; - - public CmdOptionsBuilder withOutputModule(String outputModule) { - this.outputModule = outputModule; - return this; - } - - public CmdOptionsBuilder withId(String id) { - this.id = id; - return this; - } - - public CmdOptionsBuilder withDatastore(String datastore) { - this.datastore = datastore; - return this; - } - - public CmdOptions build() { - return new CmdOptions(this); - } - } -} - diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java index 01569f97f..efecf0693 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/PersistCodeGeneratorTool.java @@ -75,7 +75,7 @@ public void execute(ToolContext toolContext) { generatedSourceDirPath = generatedSourceDirPath.resolve(moduleName); } validatePersistDirectory(datastore, projectPath); - validateExperimentalFeatures(datastore); + printExperimentalFeatureInfo(datastore); entityModule = BalProjectUtils.getEntities(schemaFilePath); validateEntityModule(entityModule, schemaFilePath); createGeneratedSourceDirIfNotExists(generatedSourceDirPath); @@ -120,7 +120,7 @@ private void validatePersistDirectory(String datastore, Path projectPath) throws } } - private void validateExperimentalFeatures(String datastore) { + private void printExperimentalFeatureInfo(String datastore) { if (datastore.equals(PersistToolsConstants.SupportedDataSources.GOOGLE_SHEETS)) { errStream.printf(BalSyntaxConstants.EXPERIMENTAL_NOTICE, "The support for Google Sheets data store " + "is currently an experimental feature, and its behavior may be subject to change in future " + From 05c2bebf5d9e124785c18bc5612b773472414f98 Mon Sep 17 00:00:00 2001 From: bhashinee Date: Thu, 29 Feb 2024 12:27:04 +0530 Subject: [PATCH 13/22] Fix the help text in add command --- persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java index dade23c0c..03ec135cf 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Add.java @@ -49,6 +49,7 @@ public class Add implements BLauncherCmd { private static final PrintStream errStream = System.err; + private static final String COMMAND_IDENTIFIER = "persist-add"; private final String sourcePath; @@ -75,7 +76,7 @@ public Add(String sourcePath) { @Override public void execute() { if (helpFlag) { - String commandUsageInfo = BLauncherCmd.getCommandUsageInfo(getName()); + String commandUsageInfo = BLauncherCmd.getCommandUsageInfo(COMMAND_IDENTIFIER); errStream.println(commandUsageInfo); return; } From 686bffd03a6cb7c21b953a422be21cb8e02ceece Mon Sep 17 00:00:00 2001 From: bhashinee Date: Fri, 1 Mar 2024 12:12:01 +0530 Subject: [PATCH 14/22] Update the specification --- docs/spec/spec.md | 54 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/docs/spec/spec.md b/docs/spec/spec.md index c09ae1b68..43e0d3538 100644 --- a/docs/spec/spec.md +++ b/docs/spec/spec.md @@ -29,13 +29,14 @@ This specification elaborates on the `Persist CLI Tool` commands. ## 2. Initializing the Bal Project with Persistence Layer ```bash -bal persist init --datastore="datastore" --module="module_name" +bal persist add --datastore="datastore" --module="module_name" ``` | Command Parameter | Description | Mandatory | Default Value | |:-----------------:|:----------------------------------------------------------------------------------------:|:---------:|:--------------:| -| --datastore | used to indicate the preferred database client. Currently, only 'mysql' is supported. | No | inmemory | +| --datastore | used to indicate the preferred database client. Currently, 'mysql', 'mssql', 'google sheets' and 'postgresql' are supported. | No | inmemory | | --module | used to indicate the persist enabled module in which the files are generated. | No | | +| --id | Used as an identifier | No | generate-db-client | The command initializes the bal project with the persistence layer. This command includes the following steps, @@ -47,32 +48,47 @@ The command initializes the bal project with the persistence layer. This command 3. Update Ballerina.toml with persist module configurations. It will update the Ballerina.toml file with persist configurations. ```ballerina - [persist] - datastore = "" - module = "." + [[tool.persist]] + id = "generate-db-client" + targetModule = "." + options.datastore = "" + filePath = "persist/model.bal" ``` The directory structure will be, ``` medical-center ├── persist - └── medical-center.bal + └── model.bal ├── Ballerina.toml └── main.bal ``` -Behaviour of the `init` command, -- User should invoke the command within a Ballerina project -- User can use the optional arguments to indicate the preferred module name and data store, otherwise default values will be used. -- User cannot execute the command multiple times within the same project. User needs to remove the Ballerina.toml configurations, if the user wants to reinitialize the project. +Behaviour of the `add` command, +- Users should invoke the command within a Ballerina project. +- Users can use optional arguments to indicate the preferred module name and data store; otherwise, default values will be used. +- Users cannot execute the command multiple times within the same project. They need to remove the persist configurations from the Ballerina.toml if they want to reinitialize the project. + +Apart from the `bal persist add` command, if you want to use the `bal persist generate` command you can initialize the project with the following `init` command, + +```bash +bal persist init +``` + +This command includes the following steps, + +1. Create persist directory: + Within this directory, a data model definition file should be created. This file will outline the necessary entities according to the [`persist` specification](https://github.com/ballerina-platform/module-ballerina-persist/blob/main/docs/spec/spec.md#2-data-model-definition) +2. Generate a model definition file within the persist directory: + This action will create a file named model.bal with the requisite imports (import ballerina/persist as _;) if no files currently exist in the persist directory. ## 3. Generating Persistence Derived Types, Clients, and Database Schema ```bash -bal persist generate +bal build ``` -The command will generate [Derived Entity Types and Persist Clients](https://github.com/ballerina-platform/module-ballerina-persist/blob/main/docs/spec/spec.md#3-derived-entity-types-and-persist-clients) +The `bal build` command will generate [Derived Entity Types and Persist Clients](https://github.com/ballerina-platform/module-ballerina-persist/blob/main/docs/spec/spec.md#3-derived-entity-types-and-persist-clients) as per the `persist` specification and the database schema associated with the data model definition. Additionally, this command will create(update) `Config.toml` file with configurables used to initialize variables in `persist_db_config.bal`. ```ballerina @@ -130,12 +146,22 @@ The database schema will contain the code to create, 1. Tables for each entity with defined primary keys 2. Create foreign key associations between tables if the model has defined associations between entities +Apart from the `bal build` users can also use the following command to generate the same as above mentioned, + +```bash +bal persist generate --datastore mysql --module db +``` + +| Command Parameter | Description | Mandatory | Default Value | +|:-----------------:|:----------------------------------------------------------------------------------------:|:---------:|:--------------:| +| --datastore | used to indicate the preferred database client. Currently, 'mysql', 'mssql', 'google sheets' and 'postgresql' are supported. | Yes | | +| --module | used to indicate the persist enabled module in which the files are generated. | No | | + Behaviour of the `generate` command, - User should invoke the command within a Ballerina project -- The user should have initiated the persistence layer in the project and update the model definition file. - The model definition file should contain the `persist` module import (`import ballerina/persist as _;`) - The Model definition file should contain at least one entity -- If the user invokes the command twice, it will not fail. It will generate the files once again. +- If the user invokes the command twice, it will fail. The user needs to remove the persist configurations from the Ballerina.toml if they want to reinitialize the project. ## 4. Push Persistence Schema to the Data Provider From 5e25761a1d5f197e29a863683df4b4ff22918950 Mon Sep 17 00:00:00 2001 From: bhashinee Date: Fri, 1 Mar 2024 14:46:03 +0530 Subject: [PATCH 15/22] Address review suggestions --- docs/spec/spec.md | 2 +- .../resources/test-src/output/tool_test_generate_13/Config.toml | 1 - .../resources/test-src/output/tool_test_generate_26/Config.toml | 1 - .../resources/test-src/output/tool_test_generate_27/Config.toml | 1 - .../test-src/output/tool_test_generate_28/Ballerina.toml | 1 - .../resources/test-src/output/tool_test_generate_29/Config.toml | 1 - .../resources/test-src/output/tool_test_generate_31/Config.toml | 1 + .../resources/test-src/output/tool_test_generate_36/Config.toml | 1 - .../test-src/output/tool_test_generate_41/Ballerina.toml | 1 - .../resources/test-src/output/tool_test_generate_5/Config.toml | 1 - .../resources/test-src/output/tool_test_generate_50/Config.toml | 2 -- .../resources/test-src/output/tool_test_generate_51/Config.toml | 2 -- .../test-src/output/tool_test_generate_54_gsheet/Config.toml | 2 -- .../test-src/output/tool_test_generate_56_gsheets/Config.toml | 1 - .../resources/test-src/output/tool_test_generate_65/Config.toml | 1 - .../output/tool_test_generate_66_postgresql/Config.toml | 1 - 16 files changed, 2 insertions(+), 18 deletions(-) diff --git a/docs/spec/spec.md b/docs/spec/spec.md index 43e0d3538..f33bdde56 100644 --- a/docs/spec/spec.md +++ b/docs/spec/spec.md @@ -161,7 +161,7 @@ Behaviour of the `generate` command, - User should invoke the command within a Ballerina project - The model definition file should contain the `persist` module import (`import ballerina/persist as _;`) - The Model definition file should contain at least one entity -- If the user invokes the command twice, it will fail. The user needs to remove the persist configurations from the Ballerina.toml if they want to reinitialize the project. +- If the user invokes the command twice, it will not fail. It will generate the files once again. ## 4. Push Persistence Schema to the Data Provider diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Config.toml index 363146c90..67d90e6a9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/Config.toml @@ -12,4 +12,3 @@ user = "root" password = "" database = "" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml index d4c816b73..e93d93468 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/Config.toml @@ -4,4 +4,3 @@ port = 3306 user = "root" password = "" database = "" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Config.toml index 293f1a68f..4e363d996 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/Config.toml @@ -12,4 +12,3 @@ user = "root" password = "" database = "" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml index 1f68c3dce..bcc5a4ff7 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/Ballerina.toml @@ -11,4 +11,3 @@ observabilityIncluded = false groupId = "io.ballerina.stdlib" artifactId = "persist.sql-native" version = "1.2.2-SNAPSHOT" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Config.toml index 5029da3b8..da50fdb68 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/Config.toml @@ -12,4 +12,3 @@ user = "root" password = "" database = "" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Config.toml index ee679e431..abcecfed1 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_31/Config.toml @@ -4,3 +4,4 @@ port = 3307 user = "root" password = "Test123#" database = "persist" + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Config.toml index 019da85d0..2bd7cc9df 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/Config.toml @@ -4,4 +4,3 @@ port = 3307 user = "root" password = "Test123#" database = "persist" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml index b519364ac..4b0159640 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/Ballerina.toml @@ -11,4 +11,3 @@ observabilityIncluded = false groupId = "io.ballerina.stdlib" artifactId = "persist.sql-native" version = "1.2.2-SNAPSHOT" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Config.toml index 53bf5ce49..71c3b04d0 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/Config.toml @@ -7,4 +7,3 @@ database = "" [persist_generate_5.connectionOptions.ssl] allowPublicKeyRetrieval=true - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Config.toml index 1c0791772..facd7f2d6 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/Config.toml @@ -4,5 +4,3 @@ port = 3306 user = "root" password = "" database = "" - - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Config.toml index 28d9113e8..fc52a0189 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/Config.toml @@ -4,5 +4,3 @@ port = 3306 user = "root" password = "" database = "" - - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Config.toml index 3848d0377..3e735304a 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/Config.toml @@ -3,5 +3,3 @@ spreadsheetId = "" clientId = "" clientSecret = "" refreshToken = "" - - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Config.toml index 10521c14b..34078132e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/Config.toml @@ -4,4 +4,3 @@ clientId = "" clientSecret = "" refreshToken = "" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Config.toml index 5878ea161..9449e5337 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/Config.toml @@ -5,4 +5,3 @@ user = "root" password = "" database = "" - diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Config.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Config.toml index a5d3e5cd1..3dc7a00fb 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/Config.toml @@ -5,4 +5,3 @@ user = "postgres" password = "" database = "" - From 2e5b31ce0893192eb0f7c5815934064d1b5d4ac1 Mon Sep 17 00:00:00 2001 From: bhashinee Date: Fri, 1 Mar 2024 15:45:34 +0530 Subject: [PATCH 16/22] Update the snapshot version of persist --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 45b332371..307ace08b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -48,7 +48,7 @@ stdlibHttpVersion=2.10.4 stdlibSqlVersion=1.11.1 # Level 09 -stdlibPersistVersion=1.2.1 +stdlibPersistVersion=1.3.0-20240301-141700-02872be # Level 10 stdlibPersistSqlVersion=1.2.2-20231206-130200-881839f From 8a7c7a660edf76a0be0dd439478b63e71b4b0cca Mon Sep 17 00:00:00 2001 From: bhashinee Date: Mon, 4 Mar 2024 14:45:37 +0530 Subject: [PATCH 17/22] Change the generated module to modules --- .../io/ballerina/persist/tools/ToolingGenerateTest.java | 8 ++++---- .../persist/tools/utils/GeneratedSourcesTestUtils.java | 8 +++++++- .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/persist_client.bal | 0 .../{generated => modules}/persist_db_config.bal | 0 .../{generated => modules}/persist_types.bal | 0 .../{generated => modules}/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/foo/persist_client.bal | 0 .../{generated => modules}/foo/persist_db_config.bal | 0 .../{generated => modules}/foo/persist_types.bal | 0 .../{generated => modules}/foo/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => }/persist_client.bal | 0 .../{generated => }/persist_db_config.bal | 0 .../{generated => }/persist_types.bal | 0 .../tool_test_generate_35/{generated => }/script.sql | 0 .../{generated => modules}/rainier/persist_client.bal | 0 .../{generated => modules}/rainier/persist_db_config.bal | 0 .../{generated => modules}/rainier/persist_types.bal | 0 .../{generated => modules}/rainier/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => }/persist_client.bal | 0 .../{generated => }/persist_db_config.bal | 0 .../{generated => }/persist_types.bal | 0 .../tool_test_generate_50/{generated => }/script.sql | 0 .../{generated => }/persist_client.bal | 0 .../{generated => }/persist_db_config.bal | 0 .../{generated => }/persist_types.bal | 0 .../tool_test_generate_51/{generated => }/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../entities/persist_sheet_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.gs | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../entities/persist_sheet_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.gs | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../entities/persist_sheet_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.gs | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/x.y.z/persist_client.bal | 0 .../{generated => modules}/x.y.z/persist_db_config.bal | 0 .../{generated => modules}/x.y.z/persist_types.bal | 0 .../{generated => modules}/x.y.z/script.sql | 0 .../{generated => }/persist_client.bal | 0 .../{generated => }/persist_db_config.bal | 0 .../{generated => }/persist_types.bal | 0 .../tool_test_generate_65/{generated => }/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../{generated => modules}/entities/persist_client.bal | 0 .../{generated => modules}/entities/persist_db_config.bal | 0 .../{generated => modules}/entities/persist_types.bal | 0 .../{generated => modules}/entities/script.sql | 0 .../src/main/java/io/ballerina/persist/cmd/Generate.java | 4 +++- .../syntax/constants/BalSyntaxConstants.java | 1 + 195 files changed, 15 insertions(+), 6 deletions(-) rename persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/{generated => modules}/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/{generated => modules}/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/{generated => modules}/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/{generated => modules}/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/{generated => modules}/foo/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/{generated => modules}/foo/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/{generated => modules}/foo/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/{generated => modules}/foo/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/{generated => }/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/{generated => }/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/{generated => }/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/{generated => }/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/{generated => modules}/rainier/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/{generated => modules}/rainier/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/{generated => modules}/rainier/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/{generated => modules}/rainier/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/{generated => }/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/{generated => }/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/{generated => }/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/{generated => }/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/{generated => }/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/{generated => }/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/{generated => }/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/{generated => }/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/{generated => modules}/entities/persist_sheet_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/{generated => modules}/entities/script.gs (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/{generated => modules}/entities/persist_sheet_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/{generated => modules}/entities/script.gs (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/{generated => modules}/entities/persist_sheet_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/{generated => modules}/entities/script.gs (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/{generated => modules}/x.y.z/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/{generated => modules}/x.y.z/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/{generated => modules}/x.y.z/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/{generated => modules}/x.y.z/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/{generated => }/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/{generated => }/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/{generated => }/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/{generated => }/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/{generated => modules}/entities/script.sql (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/{generated => modules}/entities/persist_client.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/{generated => modules}/entities/persist_db_config.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/{generated => modules}/entities/persist_types.bal (100%) rename persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/{generated => modules}/entities/script.sql (100%) diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java index 0516e5d44..37c69f56b 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java @@ -239,7 +239,7 @@ public void testGenerateWithOptionalType() { @Test(enabled = true) @Description("Test the generate command in default Ballerina package") public void testGenerateInDefaultPackage() { - executeGenerateCommand("tool_test_generate_35", "mysql", "persist_generate_35"); + executeGenerateCommand("tool_test_generate_35", "mysql"); assertGeneratedSources("tool_test_generate_35"); } @@ -356,14 +356,14 @@ public void testInMemoryWithCompositeKeys() { @Test(enabled = true) @Description("There is multiple entities with multiple enums and no imports") public void testGenerateWithEnums() { - executeGenerateCommand("tool_test_generate_50", "mysql", "persist_generate_50"); + executeGenerateCommand("tool_test_generate_50", "mysql"); assertGeneratedSources("tool_test_generate_50"); } @Test(enabled = true) @Description("There is multiple entities with multiple enums and imports") public void testGenerateWithEnumsWithImports() { - executeGenerateCommand("tool_test_generate_51", "mysql", "persist_generate_51"); + executeGenerateCommand("tool_test_generate_51", "mysql"); assertGeneratedSources("tool_test_generate_51"); } @@ -503,7 +503,7 @@ public void testGenerateEntityDotSeperatedModuleNames() { @Test(enabled = true) @Description("The model has multiple relations of various types") public void testGenerateEntitiesWithMultipleRelations() { - executeGenerateCommand("tool_test_generate_65", "mysql", "persist_generate_65"); + executeGenerateCommand("tool_test_generate_65", "mysql"); assertGeneratedSources("tool_test_generate_65"); } } diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java index 805571266..fb513e715 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java @@ -195,7 +195,13 @@ public static void executeGenerateCommand(String subDir, String... args) { persistClass = Class.forName("io.ballerina.persist.cmd.Generate"); Generate persistCmd = (Generate) persistClass.getDeclaredConstructor(String.class) .newInstance(sourcePath.toAbsolutePath().toString()); - new CommandLine(persistCmd).parseArgs("--datastore", args[0], "--module", args[1]); + if (args.length > 1) { + // ballerina persist generate --datastore --module + new CommandLine(persistCmd).parseArgs("--datastore", args[0], "--module", args[1]); + } else { + // ballerina persist generate --datastore + new CommandLine(persistCmd).parseArgs("--datastore", args[0]); + } persistCmd.execute(); } catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) { diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/modules/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/modules/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/modules/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/modules/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/modules/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/modules/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/modules/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/generated/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_1/modules/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_11/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_13/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_16/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_17/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_2/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_22/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/modules/foo/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/modules/foo/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/modules/foo/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/modules/foo/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/modules/foo/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/modules/foo/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/modules/foo/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/generated/foo/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_24/modules/foo/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_25/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_26/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_27/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_28/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_29/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_34/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/generated/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_35/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/modules/rainier/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/modules/rainier/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/modules/rainier/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/modules/rainier/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/modules/rainier/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/modules/rainier/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/modules/rainier/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/generated/rainier/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_36/modules/rainier/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_37/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_39/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_40/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_41/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_46/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_47_in_memory/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_48_in_memory/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_49_in_memory/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_5/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/generated/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_50/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/generated/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_51/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_52_in_memory/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_53_in_memory/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/persist_sheet_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/modules/entities/persist_sheet_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/persist_sheet_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/modules/entities/persist_sheet_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/script.gs b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/modules/entities/script.gs similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/generated/entities/script.gs rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_54_gsheet/modules/entities/script.gs diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_55_in_memory/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/generated/entities/persist_sheet_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/modules/entities/persist_sheet_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/generated/entities/persist_sheet_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/modules/entities/persist_sheet_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/generated/entities/script.gs b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/modules/entities/script.gs similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/generated/entities/script.gs rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_56_gsheets/modules/entities/script.gs diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/generated/entities/persist_sheet_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/modules/entities/persist_sheet_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/generated/entities/persist_sheet_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/modules/entities/persist_sheet_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/generated/entities/script.gs b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/modules/entities/script.gs similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/generated/entities/script.gs rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_57_gsheets/modules/entities/script.gs diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_58_mssql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_59_mssql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_6/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_60_mssql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_61_mssql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_62_mssql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_63_mssql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/modules/x.y.z/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/modules/x.y.z/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/modules/x.y.z/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/modules/x.y.z/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/modules/x.y.z/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/modules/x.y.z/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/modules/x.y.z/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/generated/x.y.z/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_64/modules/x.y.z/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/generated/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/generated/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/generated/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/generated/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/generated/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/generated/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/generated/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/generated/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_65/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_66_postgresql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_67_postgresql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_68_postgresql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_69_postgresql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_70_postgresql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_71_postgresql/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_8/modules/entities/script.sql diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/persist_client.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/modules/entities/persist_client.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/persist_client.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/modules/entities/persist_client.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/persist_db_config.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/modules/entities/persist_db_config.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/persist_db_config.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/modules/entities/persist_db_config.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/persist_types.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/modules/entities/persist_types.bal similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/persist_types.bal rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/modules/entities/persist_types.bal diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/script.sql b/persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/modules/entities/script.sql similarity index 100% rename from persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/generated/entities/script.sql rename to persist-cli-tests/src/test/resources/test-src/output/tool_test_generate_9/modules/entities/script.sql diff --git a/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java b/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java index 2bd63158a..65d5d68a1 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java +++ b/persist-cli/src/main/java/io/ballerina/persist/cmd/Generate.java @@ -82,7 +82,7 @@ public Generate(String sourcePath) { @Override public void execute() { - Path generatedSourceDirPath = Paths.get(this.sourcePath, BalSyntaxConstants.GENERATED_SOURCE_DIRECTORY); + Path generatedSourceDirPath; Module entityModule; Path schemaFilePath; String packageName; @@ -112,8 +112,10 @@ public void execute() { } if (module == null) { + generatedSourceDirPath = Paths.get(this.sourcePath); module = packageName; } else { + generatedSourceDirPath = Paths.get(this.sourcePath, BalSyntaxConstants.MODULES_SOURCE_DIRECTORY); module = module.replaceAll("\"", ""); } moduleNameWithPackage = (packageName.equals(module)) ? packageName : packageName + "." + module; diff --git a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/constants/BalSyntaxConstants.java b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/constants/BalSyntaxConstants.java index 75a5f1d73..91fed4705 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/constants/BalSyntaxConstants.java +++ b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/syntax/constants/BalSyntaxConstants.java @@ -128,6 +128,7 @@ private InheritedTypeReferenceConstants() { public static final String ANY_DATA = "anydata"; public static final String GENERATED_SOURCE_DIRECTORY = "generated"; + public static final String MODULES_SOURCE_DIRECTORY = "modules"; public static final String PATH_DB_CONFIGURATION_BAL_FILE = "persist_db_config.bal"; public static final String PATH_SHEET_CONFIGURATION_BAL_FILE = "persist_sheet_config.bal"; public static final String PERSIST_DEPENDENCY = "platform.java17.dependency"; From e2676cf5335dbc712b2e4878c46f0d4ea426a64f Mon Sep 17 00:00:00 2001 From: bhashinee Date: Mon, 4 Mar 2024 16:11:59 +0530 Subject: [PATCH 18/22] Add a test case for INIT cmd --- .../persist/tools/ToolingGenerateTest.java | 8 +++++++ .../utils/GeneratedSourcesTestUtils.java | 6 ++++++ .../input/tool_test_init_1/Ballerina.toml | 9 ++++++++ .../test-src/input/tool_test_init_1/main.bal | 21 +++++++++++++++++++ .../output/tool_test_init_1/Ballerina.toml | 9 ++++++++ .../test-src/output/tool_test_init_1/main.bal | 21 +++++++++++++++++++ .../output/tool_test_init_1/persist/model.bal | 1 + 7 files changed, 75 insertions(+) create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/Ballerina.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/main.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/Ballerina.toml create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/main.bal create mode 100644 persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/persist/model.bal diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java index 37c69f56b..6a7f8b7ef 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/ToolingGenerateTest.java @@ -27,6 +27,7 @@ import java.nio.file.Paths; import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.Command.GENERATE; +import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.Command.INIT; import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.GENERATED_SOURCES_DIRECTORY; import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.assertGeneratedSources; import static io.ballerina.persist.tools.utils.GeneratedSourcesTestUtils.assertGeneratedSourcesNegative; @@ -506,4 +507,11 @@ public void testGenerateEntitiesWithMultipleRelations() { executeGenerateCommand("tool_test_generate_65", "mysql"); assertGeneratedSources("tool_test_generate_65"); } + + @Test(enabled = true) + @Description("The model has multiple relations of various types") + public void testInit() { + executeCommand("tool_test_init_1", INIT); + assertGeneratedSources("tool_test_init_1"); + } } diff --git a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java index fb513e715..e374854a3 100644 --- a/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java +++ b/persist-cli-tests/src/test/java/io/ballerina/persist/tools/utils/GeneratedSourcesTestUtils.java @@ -54,6 +54,7 @@ public class GeneratedSourcesTestUtils { * Represents persist commands. */ public enum Command { + INIT, ADD, GENERATE, DB_PUSH, @@ -164,6 +165,11 @@ public static HashMap executeCommand(String subDir, Command cmd) { Add persistCmd = (Add) persistClass.getDeclaredConstructor(String.class) .newInstance(sourcePath.toAbsolutePath().toString()); persistCmd.execute(); + } else if (cmd == Command.INIT) { + persistClass = Class.forName("io.ballerina.persist.cmd.Init"); + Init persistCmd = (Init) persistClass.getDeclaredConstructor(String.class) + .newInstance(sourcePath.toAbsolutePath().toString()); + persistCmd.execute(); } else if (cmd == Command.GENERATE) { persistClass = Class.forName("io.ballerina.persist.cmd.Generate"); Generate persistCmd = (Generate) persistClass.getDeclaredConstructor(String.class) diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/Ballerina.toml new file mode 100644 index 000000000..8602e8eda --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/Ballerina.toml @@ -0,0 +1,9 @@ +[package] +org = "foo" +name = "persist_init_1" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true + diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/main.bal b/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/main.bal new file mode 100644 index 000000000..3fc27193c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_init_1/main.bal @@ -0,0 +1,21 @@ +// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/io; + +public function main() { + io:println("hello"); +} diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/Ballerina.toml new file mode 100644 index 000000000..8602e8eda --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/Ballerina.toml @@ -0,0 +1,9 @@ +[package] +org = "foo" +name = "persist_init_1" +version = "0.1.0" +distribution = "2201.3.0" + +[build-options] +observabilityIncluded = true + diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/main.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/main.bal new file mode 100644 index 000000000..3fc27193c --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/main.bal @@ -0,0 +1,21 @@ +// Copyright (c) 2022 WSO2 LLC. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/io; + +public function main() { + io:println("hello"); +} diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/persist/model.bal new file mode 100644 index 000000000..65eb21cf7 --- /dev/null +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/persist/model.bal @@ -0,0 +1 @@ +import ballerina/persist as _; \ No newline at end of file From c079ef034ef4087bc4f6a1ab92fe5039eaf720d5 Mon Sep 17 00:00:00 2001 From: bhashinee Date: Mon, 4 Mar 2024 16:13:34 +0530 Subject: [PATCH 19/22] Address review suggestions --- persist-cli/src/main/resources/version.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/persist-cli/src/main/resources/version.properties b/persist-cli/src/main/resources/version.properties index 26b6fd44e..22e655c24 100644 --- a/persist-cli/src/main/resources/version.properties +++ b/persist-cli/src/main/resources/version.properties @@ -1,4 +1,4 @@ version = ${project.version} -persistSqlVersion = 1.2.2-SNAPSHOT -persistInMemoryVersion = 1.2.0 -persistGoogleSheetsVersion = 1.2.0 +persistSqlVersion = ${project.persistSqlNativeVersion} +persistInMemoryVersion = ${project.persistInMemoryNativeVersion} +persistGoogleSheetsVersion = ${project.persistGoogleSheetsNativeVersion} From e31799d282bcc705deeb39189a3def75d6476124 Mon Sep 17 00:00:00 2001 From: bhashinee Date: Tue, 5 Mar 2024 09:49:11 +0530 Subject: [PATCH 20/22] Update the Ballerina lang version --- gradle.properties | 2 +- .../test-src/input/tool_test_db_push_1/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_10/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_11/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_12/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_13/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_14/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_15/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_16/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_17/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_18/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_19/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_20/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_21/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_22/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_23/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_24/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_25/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_26/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_27/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_28/Ballerina.toml | 1 + .../input/tool_test_db_push_29_mssql/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_3/Ballerina.toml | 1 + .../input/tool_test_db_push_30_mssql/Ballerina.toml | 1 + .../input/tool_test_db_push_31_mssql/Ballerina.toml | 1 + .../input/tool_test_db_push_32_postgresql/Ballerina.toml | 1 + .../input/tool_test_db_push_33_postgresql/Ballerina.toml | 1 + .../input/tool_test_db_push_34_postgresql/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_4/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_5/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_7/Ballerina.toml | 1 + .../test-src/input/tool_test_db_push_8/Ballerina.toml | 2 +- .../test-src/input/tool_test_migrate_1/Ballerina.toml | 1 + .../test-src/input/tool_test_migrate_10/Ballerina.toml | 1 + .../test-src/input/tool_test_migrate_11/Ballerina.toml | 1 + .../test-src/input/tool_test_migrate_2/Ballerina.toml | 1 + .../test-src/input/tool_test_migrate_3/Ballerina.toml | 1 + .../test-src/input/tool_test_migrate_4/Ballerina.toml | 1 + .../test-src/input/tool_test_migrate_5/Ballerina.toml | 1 + .../test-src/input/tool_test_migrate_6/Ballerina.toml | 1 + .../test-src/input/tool_test_migrate_7/Ballerina.toml | 1 + .../test-src/input/tool_test_migrate_8/Ballerina.toml | 1 + .../test-src/input/tool_test_migrate_9/Ballerina.toml | 1 + .../test-src/output/tool_test_add_6/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_1/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_10/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_11/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_12/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_13/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_14/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_15/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_16/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_17/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_18/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_19/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_20/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_21/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_22/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_23/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_24/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_25/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_26/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_27/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_28/Ballerina.toml | 1 + .../output/tool_test_db_push_29_mssql/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_3/Ballerina.toml | 1 + .../output/tool_test_db_push_30_mssql/Ballerina.toml | 1 + .../output/tool_test_db_push_31_mssql/Ballerina.toml | 1 + .../output/tool_test_db_push_32_postgresql/Ballerina.toml | 1 + .../output/tool_test_db_push_33_postgresql/Ballerina.toml | 1 + .../output/tool_test_db_push_34_postgresql/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_4/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_5/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_7/Ballerina.toml | 1 + .../test-src/output/tool_test_db_push_8/Ballerina.toml | 2 +- .../test-src/output/tool_test_init_1/persist/model.bal | 2 +- .../test-src/output/tool_test_migrate_1/Ballerina.toml | 1 + .../test-src/output/tool_test_migrate_10/Ballerina.toml | 1 + .../test-src/output/tool_test_migrate_11/Ballerina.toml | 1 + .../test-src/output/tool_test_migrate_2/Ballerina.toml | 1 + .../test-src/output/tool_test_migrate_3/Ballerina.toml | 1 + .../test-src/output/tool_test_migrate_4/Ballerina.toml | 1 + .../test-src/output/tool_test_migrate_5/Ballerina.toml | 1 + .../test-src/output/tool_test_migrate_6/Ballerina.toml | 1 + .../test-src/output/tool_test_migrate_7/Ballerina.toml | 1 + .../test-src/output/tool_test_migrate_8/Ballerina.toml | 1 + .../test-src/output/tool_test_migrate_9/Ballerina.toml | 1 + persist-cli/src/main/resources/version.properties | 6 +++--- 88 files changed, 90 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 307ace08b..1bbc336e9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ mySqlDriverVersion=8.0.29 mssqlDriverVersion=11.2.3.jre17 postgresqlDriverVersion=42.6.0 -ballerinaLangVersion=2201.9.0-20240216-054100-84e1bc71 +ballerinaLangVersion=2201.9.0-20240229-103900-a949e6d4 # Level 01 stdlibIoVersion=1.6.0 diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml index 31d4d882d..cad0709f8 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_1/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_1.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_10/Ballerina.toml index b32df7413..e4148e35d 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_10/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_10.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_11/Ballerina.toml index e3c769077..1847291cd 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_11/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_11/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_11.persist" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_12/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_12/Ballerina.toml index 051cee1bc..e92063b27 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_12/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_12/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_12.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_13/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_13/Ballerina.toml index cd554c132..ac1384b2e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_13/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_13/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_13.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml index 4648d37df..e9a5be9bb 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_14/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_14.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_15/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_15/Ballerina.toml index 2a6d8cefb..7ed640451 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_15/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_15/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_15.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_16/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_16/Ballerina.toml index 78d4a7e33..916c0c744 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_16/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_16/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_16.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_17/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_17/Ballerina.toml index f0d7d3eec..0e5c5e616 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_17/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_17/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_17.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_18/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_18/Ballerina.toml index 7044f7b07..fbf36c36a 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_18/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_18/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_18.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_19/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_19/Ballerina.toml index 7eacc06be..0d0c479a9 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_19/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_19/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_19.entities" +filePath = "persist/model.bal" [persist.model.storage] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_20/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_20/Ballerina.toml index 295808da1..a74d55133 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_20/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_20/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_20.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_21/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_21/Ballerina.toml index 2ca52d90f..62e7ec398 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_21/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_21/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_21.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_22/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_22/Ballerina.toml index b2a9e76b3..80ed2ee6f 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_22/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_22/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_22.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_23/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_23/Ballerina.toml index c3f092848..c20414158 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_23/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_23/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_23.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_24/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_24/Ballerina.toml index 218639c45..3af74a4c8 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_24/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_24/Ballerina.toml @@ -11,3 +11,4 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_24.entities" +filePath = "persist/model.bal" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_25/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_25/Ballerina.toml index 8b4c8749a..50efed679 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_25/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_25/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_25.rainier" +filePath = "persist/model.bal" [persist.model.storage.mysql] port = 3307 diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_26/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_26/Ballerina.toml index d866ae7cf..c307f4c0d 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_26/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_26/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_26" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_27/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_27/Ballerina.toml index 52176f811..2110e4a45 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_27/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_27/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_27.rainier" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_28/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_28/Ballerina.toml index 85d9cf43e..ec230bff9 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_28/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_28/Ballerina.toml @@ -11,3 +11,4 @@ observabilityIncluded = false id = "persist" options.datastore = "inmemory" targetModule = "tool_test_db_push_28.rainier" +filePath = "persist/model.bal" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_29_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_29_mssql/Ballerina.toml index 67ac941f1..46b45db0c 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_29_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_29_mssql/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mssql" targetModule = "tool_test_db_push_29.entities" +filePath = "persist/model.bal" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml index 85c31eae6..bb65929e2 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_3/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_3.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_30_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_30_mssql/Ballerina.toml index bcf5bbd1b..2f585e0a2 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_30_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_30_mssql/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mssql" targetModule = "tool_test_db_push_30.entities" +filePath = "persist/model.bal" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_31_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_31_mssql/Ballerina.toml index 02f392118..dac0b9249 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_31_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_31_mssql/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mssql" targetModule = "tool_test_db_push_31.entities" +filePath = "persist/model.bal" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_32_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_32_postgresql/Ballerina.toml index f5130f39c..b4f8cf948 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_32_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_32_postgresql/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "postgresql" targetModule = "tool_test_db_push_32.entities" +filePath = "persist/model.bal" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_33_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_33_postgresql/Ballerina.toml index 75bf566a0..abfd0c089 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_33_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_33_postgresql/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "postgresql" targetModule = "tool_test_db_push_33.entities" +filePath = "persist/model.bal" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_34_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_34_postgresql/Ballerina.toml index 0ddeda8fa..7c2da2adc 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_34_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_34_postgresql/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "postgresql" targetModule = "tool_test_db_push_34.entities" +filePath = "persist/model.bal" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_4/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_4/Ballerina.toml index 74108b1e7..28ae19d5a 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_4/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_4/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_4" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_5/Ballerina.toml index b35b88cad..63ad78b5c 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_5/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_5.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_7/Ballerina.toml index 25a3c164e..9da3d3ded 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_7/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_7.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "local" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_8/Ballerina.toml index ba951abbd..8940c6e06 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_db_push_8/Ballerina.toml @@ -14,7 +14,7 @@ repository="local" id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_8.entities" -filePath = "xx" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_1/Ballerina.toml index 8f0ef7835..d064efc3a 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_1/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest6" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_10/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_10/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_11/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_11/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_11/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_2/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_2/Ballerina.toml index 8f0ef7835..d064efc3a 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_2/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_2/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest6" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_3/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_3/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_4/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_4/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_4/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_4/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_5/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_5/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_6/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_6/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_7/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_7/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_8/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_8/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_9/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_9/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_9/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_migrate_9/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/Ballerina.toml index 418815dae..afd40a869 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_add_6/Ballerina.toml @@ -11,4 +11,5 @@ observabilityIncluded = true id = "persist_add_6" options.datastore = "mysql" targetModule = "persist_add_6_old" +filePath = "persist/model.bal" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_1/Ballerina.toml index 31d4d882d..cad0709f8 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_1/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_1.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_10/Ballerina.toml index b32df7413..e4148e35d 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_10/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_10.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_11/Ballerina.toml index e3c769077..1847291cd 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_11/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_11/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_11.persist" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_12/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_12/Ballerina.toml index 051cee1bc..e92063b27 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_12/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_12/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_12.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_13/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_13/Ballerina.toml index cd554c132..ac1384b2e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_13/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_13/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_13.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_14/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_14/Ballerina.toml index 4648d37df..e9a5be9bb 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_14/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_14/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_14.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_15/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_15/Ballerina.toml index 2a6d8cefb..7ed640451 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_15/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_15/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_15.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_16/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_16/Ballerina.toml index 78d4a7e33..916c0c744 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_16/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_16/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_16.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_17/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_17/Ballerina.toml index f0d7d3eec..0e5c5e616 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_17/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_17/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_17.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_18/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_18/Ballerina.toml index 7044f7b07..fbf36c36a 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_18/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_18/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_18.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_19/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_19/Ballerina.toml index 7eacc06be..0d0c479a9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_19/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_19/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_19.entities" +filePath = "persist/model.bal" [persist.model.storage] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/Ballerina.toml index 295808da1..a74d55133 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_20/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_20.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_21/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_21/Ballerina.toml index 2ca52d90f..62e7ec398 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_21/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_21/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_21.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_22/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_22/Ballerina.toml index b2a9e76b3..80ed2ee6f 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_22/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_22/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_22.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_23/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_23/Ballerina.toml index c3f092848..c20414158 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_23/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_23/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_23.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_24/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_24/Ballerina.toml index 218639c45..3af74a4c8 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_24/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_24/Ballerina.toml @@ -11,3 +11,4 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_24.entities" +filePath = "persist/model.bal" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_25/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_25/Ballerina.toml index 8b4c8749a..50efed679 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_25/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_25/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_25.rainier" +filePath = "persist/model.bal" [persist.model.storage.mysql] port = 3307 diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_26/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_26/Ballerina.toml index d866ae7cf..c307f4c0d 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_26/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_26/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_26" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_27/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_27/Ballerina.toml index 52176f811..2110e4a45 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_27/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_27/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_27.rainier" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_28/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_28/Ballerina.toml index 85d9cf43e..ec230bff9 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_28/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_28/Ballerina.toml @@ -11,3 +11,4 @@ observabilityIncluded = false id = "persist" options.datastore = "inmemory" targetModule = "tool_test_db_push_28.rainier" +filePath = "persist/model.bal" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_29_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_29_mssql/Ballerina.toml index 67ac941f1..46b45db0c 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_29_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_29_mssql/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mssql" targetModule = "tool_test_db_push_29.entities" +filePath = "persist/model.bal" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_3/Ballerina.toml index 85c31eae6..bb65929e2 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_3/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_3.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_30_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_30_mssql/Ballerina.toml index bcf5bbd1b..2f585e0a2 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_30_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_30_mssql/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mssql" targetModule = "tool_test_db_push_30.entities" +filePath = "persist/model.bal" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_31_mssql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_31_mssql/Ballerina.toml index 02f392118..dac0b9249 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_31_mssql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_31_mssql/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mssql" targetModule = "tool_test_db_push_31.entities" +filePath = "persist/model.bal" [persist.model.storage.mssql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_32_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_32_postgresql/Ballerina.toml index f5130f39c..b4f8cf948 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_32_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_32_postgresql/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "postgresql" targetModule = "tool_test_db_push_32.entities" +filePath = "persist/model.bal" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_33_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_33_postgresql/Ballerina.toml index 75bf566a0..abfd0c089 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_33_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_33_postgresql/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "postgresql" targetModule = "tool_test_db_push_33.entities" +filePath = "persist/model.bal" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_34_postgresql/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_34_postgresql/Ballerina.toml index 0ddeda8fa..7c2da2adc 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_34_postgresql/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_34_postgresql/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "postgresql" targetModule = "tool_test_db_push_34.entities" +filePath = "persist/model.bal" [persist.model.storage.postgresql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_4/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_4/Ballerina.toml index 74108b1e7..28ae19d5a 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_4/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_4/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_4" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_5/Ballerina.toml index b35b88cad..63ad78b5c 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_5/Ballerina.toml @@ -8,6 +8,7 @@ distribution = "2201.3.0" id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_5.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_7/Ballerina.toml index 25a3c164e..9da3d3ded 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_7/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = false id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_7.entities" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "local" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_8/Ballerina.toml index ba951abbd..8940c6e06 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_db_push_8/Ballerina.toml @@ -14,7 +14,7 @@ repository="local" id = "persist" options.datastore = "mysql" targetModule = "tool_test_db_push_8.entities" -filePath = "xx" +filePath = "persist/model.bal" [persist.model.storage.mysql] host = "localhost" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/persist/model.bal b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/persist/model.bal index 65eb21cf7..d02cb63ea 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/persist/model.bal +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_init_1/persist/model.bal @@ -1 +1 @@ -import ballerina/persist as _; \ No newline at end of file +import ballerina/persist as _; diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_1/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_1/Ballerina.toml index 55d9dcc86..508125f84 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_1/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_1/Ballerina.toml @@ -11,4 +11,5 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest6" +filePath = "persist/model.bal" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_10/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_10/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_10/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_10/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_11/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_11/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_11/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_11/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_2/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_2/Ballerina.toml index 8f0ef7835..d064efc3a 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_2/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_2/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest6" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_3/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_3/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_3/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_3/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_4/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_4/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_4/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_4/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_5/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_5/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_5/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_5/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_6/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_6/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_7/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_7/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_7/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_7/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_8/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_8/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_8/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_8/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_9/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_9/Ballerina.toml index b3cefe14f..0731b7f0e 100644 --- a/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_9/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/output/tool_test_migrate_9/Ballerina.toml @@ -11,6 +11,7 @@ observabilityIncluded = true id = "persist" options.datastore = "mysql" targetModule = "persistTest7" +filePath = "persist/model.bal" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/persist-cli/src/main/resources/version.properties b/persist-cli/src/main/resources/version.properties index 22e655c24..26b6fd44e 100644 --- a/persist-cli/src/main/resources/version.properties +++ b/persist-cli/src/main/resources/version.properties @@ -1,4 +1,4 @@ version = ${project.version} -persistSqlVersion = ${project.persistSqlNativeVersion} -persistInMemoryVersion = ${project.persistInMemoryNativeVersion} -persistGoogleSheetsVersion = ${project.persistGoogleSheetsNativeVersion} +persistSqlVersion = 1.2.2-SNAPSHOT +persistInMemoryVersion = 1.2.0 +persistGoogleSheetsVersion = 1.2.0 From 73dbbc8a0efae64c55e5a305a936d5caece0801c Mon Sep 17 00:00:00 2001 From: bhashinee Date: Tue, 5 Mar 2024 09:51:57 +0530 Subject: [PATCH 21/22] Change the version.properties --- persist-cli/src/main/resources/version.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/persist-cli/src/main/resources/version.properties b/persist-cli/src/main/resources/version.properties index 26b6fd44e..22e655c24 100644 --- a/persist-cli/src/main/resources/version.properties +++ b/persist-cli/src/main/resources/version.properties @@ -1,4 +1,4 @@ version = ${project.version} -persistSqlVersion = 1.2.2-SNAPSHOT -persistInMemoryVersion = 1.2.0 -persistGoogleSheetsVersion = 1.2.0 +persistSqlVersion = ${project.persistSqlNativeVersion} +persistInMemoryVersion = ${project.persistInMemoryNativeVersion} +persistGoogleSheetsVersion = ${project.persistGoogleSheetsNativeVersion} From a723b9ad7c8c39319f8c6b24751f229dbc805370 Mon Sep 17 00:00:00 2001 From: bhashinee Date: Tue, 5 Mar 2024 10:04:20 +0530 Subject: [PATCH 22/22] Fix the failing test case --- .../resources/test-src/input/tool_test_add_6/Ballerina.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/Ballerina.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/Ballerina.toml index 418815dae..17f485ca1 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/Ballerina.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_add_6/Ballerina.toml @@ -11,4 +11,4 @@ observabilityIncluded = true id = "persist_add_6" options.datastore = "mysql" targetModule = "persist_add_6_old" - +filePath = "persist/model.bal"