From fb08366f37f19c64ca3cbe9a379a5c0927216842 Mon Sep 17 00:00:00 2001 From: Sahan He <45299562+sahanHe@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:31:13 +0530 Subject: [PATCH 1/5] Update code to keep existing configs in the config.toml --- .../io/ballerina/persist/nodegenerator/SourceGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/SourceGenerator.java b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/SourceGenerator.java index 632d585c6..667682fb8 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/SourceGenerator.java +++ b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/SourceGenerator.java @@ -254,7 +254,7 @@ private SyntaxTree getUpdateConfigTomlSyntax(Path configPath, String moduleName, moduleMembers = moduleMembers.add(member); if (node.identifier().toSourceCode().trim().equals(moduleName)) { configExists = true; - break; + continue; } } else if (member instanceof TableArrayNode) { moduleMembers = moduleMembers.add(member); From b8ad9823b87663449bdea5ca7b0b38a02c0f0816 Mon Sep 17 00:00:00 2001 From: Sahan He <45299562+sahanHe@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:31:20 +0530 Subject: [PATCH 2/5] Update tests --- .../resources/test-src/input/tool_test_generate_5/Config.toml | 3 +++ .../resources/test-src/output/tool_test_generate_5/Config.toml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/Config.toml b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/Config.toml index dddc88d62..8c40b1d38 100644 --- a/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/Config.toml +++ b/persist-cli-tests/src/test/resources/test-src/input/tool_test_generate_5/Config.toml @@ -4,3 +4,6 @@ port = 3306 user = "root" password = "" database = "" + +[persist_generate_5.entities.connectionOptions.ssl] +allowPublicKeyRetrieval=true 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 0616ed500..8c40b1d38 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 @@ -5,3 +5,5 @@ user = "root" password = "" database = "" +[persist_generate_5.entities.connectionOptions.ssl] +allowPublicKeyRetrieval=true From 296ee47b29f91d0488f380745ecbf0b1cf6e2ca7 Mon Sep 17 00:00:00 2001 From: Sahan He <45299562+sahanHe@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:00:19 +0530 Subject: [PATCH 3/5] Update SourceGenerator.java --- .../java/io/ballerina/persist/nodegenerator/SourceGenerator.java | 1 - 1 file changed, 1 deletion(-) diff --git a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/SourceGenerator.java b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/SourceGenerator.java index 667682fb8..513d77be5 100644 --- a/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/SourceGenerator.java +++ b/persist-cli/src/main/java/io/ballerina/persist/nodegenerator/SourceGenerator.java @@ -254,7 +254,6 @@ private SyntaxTree getUpdateConfigTomlSyntax(Path configPath, String moduleName, moduleMembers = moduleMembers.add(member); if (node.identifier().toSourceCode().trim().equals(moduleName)) { configExists = true; - continue; } } else if (member instanceof TableArrayNode) { moduleMembers = moduleMembers.add(member); From 9f4d770312a589f453a2c7325dded9cd9d932fa3 Mon Sep 17 00:00:00 2001 From: Sahan He <45299562+sahanHe@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:42:05 +0530 Subject: [PATCH 4/5] Update changelog.md --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 854379f97..75d3f485c 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +- [Fixed the issue related to existing configurations in Config.toml file] (https://github.com/ballerina-platform/persist-tools/issues/314) ### Added - [Added support for MSSQL as a datasource](https://github.com/ballerina-platform/ballerina-standard-library/issues/4506) From 55c65ce6fa59e332475f10819082d2975e825081 Mon Sep 17 00:00:00 2001 From: Sahan He <45299562+sahanHe@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:59:27 +0530 Subject: [PATCH 5/5] Update changelog.md --- changelog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 75d3f485c..e5b029e2d 100644 --- a/changelog.md +++ b/changelog.md @@ -5,7 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -- [Fixed the issue related to existing configurations in Config.toml file] (https://github.com/ballerina-platform/persist-tools/issues/314) + +### Changed +- [Fixed the issue related to existing configurations in Config.toml file](https://github.com/ballerina-platform/persist-tools/issues/314) ### Added - [Added support for MSSQL as a datasource](https://github.com/ballerina-platform/ballerina-standard-library/issues/4506)