From 4a54b9335cc86e196524b95f29f0417abb965e18 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Thu, 22 Feb 2024 13:02:13 +0530 Subject: [PATCH 1/8] Fix file name for files inside tests directory --- .../io/ballerina/openapi/build/HttpServiceAnalysisTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi-build-extension/src/main/java/io/ballerina/openapi/build/HttpServiceAnalysisTask.java b/openapi-build-extension/src/main/java/io/ballerina/openapi/build/HttpServiceAnalysisTask.java index 516fe6c0a..f1f174435 100644 --- a/openapi-build-extension/src/main/java/io/ballerina/openapi/build/HttpServiceAnalysisTask.java +++ b/openapi-build-extension/src/main/java/io/ballerina/openapi/build/HttpServiceAnalysisTask.java @@ -127,7 +127,7 @@ public void perform(SyntaxNodeAnalysisContext context) { */ private String constructFileName(SyntaxTree syntaxTree, Map services, Symbol serviceSymbol) { String fileName = getNormalizedFileName(services.get(serviceSymbol.hashCode())); - String balFileName = syntaxTree.filePath().split("\\.")[0]; + String balFileName = syntaxTree.filePath().replaceAll(SLASH, UNDERSCORE).split("\\.")[0]; if (fileName.equals(SLASH)) { return balFileName + OPENAPI_SUFFIX + YAML_EXTENSION; } else if (fileName.contains(HYPHEN) && fileName.split(HYPHEN)[0].equals(SLASH) || fileName.isBlank()) { From b7fa479be07404b95c97f136aaf742c0922adad0 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Thu, 22 Feb 2024 13:02:26 +0530 Subject: [PATCH 2/8] Add a test case --- .../extension/build/BuildExtensionTests.java | 20 ++++++++++++++++++- .../ballerina_sources/project_11/main.bal | 8 ++++++++ .../project_11/modules/api/module.bal | 8 ++++++++ .../modules/api/tests/module_test.bal | 8 ++++++++ .../ballerina_sources/project_11/service.bal | 7 ------- .../project_11/tests/test.bal | 8 ++++++++ .../project_12/Ballerina.toml | 7 +++++++ 7 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_11/main.bal create mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/module.bal create mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/tests/module_test.bal delete mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_11/service.bal create mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_11/tests/test.bal create mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_12/Ballerina.toml diff --git a/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java b/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java index ad60a14ee..ee1b2ae1a 100644 --- a/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java +++ b/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java @@ -85,7 +85,7 @@ public void buildOptionWithSingleFile() throws IOException, InterruptedException List buildArgs = new LinkedList<>(); buildArgs.add("--export-openapi"); boolean successful = TestUtil.executeBuild(DISTRIBUTION_FILE_NAME, - TEST_RESOURCE.resolve("project_5/service.bal"), buildArgs); + TEST_RESOURCE.resolve("project_5/main.bal"), buildArgs); } @Test(description = "Check --export-openapi flag with grpc service") @@ -124,6 +124,24 @@ public void basePathWithUnicodeCharacter() throws IOException, InterruptedExcept TEST_RESOURCE.resolve("project_9"), buildArgs); Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_9/target/openapi/ชื่อ_openapi.yaml"))); } + + @Test(description = "Empty base path service inside tests directory") + public void emptyBastPathServiceInTests() throws IOException, InterruptedException { + List buildArgs = new LinkedList<>(); + buildArgs.add("--export-openapi"); + boolean successful = executeBuild(DISTRIBUTION_FILE_NAME, + TEST_RESOURCE.resolve("project_11"), buildArgs); + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_11/target/openapi/" + + "main_openapi.yaml"))); + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_11/target/openapi/" + + "module_openapi.yaml"))); + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_11/target/openapi/" + + "tests_test_openapi.yaml"))); + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_11/target/openapi/" + + "tests_module_test_openapi.yaml"))); + } + + private void executeCommand(String resourcePath) throws IOException, InterruptedException { List buildArgs = new LinkedList<>(); boolean successful = executeBuild(DISTRIBUTION_FILE_NAME, diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/main.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/main.bal new file mode 100644 index 000000000..9c422a85e --- /dev/null +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/main.bal @@ -0,0 +1,8 @@ +import ballerina/http; + +service / on new http:Listener(9090) { + + resource function get path/test(string query) returns string { + return "Hello, " + query; + } +} \ No newline at end of file diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/module.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/module.bal new file mode 100644 index 000000000..9c422a85e --- /dev/null +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/module.bal @@ -0,0 +1,8 @@ +import ballerina/http; + +service / on new http:Listener(9090) { + + resource function get path/test(string query) returns string { + return "Hello, " + query; + } +} \ No newline at end of file diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/tests/module_test.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/tests/module_test.bal new file mode 100644 index 000000000..9c422a85e --- /dev/null +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/tests/module_test.bal @@ -0,0 +1,8 @@ +import ballerina/http; + +service / on new http:Listener(9090) { + + resource function get path/test(string query) returns string { + return "Hello, " + query; + } +} \ No newline at end of file diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/service.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/service.bal deleted file mode 100644 index c0d9f4346..000000000 --- a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/service.bal +++ /dev/null @@ -1,7 +0,0 @@ -import ballerina/graphql; - -service graphql:Service /query on new graphql:Listener(8080) { - resource function get name() returns string { - return "Jack"; - } -} diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/tests/test.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/tests/test.bal new file mode 100644 index 000000000..9c422a85e --- /dev/null +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/tests/test.bal @@ -0,0 +1,8 @@ +import ballerina/http; + +service / on new http:Listener(9090) { + + resource function get path/test(string query) returns string { + return "Hello, " + query; + } +} \ No newline at end of file diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/Ballerina.toml b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/Ballerina.toml new file mode 100644 index 000000000..299d484dd --- /dev/null +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/Ballerina.toml @@ -0,0 +1,7 @@ +[package] +org = "openapi_extension_test" +name = "sample_12" +version = "0.1.0" + +[build-options] +observabilityIncluded = true From 94cb622e5648a6c9586035f99b037d65889a07ac Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Thu, 22 Feb 2024 13:19:15 +0530 Subject: [PATCH 3/8] Revert unwanted changes --- .../extension/build/BuildExtensionTests.java | 13 +++++++------ .../ballerina_sources/project_11/Ballerina.toml | 1 - .../resources/ballerina_sources/project_11/main.bal | 13 ++++++------- .../ballerina_sources/project_12/api/module.bal | 8 ++++++++ .../project_12/api/tests/module_test.bal | 8 ++++++++ .../resources/ballerina_sources/project_12/main.bal | 8 ++++++++ .../ballerina_sources/project_12/tests/test.bal | 8 ++++++++ 7 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/module.bal create mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/tests/module_test.bal create mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_12/main.bal create mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_12/tests/test.bal diff --git a/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java b/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java index ee1b2ae1a..64f922ceb 100644 --- a/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java +++ b/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java @@ -85,7 +85,7 @@ public void buildOptionWithSingleFile() throws IOException, InterruptedException List buildArgs = new LinkedList<>(); buildArgs.add("--export-openapi"); boolean successful = TestUtil.executeBuild(DISTRIBUTION_FILE_NAME, - TEST_RESOURCE.resolve("project_5/main.bal"), buildArgs); + TEST_RESOURCE.resolve("project_5/service.bal"), buildArgs); } @Test(description = "Check --export-openapi flag with grpc service") @@ -130,14 +130,15 @@ public void emptyBastPathServiceInTests() throws IOException, InterruptedExcepti List buildArgs = new LinkedList<>(); buildArgs.add("--export-openapi"); boolean successful = executeBuild(DISTRIBUTION_FILE_NAME, - TEST_RESOURCE.resolve("project_11"), buildArgs); - Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_11/target/openapi/" + + TEST_RESOURCE.resolve("project_12"), buildArgs); + Assert.assertTrue(successful); + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_12/target/openapi/" + "main_openapi.yaml"))); - Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_11/target/openapi/" + + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_12/target/openapi/" + "module_openapi.yaml"))); - Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_11/target/openapi/" + + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_12/target/openapi/" + "tests_test_openapi.yaml"))); - Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_11/target/openapi/" + + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_12/target/openapi/" + "tests_module_test_openapi.yaml"))); } diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/Ballerina.toml b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/Ballerina.toml index 9cc70021a..7894da7ce 100644 --- a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/Ballerina.toml +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/Ballerina.toml @@ -5,4 +5,3 @@ version = "0.1.0" [build-options] observabilityIncluded = true - diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/main.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/main.bal index 9c422a85e..c0d9f4346 100644 --- a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/main.bal +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/main.bal @@ -1,8 +1,7 @@ -import ballerina/http; +import ballerina/graphql; -service / on new http:Listener(9090) { - - resource function get path/test(string query) returns string { - return "Hello, " + query; - } -} \ No newline at end of file +service graphql:Service /query on new graphql:Listener(8080) { + resource function get name() returns string { + return "Jack"; + } +} diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/module.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/module.bal new file mode 100644 index 000000000..eaab4f81a --- /dev/null +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/module.bal @@ -0,0 +1,8 @@ +import ballerina/http; + +service / on new http:Listener(9090) { + + resource function get path/test(string query) returns string { + return "Hello, " + query; + } +} diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/tests/module_test.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/tests/module_test.bal new file mode 100644 index 000000000..9c422a85e --- /dev/null +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/tests/module_test.bal @@ -0,0 +1,8 @@ +import ballerina/http; + +service / on new http:Listener(9090) { + + resource function get path/test(string query) returns string { + return "Hello, " + query; + } +} \ No newline at end of file diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/main.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/main.bal new file mode 100644 index 000000000..eaab4f81a --- /dev/null +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/main.bal @@ -0,0 +1,8 @@ +import ballerina/http; + +service / on new http:Listener(9090) { + + resource function get path/test(string query) returns string { + return "Hello, " + query; + } +} diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/tests/test.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/tests/test.bal new file mode 100644 index 000000000..eaab4f81a --- /dev/null +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/tests/test.bal @@ -0,0 +1,8 @@ +import ballerina/http; + +service / on new http:Listener(9090) { + + resource function get path/test(string query) returns string { + return "Hello, " + query; + } +} From 3e5b303fb8dc2a507266c2ff29ad257108ca06e6 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Thu, 22 Feb 2024 13:38:54 +0530 Subject: [PATCH 4/8] Refactor test resources --- .../resources/ballerina_sources/project_11/Ballerina.toml | 1 + .../ballerina_sources/project_11/modules/api/module.bal | 8 -------- .../project_11/{main.bal => service.bal} | 0 .../resources/ballerina_sources/project_11/tests/test.bal | 8 -------- .../project_12/api/tests/module_test.bal | 8 -------- .../project_12/{ => modules}/api/module.bal | 0 .../modules/api/tests/module_test.bal | 2 +- 7 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/module.bal rename openapi-integration-tests/src/test/resources/ballerina_sources/project_11/{main.bal => service.bal} (100%) delete mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_11/tests/test.bal delete mode 100644 openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/tests/module_test.bal rename openapi-integration-tests/src/test/resources/ballerina_sources/project_12/{ => modules}/api/module.bal (100%) rename openapi-integration-tests/src/test/resources/ballerina_sources/{project_11 => project_12}/modules/api/tests/module_test.bal (98%) diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/Ballerina.toml b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/Ballerina.toml index 7894da7ce..9cc70021a 100644 --- a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/Ballerina.toml +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/Ballerina.toml @@ -5,3 +5,4 @@ version = "0.1.0" [build-options] observabilityIncluded = true + diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/module.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/module.bal deleted file mode 100644 index 9c422a85e..000000000 --- a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/module.bal +++ /dev/null @@ -1,8 +0,0 @@ -import ballerina/http; - -service / on new http:Listener(9090) { - - resource function get path/test(string query) returns string { - return "Hello, " + query; - } -} \ No newline at end of file diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/main.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/service.bal similarity index 100% rename from openapi-integration-tests/src/test/resources/ballerina_sources/project_11/main.bal rename to openapi-integration-tests/src/test/resources/ballerina_sources/project_11/service.bal diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/tests/test.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/tests/test.bal deleted file mode 100644 index 9c422a85e..000000000 --- a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/tests/test.bal +++ /dev/null @@ -1,8 +0,0 @@ -import ballerina/http; - -service / on new http:Listener(9090) { - - resource function get path/test(string query) returns string { - return "Hello, " + query; - } -} \ No newline at end of file diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/tests/module_test.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/tests/module_test.bal deleted file mode 100644 index 9c422a85e..000000000 --- a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/tests/module_test.bal +++ /dev/null @@ -1,8 +0,0 @@ -import ballerina/http; - -service / on new http:Listener(9090) { - - resource function get path/test(string query) returns string { - return "Hello, " + query; - } -} \ No newline at end of file diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/module.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/modules/api/module.bal similarity index 100% rename from openapi-integration-tests/src/test/resources/ballerina_sources/project_12/api/module.bal rename to openapi-integration-tests/src/test/resources/ballerina_sources/project_12/modules/api/module.bal diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/tests/module_test.bal b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/modules/api/tests/module_test.bal similarity index 98% rename from openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/tests/module_test.bal rename to openapi-integration-tests/src/test/resources/ballerina_sources/project_12/modules/api/tests/module_test.bal index 9c422a85e..eaab4f81a 100644 --- a/openapi-integration-tests/src/test/resources/ballerina_sources/project_11/modules/api/tests/module_test.bal +++ b/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/modules/api/tests/module_test.bal @@ -5,4 +5,4 @@ service / on new http:Listener(9090) { resource function get path/test(string query) returns string { return "Hello, " + query; } -} \ No newline at end of file +} From 362bafacaedc9a33930c3dc6fc4db13455e06da1 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Thu, 22 Feb 2024 13:39:08 +0530 Subject: [PATCH 5/8] Rename test function --- .../ballerina/openapi/extension/build/BuildExtensionTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java b/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java index 64f922ceb..97e9f580f 100644 --- a/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java +++ b/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java @@ -126,7 +126,7 @@ public void basePathWithUnicodeCharacter() throws IOException, InterruptedExcept } @Test(description = "Empty base path service inside tests directory") - public void emptyBastPathServiceInTests() throws IOException, InterruptedException { + public void emptyBasePathServiceInTests() throws IOException, InterruptedException { List buildArgs = new LinkedList<>(); buildArgs.add("--export-openapi"); boolean successful = executeBuild(DISTRIBUTION_FILE_NAME, From 70b5f24337719a4b56c963ea0a89e8eeefedd16b Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Thu, 22 Feb 2024 14:19:54 +0530 Subject: [PATCH 6/8] Fix test failure --- .../openapi/extension/build/BuildExtensionTests.java | 10 +++++----- .../idl/client/IDLClientGenPluginNegativeTests.java | 2 +- .../project_12 => build/project_10}/Ballerina.toml | 2 +- .../project_12 => build/project_10}/main.bal | 0 .../project_10}/modules/api/module.bal | 0 .../project_10}/modules/api/tests/module_test.bal | 0 .../project_12 => build/project_10}/tests/test.bal | 0 7 files changed, 7 insertions(+), 7 deletions(-) rename openapi-integration-tests/src/test/resources/{ballerina_sources/project_12 => build/project_10}/Ballerina.toml (84%) rename openapi-integration-tests/src/test/resources/{ballerina_sources/project_12 => build/project_10}/main.bal (100%) rename openapi-integration-tests/src/test/resources/{ballerina_sources/project_12 => build/project_10}/modules/api/module.bal (100%) rename openapi-integration-tests/src/test/resources/{ballerina_sources/project_12 => build/project_10}/modules/api/tests/module_test.bal (100%) rename openapi-integration-tests/src/test/resources/{ballerina_sources/project_12 => build/project_10}/tests/test.bal (100%) diff --git a/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java b/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java index 97e9f580f..7e7245271 100644 --- a/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java +++ b/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java @@ -130,15 +130,15 @@ public void emptyBasePathServiceInTests() throws IOException, InterruptedExcepti List buildArgs = new LinkedList<>(); buildArgs.add("--export-openapi"); boolean successful = executeBuild(DISTRIBUTION_FILE_NAME, - TEST_RESOURCE.resolve("project_12"), buildArgs); + TEST_RESOURCE.resolve("project_100"), buildArgs); Assert.assertTrue(successful); - Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_12/target/openapi/" + + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_10/target/openapi/" + "main_openapi.yaml"))); - Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_12/target/openapi/" + + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_10/target/openapi/" + "module_openapi.yaml"))); - Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_12/target/openapi/" + + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_10/target/openapi/" + "tests_test_openapi.yaml"))); - Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_12/target/openapi/" + + Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_10/target/openapi/" + "tests_module_test_openapi.yaml"))); } diff --git a/openapi-integration-tests/src/test/java/io/ballerina/openapi/idl/client/IDLClientGenPluginNegativeTests.java b/openapi-integration-tests/src/test/java/io/ballerina/openapi/idl/client/IDLClientGenPluginNegativeTests.java index f9a1c043a..6d61f4336 100644 --- a/openapi-integration-tests/src/test/java/io/ballerina/openapi/idl/client/IDLClientGenPluginNegativeTests.java +++ b/openapi-integration-tests/src/test/java/io/ballerina/openapi/idl/client/IDLClientGenPluginNegativeTests.java @@ -94,7 +94,7 @@ public void testInvalidSwaggerLocalPath() throws IOException, InterruptedExcepti @Test public void testInvalidSwaggerContract() throws IOException, InterruptedException { - Process process = executeRun(DISTRIBUTION_FILE_NAME, TEST_RESOURCE.resolve("project_12"), + Process process = executeRun(DISTRIBUTION_FILE_NAME, TEST_RESOURCE.resolve("project_10"), new ArrayList<>()); File dir = new File(RESOURCE.resolve("client-idl-projects/project_12/generated/").toString()); Assert.assertFalse(dir.exists()); diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/Ballerina.toml b/openapi-integration-tests/src/test/resources/build/project_10/Ballerina.toml similarity index 84% rename from openapi-integration-tests/src/test/resources/ballerina_sources/project_12/Ballerina.toml rename to openapi-integration-tests/src/test/resources/build/project_10/Ballerina.toml index 299d484dd..654b0b8ce 100644 --- a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/Ballerina.toml +++ b/openapi-integration-tests/src/test/resources/build/project_10/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "openapi_extension_test" -name = "sample_12" +name = "project_10" version = "0.1.0" [build-options] diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/main.bal b/openapi-integration-tests/src/test/resources/build/project_10/main.bal similarity index 100% rename from openapi-integration-tests/src/test/resources/ballerina_sources/project_12/main.bal rename to openapi-integration-tests/src/test/resources/build/project_10/main.bal diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/modules/api/module.bal b/openapi-integration-tests/src/test/resources/build/project_10/modules/api/module.bal similarity index 100% rename from openapi-integration-tests/src/test/resources/ballerina_sources/project_12/modules/api/module.bal rename to openapi-integration-tests/src/test/resources/build/project_10/modules/api/module.bal diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/modules/api/tests/module_test.bal b/openapi-integration-tests/src/test/resources/build/project_10/modules/api/tests/module_test.bal similarity index 100% rename from openapi-integration-tests/src/test/resources/ballerina_sources/project_12/modules/api/tests/module_test.bal rename to openapi-integration-tests/src/test/resources/build/project_10/modules/api/tests/module_test.bal diff --git a/openapi-integration-tests/src/test/resources/ballerina_sources/project_12/tests/test.bal b/openapi-integration-tests/src/test/resources/build/project_10/tests/test.bal similarity index 100% rename from openapi-integration-tests/src/test/resources/ballerina_sources/project_12/tests/test.bal rename to openapi-integration-tests/src/test/resources/build/project_10/tests/test.bal From b7508ccff7545217691b018e2835c97e4ecc994a Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Thu, 22 Feb 2024 14:36:34 +0530 Subject: [PATCH 7/8] Fix test project name --- .../ballerina/openapi/extension/build/BuildExtensionTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java b/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java index 7e7245271..d60a4d86c 100644 --- a/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java +++ b/openapi-integration-tests/src/test/java/io/ballerina/openapi/extension/build/BuildExtensionTests.java @@ -130,7 +130,7 @@ public void emptyBasePathServiceInTests() throws IOException, InterruptedExcepti List buildArgs = new LinkedList<>(); buildArgs.add("--export-openapi"); boolean successful = executeBuild(DISTRIBUTION_FILE_NAME, - TEST_RESOURCE.resolve("project_100"), buildArgs); + TEST_RESOURCE.resolve("project_10"), buildArgs); Assert.assertTrue(successful); Assert.assertTrue(Files.exists(RESOURCE.resolve("build/project_10/target/openapi/" + "main_openapi.yaml"))); From d2063ee4c21292fae138ba3104b85a707c3a5514 Mon Sep 17 00:00:00 2001 From: Krishnananthalingam Tharmigan <63336800+TharmiganK@users.noreply.github.com> Date: Thu, 22 Feb 2024 14:55:20 +0530 Subject: [PATCH 8/8] Revert unwanted change --- .../openapi/idl/client/IDLClientGenPluginNegativeTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi-integration-tests/src/test/java/io/ballerina/openapi/idl/client/IDLClientGenPluginNegativeTests.java b/openapi-integration-tests/src/test/java/io/ballerina/openapi/idl/client/IDLClientGenPluginNegativeTests.java index 6d61f4336..f9a1c043a 100644 --- a/openapi-integration-tests/src/test/java/io/ballerina/openapi/idl/client/IDLClientGenPluginNegativeTests.java +++ b/openapi-integration-tests/src/test/java/io/ballerina/openapi/idl/client/IDLClientGenPluginNegativeTests.java @@ -94,7 +94,7 @@ public void testInvalidSwaggerLocalPath() throws IOException, InterruptedExcepti @Test public void testInvalidSwaggerContract() throws IOException, InterruptedException { - Process process = executeRun(DISTRIBUTION_FILE_NAME, TEST_RESOURCE.resolve("project_10"), + Process process = executeRun(DISTRIBUTION_FILE_NAME, TEST_RESOURCE.resolve("project_12"), new ArrayList<>()); File dir = new File(RESOURCE.resolve("client-idl-projects/project_12/generated/").toString()); Assert.assertFalse(dir.exists());