From 82c5115b60ef53b20c362e6506a639d013d9fa26 Mon Sep 17 00:00:00 2001 From: Krishnananthalingam Tharmigan <63336800+TharmiganK@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:23:23 +0530 Subject: [PATCH 01/16] Add client invocation tip for SSE server --- examples/http-sse-service/http_sse_service.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/http-sse-service/http_sse_service.md b/examples/http-sse-service/http_sse_service.md index 352626bbab..28bc15ce55 100644 --- a/examples/http-sse-service/http_sse_service.md +++ b/examples/http-sse-service/http_sse_service.md @@ -12,6 +12,8 @@ Invoke the service by executing the following cURL command in a new terminal. ::: out http_sse_service.client.out ::: +>**Tip:** You can invoke the above service via the [Client server-sent events](/learn/by-example/http-sse-client/) example. + ## Related links - [`http` module - API documentation](https://lib.ballerina.io/ballerina/http/latest/) - [Resource return types - Specification](/spec/http/#235-return-types) From 373cf531cc09dfa5ebaff7a4868f51a1c706e1e4 Mon Sep 17 00:00:00 2001 From: Asma Jabir Date: Wed, 21 Aug 2024 15:35:54 +0530 Subject: [PATCH 02/16] Skip project api tests from release workflow --- .github/workflows/publish-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index c4f204b279..15cffca1f2 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -76,7 +76,7 @@ jobs: githubAccessToken: ${{ secrets.GITHUB_TOKEN }} ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }} run: | - ./gradlew build -Pversion=${VERSION} + ./gradlew build -x project-api-tests:test -Pversion=${VERSION} ./gradlew release -Prelease.useAutomaticVersion=true -x test - name: Checkout docker repo uses: actions/checkout@v3 From 14752555c4228ee0e7f96574c3c1c7c73c2e9549 Mon Sep 17 00:00:00 2001 From: LakshanWeerasinghe Date: Thu, 22 Aug 2024 14:19:58 +0530 Subject: [PATCH 03/16] Update update-tool version --- ballerina-test-automation/gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ballerina-test-automation/gradle.properties b/ballerina-test-automation/gradle.properties index d1b6bef883..d491fa1ea9 100644 --- a/ballerina-test-automation/gradle.properties +++ b/ballerina-test-automation/gradle.properties @@ -1,7 +1,7 @@ swan-lake-latest-version=swan-lake-2201.10.0 swan-lake-latest-spec-version=2024R1 swan-lake-latest-version-display-text=2201.10.0 -swan-lake-latest-tool-version=1.4.2 -latest-tool-version=1.4.2 +swan-lake-latest-tool-version=1.4.3 +latest-tool-version=1.4.3 1-x-channel-latest-version=1.2.13 1-x-channel-latest-spec-version=2020R1 From d79e4d07511f6d795886f0a9978e08c9df9f10fa Mon Sep 17 00:00:00 2001 From: Lakshan Weerasinghe <46857198+LakshanWeerasinghe@users.noreply.github.com> Date: Thu, 22 Aug 2024 16:10:43 +0530 Subject: [PATCH 04/16] Update gradle.properties --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6cd95508da..78a1d4cde5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -78,7 +78,7 @@ persistToolVersion=1.4.0 # Dev Tools devToolsVersion=1.5.0 -ballerinaCommandVersion=1.4.2 +ballerinaCommandVersion=1.4.3 # API Doc UI docUiApi=https://api.dev-central.ballerina.io/2.0/docs/doc-ui From 5aeecff7a787246a1106c630322ddf05235e08e3 Mon Sep 17 00:00:00 2001 From: Gayal Dassanayake Date: Fri, 16 Aug 2024 08:46:05 +0530 Subject: [PATCH 05/16] Use central prod token for project api tests --- .github/workflows/daily-build.yml | 1 + .github/workflows/publish-release.yml | 1 + .../org/ballerina/projectapi/BalToolTest.java | 9 ++++++--- .../org/ballerina/projectapi/BuildTimeTest.java | 4 ++-- .../ballerina/projectapi/CentralTestUtils.java | 16 +++++++++++++--- .../java/org/ballerina/projectapi/TestUtils.java | 4 ++-- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index b853e7e10f..4e7c6b6cc3 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -236,6 +236,7 @@ jobs: packageUser: ${{ github.actor }} packagePAT: ${{ secrets.GITHUB_TOKEN }} devCentralToken: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} + prodCentralToken: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }} githubAccessToken: ${{ secrets.GITHUB_TOKEN }} ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }} TEST_MODE_ACTIVE: true diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 15cffca1f2..04048936f6 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -73,6 +73,7 @@ jobs: packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} devCentralToken: ${{ secrets.BALLERINA_CENTRAL_DEV_ACCESS_TOKEN }} + prodCentralToken: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }} githubAccessToken: ${{ secrets.GITHUB_TOKEN }} ballerinaBotWorkflow: $ {{ secrets.BALLERINA_BOT_WORKFLOW }} run: | diff --git a/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java b/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java index 7d60a8c40b..c4e4577c40 100644 --- a/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java +++ b/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java @@ -43,8 +43,9 @@ import static io.ballerina.projects.util.ProjectConstants.BALA_DIR_NAME; import static io.ballerina.projects.util.ProjectConstants.CENTRAL_REPOSITORY_CACHE_NAME; import static io.ballerina.projects.util.ProjectConstants.REPOSITORIES_DIR; -import static org.ballerina.projectapi.CentralTestUtils.BALLERINA_DEV_CENTRAL; import static org.ballerina.projectapi.CentralTestUtils.OUTPUT_NOT_CONTAINS_EXP_MSG; +import static org.ballerina.projectapi.CentralTestUtils.TEST_MODE_ACTIVE; +import static org.ballerina.projectapi.CentralTestUtils.createSettingToml; import static org.ballerina.projectapi.CentralTestUtils.getEnvVariables; import static org.ballerina.projectapi.CentralTestUtils.getString; import static org.ballerina.projectapi.CentralTestUtils.isToolAvailableInCentral; @@ -56,6 +57,7 @@ public class BalToolTest { private Path tempWorkspaceDirectory; + private Path tempHomeDirectory; private final String orgName = "bctestorg"; private static final String toolId = "disttest"; private static final String nonExistingTool = "disttest2"; @@ -75,10 +77,12 @@ public class BalToolTest { @BeforeClass() public void setUp() throws IOException, InterruptedException { TestUtils.setupDistributions(); + tempHomeDirectory = Files.createTempDirectory("bal-test-integration-packaging-home-"); tempWorkspaceDirectory = Files.createTempDirectory("bal-test-integration-packaging-workspace-"); + createSettingToml(tempHomeDirectory); setToolEnvironmentsForSubCommands(); Map envVariables = getEnvVariables(); - envVariables.put(BALLERINA_DEV_CENTRAL, "true"); + envVariables.put(TEST_MODE_ACTIVE, "true"); if (!isToolAvailableInCentral(toolId, tempWorkspaceDirectory, envVariables)) { Assert.fail("Tool " + toolId + " is not available in central"); } @@ -994,7 +998,6 @@ private Pair executeHelpFlagOfTool(String toolId, Map envVariables = TestUtils.addEnvVariables(getEnvVariables(), tempHomeDirectory); Path balToolsTomlPath = tempHomeDirectory.resolve(".config").resolve("bal-tools.toml"); diff --git a/project-api-tests/src/test/java/org/ballerina/projectapi/BuildTimeTest.java b/project-api-tests/src/test/java/org/ballerina/projectapi/BuildTimeTest.java index 7f6c2a18c2..11326a88df 100644 --- a/project-api-tests/src/test/java/org/ballerina/projectapi/BuildTimeTest.java +++ b/project-api-tests/src/test/java/org/ballerina/projectapi/BuildTimeTest.java @@ -37,8 +37,8 @@ import java.util.Map; import java.util.Objects; -import static org.ballerina.projectapi.CentralTestUtils.BALLERINA_DEV_CENTRAL; import static org.ballerina.projectapi.CentralTestUtils.BALLERINA_HOME_DIR; +import static org.ballerina.projectapi.CentralTestUtils.TEST_MODE_ACTIVE; import static org.ballerina.projectapi.CentralTestUtils.createSettingToml; import static org.ballerina.projectapi.CentralTestUtils.deleteFiles; import static org.ballerina.projectapi.CentralTestUtils.getEnvVariables; @@ -107,7 +107,7 @@ public void testCodeGenOfflineResolution() throws IOException, InterruptedExcept */ private Map addEnvVariables(Map envVariables) { envVariables.put(BALLERINA_HOME_DIR, tempHome.toString()); - envVariables.put(BALLERINA_DEV_CENTRAL, "true"); + envVariables.put(TEST_MODE_ACTIVE, "true"); return envVariables; } diff --git a/project-api-tests/src/test/java/org/ballerina/projectapi/CentralTestUtils.java b/project-api-tests/src/test/java/org/ballerina/projectapi/CentralTestUtils.java index 658a9bd12e..69dda6803d 100644 --- a/project-api-tests/src/test/java/org/ballerina/projectapi/CentralTestUtils.java +++ b/project-api-tests/src/test/java/org/ballerina/projectapi/CentralTestUtils.java @@ -59,6 +59,7 @@ private CentralTestUtils() { static final String BALLERINA_HOME_DIR = "BALLERINA_HOME_DIR"; static final String BALLERINA_DEV_CENTRAL = "BALLERINA_DEV_CENTRAL"; + static final String TEST_MODE_ACTIVE = "TEST_MODE_ACTIVE"; static final String BALLERINA_CENTRAL_ACCESS_TOKEN = "BALLERINA_CENTRAL_ACCESS_TOKEN"; static final String BALLERINA_TOML = "Ballerina.toml"; static final String DEPENDENCIES_TOML = "Dependencies.toml"; @@ -97,21 +98,30 @@ static String randomPackageName(int count) { * @throws IOException i/o exception when writing to file */ static void createSettingToml(Path dirPath) throws IOException { - String content = "[central]\n accesstoken = \"" + getToken() + "\""; + String content = "[central]\n accesstoken = \"" + getProdToken() + "\""; Files.write(dirPath.resolve("Settings.toml"), content.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); } /** - * Get token of ballerina-central-bot required to push the module. + * Get token of ballerina-dev-central required to push the module. * * @return token required to push the module. */ - private static String getToken() { + private static String getDevToken() { // staging and dev both has the same access token return System.getenv("devCentralToken"); } + /** + * Get token of ballerina-central required to push the module. + * + * @return token required to push the module. + */ + private static String getProdToken() { + return System.getenv("prodCentralToken"); + } + /** * Get token of ballerina-bot required to dispatch GitHub workflows. * diff --git a/project-api-tests/src/test/java/org/ballerina/projectapi/TestUtils.java b/project-api-tests/src/test/java/org/ballerina/projectapi/TestUtils.java index 9ef83c35a5..8f9c047dba 100644 --- a/project-api-tests/src/test/java/org/ballerina/projectapi/TestUtils.java +++ b/project-api-tests/src/test/java/org/ballerina/projectapi/TestUtils.java @@ -30,8 +30,8 @@ import java.util.List; import java.util.Map; -import static org.ballerina.projectapi.CentralTestUtils.BALLERINA_DEV_CENTRAL; import static org.ballerina.projectapi.CentralTestUtils.BALLERINA_HOME_DIR; +import static org.ballerina.projectapi.CentralTestUtils.TEST_MODE_ACTIVE; /** * Utility class for tests. @@ -156,7 +156,7 @@ public static void cleanDistribution() throws IOException { */ static Map addEnvVariables(Map envVariables, Path tempHomeDirectory) { envVariables.put(BALLERINA_HOME_DIR, tempHomeDirectory.toString()); - envVariables.put(BALLERINA_DEV_CENTRAL, "true"); + envVariables.put(TEST_MODE_ACTIVE, "true"); return envVariables; } } From 896fee2d59d57aa4a15cab2ff10e4fdfb0336aee Mon Sep 17 00:00:00 2001 From: Gayal Dassanayake Date: Wed, 14 Aug 2024 11:02:40 +0530 Subject: [PATCH 06/16] Push tools before pulling and testing --- .../org/ballerina/projectapi/BalToolTest.java | 600 +++++++++++------- .../projectapi/CentralTestUtils.java | 1 + .../bal-tool/DistTestCommand/build.gradle | 38 ++ .../bal-tool/DistTestCommand/gradlew | 234 +++++++ .../bal-tool/DistTestCommand/gradlew.bat | 89 +++ .../bal-tool/DistTestCommand/settings.gradle | 6 + .../java/disttest/cli/DistTestCommand.java | 83 +++ .../services/io.ballerina.cli.BLauncherCmd | 1 + .../src/main/resources/disttest.help | 8 + .../cmd-outputs/tool-search-with-tool-id.txt | 2 +- .../v1.0.0/disttestpackage/BalTool.toml | 5 + .../v1.0.0/disttestpackage/Ballerina.toml | 4 + .../v1.0.0/disttestpackage/Package.md | 4 + .../resources/DistTestCommand-1.0.0.jar | Bin 0 -> 3302 bytes .../v1.0.1/disttestpackage/BalTool.toml | 5 + .../v1.0.1/disttestpackage/Ballerina.toml | 4 + .../v1.0.1/disttestpackage/Package.md | 4 + .../resources/DistTestCommand-1.0.1.jar | Bin 0 -> 3300 bytes .../v1.0.4/disttestpackage/BalTool.toml | 5 + .../v1.0.4/disttestpackage/Ballerina.toml | 4 + .../v1.0.4/disttestpackage/Package.md | 4 + .../resources/DistTestCommand-1.0.4.jar | Bin 0 -> 3302 bytes .../v1.1.0/disttestpackage/BalTool.toml | 5 + .../v1.1.0/disttestpackage/Ballerina.toml | 4 + .../v1.1.0/disttestpackage/Package.md | 4 + .../resources/DistTestCommand-1.1.0.jar | Bin 0 -> 3300 bytes 26 files changed, 899 insertions(+), 215 deletions(-) create mode 100644 project-api-tests/src/test/resources/bal-tool/DistTestCommand/build.gradle create mode 100644 project-api-tests/src/test/resources/bal-tool/DistTestCommand/gradlew create mode 100644 project-api-tests/src/test/resources/bal-tool/DistTestCommand/gradlew.bat create mode 100644 project-api-tests/src/test/resources/bal-tool/DistTestCommand/settings.gradle create mode 100644 project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/java/disttest/cli/DistTestCommand.java create mode 100644 project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/resources/META-INF/services/io.ballerina.cli.BLauncherCmd create mode 100644 project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/resources/disttest.help create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/BalTool.toml create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Ballerina.toml create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Package.md create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/resources/DistTestCommand-1.0.0.jar create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.1/disttestpackage/BalTool.toml create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.1/disttestpackage/Ballerina.toml create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.1/disttestpackage/Package.md create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.1/disttestpackage/resources/DistTestCommand-1.0.1.jar create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/BalTool.toml create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Ballerina.toml create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Package.md create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/resources/DistTestCommand-1.0.4.jar create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/BalTool.toml create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Ballerina.toml create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Package.md create mode 100644 project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/resources/DistTestCommand-1.1.0.jar diff --git a/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java b/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java index c4e4577c40..62ac077431 100644 --- a/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java +++ b/project-api-tests/src/test/java/org/ballerina/projectapi/BalToolTest.java @@ -18,8 +18,13 @@ package org.ballerina.projectapi; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import io.ballerina.projects.BalToolsManifest; import io.ballerina.projects.BalToolsToml; +import io.ballerina.projects.JvmTarget; import io.ballerina.projects.internal.BalToolsManifestBuilder; import io.ballerina.projects.util.ProjectUtils; import org.apache.commons.lang3.tuple.Pair; @@ -28,64 +33,73 @@ import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.IOException; +import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; import static io.ballerina.projects.util.ProjectConstants.BALA_DIR_NAME; import static io.ballerina.projects.util.ProjectConstants.CENTRAL_REPOSITORY_CACHE_NAME; import static io.ballerina.projects.util.ProjectConstants.REPOSITORIES_DIR; import static org.ballerina.projectapi.CentralTestUtils.OUTPUT_NOT_CONTAINS_EXP_MSG; -import static org.ballerina.projectapi.CentralTestUtils.TEST_MODE_ACTIVE; import static org.ballerina.projectapi.CentralTestUtils.createSettingToml; import static org.ballerina.projectapi.CentralTestUtils.getEnvVariables; import static org.ballerina.projectapi.CentralTestUtils.getString; -import static org.ballerina.projectapi.CentralTestUtils.isToolAvailableInCentral; import static org.ballerina.projectapi.TestUtils.DISTRIBUTION_FILE_NAME; import static org.ballerina.projectapi.TestUtils.OUTPUT_CONTAIN_ERRORS; import static org.ballerina.projectapi.TestUtils.executeCommand; import static org.ballerina.projectapi.TestUtils.executeHelpCommand; +import static org.ballerina.projectapi.TestUtils.executePackCommand; +import static org.ballerina.projectapi.TestUtils.executePushCommand; import static org.ballerina.projectapi.TestUtils.executeToolCommand; public class BalToolTest { private Path tempWorkspaceDirectory; - private Path tempHomeDirectory; - private final String orgName = "bctestorg"; - private static final String toolId = "disttest"; - private static final String nonExistingTool = "disttest2"; - private static final String latestVersion = "1.1.0"; - private static final String specificVersion = "1.0.0"; - private static final String nonExistingVersion = "1.0.3"; - private static final String incompatibleDistVersion = "1.0.4"; - private static final String packageName = "disttest"; - private static final String PULL = "pull"; - private static final String REMOVE = "remove"; - private static final String UPDATE = "update"; - private static final String USE = "use"; - private static final String LIST = "list"; - private static final String SEARCH = "search"; private Map toolEnvironments; + static final String ORG_NAME = "bctestorg"; + static final String TOOL_ID = "disttest"; + static final String PACKAGE_NAME = "disttestpackage"; + static final String NON_EXISTING_TOOL = "disttest2"; + static final String LATEST_VERSION = "1.1.0"; + static final String SPECIFIC_VERSION = "1.0.0"; + static final String PATCH_VERSION = "1.0.1"; + static final String NON_EXISTING_VERSION = "1.0.3"; + static final String INCOMPATIBLE_DIST_VERSION = "1.0.4"; + static final String PULL = "pull"; + static final String REMOVE = "remove"; + static final String UPDATE = "update"; + static final String USE = "use"; + static final String LIST = "list"; + static final String SEARCH = "search"; + @BeforeClass() public void setUp() throws IOException, InterruptedException { TestUtils.setupDistributions(); - tempHomeDirectory = Files.createTempDirectory("bal-test-integration-packaging-home-"); - tempWorkspaceDirectory = Files.createTempDirectory("bal-test-integration-packaging-workspace-"); + Path tempHomeDirectory = Files.createTempDirectory("bal-test-integration-packaging-home-"); + this.tempWorkspaceDirectory = Files.createTempDirectory("bal-test-integration-packaging-workspace-"); createSettingToml(tempHomeDirectory); - setToolEnvironmentsForSubCommands(); - Map envVariables = getEnvVariables(); - envVariables.put(TEST_MODE_ACTIVE, "true"); - if (!isToolAvailableInCentral(toolId, tempWorkspaceDirectory, envVariables)) { - Assert.fail("Tool " + toolId + " is not available in central"); - } + this.toolEnvironments = setToolEnvironmentsForSubCommands(); + Map envVariables = TestUtils.addEnvVariables(getEnvVariables(), tempHomeDirectory); + copyTestResourcesToTempWorkspace(); + pushToolPackages(envVariables); } @BeforeGroups(value = "pull") @@ -93,12 +107,12 @@ public void setupPullTests() { // Remove the tool from bal-tools.toml if exists BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.PULL).balToolsTomlPath); BalToolsManifest balToolsManifest = BalToolsManifestBuilder.from(balToolsToml).build(); - balToolsManifest.removeTool(toolId); + balToolsManifest.removeTool(TOOL_ID); balToolsToml.modify(balToolsManifest); // Delete the tool from local cache if exists Path toolPath = toolEnvironments.get(ToolSubCommand.PULL).centralCachePath - .resolve(Path.of(orgName, packageName)); + .resolve(Path.of(ORG_NAME, PACKAGE_NAME)); if (Files.exists(toolPath)) { ProjectUtils.deleteDirectory(toolPath); } @@ -107,7 +121,7 @@ public void setupPullTests() { @Test(description = "Pull a tool without specifying a version", groups = {"pull"}) public void testPullToolWithoutVersion() throws IOException, InterruptedException { Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(PULL, toolId)), toolEnvironments.get(ToolSubCommand.PULL).envVariables); + new ArrayList<>(Arrays.asList(PULL, TOOL_ID)), toolEnvironments.get(ToolSubCommand.PULL).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); if (!cmdErrors.isEmpty()) { Assert.fail(OUTPUT_CONTAIN_ERRORS + cmdErrors); @@ -123,35 +137,36 @@ public void testPullToolWithoutVersion() throws IOException, InterruptedExceptio // Check for tool availability in bal-tools.toml BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.PULL).balToolsTomlPath); Optional toolOpt = BalToolsManifestBuilder.from(balToolsToml).build() - .getActiveTool(toolId); + .getActiveTool(TOOL_ID); if (toolOpt.isEmpty()) { - Assert.fail("Tool " + toolId + " is not available in bal-tools.toml"); + Assert.fail("Tool " + TOOL_ID + " is not available in bal-tools.toml"); } BalToolsManifest.Tool tool = toolOpt.get(); - Assert.assertEquals(tool.id(), toolId); - Assert.assertEquals(tool.version(), latestVersion); - Assert.assertEquals(tool.org(), orgName); - Assert.assertEquals(tool.name(), packageName); + Assert.assertEquals(tool.id(), TOOL_ID); + Assert.assertEquals(tool.version(), LATEST_VERSION); + Assert.assertEquals(tool.org(), ORG_NAME); + Assert.assertEquals(tool.name(), PACKAGE_NAME); // Check for tool availability in local cache Path toolVersionCachePath = toolEnvironments.get(ToolSubCommand.PULL).centralCachePath .resolve(Path.of(tool.org(), tool.name(), tool.version())); if (!Files.exists(toolVersionCachePath)) { - Assert.fail("Tool " + toolId + ":" + latestVersion + " is not available in local cache"); + Assert.fail("Tool " + TOOL_ID + ":" + LATEST_VERSION + " is not available in local cache"); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.PULL).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.PULL).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); } @Test(description = "Pull a tool again without specifying a version", dependsOnMethods = "testPullToolWithoutVersion", groups = {"pull"}) public void testPullToolAgainWithoutVersion() throws IOException, InterruptedException { Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(PULL, toolId)), toolEnvironments.get(ToolSubCommand.PULL).envVariables); + new ArrayList<>(Arrays.asList(PULL, TOOL_ID)), toolEnvironments.get(ToolSubCommand.PULL).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); if (!cmdErrors.isEmpty()) { Assert.fail(OUTPUT_CONTAIN_ERRORS + cmdErrors); @@ -159,7 +174,8 @@ public void testPullToolAgainWithoutVersion() throws IOException, InterruptedExc // Validate the command output String cmdOutput = getString(cmdExec.getInputStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-pull-again-without-version.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-pull-again-without-version.txt"); if (!cmdOutput.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdOutput); } @@ -167,34 +183,35 @@ public void testPullToolAgainWithoutVersion() throws IOException, InterruptedExc // Check for tool availability in bal-tools.toml BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.PULL).balToolsTomlPath); Optional toolOpt = BalToolsManifestBuilder.from(balToolsToml).build() - .getActiveTool(toolId); + .getActiveTool(TOOL_ID); if (toolOpt.isEmpty()) { - Assert.fail("Tool " + toolId + " is not available in bal-tools.toml"); + Assert.fail("Tool " + TOOL_ID + " is not available in bal-tools.toml"); } BalToolsManifest.Tool tool = toolOpt.get(); - Assert.assertEquals(tool.id(), toolId); - Assert.assertEquals(tool.version(), latestVersion); - Assert.assertEquals(tool.org(), orgName); - Assert.assertEquals(tool.name(), packageName); + Assert.assertEquals(tool.id(), TOOL_ID); + Assert.assertEquals(tool.version(), LATEST_VERSION); + Assert.assertEquals(tool.org(), ORG_NAME); + Assert.assertEquals(tool.name(), PACKAGE_NAME); // Check for tool availability in local cache Path toolVersionCachePath = toolEnvironments.get(ToolSubCommand.PULL).centralCachePath .resolve(Path.of(tool.org(), tool.name(), tool.version())); if (!Files.exists(toolVersionCachePath)) { - Assert.fail("Tool " + toolId + ":" + latestVersion + " is not available in local cache"); + Assert.fail("Tool " + TOOL_ID + ":" + LATEST_VERSION + " is not available in local cache"); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.PULL).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.PULL).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); } @Test(description = "Pull a tool with a specific version", dependsOnMethods = {"testPullToolAgainWithoutVersion"}, groups = {"pull"}) public void testPullToolWithASpecificVersion() throws IOException, InterruptedException { - String toolIdAndVersion = toolId + ":" + specificVersion; + String toolIdAndVersion = TOOL_ID + ":" + SPECIFIC_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(PULL, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.PULL).envVariables); @@ -205,7 +222,8 @@ public void testPullToolWithASpecificVersion() throws IOException, InterruptedEx // Validate the command output String cmdOutput = getString(cmdExec.getInputStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-pull-with-specific-version.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-pull-with-specific-version.txt"); if (!cmdOutput.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdOutput); } @@ -213,34 +231,35 @@ public void testPullToolWithASpecificVersion() throws IOException, InterruptedEx // Check for tool availability in bal-tools.toml BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.PULL).balToolsTomlPath); Optional toolOpt = BalToolsManifestBuilder.from(balToolsToml).build() - .getActiveTool(toolId); + .getActiveTool(TOOL_ID); if (toolOpt.isEmpty()) { - Assert.fail("Tool " + toolId + " is not available in bal-tools.toml"); + Assert.fail("Tool " + TOOL_ID + " is not available in bal-tools.toml"); } BalToolsManifest.Tool tool = toolOpt.get(); - Assert.assertEquals(tool.id(), toolId); - Assert.assertEquals(tool.version(), specificVersion); - Assert.assertEquals(tool.org(), orgName); - Assert.assertEquals(tool.name(), packageName); + Assert.assertEquals(tool.id(), TOOL_ID); + Assert.assertEquals(tool.version(), SPECIFIC_VERSION); + Assert.assertEquals(tool.org(), ORG_NAME); + Assert.assertEquals(tool.name(), PACKAGE_NAME); // Check for tool availability in local cache Path toolVersionCachePath = toolEnvironments.get(ToolSubCommand.PULL).centralCachePath .resolve(Path.of(tool.org(), tool.name(), tool.version())); if (!Files.exists(toolVersionCachePath)) { - Assert.fail("Tool " + toolId + ":" + specificVersion + " is not available in local cache"); + Assert.fail("Tool " + TOOL_ID + ":" + SPECIFIC_VERSION + " is not available in local cache"); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.PULL).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.PULL).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString( + "tool-execute-specific-help-1.0.0.txt")); } @Test(description = "Pull a tool again with a specific version", dependsOnMethods = "testPullToolWithASpecificVersion", groups = {"pull"}) public void testPullToolAgainWithASpecificVersion() throws IOException, InterruptedException { - String toolIdAndVersion = toolId + ":" + specificVersion; + String toolIdAndVersion = TOOL_ID + ":" + SPECIFIC_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(PULL, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.PULL).envVariables); @@ -251,7 +270,8 @@ public void testPullToolAgainWithASpecificVersion() throws IOException, Interrup // Validate the command output String cmdOutput = getString(cmdExec.getInputStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-pull-again-with-specific-version.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-pull-again-with-specific-version.txt"); if (!cmdOutput.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdOutput); } @@ -259,39 +279,41 @@ public void testPullToolAgainWithASpecificVersion() throws IOException, Interrup // Check for tool availability in bal-tools.toml BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.PULL).balToolsTomlPath); Optional toolOpt = BalToolsManifestBuilder.from(balToolsToml).build() - .getActiveTool(toolId); + .getActiveTool(TOOL_ID); if (toolOpt.isEmpty()) { - Assert.fail("Tool " + toolId + " is not available in bal-tools.toml"); + Assert.fail("Tool " + TOOL_ID + " is not available in bal-tools.toml"); } BalToolsManifest.Tool tool = toolOpt.get(); - Assert.assertEquals(tool.id(), toolId); - Assert.assertEquals(tool.version(), specificVersion); - Assert.assertEquals(tool.org(), orgName); - Assert.assertEquals(tool.name(), packageName); + Assert.assertEquals(tool.id(), TOOL_ID); + Assert.assertEquals(tool.version(), SPECIFIC_VERSION); + Assert.assertEquals(tool.org(), ORG_NAME); + Assert.assertEquals(tool.name(), PACKAGE_NAME); // Check for tool availability in local cache Path toolVersionCachePath = toolEnvironments.get(ToolSubCommand.PULL).centralCachePath .resolve(Path.of(tool.org(), tool.name(), tool.version())); if (!Files.exists(toolVersionCachePath)) { - Assert.fail("Tool " + toolId + ":" + specificVersion + " is not available in local cache"); + Assert.fail("Tool " + TOOL_ID + ":" + SPECIFIC_VERSION + " is not available in local cache"); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.PULL).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.PULL).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString( + "tool-execute-specific-help-1.0.0.txt")); } @Test(description = "Pull a tool with a non existing version", dependsOnMethods = "testPullToolWithASpecificVersion", groups = {"pull"}) public void testPullToolWithANonExistingVersion() throws IOException, InterruptedException { - String toolIdAndVersion = toolId + ":" + nonExistingVersion; + String toolIdAndVersion = TOOL_ID + ":" + NON_EXISTING_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(PULL, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.PULL).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-pull-with-non-existing-version.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-pull-with-non-existing-version.txt"); if (!cmdErrors.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdErrors); } @@ -299,60 +321,63 @@ public void testPullToolWithANonExistingVersion() throws IOException, Interrupte // Check for tool availability in bal-tools.toml BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.PULL).balToolsTomlPath); Optional toolOpt = BalToolsManifestBuilder.from(balToolsToml).build() - .getTool(toolId, nonExistingVersion, null); + .getTool(TOOL_ID, NON_EXISTING_VERSION, null); if (toolOpt.isPresent()) { Assert.fail("Tool " + toolIdAndVersion + " should not be in bal-tools.toml"); } // Check for tool availability in local cache Path toolVersionCachePath = toolEnvironments.get(ToolSubCommand.PULL).centralCachePath - .resolve(Path.of(orgName, toolId, nonExistingVersion)); + .resolve(Path.of(ORG_NAME, TOOL_ID, NON_EXISTING_VERSION)); if (Files.exists(toolVersionCachePath)) { - Assert.fail("Tool " + toolId + ":" + nonExistingVersion + " should not be available in local cache"); + Assert.fail("Tool " + TOOL_ID + ":" + NON_EXISTING_VERSION + " should not be available in local cache"); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.PULL).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.PULL).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString( + "tool-execute-specific-help-1.0.0.txt")); } @Test(description = "Pull a tool version with incompatible distribution", dependsOnMethods = "testPullToolWithASpecificVersion", groups = {"pull"}) public void testPullAToolVersionWithIncompatibleDistribution() throws IOException, InterruptedException { - String toolIdAndVersion = toolId + ":" + incompatibleDistVersion; + String toolIdAndVersion = TOOL_ID + ":" + INCOMPATIBLE_DIST_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(PULL, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.PULL).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-pull-with-incompatible-dist.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-pull-with-incompatible-dist.txt"); if (!cmdErrors.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdErrors); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.PULL).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.PULL).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString( + "tool-execute-specific-help-1.0.0.txt")); } @BeforeGroups(value = "remove") public void setupRemoveTests() throws IOException, InterruptedException { // Pull a specific version of a tool - String specificToolVersion = toolId + ":" + specificVersion; + String specificToolVersion = TOOL_ID + ":" + SPECIFIC_VERSION; executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(PULL, specificToolVersion)), toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); // Pull the latest tool version executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(PULL, toolId)), + new ArrayList<>(Arrays.asList(PULL, TOOL_ID)), toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); // Pull tool version with incompatible distribution - String incompToolVersion = toolId + ":" + incompatibleDistVersion; + String incompToolVersion = TOOL_ID + ":" + INCOMPATIBLE_DIST_VERSION; executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(PULL, incompToolVersion)), toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); @@ -360,69 +385,75 @@ public void setupRemoveTests() throws IOException, InterruptedException { // Add the dist incompatible version to the toml file BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.REMOVE).balToolsTomlPath); BalToolsManifest balToolsManifest = BalToolsManifestBuilder.from(balToolsToml).build(); - balToolsManifest.addTool(toolId, orgName, packageName, incompatibleDistVersion, false, null); + balToolsManifest.addTool(TOOL_ID, ORG_NAME, PACKAGE_NAME, INCOMPATIBLE_DIST_VERSION, false, null); balToolsToml.modify(balToolsManifest); } @Test(description = "Remove a non existing tool", groups = {"remove"}) public void testRemoveANonExistingTool() throws IOException, InterruptedException { Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(REMOVE, nonExistingTool)), + new ArrayList<>(Arrays.asList(REMOVE, NON_EXISTING_TOOL)), toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); // Validate the command output String cmdErrors = getString(cmdExec.getErrorStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-remove-non-existing-tool.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-remove-non-existing-tool.txt"); if (!cmdErrors.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdErrors); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - nonExistingTool, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); + NON_EXISTING_TOOL, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); Assert.assertEquals( - outputs.getLeft(), readExpectedCmdOutsAsString("tool-execute-unknown-cmd-non-existing.txt")); - Assert.assertEquals("", outputs.getRight()); + outputs.getLeft(), + readExpectedCmdOutsAsString("tool-execute-unknown-cmd-non-existing.txt")); + Assert.assertEquals(outputs.getRight(), ""); } @Test(description = "Remove a non existing version of a tool", groups = {"remove"}) public void testRemoveANonExistingVersionOfATool() throws IOException, InterruptedException { - String toolIdAndVersion = toolId + ":" + nonExistingVersion; + String toolIdAndVersion = TOOL_ID + ":" + NON_EXISTING_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(REMOVE, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); // Validate the command output String cmdErrors = getString(cmdExec.getErrorStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-remove-non-existing-version.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-remove-non-existing-version.txt"); if (!cmdErrors.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdErrors); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); } @Test(description = "Remove a tool version with incompatible distribution", groups = {"remove"}) public void testRemoveToolVersionWithIncompatibleDistribution() throws IOException, InterruptedException { - String toolIdAndVersion = toolId + ":" + incompatibleDistVersion; + String toolIdAndVersion = TOOL_ID + ":" + INCOMPATIBLE_DIST_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(REMOVE, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-remove-with-incompatible-dist.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-remove-with-incompatible-dist.txt"); if (!cmdErrors.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdErrors); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); } @Test(description = "Remove a tool version with incompatible distribution", groups = {"remove"}) @@ -430,11 +461,11 @@ public void testRemoveToolActiveVersion() throws IOException, InterruptedExcepti // Make the latest version active BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.REMOVE).balToolsTomlPath); BalToolsManifest balToolsManifest = BalToolsManifestBuilder.from(balToolsToml).build(); - balToolsManifest.setActiveToolVersion(toolId, latestVersion, null); + balToolsManifest.setActiveToolVersion(TOOL_ID, LATEST_VERSION, null); balToolsToml.modify(balToolsManifest); // Remove the active version - String toolIdAndVersion = toolId + ":" + latestVersion; + String toolIdAndVersion = TOOL_ID + ":" + LATEST_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(REMOVE, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); @@ -446,9 +477,10 @@ public void testRemoveToolActiveVersion() throws IOException, InterruptedExcepti // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); } @Test(description = "Remove a specific tool version", @@ -459,13 +491,13 @@ public void testRemoveASpecificToolVersion() throws IOException, InterruptedExce // Make the latest version active BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.REMOVE).balToolsTomlPath); BalToolsManifest balToolsManifest = BalToolsManifestBuilder.from(balToolsToml).build(); - balToolsManifest.setActiveToolVersion(toolId, latestVersion, null); + balToolsManifest.setActiveToolVersion(TOOL_ID, LATEST_VERSION, null); balToolsToml.modify(balToolsManifest); - String toolIdAndVersion = toolId + ":" + specificVersion; + String toolIdAndVersion = TOOL_ID + ":" + SPECIFIC_VERSION; // Check for tool availability in bal-tools.toml - Optional toolOpt = balToolsManifest.getTool(toolId, specificVersion, null); + Optional toolOpt = balToolsManifest.getTool(TOOL_ID, SPECIFIC_VERSION, null); if (toolOpt.isEmpty()) { Assert.fail("Tool '" + toolIdAndVersion + "' is not available to be removed"); } @@ -480,30 +512,32 @@ public void testRemoveASpecificToolVersion() throws IOException, InterruptedExce // Validate the command output String cmdOutput = getString(cmdExec.getInputStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-remove-specific-version.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-remove-specific-version.txt"); if (!cmdOutput.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdOutput); } // Check for tool availability in bal-tools.toml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.REMOVE).balToolsTomlPath); - toolOpt = BalToolsManifestBuilder.from(balToolsToml).build().getTool(toolId, specificVersion, null); + toolOpt = BalToolsManifestBuilder.from(balToolsToml).build().getTool(TOOL_ID, SPECIFIC_VERSION, null); if (toolOpt.isPresent()) { Assert.fail("Tool '" + toolIdAndVersion + "' is available in bal-tools.toml"); } // Check for tool availability in local cache Path toolVersionCachePath = toolEnvironments.get(ToolSubCommand.REMOVE).centralCachePath - .resolve(Path.of(orgName, packageName, specificVersion)); + .resolve(Path.of(ORG_NAME, PACKAGE_NAME, SPECIFIC_VERSION)); if (Files.exists(toolVersionCachePath)) { Assert.fail("Tool '" + toolIdAndVersion + "' is available in local cache"); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); } @Test(description = "Remove all tool versions", dependsOnMethods = {"testRemoveASpecificToolVersion"}, @@ -512,14 +546,14 @@ public void testRemoveAllToolVersions() throws IOException, InterruptedException // Check for tool availability in bal-tools.toml BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.REMOVE).balToolsTomlPath); Optional toolOpt = BalToolsManifestBuilder.from(balToolsToml).build() - .getActiveTool(toolId); + .getActiveTool(TOOL_ID); if (toolOpt.isEmpty()) { - Assert.fail("Tool '" + toolId + "' is not available to be removed"); + Assert.fail("Tool '" + TOOL_ID + "' is not available to be removed"); } // Remove all versions of the tool Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(REMOVE, toolId)), + new ArrayList<>(Arrays.asList(REMOVE, TOOL_ID)), toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); if (!cmdErrors.isEmpty()) { @@ -535,35 +569,36 @@ public void testRemoveAllToolVersions() throws IOException, InterruptedException // Check for tool availability in bal-tools.toml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.REMOVE).balToolsTomlPath); - toolOpt = BalToolsManifestBuilder.from(balToolsToml).build().getActiveTool(toolId); + toolOpt = BalToolsManifestBuilder.from(balToolsToml).build().getActiveTool(TOOL_ID); if (toolOpt.isPresent()) { - Assert.fail("Tool " + toolId + " is available in bal-tools.toml"); + Assert.fail("Tool " + TOOL_ID + " is available in bal-tools.toml"); } // Check for tool availability in local cache Path toolVersionCachePath = toolEnvironments.get(ToolSubCommand.REMOVE).centralCachePath - .resolve(Path.of(orgName, packageName)); + .resolve(Path.of(ORG_NAME, PACKAGE_NAME)); if (Files.exists(toolVersionCachePath)) { - Assert.fail("Tool '" + toolId + "' is available in local cache"); + Assert.fail("Tool '" + TOOL_ID + "' is available in local cache"); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); - Assert.assertEquals(outputs.getLeft(), readExpectedCmdOutsAsString("tool-execute-unknown-cmd.txt")); - Assert.assertEquals("", outputs.getRight()); + TOOL_ID, toolEnvironments.get(ToolSubCommand.REMOVE).envVariables); + Assert.assertEquals(outputs.getLeft(), + readExpectedCmdOutsAsString("tool-execute-unknown-cmd.txt")); + Assert.assertEquals(outputs.getRight(), ""); } @BeforeGroups(value = "update") public void setupUpdateTests() throws IOException, InterruptedException { // Remove all versions of the tool Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(REMOVE, toolId)), + new ArrayList<>(Arrays.asList(REMOVE, TOOL_ID)), toolEnvironments.get(ToolSubCommand.UPDATE).envVariables); getString(cmdExec.getErrorStream()); // Pull an older version of the tool - String toolIdAndVersion = toolId + ":" + specificVersion; + String toolIdAndVersion = TOOL_ID + ":" + SPECIFIC_VERSION; executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(PULL, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.UPDATE).envVariables); @@ -572,7 +607,7 @@ public void setupUpdateTests() throws IOException, InterruptedException { @Test(description = "Update a non-existing tool", groups = {"update"}) public void testUpdateNonExistingTool() throws IOException, InterruptedException { Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(UPDATE, nonExistingTool)), + new ArrayList<>(Arrays.asList(UPDATE, NON_EXISTING_TOOL)), toolEnvironments.get(ToolSubCommand.UPDATE).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); String expectedOutput = readExpectedCmdOutsAsString("tool-update-non-existing.txt"); @@ -583,17 +618,18 @@ public void testUpdateNonExistingTool() throws IOException, InterruptedException // Check for tool availability in bal-tools.toml BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.UPDATE).balToolsTomlPath); Optional toolOpt = BalToolsManifestBuilder.from(balToolsToml).build() - .getActiveTool(nonExistingTool); + .getActiveTool(NON_EXISTING_TOOL); if (toolOpt.isPresent()) { - Assert.fail("Tool " + nonExistingTool + " should not be available in bal-tools.toml"); + Assert.fail("Tool " + NON_EXISTING_TOOL + " should not be available in bal-tools.toml"); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - nonExistingTool, toolEnvironments.get(ToolSubCommand.UPDATE).envVariables); + NON_EXISTING_TOOL, toolEnvironments.get(ToolSubCommand.UPDATE).envVariables); Assert.assertEquals( - outputs.getLeft(), readExpectedCmdOutsAsString("tool-execute-unknown-cmd-non-existing.txt")); - Assert.assertEquals("", outputs.getRight()); + outputs.getLeft(), + readExpectedCmdOutsAsString("tool-execute-unknown-cmd-non-existing.txt")); + Assert.assertEquals(outputs.getRight(), ""); } @Test(description = "Update a tool with new patch and minor versions", groups = {"update"}) @@ -601,8 +637,8 @@ public void testUpdateToolWithNewPatchAndMinor() throws IOException, Interrupted // Check for tool availability in bal-tools.toml BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.UPDATE).balToolsTomlPath); Optional toolOpt = BalToolsManifestBuilder.from(balToolsToml).build() - .getActiveTool(toolId); - String toolIdAndVersion = toolId + ":" + specificVersion; + .getActiveTool(TOOL_ID); + String toolIdAndVersion = TOOL_ID + ":" + SPECIFIC_VERSION; if (toolOpt.isEmpty()) { Assert.fail("Tool '" + toolIdAndVersion + "' should be the current version in bal-tools.toml before update command"); @@ -610,7 +646,7 @@ public void testUpdateToolWithNewPatchAndMinor() throws IOException, Interrupted // Update the tool Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(UPDATE, toolId)), + new ArrayList<>(Arrays.asList(UPDATE, TOOL_ID)), toolEnvironments.get(ToolSubCommand.UPDATE).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); @@ -620,31 +656,33 @@ public void testUpdateToolWithNewPatchAndMinor() throws IOException, Interrupted // Validate the command output String cmdOutput = getString(cmdExec.getInputStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-update-with-new-patch-and-minor.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-update-with-new-patch-and-minor.txt"); if (!cmdOutput.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdOutput); } // Check for tool availability in bal-tools.toml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.UPDATE).balToolsTomlPath); - toolOpt = BalToolsManifestBuilder.from(balToolsToml).build().getActiveTool(toolId); - toolIdAndVersion = toolId + ":" + latestVersion; + toolOpt = BalToolsManifestBuilder.from(balToolsToml).build().getActiveTool(TOOL_ID); + toolIdAndVersion = TOOL_ID + ":" + LATEST_VERSION; if (toolOpt.isEmpty()) { Assert.fail("Tool '" + toolIdAndVersion + "' is not available in bal-tools.toml"); } // Check for tool availability in local cache Path toolVersionCachePath = toolEnvironments.get(ToolSubCommand.UPDATE).centralCachePath - .resolve(Path.of(orgName, packageName, latestVersion)); + .resolve(Path.of(ORG_NAME, PACKAGE_NAME, LATEST_VERSION)); if (!Files.exists(toolVersionCachePath)) { Assert.fail("Tool '" + toolIdAndVersion + "' is not available in local cache"); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.UPDATE).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.UPDATE).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); } @Test(description = "Update a tool with no new versions", @@ -653,15 +691,15 @@ public void testUpdateToolWithNoNewVersions() throws IOException, InterruptedExc // Check for tool availability in bal-tools.toml BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.UPDATE).balToolsTomlPath); Optional toolOpt = BalToolsManifestBuilder.from(balToolsToml).build() - .getActiveTool(toolId); - String toolIdAndVersion = toolId + ":" + latestVersion; + .getActiveTool(TOOL_ID); + String toolIdAndVersion = TOOL_ID + ":" + LATEST_VERSION; if (toolOpt.isEmpty()) { Assert.fail("Tool '" + toolIdAndVersion + "' should be the current version in bal-tools.toml"); } // Update the tool Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(UPDATE, toolId)), + new ArrayList<>(Arrays.asList(UPDATE, TOOL_ID)), toolEnvironments.get(ToolSubCommand.UPDATE).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); @@ -671,40 +709,42 @@ public void testUpdateToolWithNoNewVersions() throws IOException, InterruptedExc // Validate the command output String cmdOutput = getString(cmdExec.getInputStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-update-with-no-new-version.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-update-with-no-new-version.txt"); if (!cmdOutput.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdOutput); } // Check for tool availability in bal-tools.toml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.UPDATE).balToolsTomlPath); - toolOpt = BalToolsManifestBuilder.from(balToolsToml).build().getActiveTool(toolId); - toolIdAndVersion = toolId + ":" + latestVersion; + toolOpt = BalToolsManifestBuilder.from(balToolsToml).build().getActiveTool(TOOL_ID); + toolIdAndVersion = TOOL_ID + ":" + LATEST_VERSION; if (toolOpt.isEmpty()) { Assert.fail("Tool '" + toolIdAndVersion + "' is not available in bal-tools.toml"); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.UPDATE).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.UPDATE).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); } @BeforeGroups(value = "use") public void setupUseTests() throws IOException, InterruptedException { // Pull the latest tool version executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(PULL, toolId)), toolEnvironments.get(ToolSubCommand.USE).envVariables); + new ArrayList<>(Arrays.asList(PULL, TOOL_ID)), toolEnvironments.get(ToolSubCommand.USE).envVariables); // Pull a specific version of a tool - String specificToolVersion = toolId + ":" + specificVersion; + String specificToolVersion = TOOL_ID + ":" + SPECIFIC_VERSION; executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(PULL, specificToolVersion)), toolEnvironments.get(ToolSubCommand.USE).envVariables); // Pull tool version with incompatible distribution - String incompToolVersion = toolId + ":" + incompatibleDistVersion; + String incompToolVersion = TOOL_ID + ":" + INCOMPATIBLE_DIST_VERSION; executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(PULL, incompToolVersion)), toolEnvironments.get(ToolSubCommand.USE).envVariables); @@ -712,13 +752,13 @@ public void setupUseTests() throws IOException, InterruptedException { // Add the dist incompatible version to the toml file BalToolsToml balToolsToml = BalToolsToml.from(toolEnvironments.get(ToolSubCommand.USE).balToolsTomlPath); BalToolsManifest balToolsManifest = BalToolsManifestBuilder.from(balToolsToml).build(); - balToolsManifest.addTool(toolId, orgName, packageName, incompatibleDistVersion, false, null); + balToolsManifest.addTool(TOOL_ID, ORG_NAME, PACKAGE_NAME, INCOMPATIBLE_DIST_VERSION, false, null); balToolsToml.modify(balToolsManifest); } @Test(description = "Use a newer tool version", groups = {"use"}) public void testUseNewToolVersion() throws IOException, InterruptedException { - String toolIdAndVersion = toolId + ":" + latestVersion; + String toolIdAndVersion = TOOL_ID + ":" + LATEST_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(USE, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.USE).envVariables); @@ -736,14 +776,15 @@ public void testUseNewToolVersion() throws IOException, InterruptedException { // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.USE).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.USE).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt")); } @Test(description = "Use a newer tool version", dependsOnMethods = {"testUseNewToolVersion"}, groups = {"use"}) public void testUseOldToolVersion() throws IOException, InterruptedException { - String toolIdAndVersion = toolId + ":" + specificVersion; + String toolIdAndVersion = TOOL_ID + ":" + SPECIFIC_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(USE, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.USE).envVariables); @@ -761,15 +802,16 @@ public void testUseOldToolVersion() throws IOException, InterruptedException { // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.USE).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.USE).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); } @Test(description = "Use the currently active tool version", dependsOnMethods = {"testUseOldToolVersion"}, groups = {"use"}) public void testUseCurrentlyActiveToolVersion() throws IOException, InterruptedException { - String toolIdAndVersion = toolId + ":" + specificVersion; + String toolIdAndVersion = TOOL_ID + ":" + SPECIFIC_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(USE, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.USE).envVariables); @@ -787,56 +829,61 @@ public void testUseCurrentlyActiveToolVersion() throws IOException, InterruptedE // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.USE).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.USE).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); } @Test(description = "Use a non existent tool version", dependsOnMethods = {"testUseCurrentlyActiveToolVersion"}, groups = {"use"}) public void testUseNonExistentToolVersion() throws IOException, InterruptedException { - String toolIdAndVersion = toolId + ":" + nonExistingVersion; + String toolIdAndVersion = TOOL_ID + ":" + NON_EXISTING_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(USE, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.USE).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-use-non-existent-version.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-use-non-existent-version.txt"); if (!cmdErrors.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdErrors); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.USE).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.USE).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); } @Test(description = "Use a tool version built with incompatible distribution", dependsOnMethods = "testUseNonExistentToolVersion", groups = {"use"}) public void testUseToolVersionWithIncompatibleDistribution() throws IOException, InterruptedException { - String toolIdAndVersion = toolId + ":" + incompatibleDistVersion; + String toolIdAndVersion = TOOL_ID + ":" + INCOMPATIBLE_DIST_VERSION; Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(USE, toolIdAndVersion)), toolEnvironments.get(ToolSubCommand.USE).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-use-with-incompatible-dist.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-use-with-incompatible-dist.txt"); if (!cmdErrors.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdErrors); } // Execute the tool Pair outputs = executeHelpFlagOfTool( - toolId, toolEnvironments.get(ToolSubCommand.USE).envVariables); - Assert.assertEquals("", outputs.getLeft()); - Assert.assertEquals(outputs.getRight(), readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); + TOOL_ID, toolEnvironments.get(ToolSubCommand.USE).envVariables); + Assert.assertEquals(outputs.getLeft(), ""); + Assert.assertEquals(outputs.getRight(), + readExpectedCmdOutsAsString("tool-execute-specific-help-1.0.0.txt")); } @Test(description = "List all tools when there are no tools", groups = {"list"}) public void testListToolsWhenNoToolsInstalled() throws IOException, InterruptedException { // Remove the tool entirely executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(REMOVE, toolId)), + new ArrayList<>(Arrays.asList(REMOVE, TOOL_ID)), toolEnvironments.get(ToolSubCommand.LIST).envVariables); // List all tools @@ -859,10 +906,10 @@ public void testListToolsWhenNoToolsInstalled() throws IOException, InterruptedE public void testListToolsWithMultipleToolVersions() throws IOException, InterruptedException { // Pull the latest tool version executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(PULL, toolId)), toolEnvironments.get(ToolSubCommand.LIST).envVariables); + new ArrayList<>(Arrays.asList(PULL, TOOL_ID)), toolEnvironments.get(ToolSubCommand.LIST).envVariables); // Pull a specific version of a tool - String specificToolVersion = toolId + ":" + specificVersion; + String specificToolVersion = TOOL_ID + ":" + SPECIFIC_VERSION; executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(PULL, specificToolVersion)), toolEnvironments.get(ToolSubCommand.LIST).envVariables); @@ -877,7 +924,8 @@ public void testListToolsWithMultipleToolVersions() throws IOException, Interrup // Validate the command output String cmdOutput = getString(cmdExec.getInputStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-list-with-multiple-tool-versions.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-list-with-multiple-tool-versions.txt"); if (!cmdOutput.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdOutput); } @@ -886,7 +934,7 @@ public void testListToolsWithMultipleToolVersions() throws IOException, Interrup @Test(description = "Search a tool with tool id", groups = {"list"}) public void testSearchAToolWithId() throws IOException, InterruptedException { Process cmdExec = executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(SEARCH, toolId)), + new ArrayList<>(Arrays.asList(SEARCH, TOOL_ID)), toolEnvironments.get(ToolSubCommand.SEARCH).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); if (!cmdErrors.isEmpty()) { @@ -904,14 +952,14 @@ public void testSearchAToolWithId() throws IOException, InterruptedException { @BeforeGroups(value = "execute_tool") public void setupExecuteToolTests() throws IOException, InterruptedException { // Pull a specific version of a tool - String specificToolVersion = toolId + ":" + specificVersion; + String specificToolVersion = TOOL_ID + ":" + SPECIFIC_VERSION; executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(Arrays.asList(PULL, specificToolVersion)), toolEnvironments.get(ToolSubCommand.EXECUTE).envVariables); // Pull the latest tool version executeToolCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(Arrays.asList(PULL, toolId)), + new ArrayList<>(Arrays.asList(PULL, TOOL_ID)), toolEnvironments.get(ToolSubCommand.EXECUTE).envVariables); } @@ -935,7 +983,7 @@ public void testExecuteGeneralHelpWithToolInstalled() throws IOException, Interr @Test(description = "Execute bal help disttest with the tool installed", groups = {"execute_tool"}) public void testExecuteToolSpecificHelpWithToolInstalled() throws IOException, InterruptedException { Process cmdExec = executeHelpCommand(DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(List.of(toolId)), toolEnvironments.get(ToolSubCommand.EXECUTE).envVariables); + new ArrayList<>(List.of(TOOL_ID)), toolEnvironments.get(ToolSubCommand.EXECUTE).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); if (!cmdErrors.isEmpty()) { Assert.fail(OUTPUT_CONTAIN_ERRORS + cmdErrors); @@ -943,7 +991,8 @@ public void testExecuteToolSpecificHelpWithToolInstalled() throws IOException, I // Validate the command output String cmdOutput = getString(cmdExec.getInputStream()); - String expectedOutput = readExpectedCmdOutsAsString("tool-execute-specific-help-1.1.0.txt"); + String expectedOutput = readExpectedCmdOutsAsString( + "tool-execute-specific-help-1.1.0.txt"); if (!cmdOutput.contains(expectedOutput)) { Assert.fail(OUTPUT_NOT_CONTAINS_EXP_MSG + expectedOutput + "\nactual output:" + cmdOutput); } @@ -951,7 +1000,7 @@ public void testExecuteToolSpecificHelpWithToolInstalled() throws IOException, I @Test(description = "Execute disstest tool", groups = {"execute_tool"}) public void testExecuteTool() throws IOException, InterruptedException { - Process cmdExec = executeCommand(toolId, DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, + Process cmdExec = executeCommand(TOOL_ID, DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, new ArrayList<>(List.of("arg1")), toolEnvironments.get(ToolSubCommand.EXECUTE).envVariables); String cmdErrors = getString(cmdExec.getErrorStream()); if (!cmdErrors.isEmpty()) { @@ -966,18 +1015,8 @@ public void testExecuteTool() throws IOException, InterruptedException { } } - private static String readExpectedCmdOutsAsString(String outputFileName) { - try { - return Files.readString(Path.of(Objects.requireNonNull( - BalToolTest.class.getClassLoader().getResource( - Path.of("bal-tool/cmd-outputs/").resolve(outputFileName).toString())).toURI())); - } catch (IOException | URISyntaxException e) { - throw new RuntimeException("Error reading resource file"); - } - } - - private void setToolEnvironmentsForSubCommands() { - toolEnvironments = Arrays.stream(ToolSubCommand.values()).map( + private Map setToolEnvironmentsForSubCommands() { + return Arrays.stream(ToolSubCommand.values()).map( toolSubCommand -> { try { return getToolEnvironment(toolSubCommand); @@ -988,6 +1027,148 @@ private void setToolEnvironmentsForSubCommands() { toolEnvironment -> toolEnvironment.subCommand, toolEnvironment -> toolEnvironment)); } + private BalToolTest.ToolEnvironment getToolEnvironment(ToolSubCommand subCommand) throws IOException { + Path tempHomeDirectory = Files.createTempDirectory("bal-test-integration-packaging-home-"); + Map envVariables = TestUtils.addEnvVariables(getEnvVariables(), + tempHomeDirectory); + Path balToolsTomlPath = tempHomeDirectory.resolve(".config").resolve("bal-tools.toml"); + Path centralCachePath = tempHomeDirectory.resolve( + Path.of(REPOSITORIES_DIR, CENTRAL_REPOSITORY_CACHE_NAME, BALA_DIR_NAME)); + return new BalToolTest.ToolEnvironment(subCommand, envVariables, balToolsTomlPath, centralCachePath); + } + + private void copyTestResourcesToTempWorkspace() { + try { + URI testResourcesURI = Objects.requireNonNull(BalToolTest.class.getClassLoader().getResource("bal-tool")). + toURI(); + Path start = Paths.get(testResourcesURI); + Files.walkFileTree(start, new CentralTest.Copy(start, tempWorkspaceDirectory)); + } catch (URISyntaxException | IOException e) { + Assert.fail("error loading resources"); + } + } + + private void pushToolPackages(Map envVariables) throws IOException, InterruptedException { + for (String version : + Arrays.asList(SPECIFIC_VERSION, PATCH_VERSION, INCOMPATIBLE_DIST_VERSION, LATEST_VERSION)) { + Path packagePath = tempWorkspaceDirectory.resolve("v" + version).resolve(PACKAGE_NAME); + executePackCommand(DISTRIBUTION_FILE_NAME, packagePath, new LinkedList<>(), envVariables); + Optional balaPath = getBalaPath(packagePath, version); + if (balaPath.isEmpty()) { + Assert.fail("Bala file " + balaPath + " not found for " + TOOL_ID + ":" + version); + } + // This should make the tools incompatible with the current distribution for incompatible version tests, + // and compatible with the current distribution (>=U9) for other versions. + String balVersion = version.equals(INCOMPATIBLE_DIST_VERSION) ? "2201.99.0" : "2201.9.0"; + updateBallerinaVersionOfBala(balaPath.get(), balVersion); + Process build = executePushCommand(DISTRIBUTION_FILE_NAME, packagePath, new LinkedList<>(), envVariables); + String buildErrors = getString(build.getErrorStream()); + if (!buildErrors.isEmpty() && !buildErrors.contains("already exists")) { + Assert.fail(OUTPUT_CONTAIN_ERRORS + buildErrors); + } + } + } + + private Optional getBalaPath(Path packagePath, String version) { + Path balaRootPath = packagePath.resolve("target").resolve("bala"); + String balaNamePrefix = ORG_NAME + "-" + PACKAGE_NAME + "-"; + String balaNameSuffix = "-" + version + ".bala"; + for (JvmTarget jvmTarget : JvmTarget.values()) { + Path balaPath = balaRootPath.resolve(balaNamePrefix + jvmTarget.code() + balaNameSuffix); + if (Files.exists(balaPath)) { + return Optional.of(balaPath); + } + } + return Optional.empty(); + } + + private void updateBallerinaVersionOfBala(Path balaFilePath, String balVersion) throws IOException { + Path tempDir = Files.createTempDirectory(balaFilePath.getFileName().toString()); + try { + unzipBalaFile(balaFilePath, tempDir); + updatePackageJsonBallerinaVersion(tempDir, balVersion); + zipBalaFile(tempDir, balaFilePath); + } catch (IOException e) { + Assert.fail("Failed to update the ballerina version of the bala file", e); + } + } + + private void unzipBalaFile(Path balaFilePath, Path destDir) throws IOException { + File destDirFile = destDir.toFile(); + byte[] buffer = new byte[1024]; + try (ZipInputStream zis = new ZipInputStream(new FileInputStream(balaFilePath.toFile()))) { + ZipEntry zipEntry = zis.getNextEntry(); + while (zipEntry != null) { + File newFile = newFile(destDirFile, zipEntry); + if (zipEntry.isDirectory()) { + newFile.mkdirs(); + } else { + // Create all non-existing directories + new File(newFile.getParent()).mkdirs(); + try (FileOutputStream fos = new FileOutputStream(newFile)) { + int len; + while ((len = zis.read(buffer)) > 0) { + fos.write(buffer, 0, len); + } + } + } + zipEntry = zis.getNextEntry(); + } + zis.closeEntry(); + } + } + + private File newFile(File destinationDir, ZipEntry zipEntry) throws IOException { + File destFile = new File(destinationDir, zipEntry.getName()); + String destDirPath = destinationDir.getCanonicalPath(); + String destFilePath = destFile.getCanonicalPath(); + if (!destFilePath.startsWith(destDirPath + File.separator)) { + throw new IOException("Entry is outside of the target dir: " + zipEntry.getName()); + } + return destFile; + } + + private void updatePackageJsonBallerinaVersion(Path packagePath, String balVersion) throws IOException { + Path packageJsonPath = packagePath.resolve("package.json"); + String content = Files.readString(packageJsonPath); + JsonObject jsonObject = JsonParser.parseString(content).getAsJsonObject(); + + // Update the value for the given key + jsonObject.addProperty("ballerina_version", balVersion); + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + String formattedJson = gson.toJson(jsonObject); + Files.writeString(packageJsonPath, formattedJson); + } + + private void zipBalaFile(Path sourceDirPath, Path zipFilePath) throws IOException { + Files.deleteIfExists(zipFilePath); + Path zipFile = Files.createFile(zipFilePath); + try (ZipOutputStream zs = new ZipOutputStream(Files.newOutputStream(zipFile)); + Stream walk = Files.walk(sourceDirPath)) { + walk.filter(path -> !Files.isDirectory(path)) + .forEach(path -> { + ZipEntry zipEntry = new ZipEntry(sourceDirPath.relativize(path).toString()); + try { + zs.putNextEntry(zipEntry); + Files.copy(path, zs); + zs.closeEntry(); + } catch (IOException e) { + throw new RuntimeException("\"Failed to re-zip bala with error: ", e); + } + }); + } + } + + private String readExpectedCmdOutsAsString(String outputFileName) { + try { + return Files.readString(Path.of(Objects.requireNonNull( + BalToolTest.class.getClassLoader().getResource( + Path.of("bal-tool/cmd-outputs/").resolve(outputFileName).toString())).toURI())); + } catch (IOException | URISyntaxException e) { + throw new RuntimeException("Error reading resource file"); + } + } + private Pair executeHelpFlagOfTool(String toolId, Map envVariables) throws IOException, InterruptedException { Process cmdExec = executeCommand(toolId, DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, @@ -997,15 +1178,6 @@ private Pair executeHelpFlagOfTool(String toolId, Map envVariables = TestUtils.addEnvVariables(getEnvVariables(), - tempHomeDirectory); - Path balToolsTomlPath = tempHomeDirectory.resolve(".config").resolve("bal-tools.toml"); - Path centralCachePath = tempHomeDirectory.resolve( - Path.of(REPOSITORIES_DIR, CENTRAL_REPOSITORY_CACHE_NAME, BALA_DIR_NAME)); - return new ToolEnvironment(subCommand, envVariables, balToolsTomlPath, centralCachePath); - } - static class ToolEnvironment { ToolSubCommand subCommand; Map envVariables; diff --git a/project-api-tests/src/test/java/org/ballerina/projectapi/CentralTestUtils.java b/project-api-tests/src/test/java/org/ballerina/projectapi/CentralTestUtils.java index 69dda6803d..434ac85be4 100644 --- a/project-api-tests/src/test/java/org/ballerina/projectapi/CentralTestUtils.java +++ b/project-api-tests/src/test/java/org/ballerina/projectapi/CentralTestUtils.java @@ -63,6 +63,7 @@ private CentralTestUtils() { static final String BALLERINA_CENTRAL_ACCESS_TOKEN = "BALLERINA_CENTRAL_ACCESS_TOKEN"; static final String BALLERINA_TOML = "Ballerina.toml"; static final String DEPENDENCIES_TOML = "Dependencies.toml"; + static final String BAL_TOOL_TOML = "BalTool.toml"; static final String MAIN_BAL = "main.bal"; static final String COMMON_VERSION = "1.0.0"; static final String TEST_PREFIX = "test_"; diff --git a/project-api-tests/src/test/resources/bal-tool/DistTestCommand/build.gradle b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/build.gradle new file mode 100644 index 0000000000..bd3416acd8 --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/build.gradle @@ -0,0 +1,38 @@ +plugins { + id 'java' +} + +group 'org.example' +version '1.0.0' + +repositories { + mavenLocal() + maven { + url = 'https://maven.wso2.org/nexus/content/repositories/releases/' + } + + maven { + url = 'https://maven.wso2.org/nexus/content/groups/wso2-public/' + } + + maven { + url = 'https://repo.maven.apache.org/maven2' + } + maven { + url = 'https://maven.pkg.github.com/ballerina-platform/*' + credentials { + username System.getenv("packageUser") + password System.getenv("packagePAT") + } + } +} + +dependencies { + implementation 'org.ballerinalang:ballerina-cli:2201.8.0-SNAPSHOT' + implementation 'info.picocli:picocli:4.0.1' + implementation group: 'org.talend.sdk.component', name: 'sample', version: '10.57.0' +} + +test { + useJUnitPlatform() +} diff --git a/project-api-tests/src/test/resources/bal-tool/DistTestCommand/gradlew b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/gradlew new file mode 100644 index 0000000000..1b6c787337 --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed 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 +# +# https://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. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/project-api-tests/src/test/resources/bal-tool/DistTestCommand/gradlew.bat b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/gradlew.bat new file mode 100644 index 0000000000..107acd32c4 --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/project-api-tests/src/test/resources/bal-tool/DistTestCommand/settings.gradle b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/settings.gradle new file mode 100644 index 0000000000..d110e4737b --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/settings.gradle @@ -0,0 +1,6 @@ +rootProject.name = 'DistTestCommand' +include 'src:main:main' +findProject(':src:main:main')?.name = 'main' +include 'untitled' +include 'main' + diff --git a/project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/java/disttest/cli/DistTestCommand.java b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/java/disttest/cli/DistTestCommand.java new file mode 100644 index 0000000000..617bdc8a53 --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/java/disttest/cli/DistTestCommand.java @@ -0,0 +1,83 @@ +package disttest.cli; + +import io.ballerina.cli.BLauncherCmd; +import picocli.CommandLine; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.nio.charset.StandardCharsets; +import java.util.List; + +@CommandLine.Command(name = "disttest", description = "The tool implementation for ballerina distribution tool tests") +public class DistTestCommand implements BLauncherCmd { + private final PrintStream printStream; + + @CommandLine.Option(names = {"--help", "-h", "?"}, usageHelp = true) + private boolean helpFlag; + + @CommandLine.Parameters(description = "User name") + private List argList; + + public DistTestCommand() { + this.printStream = System.out; + } + + public DistTestCommand(PrintStream printStream) { + this.printStream = printStream; + } + + @Override + public void execute() { + if (helpFlag) { + StringBuilder out = new StringBuilder(); + appendHelpText(out); + printStream.println(out); + return; + } + if (argList == null || argList.size() < 1) { + printStream.println("dist test command 1.0.0 is executing with no args\n"); + return; + } + printStream.println("dist test command 1.0.0 is executing with args " + argList.get(0) + "\n"); + } + + @Override + public String getName() { + return "disttest"; + } + + @Override + public void printLongDesc(StringBuilder out) { + appendHelpText(out); + } + + @Override + public void printUsage(StringBuilder out) { + out.append("A sample tool built for testing bal tool functionality"); + } + + @Override + public void setParentCmdParser(CommandLine parentCmdParser) { + } + + private void appendHelpText(StringBuilder out) { + Class clazz = DistTestCommand.class; + ClassLoader classLoader = clazz.getClassLoader(); + InputStream inputStream = classLoader.getResourceAsStream("disttest.help"); + if (inputStream != null) { + try (InputStreamReader inputStreamREader = new InputStreamReader(inputStream, StandardCharsets.UTF_8); + BufferedReader br = new BufferedReader(inputStreamREader)) { + String content = br.readLine(); + out.append(content); + while ((content = br.readLine()) != null) { + out.append('\n').append(content); + } + } catch (IOException e) { + out.append("Helper text is not available."); + } + } + } +} diff --git a/project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/resources/META-INF/services/io.ballerina.cli.BLauncherCmd b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/resources/META-INF/services/io.ballerina.cli.BLauncherCmd new file mode 100644 index 0000000000..8bed272842 --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/resources/META-INF/services/io.ballerina.cli.BLauncherCmd @@ -0,0 +1 @@ +disttest.cli.DistTestCommand \ No newline at end of file diff --git a/project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/resources/disttest.help b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/resources/disttest.help new file mode 100644 index 0000000000..4c762831c0 --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/DistTestCommand/src/main/resources/disttest.help @@ -0,0 +1,8 @@ +Sample tool used for testing the bal tools in ballerina distribution tests. +bal disttest + +--args-- + + The argument to be printed. + +version: 1.0.0 diff --git a/project-api-tests/src/test/resources/bal-tool/cmd-outputs/tool-search-with-tool-id.txt b/project-api-tests/src/test/resources/bal-tool/cmd-outputs/tool-search-with-tool-id.txt index 5c727eaa9d..dd802350f3 100644 --- a/project-api-tests/src/test/resources/bal-tool/cmd-outputs/tool-search-with-tool-id.txt +++ b/project-api-tests/src/test/resources/bal-tool/cmd-outputs/tool-search-with-tool-id.txt @@ -3,4 +3,4 @@ Ballerina Central |ID |PACKAGE |DESCRIPTION |DATE |VERSION | |------------|-------------|-------------|----------------|-------------| -|disttest |bctestorg... |Sample to... |2023-09-12-Tue |1.1.0 | \ No newline at end of file +|disttest |bctestorg... |Sample to... | \ No newline at end of file diff --git a/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/BalTool.toml b/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/BalTool.toml new file mode 100644 index 0000000000..35bbe95edd --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/BalTool.toml @@ -0,0 +1,5 @@ +[tool] +id="disttest" + +[[dependency]] +path="./resources/DistTestCommand-1.0.0.jar" diff --git a/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Ballerina.toml b/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Ballerina.toml new file mode 100644 index 0000000000..b383ed560a --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Ballerina.toml @@ -0,0 +1,4 @@ +[package] +org = "bctestorg" +name = "disttestpackage" +version = "1.0.0" diff --git a/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Package.md b/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Package.md new file mode 100644 index 0000000000..f44ebdfb0e --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/Package.md @@ -0,0 +1,4 @@ +# disttest + +## Description +Sample tool used for testing the bal tools in ballerina distribution tests. diff --git a/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/resources/DistTestCommand-1.0.0.jar b/project-api-tests/src/test/resources/bal-tool/v1.0.0/disttestpackage/resources/DistTestCommand-1.0.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..d0e6c1f00d84871c5e53795ac2777070b1338486 GIT binary patch literal 3302 zcmaKvc|2768^>@LA zW#2+FmO>hh(G)5aDt_a4U-^}LfA=}B@AsVZdVN06^PF>@Ki=mo9LUKB0PyetRL%=J z0NBB?xv_(ny(~{73?XJ#Fm)i{>@UJ9BFDT0TOh_>pr3`7hE`^<)8`Rtmas+3-X04$ zMD3X%9CE0yx4+u@@Q~&dgU;aCmW=KHrK+n3-q#n6_x)SdpM`?#n=K&<+XDc|Z5N+nmq4&f7<+qpA+fG%C=3#hkF)a#+B+f=T8{Q~yxRkY| zTq9%tD#+wc6lC#(A?2m^!dU;~#qx~_f=m1Do-?;Z%3N2f z$!#$xj8VhnKM0WFAL9P3Sd2P+%OIgCw>v|A>igfD(RE z$W5~>HD?@L+&fl)8EZ5h>BO=~w^yQL5?r_ypPGtvd`^nbw-qD2pC9!M18K5QN^1lC z(I9d)ZUB$BCEV2U+4tKW2`&!Dt7exeDNR^dpuVB-%A=;fko2ZQAgOd-z5Xr>O)KO~ z4bxNofM+2@Sx4s*4xckue+Tu4sEzP@O^qK36P$=Ghn46&K%U_tr$Nak44m*E8ds;HV{%tGLoO#Lt(wT9j(ji= zwVLOjSu96gho_O`v6V-iLb%$C?cdcflPf!NO}Uu ziVnJeZeU+XH9$&=^+_)(Bj$uXl-Io5%`5deZBA>@QnBl%`7H<9Uao}{zCxe&RtK7@ z1TJ3G6d1KSnf+GzO2|Tk)?BB8BthxM3J8d0EKcXUJWDkMrxSM}OiG(`QlwkNfJhsv zm^N<8$ZDUBk+P4KbM93q>-_IgXH%%}qQq{!h>w`n@CjFNMQI(sMRKH2g`X z{GcppmHM1ZiRb;DlRdKF0&rgEvryMq|Gx7l7*^!*+PBen`n$0{r4b4a4OB-)nZYG! zh?0F)Tz=EtB=h?Hy5UppkMyQ5AiD}jppdHs>YaAyUC%VNqGTQh^9kn5B<3AdkIeA) z3^{;0lC5&v>U~n=<@?65bTNoXLH@~{i*kwGf!aOkRl$y>J@=MhlPz_nyC>i6V>$8A z9#F}s8{bc`YB=HQ_YU9G<5v#&Tw$Zif6Trk_rhzDwfWA#`QFeM3W-DS%owmkPx-Q6 z4+@G^<&wa`r51wR9_R}z^71*f`vuKNlGO@)0<$&3w@WYio^bN8dl(Nq=N(vK zi?%!d8##0jf`R{2P43;G;sdq$)I&q{to1r7i-aL%`Z)K_3!J(?!u12`@N zD!#A3(q&a9?=jnfZ}l7dfH;MAp3=LF=&3sfgzjGuXJY&oLBuQ6M*&0^oT{ooa8vgq z6X^<2k0y|~cQn{(9r|Gx>6*7SOLEWR!;xOm#-{77iPrtt+8LeY_?gMmea|J;uQ8u1 z@8SP|3G3%12=!+*xz%@>sBD}pbkHyFx@We&bN%vh-aS*NLj`%3UpH-}5-29I9KC&> zyEE;O4Y4A2N56<_l~Y8e4fLXpA@v&b4#)=vi#eSO;HqrA&@L`#C)JVH&LV}^gqun{ z>$EF1x*%~bHE9Tw4-+NSKX?`N<~$-fa{;`pGYGBxyrNZ0=_}LDtFMcgZdb{unShmu zmrb{*(&{RVqzWj^ff6ek3F0r6F#H<$z9GD0ho8|@nr(SCG@W-KNY)5b|rA=M2ODFs_nQB|1MkyTFv%rpsxB?7B3r|W8OG+R?A%N{9|)z#W* zYuR37K@Wz=8g%ct=JhecI5{vtIbY9~(MxDc|5%0PctvuagP;^C)T_v?|t5ZLuApA`pTIvU(iuW@r|?-RSikDq!GzBk4!JG_h0#&#so zYVi)ewC3}{()umgeK?G9w41hm2R$%mT0C$@g!8DWHhuR{Aq^}~$!gRMv)$JrE|B~V zoCKSt8ZRyF9q$qjxZT;(DxpX}d@Wws15{4unVfoQt-WYQ@!-~N`SQqfHTaAoKsu-b>XBZx5@+1UGoMW^cxjyZ!( z&lWnd^43zY$daO$<@IZpVG|7f&yL@$3iF#5R)hYak-O`pM|`B9bw}xEBwsNJvC~e+ z*F}gOUU?h4ex<6>+gJa*&PJ7D_WGG`)ZEb+A4uFep%$=!@dlpH2{5#7^<1s;65!Me z*>gpvqpPB%HI>lH_W{TIng@pYe)nk}*13HeKat}E6JV_I;W7(+`nAC5XZNQE##t$% zXEb$IYY4wLmaEG#-|uGf6iCpAJJ#ZEMwYzbk(;jZXS|6C9dGNFvHwmNT?78wBfGUN zSQBPnZy_Qcjq~?Fq49qMv5O}HzHYLjBzvj{|Upm82pBpby%)Ql{Uepr+{ z8fWa~3hz=?J7~tnNO)h@5Pk>FC`^+1ZG6170mR109ULIw|HoH$F?Q?*%o%Q;w>sT! z+YYmv;?2klKgiy-G6O&vVXs{&*iVBX$mM0ATN40Njel z7QhO&t&J62tYxeV*8;&z^c2|vX1@r_LfK|TSb`(0CHS+@Sjz;ar)voZ8|y6^cXnJf z0)cyZj6m|;ov+I+lm;MU3_62tM>3ZGm#WSwO0l0_Eucgm>vC8eKg{GD z_O>%{W9JmvC*5S`HLyP^w&1zg;jSXcu_uMFw33M@ zg^ir02482}cPIJ8^Xsw}@BB$S|9$;^+*iQomm0}M+81+2HQDKG4_rElmrF6V{9LCDrFc#~uZ{`YblPvnY2knT&3IJ1ILJDuQ-G zy163{2#9c;ffw^9;mD7i&--_nI;lCq$~;efkvPM3>h_CV#snWfs;O2}O{LPsdQ5aG z-HAX@Gs8v-TH=4z1-)`kCUs&a;Sv# zTqTnXNWxQ1Wch%vk2Ql)j%B2MdID4Yeizrkd6{YLy1X4r%c?{DX^+EWeV)I%@g}P) zv#Pl!_7hfC#Xz1YX7ywV)O)(@cCGwzb?33>cUrLW)M(6xK`Ws|O6=+R6=8`NvFnkP zkbO!(&PD3!k2Pl@swSe)-!Am?uv0uLr4-*AqEwDGBua1v!BLZq7f}bJ<5RfQUblBD znV=^sCfyZf-CZuqoI8gk5OZc~3NhCYSqXfGC`C$65ClUhvm1R*l0r$)FmzP-ZeFy` zUF;3dHf46GDb*Y!dHgUWE-T%NtFZu%S5aZLC`mb%9p zLfrxyW$A~|y1mo|B$0|bz6ug{FQ7)GWaY9ektT1Syfsiskt&ymO~6eL*ILVGHXUJi zu`0*6opnIL1P=y;7iOm~HY`rWVvc`!1~F@qIs7{$TU=2nrcsFF;Nl#GS!4yR=)*vd z@gpj4-^kko{z%O=oZ{%_!XsunEO4QcaK>x^`da>zJc$4)aN<=wb$4qnvvBrdxNWko zvdfw_XS8WT3atlhV@XCOFp2v9y4xVmKGA*qF;r!}STTy(ykkb+3kYH{ekcI@za+I6U z_+U9Fwms~j*}2F1y#D^YplFv0c>3c_E`|UFKG>1beRF!)4LM5Xo5T;zo2@uh^*nPb zN~K{%Ek941-#cy-@Zu`^vn{lyT))%F_K~w_f?I_3bltH}HRT()WKD}wnG})YQwm|% z>^<8OMJ+i$xMSU*1`7QamkjG4N`r*j{5=gU80lDZl%~tgyZD*h@in))`#wh_1Ny@& z|tdAhR!|_(E36Y^VrgswlstZwd^vLSFOuID4Yn=2F|$N+XJ| z&n&vC{t`0$4O`N9?H<12TmG<@OR@(Ms4g9c&im`KSYOl5lv0TO2%b|<_iaw&TX~^O zb2;WPIyviXSs)X`j@CxPAP-BYwh zk*}LCgO@gA*h&#q`6tmF0g>|O5k0BP_2mWhXA7COQRZvayVu%<=kgi*wJSnsyr9wa zxxGsx-vjm4$R~kvsMu<-$erjSA%psk7&peCw0HRYL+@@xmFB$5lbFD-GSaQ|3-n;b zOSOft0-HOqO=Hxj;5A3OIDC9Gf8Z=|!o4&@F^IAlDOqr51mESu6zyt=$-H;gf!-}+ z3OqPg1IXt7qUr#pm=co{5Z^-e%7YNeD#@F~&ERiRI$?@m+%=2%_I!KV)~{wKh$1I9PQg~YMIc;kUY21Oh5@esd|)I zLU5zf2fQrSox*Oi(}(D~*QJ+dO$-C;UuDckL&mWq9F11bhwNV(k_uKjF>~_;uIv?| z)JT*abG|H*62 zcUNEL7uB*qm#5c<{idZ~7WOY&D|_?Etc!Tk2S~Lagzroz+#6p^pH4&Kim5#%(;@yM z#SaHRs+#Bzr_F8JXT3|iF`LH7=*>3hAUTP7+Kn2jbT(Vxn_uWOBSrsV-0D?~)waGb zxK_MNExoBfNKC!sZnrn>%Kq2hL3ds(16zHTIy?5dCK6iEMW!W^dL)ftU%-PC@jg(4 zhuS*AIdi=I{iXyNBbqr-TxwL7pHE=&@D06r?s&RSBPa!uoqL=72ojV~m$bLpPpGta z#D46<#_FzR%MFc|1ZduQ1(VRcqg97rJ51h>AF971J}yJUVXrhsWm}AAr$Cf)*UuKi z#T>7AUpJJNx^;Ze=x8DoIR9Iea+GCK@%8V(V6&zgZ3ZHjAhDXZ%Evq?iv_*XEz^pU z(8>xaPG(xyMm)&zd^*8Y*+ovExUTqFnxcz@=s%8f`FA!#gNp926h= zVbyw5wCct;jbEWEqrkh+k3}lQto1YAfL*cp-$8M`JnWMDw7)|l4gpf$-)9QUuu1eO z2<(v&I2YPHy(#q6W<_CEAL}|NWC+i zkf}oLYMEcl;|Q4>L~L&MhL{t>mm_qM^6l3aS)Fa8 zngHv18xVwn*_PYbpMt1Lp;HLgVpR0?rf70x=x;!bP-?C&m>^ z(DraPYCi#%gRvmesJnfDxQlQh?C9hsjn+~x$b!gSY=Z3nA6{9-Sg{{4qqTM3?sTVZ zC(3S#w<4b+$J)1TKY{Je3|s1-sd?-Eufk;3c^gvy&9?Qq|B9`Cvssthwk@{ZY2C@T zKg{`*&YjkOB;B3)c23^^@`bQ|1Aesf-#OfA-ID%z_^pZfE4H3OlJ#k}U*Gn8?DX%P hj~^NGDVG1}|JP|TGveI6m0&OHIKb+vj+Fuc_z$;;LA3w? literal 0 HcmV?d00001 diff --git a/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/BalTool.toml b/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/BalTool.toml new file mode 100644 index 0000000000..5b505a9c8c --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/BalTool.toml @@ -0,0 +1,5 @@ +[tool] +id="disttest" + +[[dependency]] +path="./resources/DistTestCommand-1.0.4.jar" diff --git a/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Ballerina.toml b/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Ballerina.toml new file mode 100644 index 0000000000..e7fb04a437 --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Ballerina.toml @@ -0,0 +1,4 @@ +[package] +org = "bctestorg" +name = "disttestpackage" +version = "1.0.4" diff --git a/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Package.md b/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Package.md new file mode 100644 index 0000000000..f44ebdfb0e --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/Package.md @@ -0,0 +1,4 @@ +# disttest + +## Description +Sample tool used for testing the bal tools in ballerina distribution tests. diff --git a/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/resources/DistTestCommand-1.0.4.jar b/project-api-tests/src/test/resources/bal-tool/v1.0.4/disttestpackage/resources/DistTestCommand-1.0.4.jar new file mode 100644 index 0000000000000000000000000000000000000000..761390bcfe422fcd89025d2378c772369637e4e6 GIT binary patch literal 3302 zcmaKvc{o&k8^)#e zCFm*3=#qt|jDfK(h#Fw}7h(Brs*n5>0WW27{w_4qG&az^WNra8(%m%bXorAhfW6FM z8L6(0?g}&60fouA={c%H$teE6RCV*f`1v6)et)a_yO5c3b0Bm@d;Cp|Lc2i zVU3rx{2b2a-kfv>&3#RRJe_$8qLn#IXHrVP3m=d z@|Nt`R43_u%=wRCqT<3}-Lb02vo1Z-oM#k4Jr?$EmMJJmQIj%`oZ|OD8-Gq(*qCQf zn3!Q0^$1cyEjH2$RuA6_6Kf^)l7k0N_n^5V`Z|R~8nbFO)D)j1ttVI49ve@ey3wf7 zOn!Y$$H|B}_9#`;#Y2ZK6bt-nMHR%e6mryHQk1G@8%b4Y>gOi@Sye*ewNgl8e_CnX zlcLnJl*L8A*3OX11zY?{M+*bu1Q|e^*beB`e)y!^K}BX|^z2 zwopjT&V_Z01Z$A$_==aqLe<2Go-c`lgmwdgmw7lj4!sTNZmqcJ=0mM!#3bQ+%Bawp zS$IoZysV|(sEbF&E)&GGj89_5jQ%p2Gly9~VM9*f#5EfZQdUPN?3S?hU4`~D>gqhj z9{#TfW_v137|# z%fMKt*>BSIbvzK&9BrVq4&mImN;}%NAYs__6cnr>zbBZ7w++#jR>LdMzAErnkoRBL zGUm3_lJGHhs_=xHW&a2Ph`up`y5xXExgrF=fd$eAt( zs?KnD)bH;U>(Kya0@FL0Dk38MyUbPRjEhDq5s-EyLb1w9Gv>_rSh275lal0%97WyD zW=@@k+4hmC8a}SC(y+zE+5Q!~__MWR?XJXx#l)mn4{a}og!ZxO_r)b>cD;ChF;0%F zhs#i6`;8{3JLA$uWITgHU%Ca5O&?L0G6%7%FMc=Ix$D!FbCMOYhGpCWg?hF+yp!v^ zC5W}Xn{5r@X-*4?RS6#cG^gP+OEG-Z=lJp0UWDGQ;eE%7jJ8d^VH`nGpK<+ReuLfe*?d5UT_h2_!$T2>8o z1)r+nC!(=S?9ha5FxRp@c5j5Jr6=Y<&2o4IWW}LU_docUv)ULgG*8!H#(JLcTp~OGASiRMgtU>yg+(;c-c9)iwBC%}MS>;bg8bT-1B$q^u zO4#FvMwBN5Pjwefv+;HXetjZ_S3kYMUBXjU@Nrtb{4;lP#TaHB24lhcsj`oeR?>^fjrc^0MndPyxX%8OI+P5QV8E(L7MEa2Tyom%G4yf_5B<7!_r;c`%oV zYoJHhf%f=!j=il?l*Ho0z7C`28R3(vF8cXMMLSIDbv?|Q$bttxp=vWcHjL)l#YPG0 z+B+txjk(pWdeVF9nXrq6t;q&IFZ{fCn_Z;w#LhY4f&0{Z@Yy9t83tLEQcXX{kPQ|q zhu%^6K<%>QHNY0<@V%&=n5U788;Bd1#(2rQp1i0qd#pe#Utu9_pSZ{sT~YXR29KLM z4!UL)Z}}W1vme}Ai!p&3Ve6v?Q2G<(-I@1;%gQzL(evX{_~cTbK7amV&ni4?xy1xo z3j26DO|MkhvaoUxt7>)sOW6u-+R*`eoU3h}F~c!I9Pa!xC&s!uLYr4+`RX8!#R?&@ zTXr&bu_SL?D>G^R+$ui5oDIHEdZerq#aI1<`As?3*sv4>c=cA{bWGLwFm!IfrYV0S z>vI!8@)-GfQv{3A@|Z*1whlpIh6~x;PNKh2c=vf}Bw^8THMOPQ72Lb)vG-BxnGTH% zRP)>UdUM^8{ObHwf|&Sf;oak0bhx!?#LxHnYb3g-Ueucz(Ma#Cq=)GA7F_SgfvG^Z zZ_E8#FE;v&B85!e!<%N$r7WVV!p&RyncuIY;i@OoTOjGZg!6G+*Ri$TRZ$k!C||+c z%+>aQpT))>+V#Ki&Ls{d=<_d;RY#v)l^&C2g{L;RE1366x+|V+$c|@r$TyqKrTy&0 z*S#LNBM_|IQpS8LZDEHhV&xKkWic^8NwlIMeSxAYt4qwI^ zOMkz~RSEDYRD_koJ1*=s`GR2V+z z*peQ5_0IGK9J7@S2x`0e;l)m>F&H~ejNq+SGNtV0g(9ab)wgVLw>0>Cm;Q+# z(ccsLD^!g_X-BS8NF|@Le#aZ&WdzzsCJM^(T9`?D55oWlJTv^3l;hx10|sai`$^;-o{n!Dd8 zj}4}qc8)q-L#MjfAScM#54ZSvRji-0=`=g9wzYEnsEQz{6L*pu`VTcp>Fog4*eTZs zh=@V>`g^z{FnZHHS)hM(cz6R{oY826uZNd21;spoS`cTfm+NJOul5x; zaO)YMqyYsZ!CkEbm?OSgcLWx`kB*XSIVl)@IPa}-*n35fo-2|4_gn@?Jsi{ zuH&%vA6fTszQeQkzkIhSKLWp6`R^niw(d)RJ^cPe{2BXCAxil)2e0p7J`Vd2&&RI} eSvbpo^#AL$n1X3&_Y=@j4h~9Jb(9nUz<&Ve^-$6P literal 0 HcmV?d00001 diff --git a/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/BalTool.toml b/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/BalTool.toml new file mode 100644 index 0000000000..2cb820db09 --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/BalTool.toml @@ -0,0 +1,5 @@ +[tool] +id="disttest" + +[[dependency]] +path="./resources/DistTestCommand-1.1.0.jar" \ No newline at end of file diff --git a/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Ballerina.toml b/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Ballerina.toml new file mode 100644 index 0000000000..36b8931a27 --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Ballerina.toml @@ -0,0 +1,4 @@ +[package] +org = "bctestorg" +name = "disttestpackage" +version = "1.1.0" diff --git a/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Package.md b/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Package.md new file mode 100644 index 0000000000..f44ebdfb0e --- /dev/null +++ b/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/Package.md @@ -0,0 +1,4 @@ +# disttest + +## Description +Sample tool used for testing the bal tools in ballerina distribution tests. diff --git a/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/resources/DistTestCommand-1.1.0.jar b/project-api-tests/src/test/resources/bal-tool/v1.1.0/disttestpackage/resources/DistTestCommand-1.1.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..0287317e4894a9097c9c481861ba125d7eefadbb GIT binary patch literal 3300 zcmaKvc|2768^34v%ozKYl%2>{Bx__!S+c88 z$dWB}8PaGhQ^=a_<~M%#m0!8{cc1h6e$P3t*XQ#*&pGG$<9$pGS=qP%fPMP_I0Uy1 zfEg^?8#6eW%SZ>V34$5xDzE}fe-W02u*?cG1xJ}n;Af$crZG%c#{v#E(p@y_?6_nI z0{3zog5PSgoXcZBIj(l$3^WU!0oB7A)lA zM$S@$kCV;&Q@mpNbyGR^l$yQ|9S3-KO zkxBX_p{XXaod35c8bK(BGSYrs{wY4+OKae~%(QkLo{pvErDc`dPr_rpU%bBgHmfVM zs<|fiGgd}fUydkh`E&`?d#3D8t=tJUr?KYuny~WJXv~IwE1^VE^x1_KA@P^7>ycr> z`xSxgi7T3oY%l}rNCIV()PB^yhJ7W zuLi;0Lx)d(a%g>>s%WW4b;RYYOTH?$j!RZD8FUWFF2iw<4`%Myu&V%8Eb zGO&f&V$p-A>(B(p)eLF2vscpi(xRqnl``R7blC}ffKdbD%IrNgliw%~V?rmh)ZEt) zYUa==3txohouw`yiB#0_O@Od>0W~5iBb!}`G=BH=oxXC4WVsw{0&a4o)=Dn3=_sqS zWjVg>oIMIAaL7NrFgty*VR0fBbK>K3h-r)Tk>4TNVhVyWje=~47U#kkMV8QtJ`D6Y zAENTk%{&h9CrYlt6k9hZ9x>Bljth~1(`WtB*Yls|iTg`}6R+VZds}lEg|m;sZIX4A zoY%D2qfHW0s6Ak73o zhs!y!?V*oM&p*-Q@$=&WMLSo()1Pc|()q*SgB=;&x2A_(k)sseN&L{f>56?-&vVD3 zR4P`);>)Dj{S(&yFR!7$*g$K_^*SAG9y^I7xJFn_*B$>{Q@(*q)-W%XP7y9XEgyQ_ z&Z8|+#De{!8`c%7FW+x|*`WTB6iBem&qLpwo{lv`X*l1yho8wEUvsT{;C(F8zdyWE zuC7Uf!Z@sHsm416Jf(mHGWvpxFJ_g@h6p33itue9CFe6TKq^)cy8DTUaL;MsL`-sLpDlM~D| zlVuD;P6Xw*TQ;2vu;Wlw_>^Iz;ut}+S96IP=Y`cr$n#shMQ-Y)j^=tl4d}k$mZBws zeA9ddytEm^Qi`a`KZR!VkCeNB=t*6!FE5}yU&yqHGFz+OyVfo=mrp;SRS`_(0ga~5 z?OPhz3eZy}p90FFVynTzccY60_3JxgTSUg7hPyt)xp8uQLiV*a=yFMlh994m+po=Y+@Ga@&}4Y=ulXjz|j!+U2T7xjsrf~{Rv&_4*m4_&L{ zdCTA*TI9Ub8F%$c&s&y&o_zMD@XTQ*xmETQ9b{>(@Xr$9QDKP!xo8SEG^D)t$Sa$f z(&8v7JIMMzo|9w+_slUfTD?tfb^0T+bn#v2`-wAg)bD#KWr8C^a$JTp{w1`e>QP1s z!IeTA@HAg{486rl8=~plkXoKKHVCMHoiQH`8OM&WHCnzHvU_DfDp={n%*_|LuvUav z3EJjfO)a_?B>X`(Z>EPju=1Kec?F>v$#w0y&-|&a&jUV4HnXa*wVt+eW%Dk*r*AM@ zE|eH0^5T|W7xthHkZL~)-JMRjKfahgorc5}Q+i6KgZ+ey z9}Rv|G1ePSo7=R@dY^W4HjSRqo2}nLauoHj9W_wyY__^TztCw)ivGi>)w39@W%WQ{ zt$2@WdQ*R(s9MLpZZGQ918=+n@4j3Hwt6phcIT=VE0yKhgIR#U!kgDagf88Nh-z6^)udpU9kAyL2DPl9D(Oo%k>ZXY1-AzTbSHn~Zqw$uwSA#x9k0PFvUS7tG0901H{Zl8BL-EG^A zvfJYA$Pbfc?mM=hz;<_rZS~L8ynX*yVKVc)1F8RJ+y2~t#dg2h%*!3yHrwvD?q=H` z=KQeE-PV63-QD?iPu~CX1v7sGezfx6IoxgCmi~D7?TPp+wx2?R`Du1u-_CsO_V1pL g9~tt)EdJ5|uhU{`$i8 Date: Wed, 21 Aug 2024 18:35:03 +0530 Subject: [PATCH 07/16] Move BuildNewCommandTest to project api --- .../devtools/cmd/BuildNewCommandTest.java | 138 ---------- .../org/ballerina/devtools/cmd/TestUtils.java | 237 ------------------ .../src/test/resources/testng.xml | 2 - .../org/ballerina/projectapi/TestUtils.java | 6 + 4 files changed, 6 insertions(+), 377 deletions(-) delete mode 100644 devtools-integration-tests/src/test/java/org/ballerina/devtools/cmd/BuildNewCommandTest.java delete mode 100644 devtools-integration-tests/src/test/java/org/ballerina/devtools/cmd/TestUtils.java diff --git a/devtools-integration-tests/src/test/java/org/ballerina/devtools/cmd/BuildNewCommandTest.java b/devtools-integration-tests/src/test/java/org/ballerina/devtools/cmd/BuildNewCommandTest.java deleted file mode 100644 index f5b3cf488b..0000000000 --- a/devtools-integration-tests/src/test/java/org/ballerina/devtools/cmd/BuildNewCommandTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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 org.ballerina.devtools.cmd; - -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.LinkedList; -import java.util.List; - -import static org.ballerina.devtools.cmd.TestUtils.*; - -/** - * Tests related new command compiling. - */ -public class BuildNewCommandTest { - - public static final String DISTRIBUTION_FILE_NAME = "ballerina-" + MAVEN_VERSION + "-" + CODE_NAME; - public static final String WHITESPACE_PATTERN = "\\s+"; - - private Path tempHomeDirectory; - private Path tempWorkspaceDirectory; - private static Path sourceDirectory; - private ByteArrayOutputStream console; - protected PrintStream printStream; - - @BeforeClass() - public void setUp() throws IOException { - setupDistributions(); - TestUtils.createTempDirectories(); - tempWorkspaceDirectory = Files.createTempDirectory("bal-test-integration-packaging-workspace-"); - } - - @BeforeMethod - public void beforeMethod() { - this.console = new ByteArrayOutputStream(); - this.printStream = new PrintStream(this.console); - } - - @Test(description = "Build package created from new command with default template") - public void testCompilingNewCommandDefaultTempProject() throws IOException { - List args = new LinkedList<>(); - args.add("project_sample"); - Path newOutputPath = TestUtils.executeNew(distributionName, args); - Assert.assertTrue(Files.isDirectory(newOutputPath.resolve("project_sample"))); - Assert.assertTrue(Files.exists(newOutputPath.resolve("project_sample").resolve("Ballerina.toml"))); - - List buildArgs = new LinkedList<>(); - String buildOutput = TestUtils.executeBuild(distributionName, newOutputPath.resolve("project_sample"), buildArgs); - Assert.assertTrue(buildOutput.contains("Compiling source")); - Assert.assertTrue(buildOutput.contains("Generating executable")); - } - - @Test(description = "Build package created from new command with main template") - public void testCompilingNewCommandMainTempProject() throws IOException { - List args = new LinkedList<>(); - args.add("main_sample"); - args.add("-t"); - args.add("main"); - Path newOutputPath = TestUtils.executeNew(distributionName, args); - Assert.assertTrue(Files.isDirectory(newOutputPath.resolve("main_sample"))); - Assert.assertTrue(Files.exists(newOutputPath.resolve("main_sample").resolve("Ballerina.toml"))); - - List buildArgs = new LinkedList<>(); - String buildOutput = TestUtils.executeBuild(distributionName, newOutputPath.resolve("main_sample"), buildArgs); - Assert.assertTrue(buildOutput.contains("Compiling source")); - Assert.assertTrue(buildOutput.contains("Generating executable")); - } - - @Test(description = "Build package created from new command with service template") - public void testCompilingNewCommandServiceTempProject() throws IOException { - List args = new LinkedList<>(); - args.add("service_sample"); - args.add("-t"); - args.add("service"); - Path newOutputPath = TestUtils.executeNew(distributionName, args); - Assert.assertTrue(Files.isDirectory(newOutputPath.resolve("service_sample"))); - Assert.assertTrue(Files.exists(newOutputPath.resolve("service_sample").resolve("Ballerina.toml"))); - - List buildArgs = new LinkedList<>(); - String buildOutput = TestUtils.executeBuild(distributionName, newOutputPath.resolve("service_sample"), buildArgs); - Assert.assertTrue(buildOutput.contains("Compiling source")); - Assert.assertTrue(buildOutput.contains("Generating executable")); - } - - @Test(description = "Build package created from new command with lib template") - public void testCompilingNewCommandLibTempProject() throws IOException { - List args = new LinkedList<>(); - args.add("lib_sample"); - args.add("-t"); - args.add("lib"); - Path newOutputPath = TestUtils.executeNew(distributionName, args); - Assert.assertTrue(Files.isDirectory(newOutputPath.resolve("lib_sample"))); - Assert.assertTrue(Files.exists(newOutputPath.resolve("lib_sample").resolve("Ballerina.toml"))); - - List buildArgs = new LinkedList<>(); - String buildOutput = TestUtils.executeBuild(distributionName, newOutputPath.resolve("lib_sample"), buildArgs); - Assert.assertTrue(buildOutput.contains("Compiling source")); - Assert.assertTrue(buildOutput.contains("Generating executable")); - } - - @AfterClass - private void cleanup() throws IOException { - TestUtils.deleteFiles(); - } - - /** - * Clean and set up distributions. - */ - private void setupDistributions() throws IOException { - TestUtils.cleanDistribution(); - TestUtils.prepareDistribution(DISTRIBUTIONS_DIR.resolve(DISTRIBUTION_FILE_NAME + ".zip")); - } -} diff --git a/devtools-integration-tests/src/test/java/org/ballerina/devtools/cmd/TestUtils.java b/devtools-integration-tests/src/test/java/org/ballerina/devtools/cmd/TestUtils.java deleted file mode 100644 index 31070d31be..0000000000 --- a/devtools-integration-tests/src/test/java/org/ballerina/devtools/cmd/TestUtils.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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 org.ballerina.devtools.cmd; - -import net.lingala.zip4j.ZipFile; -import net.lingala.zip4j.exception.ZipException; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.testng.Assert; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PrintStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardOpenOption; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class TestUtils { - private TestUtils() { - } - - public static final Path DISTRIBUTIONS_DIR = Paths.get(System.getProperty("distributions.dir")); - public static final Path MAVEN_VERSION = Paths.get(System.getProperty("maven.version")); - public static final Path CODE_NAME = Paths.get(System.getProperty("code.name")); - - private static final String BALLERINA_HOME_DIR = "BALLERINA_HOME_DIR"; - private static final String BALLERINA_DEV_CENTRAL = "BALLERINA_DEV_CENTRAL"; - private static final PrintStream OUT = System.out; - private static final Path TARGET_DIR = Paths.get(System.getProperty("target.dir")); - private static final Path TEST_DISTRIBUTION_PATH = TARGET_DIR.resolve("test-distribution"); - - public static String distributionName = "ballerina-" + MAVEN_VERSION + "-" + CODE_NAME; - private static Path sourceDirectory; - private static Path tempHomeDirectory; - private static Map envProperties; - - public static String executeBuild(String distributionName, Path projectDir, List args) throws - IOException { - args.add(0, "build"); - args.add(0, TEST_DISTRIBUTION_PATH.resolve(distributionName).resolve("bin").resolve("bal").toString()); - OUT.println("Executing: " + StringUtils.join(args, ' ')); - ProcessBuilder pb = new ProcessBuilder(args); - pb.directory(projectDir.toFile()); - Process process = pb.start(); - InputStream inputStream = process.getInputStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); - String line; - String output = ""; - while ((line = reader.readLine()) != null) { - output += line + "\n"; - } - if (output.isEmpty()) { - inputStream = process.getErrorStream(); - reader = new BufferedReader(new InputStreamReader(inputStream)); - while ((line = reader.readLine()) != null) { - output += line + "\n"; - } - } - return output; - } - - /** - * Execute ballerina build command. - * - * @param distributionName The name of the distribution. - * @param args The arguments to be passed to the build command. - * @return True if build is successful, else false. - * @throws IOException Error executing build command. - * @throws InterruptedException Interrupted error executing build command. - */ - public static Path executeNew(String distributionName, List args) throws - IOException { - args.add(0, "new"); - args.add(0, TEST_DISTRIBUTION_PATH.resolve(distributionName).resolve("bin").resolve("bal").toString()); - OUT.println("Executing: " + StringUtils.join(args, ' ')); - ProcessBuilder pb = new ProcessBuilder(args); - pb.directory(sourceDirectory.toFile()); - Process process = pb.start(); - InputStream inputStream = process.getInputStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); - String line; - String output = ""; - while ((line = reader.readLine()) != null) { - output += line + "\n"; - } - if (output.isEmpty()) { - inputStream = process.getErrorStream(); - reader = new BufferedReader(new InputStreamReader(inputStream)); - while ((line = reader.readLine()) != null) { - output += line + "\n"; - } - } - return sourceDirectory; - } - - /** - * Creates temporary directories. - * - * @throws ZipException Error occurred when extracting. - */ - public static void createTempDirectories() throws IOException { - sourceDirectory = Files.createTempDirectory("bal-test-integration-packaging-workspace-"); - envProperties = addEnvVariables(getEnvVariables()); - tempHomeDirectory = Files.createTempDirectory("bal-test-integration-packaging-home-"); - createSettingToml(tempHomeDirectory); - } - - /** - * Extracts a distribution to a temporary directory. - * - * @param distributionZipPath Path to the distribution. - * @throws ZipException Error occurred when extracting. - */ - public static void prepareDistribution(Path distributionZipPath) throws ZipException { - OUT.println("Extracting: " + distributionZipPath.normalize()); - ZipFile zipFile = new ZipFile(distributionZipPath.toFile()); - zipFile.extractAll(TEST_DISTRIBUTION_PATH.toAbsolutePath().toString()); - } - - /** - * Delete the temporary directory used to extract distributions. - * - * @throws IOException If temporary directory does not exists. - */ - public static void cleanDistribution() throws IOException { - FileUtils.deleteDirectory(TEST_DISTRIBUTION_PATH.toFile()); - } - - /** - * Create Settings.toml inside the home repository. - * - * @param dirPath Path to directory for creating settings.toml. - * @throws IOException i/o exception when writing to file. - */ - static void createSettingToml(Path dirPath) throws IOException { - String content = "[central]\n accesstoken = \"" + getToken() + "\""; - Files.write(dirPath.resolve("Settings.toml"), content.getBytes(), StandardOpenOption.CREATE, - StandardOpenOption.TRUNCATE_EXISTING); - } - - /** - * Get token of ballerina-central-bot required to push the module. - * - * @return token required to push the module. - */ - private static String getToken() { - // staging and dev both has the same access token - return System.getenv("devCentralToken"); - } - - /** - * Get environment variables and add ballerina_home as a env variable the tmp directory. - * - * @return env directory variable array - */ - static Map getEnvVariables() { - Map envVarMap = System.getenv(); - Map retMap = new HashMap<>(); - envVarMap.forEach(retMap::put); - return retMap; - } - - /** - * Delete files inside directories. - * - * @throws IOException throw an exception if an issue occurs - */ - static void deleteFiles() throws IOException { - if (sourceDirectory == null && tempHomeDirectory == null) { - return; - } - if (sourceDirectory != null) { - Files.walk(sourceDirectory).sorted(Comparator.reverseOrder()).forEach(path -> { - try { - Files.delete(path); - } catch (IOException e) { - Assert.fail(e.getMessage(), e); - } - }); - } - if (tempHomeDirectory != null) { - Files.walk(tempHomeDirectory).sorted(Comparator.reverseOrder()).forEach(path -> { - try { - Files.delete(path); - } catch (IOException e) { - Assert.fail(e.getMessage(), e); - } - }); - } - } - - /** - * Get environment variables and add ballerina_home as a env variable the tmp directory. - * - * @return env directory variable array - */ - public static Map addEnvVariables(Map envVariables) throws IOException { - Path tempHomeDirectory = Files.createTempDirectory("bal-test-integration-packaging-home-"); - envVariables.put(BALLERINA_HOME_DIR, tempHomeDirectory.toString()); - envVariables.put(BALLERINA_DEV_CENTRAL, "true"); - return envVariables; - } - - /** - * Get executable jar path. - * - * @param projectPath project path - * @param pkgName package name - * @return executable jar path - */ - static Path getExecutableJarPath(Path projectPath, String pkgName) { - return projectPath.resolve("target").resolve("bin").resolve(pkgName + ".jar"); - } -} diff --git a/devtools-integration-tests/src/test/resources/testng.xml b/devtools-integration-tests/src/test/resources/testng.xml index be5055e339..4e1d336aa5 100644 --- a/devtools-integration-tests/src/test/resources/testng.xml +++ b/devtools-integration-tests/src/test/resources/testng.xml @@ -22,8 +22,6 @@ - - diff --git a/project-api-tests/src/test/java/org/ballerina/projectapi/TestUtils.java b/project-api-tests/src/test/java/org/ballerina/projectapi/TestUtils.java index 8f9c047dba..67cc0ef516 100644 --- a/project-api-tests/src/test/java/org/ballerina/projectapi/TestUtils.java +++ b/project-api-tests/src/test/java/org/ballerina/projectapi/TestUtils.java @@ -118,6 +118,12 @@ public static Process executeHelpCommand(String distributionName, Path sourceDir return executeCommand("help", distributionName, sourceDirectory, args, envProperties); } + public static Process executeNewCommand(String distributionName, Path sourceDirectory, + List args, Map envProperties) + throws IOException, InterruptedException { + return executeCommand("new", distributionName, sourceDirectory, args, envProperties); + } + /** * Clean and setup the distribution. * From fc8ee73730df2825ca4e9c81a9fe5edaea1a4c92 Mon Sep 17 00:00:00 2001 From: LakshanWeerasinghe Date: Tue, 27 Aug 2024 13:56:21 +0530 Subject: [PATCH 08/16] Update project version to 2201.10.1 --- ballerina-test-automation/gradle.properties | 4 ++-- gradle.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ballerina-test-automation/gradle.properties b/ballerina-test-automation/gradle.properties index d491fa1ea9..d0aa1e04a5 100644 --- a/ballerina-test-automation/gradle.properties +++ b/ballerina-test-automation/gradle.properties @@ -1,6 +1,6 @@ -swan-lake-latest-version=swan-lake-2201.10.0 +swan-lake-latest-version=swan-lake-2201.10.1 swan-lake-latest-spec-version=2024R1 -swan-lake-latest-version-display-text=2201.10.0 +swan-lake-latest-version-display-text=2201.10.1 swan-lake-latest-tool-version=1.4.3 latest-tool-version=1.4.3 1-x-channel-latest-version=1.2.13 diff --git a/gradle.properties b/gradle.properties index 78a1d4cde5..21e60e85e9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.caching=true group=org.ballerinalang # During the release workflow, the following will get bumped automatically -version=2201.10.0-SNAPSHOT +version=2201.10.1-SNAPSHOT codeName=swan-lake ballerinaLangVersion=2201.10.0 From 99354d593d8a88f15e0f1338017605b6ee11845e Mon Sep 17 00:00:00 2001 From: MaryamZi Date: Mon, 9 Sep 2024 14:02:35 +0530 Subject: [PATCH 09/16] Reorganize examples landing page columns --- examples/index.json | 60 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/examples/index.json b/examples/index.json index 5271b376a6..386ec561ef 100644 --- a/examples/index.json +++ b/examples/index.json @@ -417,7 +417,7 @@ }, { "title": "Lists", - "column": 1, + "column": 0, "category": "Language concepts", "samples": [ { @@ -767,30 +767,9 @@ } ] }, - { - "title": "Regular Expressions", - "column": 1, - "category": "Language concepts", - "samples": [ - { - "name": "RegExp type", - "url": "regexp-type", - "verifyBuild": true, - "verifyOutput": true, - "isLearnByExample": true - }, - { - "name": "RegExp operations", - "url": "regexp-operations", - "verifyBuild": true, - "verifyOutput": true, - "isLearnByExample": true - } - ] - }, { "title": "Tables", - "column": 2, + "column": 1, "category": "Language concepts", "samples": [ { @@ -825,7 +804,7 @@ }, { "title": "Query expressions", - "column": 2, + "column": 1, "category": "Language concepts", "samples": [ { @@ -1176,6 +1155,27 @@ } ] }, + { + "title": "Regular Expressions", + "column": 2, + "category": "Language concepts", + "samples": [ + { + "name": "RegExp type", + "url": "regexp-type", + "verifyBuild": true, + "verifyOutput": true, + "isLearnByExample": true + }, + { + "name": "RegExp operations", + "url": "regexp-operations", + "verifyBuild": true, + "verifyOutput": true, + "isLearnByExample": true + } + ] + }, { "title": "Metadata", "column": 2, @@ -1295,7 +1295,7 @@ }, { "title": "Error handling", - "column": 3, + "column": 2, "category": "Language concepts", "samples": [ { @@ -1351,7 +1351,7 @@ }, { "title": "Ignore return values and errors", - "column": 3, + "column": 2, "category": "Language concepts", "samples": [ { @@ -2348,7 +2348,7 @@ }, { "title": "HTTP service interceptors", - "column": 1, + "column": 0, "category": "Network libraries", "samples": [ { @@ -4732,7 +4732,7 @@ } ] }, - { + { "title": "AWS Lambda", "column": 2, "category": "Deployment", @@ -4775,7 +4775,7 @@ } ] }, - { + { "title": "Azure Functions", "column": 3, "category": "Deployment", @@ -4818,7 +4818,7 @@ } ] }, - { + { "title": "Query data", "column": 0, "category": "Bal persist", From 0bccb2ece7059f73e24c30aff3c284c5063a6dcb Mon Sep 17 00:00:00 2001 From: ayeshLK Date: Thu, 12 Sep 2024 18:05:48 +0530 Subject: [PATCH 10/16] Update Ballerina time version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 21e60e85e9..cf8be314b6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ devIdpUrl=https://dev.api.asgardeo.io/oauth2/token/.well-known/openid-configurat # Stdlib Level 01 stdlibIoVersion=1.6.1 stdlibJavaArraysVersion=1.4.0 -stdlibTimeVersion=2.4.0 +stdlibTimeVersion=2.5.0 stdlibUrlVersion=2.4.0 stdlibXmldataVersion=2.8.0 observeVersion=1.3.0 From e4a25d3df60cdf6c0d94beff37859ceddcc35f86 Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Thu, 12 Sep 2024 18:12:47 +0530 Subject: [PATCH 11/16] Update the artifact action version to v4 --- .github/workflows/daily-build-2201.10.x.yml | 34 +++++++++---------- .github/workflows/daily-build-2201.3.x.yml | 28 +++++++-------- .github/workflows/daily-build-2201.4.x.yml | 28 +++++++-------- .github/workflows/daily-build-2201.5.x.yml | 34 +++++++++---------- .github/workflows/daily-build-2201.6.x.yml | 34 +++++++++---------- .github/workflows/daily-build-2201.7.x.yml | 34 +++++++++---------- .github/workflows/daily-build-2201.8.x.yml | 34 +++++++++---------- .github/workflows/daily-build-2201.9.x.yml | 34 +++++++++---------- .github/workflows/daily-build-editor.yml | 12 +++---- .github/workflows/daily-build.yml | 34 +++++++++---------- .../language_server_simulator_fhir.yml | 4 +-- .../language_server_simulator_nballerina.yml | 4 +-- .github/workflows/main.yml | 10 +++--- .../publish-release-artifacts-1.2.x.yml | 2 +- .../workflows/publish-release-artifacts.yml | 2 +- 15 files changed, 164 insertions(+), 164 deletions(-) diff --git a/.github/workflows/daily-build-2201.10.x.yml b/.github/workflows/daily-build-2201.10.x.yml index d9152ce889..b463c2c438 100644 --- a/.github/workflows/daily-build-2201.10.x.yml +++ b/.github/workflows/daily-build-2201.10.x.yml @@ -62,57 +62,57 @@ jobs: openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.version }}.zip openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Ballerina ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina ZIP path: ballerina/build/distributions/ballerina-*-swan-lake.zip - name: Archive Ballerina Short Name ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name ZIP path: ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Linux deb - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer deb path: installers/linux-deb/target/ballerina-*-linux-x64.deb - name: Archive Linux rpm - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer rpm path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm - name: Archive MacOS Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ZIP path: ballerina/build/distributions/ballerina-*-macos.zip - name: Archive MacOS-ARM Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM Installer ZIP path: ballerina/build/distributions/ballerina-*-macos-arm.zip - name: Archive Windows Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer ZIP path: ballerina/build/distributions/ballerina-*-windows.zip - name: Archive Linux deb Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux deb Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb.sha256 - name: Archive Linux rpm Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux rpm Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.rpm.sha256 - name: Archive Ballerina Zip Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Zip Hashes path: ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 - name: Archive Ballerina Short Name Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name Hashes path: ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 @@ -330,12 +330,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-x64.pkg - name: Archive MacOS pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 - name: Archive MacOS pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer pkg path: installers/mac/target/pkg/ballerina-*-macos-x64.pkg @@ -380,12 +380,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg - name: Archive MacOS-ARM pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 - name: Archive MacOS-ARM pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ARM pkg path: installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg @@ -428,12 +428,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 w\target\msi\ballerina-*-windows-x64.msi - name: Archive Windows msi Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows msi Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 - name: Archive Windows msi - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer msi path: w\target\msi\ballerina-*-windows-x64.msi diff --git a/.github/workflows/daily-build-2201.3.x.yml b/.github/workflows/daily-build-2201.3.x.yml index 3a89def584..eeacbae3f6 100644 --- a/.github/workflows/daily-build-2201.3.x.yml +++ b/.github/workflows/daily-build-2201.3.x.yml @@ -62,52 +62,52 @@ jobs: openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.version }}.zip openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Ballerina ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina ZIP path: ballerina/build/distributions/ballerina-*-swan-lake.zip - name: Archive Ballerina Short Name ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name ZIP path: ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Linux deb - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer deb path: installers/linux-deb/target/ballerina-*-linux-x64.deb - name: Archive Linux rpm - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer rpm path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm - name: Archive MacOS Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ZIP path: ballerina/build/distributions/ballerina-*-macos.zip - name: Archive Windows Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer ZIP path: ballerina/build/distributions/ballerina-*-windows.zip - name: Archive Linux deb Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux deb Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb.sha256 - name: Archive Linux rpm Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux rpm Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.rpm.sha256 - name: Archive Ballerina Zip Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Zip Hashes path: ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 - name: Archive Ballerina Short Name Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name Hashes path: ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 @@ -324,12 +324,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-x64.pkg - name: Archive MacOS pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 - name: Archive MacOS pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer pkg path: installers/mac/target/pkg/ballerina-*-macos-x64.pkg @@ -379,12 +379,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 w\target\msi\ballerina-*-windows-x64.msi - name: Archive Windows msi Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows msi Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 - name: Archive Windows msi - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer msi path: w\target\msi\ballerina-*-windows-x64.msi diff --git a/.github/workflows/daily-build-2201.4.x.yml b/.github/workflows/daily-build-2201.4.x.yml index 454ee27c16..9b40aca7b4 100644 --- a/.github/workflows/daily-build-2201.4.x.yml +++ b/.github/workflows/daily-build-2201.4.x.yml @@ -62,52 +62,52 @@ jobs: openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.version }}.zip openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Ballerina ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina ZIP path: ballerina/build/distributions/ballerina-*-swan-lake.zip - name: Archive Ballerina Short Name ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name ZIP path: ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Linux deb - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer deb path: installers/linux-deb/target/ballerina-*-linux-x64.deb - name: Archive Linux rpm - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer rpm path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm - name: Archive MacOS Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ZIP path: ballerina/build/distributions/ballerina-*-macos.zip - name: Archive Windows Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer ZIP path: ballerina/build/distributions/ballerina-*-windows.zip - name: Archive Linux deb Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux deb Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb.sha256 - name: Archive Linux rpm Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux rpm Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.rpm.sha256 - name: Archive Ballerina Zip Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Zip Hashes path: ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 - name: Archive Ballerina Short Name Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name Hashes path: ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 @@ -325,12 +325,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-x64.pkg - name: Archive MacOS pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 - name: Archive MacOS pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer pkg path: installers/mac/target/pkg/ballerina-*-macos-x64.pkg @@ -380,12 +380,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 w\target\msi\ballerina-*-windows-x64.msi - name: Archive Windows msi Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows msi Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 - name: Archive Windows msi - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer msi path: w\target\msi\ballerina-*-windows-x64.msi diff --git a/.github/workflows/daily-build-2201.5.x.yml b/.github/workflows/daily-build-2201.5.x.yml index 9c786cd7df..b3cae7b4e7 100644 --- a/.github/workflows/daily-build-2201.5.x.yml +++ b/.github/workflows/daily-build-2201.5.x.yml @@ -62,57 +62,57 @@ jobs: openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.version }}.zip openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Ballerina ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina ZIP path: ballerina/build/distributions/ballerina-*-swan-lake.zip - name: Archive Ballerina Short Name ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name ZIP path: ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Linux deb - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer deb path: installers/linux-deb/target/ballerina-*-linux-x64.deb - name: Archive Linux rpm - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer rpm path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm - name: Archive MacOS Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ZIP path: ballerina/build/distributions/ballerina-*-macos.zip - name: Archive MacOS-ARM Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM Installer ZIP path: ballerina/build/distributions/ballerina-*-macos-arm.zip - name: Archive Windows Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer ZIP path: ballerina/build/distributions/ballerina-*-windows.zip - name: Archive Linux deb Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux deb Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb.sha256 - name: Archive Linux rpm Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux rpm Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.rpm.sha256 - name: Archive Ballerina Zip Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Zip Hashes path: ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 - name: Archive Ballerina Short Name Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name Hashes path: ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 @@ -330,12 +330,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-x64.pkg - name: Archive MacOS pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 - name: Archive MacOS pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer pkg path: installers/mac/target/pkg/ballerina-*-macos-x64.pkg @@ -380,12 +380,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg - name: Archive MacOS-ARM pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 - name: Archive MacOS-ARM pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ARM pkg path: installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg @@ -422,12 +422,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 w\target\msi\ballerina-*-windows-x64.msi - name: Archive Windows msi Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows msi Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 - name: Archive Windows msi - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer msi path: w\target\msi\ballerina-*-windows-x64.msi diff --git a/.github/workflows/daily-build-2201.6.x.yml b/.github/workflows/daily-build-2201.6.x.yml index 69a0d751e9..c748aedc7c 100644 --- a/.github/workflows/daily-build-2201.6.x.yml +++ b/.github/workflows/daily-build-2201.6.x.yml @@ -62,57 +62,57 @@ jobs: openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.version }}.zip openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Ballerina ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina ZIP path: ballerina/build/distributions/ballerina-*-swan-lake.zip - name: Archive Ballerina Short Name ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name ZIP path: ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Linux deb - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer deb path: installers/linux-deb/target/ballerina-*-linux-x64.deb - name: Archive Linux rpm - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer rpm path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm - name: Archive MacOS Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ZIP path: ballerina/build/distributions/ballerina-*-macos.zip - name: Archive MacOS-ARM Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM Installer ZIP path: ballerina/build/distributions/ballerina-*-macos-arm.zip - name: Archive Windows Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer ZIP path: ballerina/build/distributions/ballerina-*-windows.zip - name: Archive Linux deb Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux deb Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb.sha256 - name: Archive Linux rpm Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux rpm Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.rpm.sha256 - name: Archive Ballerina Zip Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Zip Hashes path: ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 - name: Archive Ballerina Short Name Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name Hashes path: ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 @@ -330,12 +330,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-x64.pkg - name: Archive MacOS pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 - name: Archive MacOS pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer pkg path: installers/mac/target/pkg/ballerina-*-macos-x64.pkg @@ -380,12 +380,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg - name: Archive MacOS-ARM pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 - name: Archive MacOS-ARM pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ARM pkg path: installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg @@ -428,12 +428,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 w\target\msi\ballerina-*-windows-x64.msi - name: Archive Windows msi Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows msi Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 - name: Archive Windows msi - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer msi path: w\target\msi\ballerina-*-windows-x64.msi diff --git a/.github/workflows/daily-build-2201.7.x.yml b/.github/workflows/daily-build-2201.7.x.yml index f66c3474df..9ce1a2fb0b 100644 --- a/.github/workflows/daily-build-2201.7.x.yml +++ b/.github/workflows/daily-build-2201.7.x.yml @@ -62,57 +62,57 @@ jobs: openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.version }}.zip openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Ballerina ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina ZIP path: ballerina/build/distributions/ballerina-*-swan-lake.zip - name: Archive Ballerina Short Name ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name ZIP path: ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Linux deb - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer deb path: installers/linux-deb/target/ballerina-*-linux-x64.deb - name: Archive Linux rpm - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer rpm path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm - name: Archive MacOS Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ZIP path: ballerina/build/distributions/ballerina-*-macos.zip - name: Archive MacOS-ARM Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM Installer ZIP path: ballerina/build/distributions/ballerina-*-macos-arm.zip - name: Archive Windows Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer ZIP path: ballerina/build/distributions/ballerina-*-windows.zip - name: Archive Linux deb Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux deb Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb.sha256 - name: Archive Linux rpm Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux rpm Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.rpm.sha256 - name: Archive Ballerina Zip Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Zip Hashes path: ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 - name: Archive Ballerina Short Name Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name Hashes path: ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 @@ -330,12 +330,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-x64.pkg - name: Archive MacOS pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 - name: Archive MacOS pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer pkg path: installers/mac/target/pkg/ballerina-*-macos-x64.pkg @@ -380,12 +380,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg - name: Archive MacOS-ARM pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 - name: Archive MacOS-ARM pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ARM pkg path: installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg @@ -428,12 +428,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 w\target\msi\ballerina-*-windows-x64.msi - name: Archive Windows msi Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows msi Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 - name: Archive Windows msi - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer msi path: w\target\msi\ballerina-*-windows-x64.msi diff --git a/.github/workflows/daily-build-2201.8.x.yml b/.github/workflows/daily-build-2201.8.x.yml index cfda4ce2b2..694f0a0493 100644 --- a/.github/workflows/daily-build-2201.8.x.yml +++ b/.github/workflows/daily-build-2201.8.x.yml @@ -62,57 +62,57 @@ jobs: openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.version }}.zip openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Ballerina ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina ZIP path: ballerina/build/distributions/ballerina-*-swan-lake.zip - name: Archive Ballerina Short Name ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name ZIP path: ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Linux deb - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer deb path: installers/linux-deb/target/ballerina-*-linux-x64.deb - name: Archive Linux rpm - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer rpm path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm - name: Archive MacOS Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ZIP path: ballerina/build/distributions/ballerina-*-macos.zip - name: Archive MacOS-ARM Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM Installer ZIP path: ballerina/build/distributions/ballerina-*-macos-arm.zip - name: Archive Windows Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer ZIP path: ballerina/build/distributions/ballerina-*-windows.zip - name: Archive Linux deb Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux deb Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb.sha256 - name: Archive Linux rpm Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux rpm Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.rpm.sha256 - name: Archive Ballerina Zip Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Zip Hashes path: ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 - name: Archive Ballerina Short Name Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name Hashes path: ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 @@ -330,12 +330,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-x64.pkg - name: Archive MacOS pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 - name: Archive MacOS pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer pkg path: installers/mac/target/pkg/ballerina-*-macos-x64.pkg @@ -380,12 +380,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg - name: Archive MacOS-ARM pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 - name: Archive MacOS-ARM pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ARM pkg path: installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg @@ -428,12 +428,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 w\target\msi\ballerina-*-windows-x64.msi - name: Archive Windows msi Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows msi Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 - name: Archive Windows msi - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer msi path: w\target\msi\ballerina-*-windows-x64.msi diff --git a/.github/workflows/daily-build-2201.9.x.yml b/.github/workflows/daily-build-2201.9.x.yml index 70fff39ea0..9c96b55bd6 100644 --- a/.github/workflows/daily-build-2201.9.x.yml +++ b/.github/workflows/daily-build-2201.9.x.yml @@ -62,57 +62,57 @@ jobs: openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.version }}.zip openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Ballerina ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina ZIP path: ballerina/build/distributions/ballerina-*-swan-lake.zip - name: Archive Ballerina Short Name ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name ZIP path: ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Linux deb - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer deb path: installers/linux-deb/target/ballerina-*-linux-x64.deb - name: Archive Linux rpm - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer rpm path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm - name: Archive MacOS Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ZIP path: ballerina/build/distributions/ballerina-*-macos.zip - name: Archive MacOS-ARM Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM Installer ZIP path: ballerina/build/distributions/ballerina-*-macos-arm.zip - name: Archive Windows Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer ZIP path: ballerina/build/distributions/ballerina-*-windows.zip - name: Archive Linux deb Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux deb Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb.sha256 - name: Archive Linux rpm Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux rpm Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.rpm.sha256 - name: Archive Ballerina Zip Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Zip Hashes path: ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 - name: Archive Ballerina Short Name Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name Hashes path: ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 @@ -330,12 +330,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-x64.pkg - name: Archive MacOS pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 - name: Archive MacOS pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer pkg path: installers/mac/target/pkg/ballerina-*-macos-x64.pkg @@ -380,12 +380,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg - name: Archive MacOS-ARM pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 - name: Archive MacOS-ARM pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ARM pkg path: installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg @@ -428,12 +428,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 w\target\msi\ballerina-*-windows-x64.msi - name: Archive Windows msi Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows msi Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 - name: Archive Windows msi - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer msi path: w\target\msi\ballerina-*-windows-x64.msi diff --git a/.github/workflows/daily-build-editor.yml b/.github/workflows/daily-build-editor.yml index 9cd0610fc5..e374eb1184 100644 --- a/.github/workflows/daily-build-editor.yml +++ b/.github/workflows/daily-build-editor.yml @@ -93,32 +93,32 @@ jobs: name: Ballerina ZIP path: ballerina-distribution/ballerina/build/distributions/ballerina-*-swan-lake.zip - name: Archive Ballerina Short Name ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name ZIP path: ballerina-distribution/ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Linux deb - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer deb path: ballerina-distribution/installers/linux-deb/target/ballerina-*-linux-x64.deb - name: Archive Linux rpm - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer rpm path: ballerina-distribution/installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm - name: Archive MacOS Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ZIP path: ballerina-distribution/ballerina/build/distributions/ballerina-*-macos.zip - name: Archive MacOS-ARM Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM Installer ZIP path: ballerina-distribution/ballerina/build/distributions/ballerina-*-macos-arm.zip - name: Archive Windows Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer ZIP path: ballerina-distribution/ballerina/build/distributions/ballerina-*-windows.zip diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index 4e7c6b6cc3..a2f2e806dc 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -61,57 +61,57 @@ jobs: openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.version }}.zip openssl dgst -sha256 -out ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Ballerina ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina ZIP path: ballerina/build/distributions/ballerina-*-swan-lake.zip - name: Archive Ballerina Short Name ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name ZIP path: ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Linux deb - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer deb path: installers/linux-deb/target/ballerina-*-linux-x64.deb - name: Archive Linux rpm - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux Installer rpm path: installers/linux-rpm/rpmbuild/RPMS/x86_64/ballerina-*-linux-x64.rpm - name: Archive MacOS Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ZIP path: ballerina/build/distributions/ballerina-*-macos.zip - name: Archive MacOS-ARM Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM Installer ZIP path: ballerina/build/distributions/ballerina-*-macos-arm.zip - name: Archive Windows Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer ZIP path: ballerina/build/distributions/ballerina-*-windows.zip - name: Archive Linux deb Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux deb Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.deb.sha256 - name: Archive Linux rpm Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux rpm Hashes path: ballerina-${{ steps.project-version.outputs.version }}-linux-x64.rpm.sha256 - name: Archive Ballerina Zip Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Zip Hashes path: ballerina-${{ steps.project-version.outputs.version }}.zip.sha256 - name: Archive Ballerina Short Name Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name Hashes path: ballerina-${{ steps.project-version.outputs.sversion }}.zip.sha256 @@ -328,12 +328,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-x64.pkg - name: Archive MacOS pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-x64.pkg.sha256 - name: Archive MacOS pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer pkg path: installers/mac/target/pkg/ballerina-*-macos-x64.pkg @@ -378,12 +378,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg - name: Archive MacOS-ARM pkg Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS-ARM pkg Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-macos-arm-x64.pkg.sha256 - name: Archive MacOS-ARM pkg - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS Installer ARM pkg path: installers/mac/target/pkg/ballerina-*-macos-arm-x64.pkg @@ -424,12 +424,12 @@ jobs: run: | openssl dgst -sha256 -out ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 w\target\msi\ballerina-*-windows-x64.msi - name: Archive Windows msi Hashes - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows msi Hashes path: ballerina-${{ needs.ubuntu-build.outputs.project-version }}-windows-x64.msi.sha256 - name: Archive Windows msi - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer msi path: w\target\msi\ballerina-*-windows-x64.msi diff --git a/.github/workflows/language_server_simulator_fhir.yml b/.github/workflows/language_server_simulator_fhir.yml index ac7cd8b4d4..2ad7385341 100644 --- a/.github/workflows/language_server_simulator_fhir.yml +++ b/.github/workflows/language_server_simulator_fhir.yml @@ -53,14 +53,14 @@ jobs: ./mat/ParseHeapDump.sh ./dump.hprof org.eclipse.mat.api:suspects - name: Upload Heap Dumps - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: always() with: name: heap_dump-${{ matrix.branch }}.hprof path: '*.hprof' - name: Upload Leaks Suspects - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: failure() with: name: Leak_Suspects-${{ matrix.branch }} diff --git a/.github/workflows/language_server_simulator_nballerina.yml b/.github/workflows/language_server_simulator_nballerina.yml index f47be491ab..4291cded23 100644 --- a/.github/workflows/language_server_simulator_nballerina.yml +++ b/.github/workflows/language_server_simulator_nballerina.yml @@ -53,14 +53,14 @@ jobs: ./mat/ParseHeapDump.sh ./dump.hprof org.eclipse.mat.api:suspects - name: Upload Heap Dumps - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: always() with: name: heap_dump-${{ matrix.branch }}.hprof path: '*.hprof' - name: Upload Leaks Suspects - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: failure() with: name: Leak_Suspects-${{ matrix.branch }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c55316533..3b0d2d73c0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,27 +51,27 @@ jobs: githubAccessToken: ${{ secrets.GITHUB_TOKEN }} run: ./gradlew clean build --stacktrace --scan --console=plain --no-daemon --continue -x test - name: Archive Ballerina ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina ZIP path: ballerina/build/distributions/ballerina-*-swan-lake.zip - name: Archive Ballerina Short Name ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ballerina Short Name ZIP path: ballerina/build/distributions/ballerina-${{ steps.project-version.outputs.sversion }}.zip - name: Archive Linux installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Linux installer ZIP path: ballerina/build/distributions/ballerina-*-linux.zip - name: Archive MacOS installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: MacOS installer ZIP path: ballerina/build/distributions/ballerina-*-macos.zip - name: Archive Windows Installer ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Windows Installer ZIP path: ballerina/build/distributions/ballerina-*-windows.zip diff --git a/.github/workflows/publish-release-artifacts-1.2.x.yml b/.github/workflows/publish-release-artifacts-1.2.x.yml index 86bd16adf2..f04123ed48 100644 --- a/.github/workflows/publish-release-artifacts-1.2.x.yml +++ b/.github/workflows/publish-release-artifacts-1.2.x.yml @@ -88,7 +88,7 @@ jobs: echo } >> $fileName - name: Archive metadata json - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Metadata JSON path: ${{ steps.set-version.outputs.version }}/metadata.json diff --git a/.github/workflows/publish-release-artifacts.yml b/.github/workflows/publish-release-artifacts.yml index 701a95855d..622763ac5f 100644 --- a/.github/workflows/publish-release-artifacts.yml +++ b/.github/workflows/publish-release-artifacts.yml @@ -106,7 +106,7 @@ jobs: echo "}" >> $fileName - name: Archive metadata json - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Metadata JSON path: ${{ steps.set-version.outputs.version }}/metadata.json From ea87397c44565b8066fa63fb924001666786e613 Mon Sep 17 00:00:00 2001 From: ayeshLK Date: Fri, 13 Sep 2024 10:21:44 +0530 Subject: [PATCH 12/16] Fix test and output verification for time-formatting and parsing bbe --- .../tests/time_formatting_and_parsing_test.bal | 2 +- .../time-formatting-and-parsing/time_formatting_and_parsing.bal | 2 +- .../time-formatting-and-parsing/time_formatting_and_parsing.out | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/time-formatting-and-parsing/tests/time_formatting_and_parsing_test.bal b/examples/time-formatting-and-parsing/tests/time_formatting_and_parsing_test.bal index 90e0b39589..eaeaf67b7a 100644 --- a/examples/time-formatting-and-parsing/tests/time_formatting_and_parsing_test.bal +++ b/examples/time-formatting-and-parsing/tests/time_formatting_and_parsing_test.bal @@ -76,7 +76,7 @@ function testFunc() returns error? { test:assertEquals(outputs[2], "Converted civil value: {\"utcOffset\":{\"hours\":5,\"minutes\":30},\"timeAbbrev\":\"Asia/Colombo\",\"dayOfWeek\":1,\"year\":2021,\"month\":4,\"day\":12,\"hour\":23,\"minute\":20,\"second\":50.52}"); - test:assertEquals(outputs[3], "Civil string representation: 2021-04-12T17:50:50.520Z"); + test:assertEquals(outputs[3], "Civil string representation: 2021-04-12T23:20:50.520+05:30"); test:assertEquals(outputs[4], "Email formatted string: Mon, 3 Dec 2007 10:15:30 Z"); test:assertEquals(outputs[5], diff --git a/examples/time-formatting-and-parsing/time_formatting_and_parsing.bal b/examples/time-formatting-and-parsing/time_formatting_and_parsing.bal index 743c0e439e..0b6697611e 100644 --- a/examples/time-formatting-and-parsing/time_formatting_and_parsing.bal +++ b/examples/time-formatting-and-parsing/time_formatting_and_parsing.bal @@ -19,7 +19,7 @@ public function main() returns error? { io:println("Converted civil value: " + civil1.toString()); // Converts a given `time:Civil` value to a RFC 3339 - // (e.g. `2007-12-03T10:15:30.00Z`) formatted string. + // (e.g. `2021-04-12T23:20:50.520+05:30`) formatted string. string civilString = check time:civilToString(civil1); io:println(`Civil string representation: ${civilString}`); diff --git a/examples/time-formatting-and-parsing/time_formatting_and_parsing.out b/examples/time-formatting-and-parsing/time_formatting_and_parsing.out index acd96a9a17..3723252b13 100644 --- a/examples/time-formatting-and-parsing/time_formatting_and_parsing.out +++ b/examples/time-formatting-and-parsing/time_formatting_and_parsing.out @@ -2,7 +2,7 @@ $ bal run time_formatting_and_parsing.bal UTC value: [1196676930,0.12] UTC string representation: 2007-12-03T10:15:30.120Z Converted civil value: {"utcOffset":{"hours":5,"minutes":30},"timeAbbrev":"Asia/Colombo","dayOfWeek":1,"year":2021,"month":4,"day":12,"hour":23,"minute":20,"second":50.52} -Civil string representation: 2021-04-12T17:50:50.520Z +Civil string representation: 2021-04-12T23:20:50.520+05:30 Email formatted string: Mon, 3 Dec 2007 10:15:30 Z Civil record of the email string: {"utcOffset":{"hours":-8,"minutes":0},"timeAbbrev":"America/Los_Angeles","dayOfWeek":3,"year":2021,"month":3,"day":10,"hour":19,"minute":51,"second":55} Email string of the civil record: Wed, 10 Mar 2021 19:51:55 -0800 From 3d95563f1a01193dc3cc7ba8aaee5d56ab07db9c Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Fri, 13 Sep 2024 14:04:11 +0530 Subject: [PATCH 13/16] Update the download artifact action version to v4 --- .github/workflows/daily-build-2201.10.x.yml | 8 ++++---- .github/workflows/daily-build-2201.3.x.yml | 6 +++--- .github/workflows/daily-build-2201.4.x.yml | 6 +++--- .github/workflows/daily-build-2201.5.x.yml | 8 ++++---- .github/workflows/daily-build-2201.6.x.yml | 8 ++++---- .github/workflows/daily-build-2201.7.x.yml | 8 ++++---- .github/workflows/daily-build-2201.8.x.yml | 8 ++++---- .github/workflows/daily-build-2201.9.x.yml | 8 ++++---- .github/workflows/daily-build.yml | 8 ++++---- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/daily-build-2201.10.x.yml b/.github/workflows/daily-build-2201.10.x.yml index b463c2c438..aa714d962b 100644 --- a/.github/workflows/daily-build-2201.10.x.yml +++ b/.github/workflows/daily-build-2201.10.x.yml @@ -288,7 +288,7 @@ jobs: sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* - name: Download Ballerina rpm Installer - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Linux Installer rpm - name: Install Ballerina RPM @@ -317,7 +317,7 @@ jobs: with: ref: 2201.10.x - name: Download MacOS Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS Installer ZIP - name: Create macos-pkg @@ -367,7 +367,7 @@ jobs: distribution: 'temurin' java-version: '17.0.7' - name: Download MacOS-ARM Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS-ARM Installer ZIP - name: Create macos-arm-pkg @@ -414,7 +414,7 @@ jobs: run: echo "${WIX}bin" >> $GITHUB_PATH shell: bash - name: Download Windows Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Windows Installer ZIP - name: Create windows-msi diff --git a/.github/workflows/daily-build-2201.3.x.yml b/.github/workflows/daily-build-2201.3.x.yml index eeacbae3f6..961aa989fe 100644 --- a/.github/workflows/daily-build-2201.3.x.yml +++ b/.github/workflows/daily-build-2201.3.x.yml @@ -283,7 +283,7 @@ jobs: sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* - name: Download Ballerina rpm Installer - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Linux Installer rpm - name: Install Ballerina RPM @@ -311,7 +311,7 @@ jobs: with: ref: 2201.3.x - name: Download MacOS Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS Installer ZIP - name: Create macos-pkg @@ -363,7 +363,7 @@ jobs: - name: Install GUID Generator run: dotnet tool install -g dotnet-guid --version 0.5.2 - name: Download Windows Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Windows Installer ZIP - name: Create windows-msi diff --git a/.github/workflows/daily-build-2201.4.x.yml b/.github/workflows/daily-build-2201.4.x.yml index 9b40aca7b4..735bad0e27 100644 --- a/.github/workflows/daily-build-2201.4.x.yml +++ b/.github/workflows/daily-build-2201.4.x.yml @@ -283,7 +283,7 @@ jobs: sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* - name: Download Ballerina rpm Installer - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Linux Installer rpm - name: Install Ballerina RPM @@ -312,7 +312,7 @@ jobs: with: ref: 2201.4.x - name: Download MacOS Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS Installer ZIP - name: Create macos-pkg @@ -364,7 +364,7 @@ jobs: - name: Install GUID Generator run: dotnet tool install -g dotnet-guid --version 0.5.2 - name: Download Windows Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Windows Installer ZIP - name: Create windows-msi diff --git a/.github/workflows/daily-build-2201.5.x.yml b/.github/workflows/daily-build-2201.5.x.yml index b3cae7b4e7..fa9fd1faf8 100644 --- a/.github/workflows/daily-build-2201.5.x.yml +++ b/.github/workflows/daily-build-2201.5.x.yml @@ -288,7 +288,7 @@ jobs: sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* - name: Download Ballerina rpm Installer - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Linux Installer rpm - name: Install Ballerina RPM @@ -317,7 +317,7 @@ jobs: with: ref: 2201.5.x - name: Download MacOS Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS Installer ZIP - name: Create macos-pkg @@ -367,7 +367,7 @@ jobs: distribution: 'temurin' java-version: '11' - name: Download MacOS-ARM Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS-ARM Installer ZIP - name: Create macos-arm-pkg @@ -406,7 +406,7 @@ jobs: - name: Install GUID Generator run: dotnet tool install -g dotnet-guid --version 0.5.2 - name: Download Windows Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Windows Installer ZIP - name: Create windows-msi diff --git a/.github/workflows/daily-build-2201.6.x.yml b/.github/workflows/daily-build-2201.6.x.yml index c748aedc7c..0464ef9672 100644 --- a/.github/workflows/daily-build-2201.6.x.yml +++ b/.github/workflows/daily-build-2201.6.x.yml @@ -288,7 +288,7 @@ jobs: sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* - name: Download Ballerina rpm Installer - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Linux Installer rpm - name: Install Ballerina RPM @@ -317,7 +317,7 @@ jobs: with: ref: 2201.6.x - name: Download MacOS Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS Installer ZIP - name: Create macos-pkg @@ -367,7 +367,7 @@ jobs: distribution: 'temurin' java-version: '11' - name: Download MacOS-ARM Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS-ARM Installer ZIP - name: Create macos-arm-pkg @@ -414,7 +414,7 @@ jobs: run: echo "${WIX}bin" >> $GITHUB_PATH shell: bash - name: Download Windows Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Windows Installer ZIP - name: Create windows-msi diff --git a/.github/workflows/daily-build-2201.7.x.yml b/.github/workflows/daily-build-2201.7.x.yml index 9ce1a2fb0b..98a7f7cfb8 100644 --- a/.github/workflows/daily-build-2201.7.x.yml +++ b/.github/workflows/daily-build-2201.7.x.yml @@ -288,7 +288,7 @@ jobs: sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* - name: Download Ballerina rpm Installer - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Linux Installer rpm - name: Install Ballerina RPM @@ -317,7 +317,7 @@ jobs: with: ref: 2201.7.x - name: Download MacOS Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS Installer ZIP - name: Create macos-pkg @@ -367,7 +367,7 @@ jobs: distribution: 'temurin' java-version: '11' - name: Download MacOS-ARM Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS-ARM Installer ZIP - name: Create macos-arm-pkg @@ -414,7 +414,7 @@ jobs: run: echo "${WIX}bin" >> $GITHUB_PATH shell: bash - name: Download Windows Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Windows Installer ZIP - name: Create windows-msi diff --git a/.github/workflows/daily-build-2201.8.x.yml b/.github/workflows/daily-build-2201.8.x.yml index 694f0a0493..d3c2eb64ff 100644 --- a/.github/workflows/daily-build-2201.8.x.yml +++ b/.github/workflows/daily-build-2201.8.x.yml @@ -288,7 +288,7 @@ jobs: sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* - name: Download Ballerina rpm Installer - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Linux Installer rpm - name: Install Ballerina RPM @@ -317,7 +317,7 @@ jobs: with: ref: 2201.8.x - name: Download MacOS Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS Installer ZIP - name: Create macos-pkg @@ -367,7 +367,7 @@ jobs: distribution: 'temurin' java-version: '17.0.7' - name: Download MacOS-ARM Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS-ARM Installer ZIP - name: Create macos-arm-pkg @@ -414,7 +414,7 @@ jobs: run: echo "${WIX}bin" >> $GITHUB_PATH shell: bash - name: Download Windows Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Windows Installer ZIP - name: Create windows-msi diff --git a/.github/workflows/daily-build-2201.9.x.yml b/.github/workflows/daily-build-2201.9.x.yml index 9c96b55bd6..9347efa031 100644 --- a/.github/workflows/daily-build-2201.9.x.yml +++ b/.github/workflows/daily-build-2201.9.x.yml @@ -288,7 +288,7 @@ jobs: sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* - name: Download Ballerina rpm Installer - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Linux Installer rpm - name: Install Ballerina RPM @@ -317,7 +317,7 @@ jobs: with: ref: 2201.9.x - name: Download MacOS Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS Installer ZIP - name: Create macos-pkg @@ -367,7 +367,7 @@ jobs: distribution: 'temurin' java-version: '17.0.7' - name: Download MacOS-ARM Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS-ARM Installer ZIP - name: Create macos-arm-pkg @@ -414,7 +414,7 @@ jobs: run: echo "${WIX}bin" >> $GITHUB_PATH shell: bash - name: Download Windows Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Windows Installer ZIP - name: Create windows-msi diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index a2f2e806dc..804ca5b392 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -283,7 +283,7 @@ jobs: sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* - name: Download Ballerina rpm Installer - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Linux Installer rpm - name: Install Ballerina RPM @@ -315,7 +315,7 @@ jobs: distribution: 'temurin' java-version: '17.0.7' - name: Download MacOS Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS Installer ZIP - name: Create macos-pkg @@ -365,7 +365,7 @@ jobs: distribution: 'temurin' java-version: '17.0.7' - name: Download MacOS-ARM Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: MacOS-ARM Installer ZIP - name: Create macos-arm-pkg @@ -410,7 +410,7 @@ jobs: run: echo "${WIX}bin" >> $GITHUB_PATH shell: bash - name: Download Windows Intaller Zip - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Windows Installer ZIP - name: Create windows-msi From 0ef5fc1338871c871afc3824037c4a3fbd34c2ff Mon Sep 17 00:00:00 2001 From: Sasindu Alahakoon Date: Wed, 11 Sep 2024 14:52:40 +0530 Subject: [PATCH 14/16] Fix reference link in json type BBE --- examples/json-type/json_type.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/json-type/json_type.md b/examples/json-type/json_type.md index 846771c539..54431cce7a 100644 --- a/examples/json-type/json_type.md +++ b/examples/json-type/json_type.md @@ -10,7 +10,7 @@ The `json` type can be explained as a union of the simple basic types, `string`, ## Related links - [Access JSON elements](/learn/by-example/access-json-elements/) -- [Converting from JSON to user defined type with langlib functions](/learn/by-example/converting-from-json-to-user-defined-type-with-langlib-functions/) +- [Convert from JSON to user-defined type](/learn/by-example/convert-from-json-to-user-defined-type/) - [Converting from user-defined type to JSON](/learn/by-example/converting-from-user-defined-type-to-json/) - [fromJsonString](https://lib.ballerina.io/ballerina/lang.value/0.0.0#fromJsonString) - [cloneWithType](https://lib.ballerina.io/ballerina/lang.value/0.0.0#cloneWithType) \ No newline at end of file From fcd131b95ff1a925a8bfb7de3dbe1764cda97e11 Mon Sep 17 00:00:00 2001 From: Sasindu Alahakoon Date: Wed, 11 Sep 2024 14:57:43 +0530 Subject: [PATCH 15/16] Fix the udt to json reference link in json type be --- examples/json-type/json_type.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/json-type/json_type.md b/examples/json-type/json_type.md index 54431cce7a..cc7b323ca9 100644 --- a/examples/json-type/json_type.md +++ b/examples/json-type/json_type.md @@ -11,6 +11,6 @@ The `json` type can be explained as a union of the simple basic types, `string`, ## Related links - [Access JSON elements](/learn/by-example/access-json-elements/) - [Convert from JSON to user-defined type](/learn/by-example/convert-from-json-to-user-defined-type/) -- [Converting from user-defined type to JSON](/learn/by-example/converting-from-user-defined-type-to-json/) +- [Convert from user-defined type to JSON](/learn/by-example/converting-from-user-defined-type-to-json/) - [fromJsonString](https://lib.ballerina.io/ballerina/lang.value/0.0.0#fromJsonString) - [cloneWithType](https://lib.ballerina.io/ballerina/lang.value/0.0.0#cloneWithType) \ No newline at end of file From 80d1dcab44430c9eb4b380b0183367684b8492b9 Mon Sep 17 00:00:00 2001 From: LakshanWeerasinghe Date: Wed, 18 Sep 2024 16:35:32 +0530 Subject: [PATCH 16/16] Update ballerina versions --- ballerina-test-automation/gradle.properties | 4 ++-- gradle.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ballerina-test-automation/gradle.properties b/ballerina-test-automation/gradle.properties index d0aa1e04a5..c3e444e3d0 100644 --- a/ballerina-test-automation/gradle.properties +++ b/ballerina-test-automation/gradle.properties @@ -1,6 +1,6 @@ -swan-lake-latest-version=swan-lake-2201.10.1 +swan-lake-latest-version=swan-lake-2201.11.0 swan-lake-latest-spec-version=2024R1 -swan-lake-latest-version-display-text=2201.10.1 +swan-lake-latest-version-display-text=2201.11.0 swan-lake-latest-tool-version=1.4.3 latest-tool-version=1.4.3 1-x-channel-latest-version=1.2.13 diff --git a/gradle.properties b/gradle.properties index cf8be314b6..8a4fac91f1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.caching=true group=org.ballerinalang # During the release workflow, the following will get bumped automatically -version=2201.10.1-SNAPSHOT +version=2201.11.0-SNAPSHOT codeName=swan-lake ballerinaLangVersion=2201.10.0