From 2e019145fd76a8218eec45e210a4238a50ee84bf Mon Sep 17 00:00:00 2001 From: Gayal Dassanayake Date: Wed, 14 Aug 2024 11:02:40 +0530 Subject: [PATCH] Push tools before pulling and testing --- .../org/ballerina/projectapi/BalToolTest.java | 604 +++++++++++------- .../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, 901 insertions(+), 217 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..d153916f62 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")); + 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")); + 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")); + 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")); + 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")); + 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")); + 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); + 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")); + 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")); + 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")); + 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")); + 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()); + 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); + 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")); + 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")); + 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")); + 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")); + 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")); + 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")); + 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")); + 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,22 +1027,155 @@ private void setToolEnvironmentsForSubCommands() { toolEnvironment -> toolEnvironment.subCommand, toolEnvironment -> toolEnvironment)); } - private Pair executeHelpFlagOfTool(String toolId, Map envVariables) - throws IOException, InterruptedException { - Process cmdExec = executeCommand(toolId, DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, - new ArrayList<>(List.of("--help")), envVariables); - String cmdErrors = getString(cmdExec.getErrorStream()); - String cmdOutput = getString(cmdExec.getInputStream()); - return Pair.of(cmdErrors, cmdOutput); - } - - private ToolEnvironment getToolEnvironment(ToolSubCommand subCommand) throws IOException { + 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 ToolEnvironment(subCommand, envVariables, balToolsTomlPath, centralCachePath); + 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(Map envVariables) + throws IOException, InterruptedException { + Process cmdExec = executeCommand(TOOL_ID, DISTRIBUTION_FILE_NAME, tempWorkspaceDirectory, + new ArrayList<>(List.of("--help")), envVariables); + String cmdErrors = getString(cmdExec.getErrorStream()); + String cmdOutput = getString(cmdExec.getInputStream()); + return Pair.of(cmdErrors, cmdOutput); } static class ToolEnvironment { 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%9C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DoIR9Iea+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`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xHnYb3g-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#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