From a6afb8987642ec0461a228887ecd0f01a18a3881 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Wed, 22 Sep 2021 09:44:17 +0300 Subject: [PATCH 01/29] fix archive name --- Tasks/JavaToolInstallerV0/javatoolinstaller.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index 0900e964b869..755578d94703 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -62,7 +62,8 @@ async function getJava(versionSpec: string, jdkArchitectureOption: string): Prom taskLib.getInput('azureStorageAccountName', true), taskLib.getInput('azureContainerName', true), ""); await azureDownloader.downloadArtifacts(extractLocation, '*' + fileNameAndPath); await taskutils.sleepFor(250); //Wait for the file to be released before extracting it. - jdkFileName = path.join(extractLocation, fileNameAndPath); + let jdkArchiveName = fileNameAndPath.slice(fileNameAndPath.lastIndexOf('/')+1); + jdkFileName = path.join(extractLocation, jdkArchiveName); } else { // get from local directory console.log(taskLib.loc('RetrievingJdkFromLocalPath')); From 4f9befac3659e72c92f20a0048f35f0d231e0e62 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Wed, 22 Sep 2021 10:10:39 +0300 Subject: [PATCH 02/29] fix spaces --- Tasks/JavaToolInstallerV0/javatoolinstaller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index 755578d94703..93640968c89f 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -62,7 +62,7 @@ async function getJava(versionSpec: string, jdkArchitectureOption: string): Prom taskLib.getInput('azureStorageAccountName', true), taskLib.getInput('azureContainerName', true), ""); await azureDownloader.downloadArtifacts(extractLocation, '*' + fileNameAndPath); await taskutils.sleepFor(250); //Wait for the file to be released before extracting it. - let jdkArchiveName = fileNameAndPath.slice(fileNameAndPath.lastIndexOf('/')+1); + let jdkArchiveName = fileNameAndPath.slice(fileNameAndPath.lastIndexOf('/') + 1); jdkFileName = path.join(extractLocation, jdkArchiveName); } else { // get from local directory From 53838af29d3de7b1585a755c110bdd1df26d350f Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Wed, 22 Sep 2021 10:49:29 +0300 Subject: [PATCH 03/29] bump version --- Tasks/JavaToolInstallerV0/task.json | 2 +- Tasks/JavaToolInstallerV0/task.loc.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/task.json b/Tasks/JavaToolInstallerV0/task.json index c7e7d7528e9e..a76e99af790f 100644 --- a/Tasks/JavaToolInstallerV0/task.json +++ b/Tasks/JavaToolInstallerV0/task.json @@ -13,7 +13,7 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 193, + "Minor": 194, "Patch": 0 }, "satisfies": [ diff --git a/Tasks/JavaToolInstallerV0/task.loc.json b/Tasks/JavaToolInstallerV0/task.loc.json index 22bbecdccb77..8ade78ca572e 100644 --- a/Tasks/JavaToolInstallerV0/task.loc.json +++ b/Tasks/JavaToolInstallerV0/task.loc.json @@ -13,7 +13,7 @@ "author": "Microsoft Corporation", "version": { "Major": 0, - "Minor": 193, + "Minor": 194, "Patch": 0 }, "satisfies": [ From 6973facb1776830a5f8a1fad52879bc152d90e57 Mon Sep 17 00:00:00 2001 From: annaOpareva Date: Thu, 23 Sep 2021 18:15:02 +0300 Subject: [PATCH 04/29] fix path --- Tasks/JavaToolInstallerV0/javatoolinstaller.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index 93640968c89f..9f56e0d426af 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -62,7 +62,7 @@ async function getJava(versionSpec: string, jdkArchitectureOption: string): Prom taskLib.getInput('azureStorageAccountName', true), taskLib.getInput('azureContainerName', true), ""); await azureDownloader.downloadArtifacts(extractLocation, '*' + fileNameAndPath); await taskutils.sleepFor(250); //Wait for the file to be released before extracting it. - let jdkArchiveName = fileNameAndPath.slice(fileNameAndPath.lastIndexOf('/') + 1); + let jdkArchiveName = path.basename(fileNameAndPath); jdkFileName = path.join(extractLocation, jdkArchiveName); } else { // get from local directory @@ -171,6 +171,7 @@ async function unpackArchive(unpackDir: string, jdkFileName: string, fileExt: st /** * Get the path to a folder inside the VOLUMES_FOLDER. + * * Only for macOS. * @param volumes VOLUMES_FOLDER contents before attaching a disk image. * @returns string From eb5931df943a3617a27bbe79eab1229cfdcfd933 Mon Sep 17 00:00:00 2001 From: annaOpareva Date: Thu, 23 Sep 2021 19:47:32 +0300 Subject: [PATCH 05/29] add test --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 11 ++++ ...L0DownloadsJdkFromAzureStorageSubFolder.ts | 65 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 8d6e7be6a061..2959c7348b96 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -29,6 +29,17 @@ describe('JavaToolInstaller L0 Suite', function () { assert(testRunner.succeeded, 'task should have succeeded.'); }); + it('should run successfully when fetching JDK files from azure storage from subfolder', function () { + this.timeout(20000); + + const testPath: string = path.join(__dirname, 'L0DownloadArtifactsFromAzureStorageSubFolder.js'); + const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath); + + testRunner.run(); + + assert(testRunner.succeeded, 'task should have succeeded.'); + }); + it('should fail when JavaToolInstaller is run with to destination folder specified', function () { this.timeout(20000); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts new file mode 100644 index 000000000000..65e0c9c82980 --- /dev/null +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -0,0 +1,65 @@ +import ma = require('azure-pipelines-task-lib/mock-answer'); +import tmrm = require('azure-pipelines-task-lib/mock-run'); +import path = require('path'); +import mockTask = require('azure-pipelines-task-lib/mock-task'); + +const taskPath = path.join(__dirname, '..', 'javatoolinstaller.js'); +const tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); + +tr.setInput("versionSpec", "8.1"); +tr.setInput("jdkSourceOption", "AzureStorage") +tr.setInput("jdkArchitectureOption", "x64"); +tr.setInput("azureResourceManagerEndpoint", "ARM1"); +tr.setInput("azureStorageAccountName", "storage1"); +tr.setInput("azureContainerName", "container1"); +tr.setInput("azureCommonVirtualFile", "folder/JDKname"); +tr.setInput("jdkDestinationDirectory", "javaJDK"); +tr.setInput("cleanDestinationDirectory", "false"); + +process.env['ENDPOINT_URL_ID1'] = 'http://url'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_username'] = 'dummyusername'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_password'] = 'dummypassword'; +process.env['ENDPOINT_DATA_ID1_acceptUntrustedCerts'] = 'true'; + +process.env['ENDPOINT_URL_ARM1'] = 'http://url'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_serviceprincipalid'] = 'dummyid'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_serviceprincipalkey'] = 'dummykey'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_tenantid'] = 'dummyTenantid'; +process.env['ENDPOINT_DATA_ARM1_environmentAuthorityUrl'] = 'dummyurl'; +process.env['ENDPOINT_DATA_ARM1_activeDirectoryServiceEndpointResourceId'] = 'dummyResourceId'; +process.env['ENDPOINT_DATA_ARM1_subscriptionId'] = 'dummySubscriptionId'; + +tr.registerMock("azure-pipelines-tasks-azure-arm-rest/azure-arm-storage", { + StorageManagementClient: function (A, B) { + return { + storageAccounts: { + get: function (A) { + return { + properties: { + primaryEndpoints: { + blob: "primaryBlobUrl" + } + }, + id: "StorageAccountUrl" + } + }, + listkeys: function (A, B, C) { + return ["accesskey1", "accessKey2"]; + } + } + } + }, + StorageAccounts: { + getResourceGroupNameFromUri: function (A) { + return "storageAccountResouceGroupName"; + } + } +}); + +tr.registerMock("azure-pipelines-tasks-azure-arm-rest/azure-arm-common", { + ApplicationTokenCredentials: function(A,B,C,D,E,F,G) { + return {}; + } +}); + +tr.run(); From 3b3de49013cc8ac08c1f975dda40a67cfd89dac1 Mon Sep 17 00:00:00 2001 From: annaOpareva Date: Sun, 26 Sep 2021 13:02:58 +0300 Subject: [PATCH 06/29] fix path to tests --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 2959c7348b96..933266adf49f 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -21,22 +21,20 @@ describe('JavaToolInstaller L0 Suite', function () { it('should run successfully when fetching JDK files from azure storage', function () { this.timeout(20000); - const testPath: string = path.join(__dirname, 'L0DownloadArtifactsFromAzureStorage.js'); + const testPath: string = path.join(__dirname, 'L0DownloadsJdkFromAzureStorage.js'); const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath); testRunner.run(); - assert(testRunner.succeeded, 'task should have succeeded.'); }); it('should run successfully when fetching JDK files from azure storage from subfolder', function () { this.timeout(20000); - const testPath: string = path.join(__dirname, 'L0DownloadArtifactsFromAzureStorageSubFolder.js'); + const testPath: string = path.join(__dirname, 'L0DownloadsJdkFromAzureStorageSubFolder.js'); const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath); testRunner.run(); - assert(testRunner.succeeded, 'task should have succeeded.'); }); From be768cdc1b50c1581207b07c8aa339a6c1aca08f Mon Sep 17 00:00:00 2001 From: annaOpareva Date: Tue, 28 Sep 2021 10:22:33 +0300 Subject: [PATCH 07/29] tried fix test --- .../Tests/L0DownloadsJdkFromAzureStorage.ts | 17 ++++++++++++++--- .../L0DownloadsJdkFromAzureStorageSubFolder.ts | 18 ++++++++++++++++-- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index e82008057c4b..ab7cb964558c 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -12,16 +12,20 @@ tr.setInput("jdkArchitectureOption", "x64"); tr.setInput("azureResourceManagerEndpoint", "ARM1"); tr.setInput("azureStorageAccountName", "storage1"); tr.setInput("azureContainerName", "container1"); -tr.setInput("azureCommonVirtualFile", ""); +tr.setInput("azureCommonVirtualFile", "nameJDK"); tr.setInput("jdkDestinationDirectory", "javaJDK"); tr.setInput("cleanDestinationDirectory", "false"); +process.env['AGENT_TOOLSDIRECTORY'] = '/_work/_tool'; +process.env['AGENT_VERSION'] = '2.194.0'; + process.env['ENDPOINT_URL_ID1'] = 'http://url'; process.env['ENDPOINT_AUTH_PARAMETER_connection1_username'] = 'dummyusername'; process.env['ENDPOINT_AUTH_PARAMETER_connection1_password'] = 'dummypassword'; process.env['ENDPOINT_DATA_ID1_acceptUntrustedCerts'] = 'true'; process.env['ENDPOINT_URL_ARM1'] = 'http://url'; +process.env['ENDPOINT_DATA_ARM1_AUTH'] = 'data'; process.env['ENDPOINT_AUTH_PARAMETER_connection1_serviceprincipalid'] = 'dummyid'; process.env['ENDPOINT_AUTH_PARAMETER_connection1_serviceprincipalkey'] = 'dummykey'; process.env['ENDPOINT_AUTH_PARAMETER_connection1_tenantid'] = 'dummyTenantid'; @@ -29,7 +33,7 @@ process.env['ENDPOINT_DATA_ARM1_environmentAuthorityUrl'] = 'dummyurl'; process.env['ENDPOINT_DATA_ARM1_activeDirectoryServiceEndpointResourceId'] = 'dummyResourceId'; process.env['ENDPOINT_DATA_ARM1_subscriptionId'] = 'dummySubscriptionId'; -tr.registerMock("azure-pipelines-tasks-azure-arm-rest/azure-arm-storage", { +tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-storage", { StorageManagementClient: function (A, B) { return { storageAccounts: { @@ -56,10 +60,17 @@ tr.registerMock("azure-pipelines-tasks-azure-arm-rest/azure-arm-storage", { } }); -tr.registerMock("azure-pipelines-tasks-azure-arm-rest/azure-arm-common", { +tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-common", { ApplicationTokenCredentials: function(A,B,C,D,E,F,G) { return {}; } }); +const exist: ma.TaskLibAnswers = { + checkPath: { }, + find: { }, + rmRF: { }, +}; +tr.setAnswers(exist); + tr.run(); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index 65e0c9c82980..fe6144e5fe06 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -1,5 +1,6 @@ import ma = require('azure-pipelines-task-lib/mock-answer'); import tmrm = require('azure-pipelines-task-lib/mock-run'); +import msRestAzure = require('azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-common'); import path = require('path'); import mockTask = require('azure-pipelines-task-lib/mock-task'); @@ -16,6 +17,9 @@ tr.setInput("azureCommonVirtualFile", "folder/JDKname"); tr.setInput("jdkDestinationDirectory", "javaJDK"); tr.setInput("cleanDestinationDirectory", "false"); +process.env['AGENT_TOOLSDIRECTORY'] = '/tool'; +process.env['AGENT_VERSION'] = '2.194.0'; + process.env['ENDPOINT_URL_ID1'] = 'http://url'; process.env['ENDPOINT_AUTH_PARAMETER_connection1_username'] = 'dummyusername'; process.env['ENDPOINT_AUTH_PARAMETER_connection1_password'] = 'dummypassword'; @@ -29,7 +33,7 @@ process.env['ENDPOINT_DATA_ARM1_environmentAuthorityUrl'] = 'dummyurl'; process.env['ENDPOINT_DATA_ARM1_activeDirectoryServiceEndpointResourceId'] = 'dummyResourceId'; process.env['ENDPOINT_DATA_ARM1_subscriptionId'] = 'dummySubscriptionId'; -tr.registerMock("azure-pipelines-tasks-azure-arm-rest/azure-arm-storage", { +tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-storage", { StorageManagementClient: function (A, B) { return { storageAccounts: { @@ -56,10 +60,20 @@ tr.registerMock("azure-pipelines-tasks-azure-arm-rest/azure-arm-storage", { } }); -tr.registerMock("azure-pipelines-tasks-azure-arm-rest/azure-arm-common", { +tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-common", { ApplicationTokenCredentials: function(A,B,C,D,E,F,G) { return {}; } }); +const exist: ma.TaskLibAnswers = { +}; +tr.setAnswers(exist); + +tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ + _getARMCredentials: function(A,B,C,D,E,F,G) { + return {}; + } +}) + tr.run(); From bd970deb8307a38595be3b88f8da0852339a9218 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Tue, 28 Sep 2021 18:06:55 +0300 Subject: [PATCH 08/29] draft test --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 2 + ...L0DownloadsJdkFromAzureStorageSubFolder.ts | 41 ++++++++++++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 933266adf49f..1fb6726a4c50 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -35,6 +35,8 @@ describe('JavaToolInstaller L0 Suite', function () { const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath); testRunner.run(); + console.log(testRunner.stdout); + console.log(testRunner.stdOutContained('creating path: javaJDK')); assert(testRunner.succeeded, 'task should have succeeded.'); }); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index fe6144e5fe06..92e39f177efb 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -13,8 +13,8 @@ tr.setInput("jdkArchitectureOption", "x64"); tr.setInput("azureResourceManagerEndpoint", "ARM1"); tr.setInput("azureStorageAccountName", "storage1"); tr.setInput("azureContainerName", "container1"); -tr.setInput("azureCommonVirtualFile", "folder/JDKname"); -tr.setInput("jdkDestinationDirectory", "javaJDK"); +tr.setInput("azureCommonVirtualFile", "folder/JDKname.tar.gz"); +tr.setInput("jdkDestinationDirectory", "DestinationDirectory"); tr.setInput("cleanDestinationDirectory", "false"); process.env['AGENT_TOOLSDIRECTORY'] = '/tool'; @@ -66,13 +66,42 @@ tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-common", { } }); -const exist: ma.TaskLibAnswers = { +const a: ma.TaskLibAnswers = { + "exist": { + "DestinationDirectory": false, + '"\\tool\\Java\"': true, + }, + "stats": { + "DestinationDirectory\\JDKname.tar.gz": true, + }, + "find": { + "DestinationDirectory": ["answjavaJDK"], + }, }; -tr.setAnswers(exist); +tr.setAnswers(a); + + tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ - _getARMCredentials: function(A,B,C,D,E,F,G) { - return {}; + AzureStorageArtifactDownloader: function(A,B,C) { + return { + downloadArtifacts: function(A,B) { + return "pathFromDownloader"; + } + } + } +}) + +tr.registerMock('./FileExtractor/JavaFilesExtractor',{ + JavaFilesExtractor: function (){ + return{ + unzipJavaDownload: function(A,B,C) { + return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; + }, + getSupportedFileEnding:function(A) { + return '.tar.gz' + } + } } }) From 4a0cb9ddb1079a85412ae82566a20eba9fe34d4f Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Wed, 29 Sep 2021 09:32:19 +0300 Subject: [PATCH 09/29] fix test for download from azure --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 2 +- .../Tests/L0DownloadsJdkFromAzureStorage.ts | 43 +++++++++++++++---- ...L0DownloadsJdkFromAzureStorageSubFolder.ts | 21 +++------ 3 files changed, 42 insertions(+), 24 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 1fb6726a4c50..86b59d41a280 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -36,7 +36,7 @@ describe('JavaToolInstaller L0 Suite', function () { testRunner.run(); console.log(testRunner.stdout); - console.log(testRunner.stdOutContained('creating path: javaJDK')); + console.log(testRunner.stdOutContained('DestinationDirectory\\JDKname.tar.gz')); assert(testRunner.succeeded, 'task should have succeeded.'); }); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index ab7cb964558c..cdba4f426fae 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -1,5 +1,6 @@ import ma = require('azure-pipelines-task-lib/mock-answer'); import tmrm = require('azure-pipelines-task-lib/mock-run'); +import msRestAzure = require('azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-common'); import path = require('path'); import mockTask = require('azure-pipelines-task-lib/mock-task'); @@ -12,11 +13,11 @@ tr.setInput("jdkArchitectureOption", "x64"); tr.setInput("azureResourceManagerEndpoint", "ARM1"); tr.setInput("azureStorageAccountName", "storage1"); tr.setInput("azureContainerName", "container1"); -tr.setInput("azureCommonVirtualFile", "nameJDK"); -tr.setInput("jdkDestinationDirectory", "javaJDK"); +tr.setInput("azureCommonVirtualFile", "JDKname.tar.gz"); +tr.setInput("jdkDestinationDirectory", "DestinationDirectory"); tr.setInput("cleanDestinationDirectory", "false"); -process.env['AGENT_TOOLSDIRECTORY'] = '/_work/_tool'; +process.env['AGENT_TOOLSDIRECTORY'] = '/tool'; process.env['AGENT_VERSION'] = '2.194.0'; process.env['ENDPOINT_URL_ID1'] = 'http://url'; @@ -25,7 +26,6 @@ process.env['ENDPOINT_AUTH_PARAMETER_connection1_password'] = 'dummypassword'; process.env['ENDPOINT_DATA_ID1_acceptUntrustedCerts'] = 'true'; process.env['ENDPOINT_URL_ARM1'] = 'http://url'; -process.env['ENDPOINT_DATA_ARM1_AUTH'] = 'data'; process.env['ENDPOINT_AUTH_PARAMETER_connection1_serviceprincipalid'] = 'dummyid'; process.env['ENDPOINT_AUTH_PARAMETER_connection1_serviceprincipalkey'] = 'dummykey'; process.env['ENDPOINT_AUTH_PARAMETER_connection1_tenantid'] = 'dummyTenantid'; @@ -66,11 +66,36 @@ tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-common", { } }); -const exist: ma.TaskLibAnswers = { - checkPath: { }, - find: { }, - rmRF: { }, +const a: ma.TaskLibAnswers = { + "exist": { + "DestinationDirectory": false, + '"\\tool\\Java\"': true, + }, + "stats": { + "DestinationDirectory\\JDKname.tar.gz": true, + }, + "find": { + "DestinationDirectory": ["answjavaJDK"], + }, +}; +tr.setAnswers(a); + +tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ + AzureStorageArtifactDownloader: function(A,B,C) { + return { + downloadArtifacts: function(A,B) { + return "pathFromDownloader"; + } + } + } +}) + +const jfe = require('./FileExtractor/JavaFilesExtractor'); +const jfeClone = Object.assign({}, jfe); +jfeClone.unzipJavaDownload = function(variable: string) { + return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; }; -tr.setAnswers(exist); + +tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); tr.run(); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index 92e39f177efb..6a405d7dbbf8 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -80,8 +80,6 @@ const a: ma.TaskLibAnswers = { }; tr.setAnswers(a); - - tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ AzureStorageArtifactDownloader: function(A,B,C) { return { @@ -92,17 +90,12 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -tr.registerMock('./FileExtractor/JavaFilesExtractor',{ - JavaFilesExtractor: function (){ - return{ - unzipJavaDownload: function(A,B,C) { - return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; - }, - getSupportedFileEnding:function(A) { - return '.tar.gz' - } - } - } -}) +const jfe = require('./FileExtractor/JavaFilesExtractor'); +const jfeClone = Object.assign({}, jfe); +jfeClone.unzipJavaDownload = function(variable: string) { + return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; +}; + +tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); tr.run(); From 99675533f757d0d5fd3814533589e4b854113c73 Mon Sep 17 00:00:00 2001 From: annaOpareva Date: Wed, 29 Sep 2021 10:01:19 +0300 Subject: [PATCH 10/29] fix path --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 2 +- .../Tests/L0DownloadsJdkFromAzureStorage.ts | 2 +- .../Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 86b59d41a280..3d5aeb01adac 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -37,7 +37,7 @@ describe('JavaToolInstaller L0 Suite', function () { testRunner.run(); console.log(testRunner.stdout); console.log(testRunner.stdOutContained('DestinationDirectory\\JDKname.tar.gz')); - assert(testRunner.succeeded, 'task should have succeeded.'); + assert(testRunner.failed, 'task should have succeeded.'); }); it('should fail when JavaToolInstaller is run with to destination folder specified', function () { diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index cdba4f426fae..bf37c9bb7efe 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -90,7 +90,7 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -const jfe = require('./FileExtractor/JavaFilesExtractor'); +const jfe = require('./../FileExtractor/JavaFilesExtractor'); const jfeClone = Object.assign({}, jfe); jfeClone.unzipJavaDownload = function(variable: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index 6a405d7dbbf8..6d76ad7900bd 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -4,6 +4,7 @@ import msRestAzure = require('azure-pipelines-tasks-azure-arm-rest-v2/azure-arm- import path = require('path'); import mockTask = require('azure-pipelines-task-lib/mock-task'); + const taskPath = path.join(__dirname, '..', 'javatoolinstaller.js'); const tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); @@ -90,7 +91,7 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -const jfe = require('./FileExtractor/JavaFilesExtractor'); +const jfe = require('./../FileExtractor/JavaFilesExtractor'); const jfeClone = Object.assign({}, jfe); jfeClone.unzipJavaDownload = function(variable: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; From daec0765d849d0cf9091b31c46968b9061d1ac4a Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Wed, 29 Sep 2021 10:11:03 +0300 Subject: [PATCH 11/29] return path --- .../Tests/L0DownloadsJdkFromAzureStorage.ts | 2 +- .../Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index bf37c9bb7efe..cdba4f426fae 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -90,7 +90,7 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -const jfe = require('./../FileExtractor/JavaFilesExtractor'); +const jfe = require('./FileExtractor/JavaFilesExtractor'); const jfeClone = Object.assign({}, jfe); jfeClone.unzipJavaDownload = function(variable: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index 6d76ad7900bd..e25c639e9b7b 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -69,7 +69,7 @@ tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-common", { const a: ma.TaskLibAnswers = { "exist": { - "DestinationDirectory": false, + "DestinationDirectory": true, '"\\tool\\Java\"': true, }, "stats": { @@ -91,7 +91,7 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -const jfe = require('./../FileExtractor/JavaFilesExtractor'); +const jfe = require('./FileExtractor/JavaFilesExtractor'); const jfeClone = Object.assign({}, jfe); jfeClone.unzipJavaDownload = function(variable: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; From ded239ca02b3251088c69b7623c929f52945442d Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Wed, 29 Sep 2021 10:13:01 +0300 Subject: [PATCH 12/29] return path --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 3d5aeb01adac..86b59d41a280 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -37,7 +37,7 @@ describe('JavaToolInstaller L0 Suite', function () { testRunner.run(); console.log(testRunner.stdout); console.log(testRunner.stdOutContained('DestinationDirectory\\JDKname.tar.gz')); - assert(testRunner.failed, 'task should have succeeded.'); + assert(testRunner.succeeded, 'task should have succeeded.'); }); it('should fail when JavaToolInstaller is run with to destination folder specified', function () { From 149031f472dc2c3406342cfb545aab1d52828b31 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Wed, 29 Sep 2021 12:05:32 +0300 Subject: [PATCH 13/29] fix test for sub folder --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 4 ++-- .../Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts | 2 +- Tasks/JavaToolInstallerV0/javatoolinstaller.ts | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 86b59d41a280..6a36027f4790 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -36,8 +36,8 @@ describe('JavaToolInstaller L0 Suite', function () { testRunner.run(); console.log(testRunner.stdout); - console.log(testRunner.stdOutContained('DestinationDirectory\\JDKname.tar.gz')); - assert(testRunner.succeeded, 'task should have succeeded.'); + console.log(testRunner.stdOutContained('jdkArchiveName: DestinationDirectory\\JDKname.tar.gz')); + assert(testRunner.stdOutContained('jdkArchiveName: DestinationDirectory\\JDKname.tar.gz'), 'right destination directory'); }); it('should fail when JavaToolInstaller is run with to destination folder specified', function () { diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index e25c639e9b7b..ffe67612bbd4 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -69,7 +69,7 @@ tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-common", { const a: ma.TaskLibAnswers = { "exist": { - "DestinationDirectory": true, + "DestinationDirectory": false, '"\\tool\\Java\"': true, }, "stats": { diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index 9f56e0d426af..b5b4a9191281 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -64,6 +64,7 @@ async function getJava(versionSpec: string, jdkArchitectureOption: string): Prom await taskutils.sleepFor(250); //Wait for the file to be released before extracting it. let jdkArchiveName = path.basename(fileNameAndPath); jdkFileName = path.join(extractLocation, jdkArchiveName); + toolLib.debug(`jdkArchiveName: ${jdkFileName}`); } else { // get from local directory console.log(taskLib.loc('RetrievingJdkFromLocalPath')); From a7a62bf2192d0aa98c2255ed6cd79b0c6d90010f Mon Sep 17 00:00:00 2001 From: annaOpareva Date: Wed, 29 Sep 2021 13:40:03 +0300 Subject: [PATCH 14/29] try --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 1 + .../Tests/L0DownloadsJdkFromAzureStorage.ts | 4 ++-- .../Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 6a36027f4790..3a302fa3d91b 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -25,6 +25,7 @@ describe('JavaToolInstaller L0 Suite', function () { const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath); testRunner.run(); + console.log(testRunner.stdout); assert(testRunner.succeeded, 'task should have succeeded.'); }); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index cdba4f426fae..60e1c04b5fe6 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -90,12 +90,12 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -const jfe = require('./FileExtractor/JavaFilesExtractor'); +const jfe = require('./../FileExtractor/JavaFilesExtractor'); const jfeClone = Object.assign({}, jfe); jfeClone.unzipJavaDownload = function(variable: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; }; -tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); +tr.registerMock('./../FileExtractor/JavaFilesExtractor', jfeClone); tr.run(); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index ffe67612bbd4..12bc69368c61 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -91,12 +91,12 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -const jfe = require('./FileExtractor/JavaFilesExtractor'); +const jfe = require('./../FileExtractor/JavaFilesExtractor'); const jfeClone = Object.assign({}, jfe); jfeClone.unzipJavaDownload = function(variable: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; }; -tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); +tr.registerMock('./../FileExtractor/JavaFilesExtractor', jfeClone); tr.run(); From d2cebffac2329ae1aba372a1a123bb841e1a4891 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Wed, 29 Sep 2021 14:39:42 +0300 Subject: [PATCH 15/29] test --- .../FileExtractor/JavaFilesExtractor.ts | 1 + .../Tests/L0DownloadsJdkFromAzureStorage.ts | 12 +++++++++--- .../L0DownloadsJdkFromAzureStorageSubFolder.ts | 14 +++++++++----- Tasks/JavaToolInstallerV0/javatoolinstaller.ts | 6 +++++- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts b/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts index 7366eae151c9..a563b5a1338f 100644 --- a/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts +++ b/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts @@ -229,6 +229,7 @@ export class JavaFilesExtractor { } public async unzipJavaDownload(repoRoot: string, fileEnding: string, extractLocation: string): Promise { + console.log('+++++ inside unzipJavaDownload') this.destinationFolder = extractLocation; // Create the destination folder if it doesn't exist diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index 60e1c04b5fe6..6b040cbd869a 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -15,7 +15,7 @@ tr.setInput("azureStorageAccountName", "storage1"); tr.setInput("azureContainerName", "container1"); tr.setInput("azureCommonVirtualFile", "JDKname.tar.gz"); tr.setInput("jdkDestinationDirectory", "DestinationDirectory"); -tr.setInput("cleanDestinationDirectory", "false"); +tr.setInput("cleanDestinationDirectory", "true"); process.env['AGENT_TOOLSDIRECTORY'] = '/tool'; process.env['AGENT_VERSION'] = '2.194.0'; @@ -90,12 +90,18 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -const jfe = require('./../FileExtractor/JavaFilesExtractor'); +// const jfe = require('./../FileExtractor/JavaFilesExtractor'); +const jfe = require('./FileExtractor/JavaFilesExtractor'); const jfeClone = Object.assign({}, jfe); jfeClone.unzipJavaDownload = function(variable: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; }; -tr.registerMock('./../FileExtractor/JavaFilesExtractor', jfeClone); +jfeClone.setJavaHome = function(variable: string) { + return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz'; +}; + +// tr.registerMock('./../FileExtractor/JavaFilesExtractor', jfeClone); +tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); tr.run(); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index 12bc69368c61..ad97fa2592a5 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -16,7 +16,7 @@ tr.setInput("azureStorageAccountName", "storage1"); tr.setInput("azureContainerName", "container1"); tr.setInput("azureCommonVirtualFile", "folder/JDKname.tar.gz"); tr.setInput("jdkDestinationDirectory", "DestinationDirectory"); -tr.setInput("cleanDestinationDirectory", "false"); +tr.setInput("cleanDestinationDirectory", "true"); process.env['AGENT_TOOLSDIRECTORY'] = '/tool'; process.env['AGENT_VERSION'] = '2.194.0'; @@ -69,7 +69,7 @@ tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-common", { const a: ma.TaskLibAnswers = { "exist": { - "DestinationDirectory": false, + "DestinationDirectory": true, '"\\tool\\Java\"': true, }, "stats": { @@ -91,12 +91,16 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -const jfe = require('./../FileExtractor/JavaFilesExtractor'); +const jfe = require('./FileExtractor/JavaFilesExtractor'); const jfeClone = Object.assign({}, jfe); -jfeClone.unzipJavaDownload = function(variable: string) { +jfeClone.unzipJavaDownload = function(variable1: string, variable2: string, variable3: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; }; -tr.registerMock('./../FileExtractor/JavaFilesExtractor', jfeClone); +jfeClone.setJavaHome = function(variable: string) { + return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz'; +}; + +tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); tr.run(); diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index b5b4a9191281..1e4d133f3216 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -109,6 +109,7 @@ function cleanFolder(directory: string): boolean { * @returns string */ async function installJDK(sourceFile: string, fileExtension: string, archiveExtractLocation: string, extendedJavaHome: string, versionSpec: string, cleanDestinationDirectory: boolean): Promise { + console.log("+++++++++++++++ installJDK") let jdkDirectory: string; if (fileExtension === '.dmg' && os.platform() === 'darwin') { // Using set because 'includes' array method requires tsconfig option "lib": ["ES2017"] @@ -132,6 +133,7 @@ async function installJDK(sourceFile: string, fileExtension: string, archiveExtr else { const createExtractDirectory: boolean = taskLib.getBoolInput('createExtractDirectory', false); let extractionDirectory: string = ""; + if (createExtractDirectory) { const extractDirectoryName: string = `${extendedJavaHome}_${JavaFilesExtractor.getStrippedName(sourceFile)}_${fileExtension.substr(1)}`; extractionDirectory = path.join(archiveExtractLocation, extractDirectoryName); @@ -144,6 +146,7 @@ async function installJDK(sourceFile: string, fileExtension: string, archiveExtr extractionDirectory = path.normalize(archiveExtractLocation); } // unpack the archive, set `JAVA_HOME` and save it for further processing + console.log('++++++++ installJDK + before unpackArchive') await unpackArchive(extractionDirectory, sourceFile, fileExtension, cleanDestinationDirectory); jdkDirectory = JavaFilesExtractor.setJavaHome(extractionDirectory); } @@ -166,7 +169,8 @@ async function unpackArchive(unpackDir: string, jdkFileName: string, fileExt: st } else { // unpack files to specified directory console.log(taskLib.loc('ExtractingArchiveToPath', unpackDir)); - await javaFilesExtractor.unzipJavaDownload(jdkFileName, fileExt, unpackDir); + const temp = await javaFilesExtractor.unzipJavaDownload(jdkFileName, fileExt, unpackDir); + console.log('result mock', temp) } } From 1253ab572f7373f0e362ec9738781b8a30faedd0 Mon Sep 17 00:00:00 2001 From: annaOpareva Date: Wed, 29 Sep 2021 14:49:02 +0300 Subject: [PATCH 16/29] fix --- .../Tests/L0DownloadsJdkFromAzureStorage.ts | 6 ++---- .../Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index 6b040cbd869a..98447f22d3c7 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -90,8 +90,7 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -// const jfe = require('./../FileExtractor/JavaFilesExtractor'); -const jfe = require('./FileExtractor/JavaFilesExtractor'); +const jfe = require('./../FileExtractor/JavaFilesExtractor'); const jfeClone = Object.assign({}, jfe); jfeClone.unzipJavaDownload = function(variable: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; @@ -101,7 +100,6 @@ jfeClone.setJavaHome = function(variable: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz'; }; -// tr.registerMock('./../FileExtractor/JavaFilesExtractor', jfeClone); -tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); +tr.registerMock('./../FileExtractor/JavaFilesExtractor', jfeClone); tr.run(); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index ad97fa2592a5..6eefb5954b4f 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -91,7 +91,7 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -const jfe = require('./FileExtractor/JavaFilesExtractor'); +const jfe = require('./../FileExtractor/JavaFilesExtractor'); const jfeClone = Object.assign({}, jfe); jfeClone.unzipJavaDownload = function(variable1: string, variable2: string, variable3: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; @@ -101,6 +101,6 @@ jfeClone.setJavaHome = function(variable: string) { return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz'; }; -tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); +tr.registerMock('./../FileExtractor/JavaFilesExtractor', jfeClone); tr.run(); From 1a30cbdac8f7d40526f2910151134144c90eb2a9 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Wed, 29 Sep 2021 17:53:26 +0300 Subject: [PATCH 17/29] try billion times --- .../FileExtractor/JavaFilesExtractor.ts | 15 ++ .../Tests/L0DownloadsJdkFromAzureStorage.ts | 37 ++- ...L0DownloadsJdkFromAzureStorageSubFolder.ts | 20 +- .../Tests/package-lock.json | 243 +----------------- .../JavaToolInstallerV0/javatoolinstaller.ts | 3 +- 5 files changed, 65 insertions(+), 253 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts b/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts index a563b5a1338f..bb0e2883e49f 100644 --- a/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts +++ b/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts @@ -161,6 +161,8 @@ export class JavaFilesExtractor { * @param root - path to the directory we want to get the structure of */ public static sliceStructure(pathsArray: Array, root: string = pathsArray[0]): Array{ + console.log('//////// sliceStructure pathsArray',pathsArray) + console.log('//////// sliceStructure root',root) const dirPathLength = root.length; const structureObject: IDirectoriesDictionary = {}; for(let i = 0; i < pathsArray.length; i++){ @@ -173,6 +175,8 @@ export class JavaFilesExtractor { // Create the list of unique values structureObject[dirPathArray[0]] = null; } + + console.log('******************** sliceStructure', Object.keys(structureObject)) return Object.keys(structureObject); } @@ -191,10 +195,14 @@ export class JavaFilesExtractor { * @param pathToStructure - path to files extracted from the JDK archive */ public static getJavaHomeFromStructure(pathToStructure): string { + console.log('--------- getJavaHomeFromStructure ') const structure: Array = taskLib.find(pathToStructure); + console.log('--------- structure ', structure) const rootItemsArray: Array = JavaFilesExtractor.sliceStructure(structure); const rootDirectoriesArray: Array = new Array(); // it is allowed to have extra files in extraction directory, but we shouldn't have more than 1 directory here + + console.log('rootItemsArray ', rootItemsArray) rootItemsArray.forEach(rootItem => { if (fs.lstatSync(path.join(pathToStructure, rootItem)).isDirectory()) { rootDirectoriesArray.push(rootItem); @@ -202,15 +210,19 @@ export class JavaFilesExtractor { }); let jdkDirectory: string; + console.log('rootDirectoriesArray',rootDirectoriesArray) if (rootDirectoriesArray.find(dir => dir === BIN_FOLDER)){ + console.log('dddddd') jdkDirectory = pathToStructure; } else { + console.log('bbbbbb') jdkDirectory = path.join(pathToStructure, rootDirectoriesArray[0]); const ifBinExistsInside: boolean = fs.existsSync(path.join(jdkDirectory, BIN_FOLDER)); if (rootDirectoriesArray.length > 1 || !ifBinExistsInside){ throw new Error(taskLib.loc('WrongArchiveStructure')); } } + console.log('--------- getJavaHomeFromStructure ', jdkDirectory) return jdkDirectory; } @@ -251,7 +263,10 @@ export class JavaFilesExtractor { if (stats.isFile()) { await this.extractFiles(jdkFile, fileEnding); } + + console.log('********** before getJavaHomeFromStructure') const jdkDirectory: string = JavaFilesExtractor.getJavaHomeFromStructure(this.destinationFolder); + console.log('********** ',jdkDirectory) JavaFilesExtractor.unpackJars(jdkDirectory, path.join(jdkDirectory, BIN_FOLDER)); return jdkDirectory; } diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index 6b040cbd869a..ee92c812302a 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -15,7 +15,7 @@ tr.setInput("azureStorageAccountName", "storage1"); tr.setInput("azureContainerName", "container1"); tr.setInput("azureCommonVirtualFile", "JDKname.tar.gz"); tr.setInput("jdkDestinationDirectory", "DestinationDirectory"); -tr.setInput("cleanDestinationDirectory", "true"); +tr.setInput("cleanDestinationDirectory", "false"); process.env['AGENT_TOOLSDIRECTORY'] = '/tool'; process.env['AGENT_VERSION'] = '2.194.0'; @@ -75,7 +75,7 @@ const a: ma.TaskLibAnswers = { "DestinationDirectory\\JDKname.tar.gz": true, }, "find": { - "DestinationDirectory": ["answjavaJDK"], + "DestinationDirectory": ["rootJDK/", "rootJDK/secondlevelJDK2"], }, }; tr.setAnswers(a); @@ -90,18 +90,31 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -// const jfe = require('./../FileExtractor/JavaFilesExtractor'); -const jfe = require('./FileExtractor/JavaFilesExtractor'); -const jfeClone = Object.assign({}, jfe); -jfeClone.unzipJavaDownload = function(variable: string) { - return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; -}; +// // const jfe = require('./../FileExtractor/JavaFilesExtractor'); +// const jfe = require('./FileExtractor/JavaFilesExtractor'); +// const jfeClone = Object.assign({}, jfe); +// jfeClone.unzipJavaDownload = function(variable: string) { +// return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; +// }; + +// jfeClone.setJavaHome = function(variable: string) { +// return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz'; +// }; -jfeClone.setJavaHome = function(variable: string) { - return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz'; +// // tr.registerMock('./../FileExtractor/JavaFilesExtractor', jfeClone); +// tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); + +const mfs = require('fs') +const mfsClone = Object.assign({}, mfs); +mfsClone.isDirectory = function() { + return true; +}; +mfsClone.lstatSync = function(variable: string) { + return { + IsDirectory() {} + }; }; -// tr.registerMock('./../FileExtractor/JavaFilesExtractor', jfeClone); -tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); +tr.registerMock('fs', mfsClone); tr.run(); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index ad97fa2592a5..c481ea1d96ea 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -76,7 +76,7 @@ const a: ma.TaskLibAnswers = { "DestinationDirectory\\JDKname.tar.gz": true, }, "find": { - "DestinationDirectory": ["answjavaJDK"], + "DestinationDirectory": ["rootJDK", "rootJDK/secondlevelJDK2"], }, }; tr.setAnswers(a); @@ -91,16 +91,16 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -const jfe = require('./FileExtractor/JavaFilesExtractor'); -const jfeClone = Object.assign({}, jfe); -jfeClone.unzipJavaDownload = function(variable1: string, variable2: string, variable3: string) { - return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; -}; +// const jfe = require('./FileExtractor/JavaFilesExtractor'); +// const jfeClone = Object.assign({}, jfe); +// jfeClone.unzipJavaDownload = function(variable1: string, variable2: string, variable3: string) { +// return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; +// }; -jfeClone.setJavaHome = function(variable: string) { - return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz'; -}; +// jfeClone.setJavaHome = function(variable: string) { +// return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz'; +// }; -tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); +// tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); tr.run(); diff --git a/Tasks/JavaToolInstallerV0/Tests/package-lock.json b/Tasks/JavaToolInstallerV0/Tests/package-lock.json index 85ae602809a5..68efce07e850 100644 --- a/Tasks/JavaToolInstallerV0/Tests/package-lock.json +++ b/Tasks/JavaToolInstallerV0/Tests/package-lock.json @@ -1,225 +1,8 @@ { "name": "java-tool-installer", "version": "0.134.0", - "lockfileVersion": 2, + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "name": "java-tool-installer", - "version": "0.134.0", - "license": "MIT", - "dependencies": { - "@types/mocha": "5.2.5", - "mocha": "5.2.0" - } - }, - "node_modules/@types/mocha": { - "version": "5.2.5", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", - "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==" - }, - "node_modules/balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" - }, - "node_modules/commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "node_modules/debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "node_modules/glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dependencies": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "engines": { - "node": ">=4.x" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "engines": { - "node": ">=4" - } - }, - "node_modules/he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "bin": { - "he": "bin/he" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dependencies": { - "once": "1.4.0", - "wrappy": "1.0.2" - } - }, - "node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dependencies": { - "brace-expansion": "1.1.11" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" - }, - "node_modules/mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dependencies": { - "minimist": "0.0.8" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", - "dependencies": { - "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.5", - "he": "1.1.1", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dependencies": { - "wrappy": "1.0.2" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dependencies": { - "has-flag": "3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - } - }, "dependencies": { "@types/mocha": { "version": "5.2.5", @@ -236,7 +19,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -283,12 +66,12 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "growl": { @@ -311,8 +94,8 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -325,7 +108,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -369,7 +152,7 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "path-is-absolute": { @@ -382,7 +165,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "requires": { - "has-flag": "3.0.0" + "has-flag": "^3.0.0" } }, "wrappy": { diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index 1e4d133f3216..d0197b8b0240 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -169,8 +169,9 @@ async function unpackArchive(unpackDir: string, jdkFileName: string, fileExt: st } else { // unpack files to specified directory console.log(taskLib.loc('ExtractingArchiveToPath', unpackDir)); + console.log('++++++++ unpackArchive, second conduction') const temp = await javaFilesExtractor.unzipJavaDownload(jdkFileName, fileExt, unpackDir); - console.log('result mock', temp) + } } From 1ce02aeb36482330dafd6d8432d0ac788ffb8ca0 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Thu, 30 Sep 2021 11:51:19 +0300 Subject: [PATCH 18/29] add test --- .../FileExtractor/JavaFilesExtractor.ts | 17 +----- Tasks/JavaToolInstallerV0/Tests/L0.ts | 8 +-- .../Tests/L0DownloadsJdkFromAzureStorage.ts | 56 +++++++++--------- ...L0DownloadsJdkFromAzureStorageSubFolder.ts | 59 +++++++++++-------- .../JavaToolInstallerV0/javatoolinstaller.ts | 4 -- 5 files changed, 69 insertions(+), 75 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts b/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts index bb0e2883e49f..8684c6cb5149 100644 --- a/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts +++ b/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts @@ -152,7 +152,7 @@ export class JavaFilesExtractor { const name = path.join(p.dir, p.name); taskLib.execSync(path.join(javaBinPath, toolName), `${args} "${name}.pack" "${name}.jar"`); } - } + } } /** @@ -161,8 +161,6 @@ export class JavaFilesExtractor { * @param root - path to the directory we want to get the structure of */ public static sliceStructure(pathsArray: Array, root: string = pathsArray[0]): Array{ - console.log('//////// sliceStructure pathsArray',pathsArray) - console.log('//////// sliceStructure root',root) const dirPathLength = root.length; const structureObject: IDirectoriesDictionary = {}; for(let i = 0; i < pathsArray.length; i++){ @@ -176,7 +174,6 @@ export class JavaFilesExtractor { structureObject[dirPathArray[0]] = null; } - console.log('******************** sliceStructure', Object.keys(structureObject)) return Object.keys(structureObject); } @@ -195,14 +192,11 @@ export class JavaFilesExtractor { * @param pathToStructure - path to files extracted from the JDK archive */ public static getJavaHomeFromStructure(pathToStructure): string { - console.log('--------- getJavaHomeFromStructure ') const structure: Array = taskLib.find(pathToStructure); - console.log('--------- structure ', structure) const rootItemsArray: Array = JavaFilesExtractor.sliceStructure(structure); const rootDirectoriesArray: Array = new Array(); // it is allowed to have extra files in extraction directory, but we shouldn't have more than 1 directory here - console.log('rootItemsArray ', rootItemsArray) rootItemsArray.forEach(rootItem => { if (fs.lstatSync(path.join(pathToStructure, rootItem)).isDirectory()) { rootDirectoriesArray.push(rootItem); @@ -210,19 +204,15 @@ export class JavaFilesExtractor { }); let jdkDirectory: string; - console.log('rootDirectoriesArray',rootDirectoriesArray) if (rootDirectoriesArray.find(dir => dir === BIN_FOLDER)){ - console.log('dddddd') jdkDirectory = pathToStructure; } else { - console.log('bbbbbb') jdkDirectory = path.join(pathToStructure, rootDirectoriesArray[0]); const ifBinExistsInside: boolean = fs.existsSync(path.join(jdkDirectory, BIN_FOLDER)); if (rootDirectoriesArray.length > 1 || !ifBinExistsInside){ throw new Error(taskLib.loc('WrongArchiveStructure')); } } - console.log('--------- getJavaHomeFromStructure ', jdkDirectory) return jdkDirectory; } @@ -235,13 +225,12 @@ export class JavaFilesExtractor { let jdkDirectory: string = withValidation ? JavaFilesExtractor.getJavaHomeFromStructure(pathToExtractedJDK) : pathToExtractedJDK; - console.log(taskLib.loc('SetJavaHome', jdkDirectory)); taskLib.setVariable('JAVA_HOME', jdkDirectory); return jdkDirectory; } public async unzipJavaDownload(repoRoot: string, fileEnding: string, extractLocation: string): Promise { - console.log('+++++ inside unzipJavaDownload') + this.destinationFolder = extractLocation; // Create the destination folder if it doesn't exist @@ -264,9 +253,7 @@ export class JavaFilesExtractor { await this.extractFiles(jdkFile, fileEnding); } - console.log('********** before getJavaHomeFromStructure') const jdkDirectory: string = JavaFilesExtractor.getJavaHomeFromStructure(this.destinationFolder); - console.log('********** ',jdkDirectory) JavaFilesExtractor.unpackJars(jdkDirectory, path.join(jdkDirectory, BIN_FOLDER)); return jdkDirectory; } diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 3a302fa3d91b..1b9f343c7ea2 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -25,7 +25,7 @@ describe('JavaToolInstaller L0 Suite', function () { const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath); testRunner.run(); - console.log(testRunner.stdout); + console.log(testRunner.stdout) assert(testRunner.succeeded, 'task should have succeeded.'); }); @@ -36,9 +36,9 @@ describe('JavaToolInstaller L0 Suite', function () { const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath); testRunner.run(); - console.log(testRunner.stdout); - console.log(testRunner.stdOutContained('jdkArchiveName: DestinationDirectory\\JDKname.tar.gz')); - assert(testRunner.stdOutContained('jdkArchiveName: DestinationDirectory\\JDKname.tar.gz'), 'right destination directory'); + console.log(testRunner.stdout) + assert(testRunner.stdOutContained('jdkArchiveName: DestinationDirectory\\JDKname.tar.gz'), 'JDK archive should unpack in the right destination directory'); + assert(testRunner.succeeded, 'task should have succeeded.'); }); it('should fail when JavaToolInstaller is run with to destination folder specified', function () { diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index ee92c812302a..9fcdd89a2afd 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -33,6 +33,17 @@ process.env['ENDPOINT_DATA_ARM1_environmentAuthorityUrl'] = 'dummyurl'; process.env['ENDPOINT_DATA_ARM1_activeDirectoryServiceEndpointResourceId'] = 'dummyResourceId'; process.env['ENDPOINT_DATA_ARM1_subscriptionId'] = 'dummySubscriptionId'; +const a: ma.TaskLibAnswers = { + "stats": { + "DestinationDirectory\\JDKname.tar.gz": true, + }, + "find": { + "DestinationDirectory": ["rootJDK/", "rootJDK/secondlevelJDK2"], + }, +}; + +tr.setAnswers(a); + tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-storage", { StorageManagementClient: function (A, B) { return { @@ -66,20 +77,6 @@ tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-common", { } }); -const a: ma.TaskLibAnswers = { - "exist": { - "DestinationDirectory": false, - '"\\tool\\Java\"': true, - }, - "stats": { - "DestinationDirectory\\JDKname.tar.gz": true, - }, - "find": { - "DestinationDirectory": ["rootJDK/", "rootJDK/secondlevelJDK2"], - }, -}; -tr.setAnswers(a); - tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ AzureStorageArtifactDownloader: function(A,B,C) { return { @@ -90,31 +87,32 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -// // const jfe = require('./../FileExtractor/JavaFilesExtractor'); -// const jfe = require('./FileExtractor/JavaFilesExtractor'); -// const jfeClone = Object.assign({}, jfe); -// jfeClone.unzipJavaDownload = function(variable: string) { -// return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; -// }; +const mtl = require("azure-pipelines-tool-lib/tool") +const mtlClone = Object.assign({}, mtl); -// jfeClone.setJavaHome = function(variable: string) { -// return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz'; -// }; +mtlClone.prependPath = function(variable1: string, variable2: string) { + return {}; +}; -// // tr.registerMock('./../FileExtractor/JavaFilesExtractor', jfeClone); -// tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); +tr.registerMock("azure-pipelines-tool-lib/tool", mtlClone); const mfs = require('fs') const mfsClone = Object.assign({}, mfs); -mfsClone.isDirectory = function() { - return true; -}; + mfsClone.lstatSync = function(variable: string) { return { - IsDirectory() {} + isDirectory: function() { + return true; + } }; }; +mfsClone.existsSync = function (variable: string) { + if (variable === "DestinationDirectory\\econdlevelJDK2") { + return false; + } else return true; +} + tr.registerMock('fs', mfsClone); tr.run(); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index c481ea1d96ea..01d8b656ad07 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -34,6 +34,17 @@ process.env['ENDPOINT_DATA_ARM1_environmentAuthorityUrl'] = 'dummyurl'; process.env['ENDPOINT_DATA_ARM1_activeDirectoryServiceEndpointResourceId'] = 'dummyResourceId'; process.env['ENDPOINT_DATA_ARM1_subscriptionId'] = 'dummySubscriptionId'; +const a: ma.TaskLibAnswers = { + "stats": { + "DestinationDirectory\\JDKname.tar.gz": true, + }, + "find": { + "DestinationDirectory": ["rootJDK/", "rootJDK/secondlevelJDK2"], + }, +}; + +tr.setAnswers(a); + tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-storage", { StorageManagementClient: function (A, B) { return { @@ -67,20 +78,6 @@ tr.registerMock("azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-common", { } }); -const a: ma.TaskLibAnswers = { - "exist": { - "DestinationDirectory": true, - '"\\tool\\Java\"': true, - }, - "stats": { - "DestinationDirectory\\JDKname.tar.gz": true, - }, - "find": { - "DestinationDirectory": ["rootJDK", "rootJDK/secondlevelJDK2"], - }, -}; -tr.setAnswers(a); - tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ AzureStorageArtifactDownloader: function(A,B,C) { return { @@ -91,16 +88,32 @@ tr.registerMock('./AzureStorageArtifacts/AzureStorageArtifactDownloader',{ } }) -// const jfe = require('./FileExtractor/JavaFilesExtractor'); -// const jfeClone = Object.assign({}, jfe); -// jfeClone.unzipJavaDownload = function(variable1: string, variable2: string, variable3: string) { -// return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz/JDKname'; -// }; +const mtl = require("azure-pipelines-tool-lib/tool") +const mtlClone = Object.assign({}, mtl); + +mtlClone.prependPath = function(variable1: string, variable2: string) { + return {}; +}; + +tr.registerMock("azure-pipelines-tool-lib/tool", mtlClone); + +const mfs = require('fs') +const mfsClone = Object.assign({}, mfs); + +mfsClone.lstatSync = function(variable: string) { + return { + isDirectory: function() { + return true; + } + }; +}; -// jfeClone.setJavaHome = function(variable: string) { -// return 'DestinationDirectory/JAVA_HOME_11_X64_JDKname_tar.gz'; -// }; +mfsClone.existsSync = function (variable: string) { + if (variable === "DestinationDirectory\\econdlevelJDK2") { + return false; + } else return true; +} -// tr.registerMock('./FileExtractor/JavaFilesExtractor', jfeClone); +tr.registerMock('fs', mfsClone); tr.run(); diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index d0197b8b0240..35f698d21224 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -109,7 +109,6 @@ function cleanFolder(directory: string): boolean { * @returns string */ async function installJDK(sourceFile: string, fileExtension: string, archiveExtractLocation: string, extendedJavaHome: string, versionSpec: string, cleanDestinationDirectory: boolean): Promise { - console.log("+++++++++++++++ installJDK") let jdkDirectory: string; if (fileExtension === '.dmg' && os.platform() === 'darwin') { // Using set because 'includes' array method requires tsconfig option "lib": ["ES2017"] @@ -146,7 +145,6 @@ async function installJDK(sourceFile: string, fileExtension: string, archiveExtr extractionDirectory = path.normalize(archiveExtractLocation); } // unpack the archive, set `JAVA_HOME` and save it for further processing - console.log('++++++++ installJDK + before unpackArchive') await unpackArchive(extractionDirectory, sourceFile, fileExtension, cleanDestinationDirectory); jdkDirectory = JavaFilesExtractor.setJavaHome(extractionDirectory); } @@ -165,11 +163,9 @@ async function unpackArchive(unpackDir: string, jdkFileName: string, fileExt: st const javaFilesExtractor = new JavaFilesExtractor(); if (!cleanDestinationDirectory && taskLib.exist(unpackDir)) { // do nothing since the files were extracted and ready for using - console.log(taskLib.loc('ArchiveWasExtractedEarlier')); } else { // unpack files to specified directory console.log(taskLib.loc('ExtractingArchiveToPath', unpackDir)); - console.log('++++++++ unpackArchive, second conduction') const temp = await javaFilesExtractor.unzipJavaDownload(jdkFileName, fileExt, unpackDir); } From e55c754a1fabd3384ca456788da29fddc9476cdc Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Thu, 30 Sep 2021 12:35:02 +0300 Subject: [PATCH 19/29] fix format --- .../FileExtractor/JavaFilesExtractor.ts | 5 +---- Tasks/JavaToolInstallerV0/javatoolinstaller.ts | 8 +++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts b/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts index 8684c6cb5149..021b1f41d134 100644 --- a/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts +++ b/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts @@ -173,7 +173,6 @@ export class JavaFilesExtractor { // Create the list of unique values structureObject[dirPathArray[0]] = null; } - return Object.keys(structureObject); } @@ -196,7 +195,6 @@ export class JavaFilesExtractor { const rootItemsArray: Array = JavaFilesExtractor.sliceStructure(structure); const rootDirectoriesArray: Array = new Array(); // it is allowed to have extra files in extraction directory, but we shouldn't have more than 1 directory here - rootItemsArray.forEach(rootItem => { if (fs.lstatSync(path.join(pathToStructure, rootItem)).isDirectory()) { rootDirectoriesArray.push(rootItem); @@ -225,12 +223,12 @@ export class JavaFilesExtractor { let jdkDirectory: string = withValidation ? JavaFilesExtractor.getJavaHomeFromStructure(pathToExtractedJDK) : pathToExtractedJDK; + console.log(taskLib.loc('SetJavaHome', jdkDirectory)); taskLib.setVariable('JAVA_HOME', jdkDirectory); return jdkDirectory; } public async unzipJavaDownload(repoRoot: string, fileEnding: string, extractLocation: string): Promise { - this.destinationFolder = extractLocation; // Create the destination folder if it doesn't exist @@ -252,7 +250,6 @@ export class JavaFilesExtractor { if (stats.isFile()) { await this.extractFiles(jdkFile, fileEnding); } - const jdkDirectory: string = JavaFilesExtractor.getJavaHomeFromStructure(this.destinationFolder); JavaFilesExtractor.unpackJars(jdkDirectory, path.join(jdkDirectory, BIN_FOLDER)); return jdkDirectory; diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index 35f698d21224..f51a5deb0417 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -132,7 +132,6 @@ async function installJDK(sourceFile: string, fileExtension: string, archiveExtr else { const createExtractDirectory: boolean = taskLib.getBoolInput('createExtractDirectory', false); let extractionDirectory: string = ""; - if (createExtractDirectory) { const extractDirectoryName: string = `${extendedJavaHome}_${JavaFilesExtractor.getStrippedName(sourceFile)}_${fileExtension.substr(1)}`; extractionDirectory = path.join(archiveExtractLocation, extractDirectoryName); @@ -163,17 +162,16 @@ async function unpackArchive(unpackDir: string, jdkFileName: string, fileExt: st const javaFilesExtractor = new JavaFilesExtractor(); if (!cleanDestinationDirectory && taskLib.exist(unpackDir)) { // do nothing since the files were extracted and ready for using + console.log(taskLib.loc('ArchiveWasExtractedEarlier')); } else { // unpack files to specified directory console.log(taskLib.loc('ExtractingArchiveToPath', unpackDir)); - const temp = await javaFilesExtractor.unzipJavaDownload(jdkFileName, fileExt, unpackDir); - + await javaFilesExtractor.unzipJavaDownload(jdkFileName, fileExt, unpackDir); } } /** - * Get the path to a folder inside the VOLUMES_FOLDER. - * + * Get the path to a folder inside the VOLUMES_FOLDER. * * Only for macOS. * @param volumes VOLUMES_FOLDER contents before attaching a disk image. * @returns string From a41cf030d609b91c09c8c286a3fd735f97694e63 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Thu, 30 Sep 2021 12:45:10 +0300 Subject: [PATCH 20/29] fix format --- .../FileExtractor/JavaFilesExtractor.ts | 2 +- Tasks/JavaToolInstallerV0/Tests/L0.ts | 4 +- .../Tests/package-lock.json | 245 +++++++++++++++++- 3 files changed, 234 insertions(+), 17 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts b/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts index 021b1f41d134..7366eae151c9 100644 --- a/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts +++ b/Tasks/JavaToolInstallerV0/FileExtractor/JavaFilesExtractor.ts @@ -152,7 +152,7 @@ export class JavaFilesExtractor { const name = path.join(p.dir, p.name); taskLib.execSync(path.join(javaBinPath, toolName), `${args} "${name}.pack" "${name}.jar"`); } - } + } } /** diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 1b9f343c7ea2..6b65cd2de124 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -25,7 +25,7 @@ describe('JavaToolInstaller L0 Suite', function () { const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath); testRunner.run(); - console.log(testRunner.stdout) + assert(testRunner.succeeded, 'task should have succeeded.'); }); @@ -36,7 +36,7 @@ describe('JavaToolInstaller L0 Suite', function () { const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath); testRunner.run(); - console.log(testRunner.stdout) + assert(testRunner.stdOutContained('jdkArchiveName: DestinationDirectory\\JDKname.tar.gz'), 'JDK archive should unpack in the right destination directory'); assert(testRunner.succeeded, 'task should have succeeded.'); }); diff --git a/Tasks/JavaToolInstallerV0/Tests/package-lock.json b/Tasks/JavaToolInstallerV0/Tests/package-lock.json index 68efce07e850..434f2647a85f 100644 --- a/Tasks/JavaToolInstallerV0/Tests/package-lock.json +++ b/Tasks/JavaToolInstallerV0/Tests/package-lock.json @@ -1,8 +1,225 @@ { "name": "java-tool-installer", "version": "0.134.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "java-tool-installer", + "version": "0.134.0", + "license": "MIT", + "dependencies": { + "@types/mocha": "5.2.5", + "mocha": "5.2.0" + } + }, + "node_modules/@types/mocha": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", + "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==" + }, + "node_modules/balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" + }, + "node_modules/commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "node_modules/debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "node_modules/glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dependencies": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "engines": { + "node": ">=4.x" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "engines": { + "node": ">=4" + } + }, + "node_modules/he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "bin": { + "he": "bin/he" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dependencies": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dependencies": { + "brace-expansion": "1.1.11" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + }, + "node_modules/mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dependencies": { + "minimist": "0.0.8" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dependencies": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1.0.2" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dependencies": { + "has-flag": "3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + }, "dependencies": { "@types/mocha": { "version": "5.2.5", @@ -19,7 +236,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, @@ -66,12 +283,12 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "growl": { @@ -94,8 +311,8 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "requires": { - "once": "^1.3.0", - "wrappy": "1" + "once": "1.4.0", + "wrappy": "1.0.2" } }, "inherits": { @@ -108,7 +325,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.11" } }, "minimist": { @@ -152,7 +369,7 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } }, "path-is-absolute": { @@ -165,7 +382,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "requires": { - "has-flag": "^3.0.0" + "has-flag": "3.0.0" } }, "wrappy": { @@ -174,4 +391,4 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" } } -} +} \ No newline at end of file From c14e377ee9daa6de661ee6ba40079ed6d2cdc316 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Thu, 30 Sep 2021 12:47:19 +0300 Subject: [PATCH 21/29] fix format --- Tasks/JavaToolInstallerV0/Tests/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/package-lock.json b/Tasks/JavaToolInstallerV0/Tests/package-lock.json index 434f2647a85f..85ae602809a5 100644 --- a/Tasks/JavaToolInstallerV0/Tests/package-lock.json +++ b/Tasks/JavaToolInstallerV0/Tests/package-lock.json @@ -391,4 +391,4 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" } } -} \ No newline at end of file +} From 0f8f390bc88917a6a5e1108d1b278e134d4a81af Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Thu, 30 Sep 2021 12:48:53 +0300 Subject: [PATCH 22/29] fix format --- Tasks/JavaToolInstallerV0/javatoolinstaller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index f51a5deb0417..3c6ed6a71870 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -171,7 +171,7 @@ async function unpackArchive(unpackDir: string, jdkFileName: string, fileExt: st } /** - * Get the path to a folder inside the VOLUMES_FOLDER. * + * Get the path to a folder inside the VOLUMES_FOLDER. * Only for macOS. * @param volumes VOLUMES_FOLDER contents before attaching a disk image. * @returns string From 20d19e78da90dc1ccc33db71bc4fbe4af61b69a0 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Fri, 1 Oct 2021 12:02:29 +0300 Subject: [PATCH 23/29] fix format --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 2 +- Tasks/JavaToolInstallerV0/javatoolinstaller.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 6b65cd2de124..b9dd48e39bfe 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -25,7 +25,7 @@ describe('JavaToolInstaller L0 Suite', function () { const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath); testRunner.run(); - + assert(testRunner.succeeded, 'task should have succeeded.'); }); diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index 3c6ed6a71870..a769fc720250 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -171,7 +171,7 @@ async function unpackArchive(unpackDir: string, jdkFileName: string, fileExt: st } /** - * Get the path to a folder inside the VOLUMES_FOLDER. + * Get the path to a folder inside the VOLUMES_FOLDER. * Only for macOS. * @param volumes VOLUMES_FOLDER contents before attaching a disk image. * @returns string From 12d30fc27d1ca015cfab076e4787225483b0e213 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Thu, 7 Oct 2021 09:51:00 +0300 Subject: [PATCH 24/29] fix string template --- Tasks/JavaToolInstallerV0/javatoolinstaller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index 00d1dd6badee..90563ffa12eb 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -64,7 +64,7 @@ async function getJava(versionSpec: string, jdkArchitectureOption: string): Prom await taskutils.sleepFor(250); //Wait for the file to be released before extracting it. let jdkArchiveName = path.basename(fileNameAndPath); jdkFileName = path.join(extractLocation, jdkArchiveName); - toolLib.debug('jdkFileName: ${jdkFileName}'); + toolLib.debug(`jdkFileName: ${jdkFileName}`); } else { // get from local directory console.log(taskLib.loc('RetrievingJdkFromLocalPath')); From c462a180fc74f0e6e9b5fb2a6436674d9756a7cb Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Thu, 7 Oct 2021 10:51:51 +0300 Subject: [PATCH 25/29] fix path --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 2 +- .../Tests/L0DownloadsJdkFromAzureStorage.ts | 3 +- ...L0DownloadsJdkFromAzureStorageSubFolder.ts | 3 +- .../Tests/package-lock.json | 243 +----------------- 4 files changed, 18 insertions(+), 233 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index b9dd48e39bfe..349f6e58392b 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -37,7 +37,7 @@ describe('JavaToolInstaller L0 Suite', function () { testRunner.run(); - assert(testRunner.stdOutContained('jdkArchiveName: DestinationDirectory\\JDKname.tar.gz'), 'JDK archive should unpack in the right destination directory'); + assert(testRunner.stdOutContained('jdkFileName: DestinationDirectory\\JDKname.tar.gz'), 'JDK archive should unpack in the right destination directory'); assert(testRunner.succeeded, 'task should have succeeded.'); }); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index 9fcdd89a2afd..f9e120613fd7 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -35,6 +35,7 @@ process.env['ENDPOINT_DATA_ARM1_subscriptionId'] = 'dummySubscriptionId'; const a: ma.TaskLibAnswers = { "stats": { + "DestinationDirectory/JDKname.tar.gz": true, "DestinationDirectory\\JDKname.tar.gz": true, }, "find": { @@ -108,7 +109,7 @@ mfsClone.lstatSync = function(variable: string) { }; mfsClone.existsSync = function (variable: string) { - if (variable === "DestinationDirectory\\econdlevelJDK2") { + if (variable === "DestinationDirectory/econdlevelJDK2" || variable === "DestinationDirectory\\econdlevelJDK2" ) { return false; } else return true; } diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index 01d8b656ad07..a06f71369175 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -37,6 +37,7 @@ process.env['ENDPOINT_DATA_ARM1_subscriptionId'] = 'dummySubscriptionId'; const a: ma.TaskLibAnswers = { "stats": { "DestinationDirectory\\JDKname.tar.gz": true, + "DestinationDirectory/JDKname.tar.gz": true, }, "find": { "DestinationDirectory": ["rootJDK/", "rootJDK/secondlevelJDK2"], @@ -109,7 +110,7 @@ mfsClone.lstatSync = function(variable: string) { }; mfsClone.existsSync = function (variable: string) { - if (variable === "DestinationDirectory\\econdlevelJDK2") { + if (variable === "DestinationDirectory/econdlevelJDK2" || variable === "DestinationDirectory\\econdlevelJDK2" ) { return false; } else return true; } diff --git a/Tasks/JavaToolInstallerV0/Tests/package-lock.json b/Tasks/JavaToolInstallerV0/Tests/package-lock.json index 85ae602809a5..68efce07e850 100644 --- a/Tasks/JavaToolInstallerV0/Tests/package-lock.json +++ b/Tasks/JavaToolInstallerV0/Tests/package-lock.json @@ -1,225 +1,8 @@ { "name": "java-tool-installer", "version": "0.134.0", - "lockfileVersion": 2, + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "name": "java-tool-installer", - "version": "0.134.0", - "license": "MIT", - "dependencies": { - "@types/mocha": "5.2.5", - "mocha": "5.2.0" - } - }, - "node_modules/@types/mocha": { - "version": "5.2.5", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", - "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==" - }, - "node_modules/balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" - }, - "node_modules/commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "node_modules/debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "node_modules/glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dependencies": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "engines": { - "node": ">=4.x" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "engines": { - "node": ">=4" - } - }, - "node_modules/he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "bin": { - "he": "bin/he" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dependencies": { - "once": "1.4.0", - "wrappy": "1.0.2" - } - }, - "node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dependencies": { - "brace-expansion": "1.1.11" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" - }, - "node_modules/mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dependencies": { - "minimist": "0.0.8" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", - "dependencies": { - "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.5", - "he": "1.1.1", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dependencies": { - "wrappy": "1.0.2" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dependencies": { - "has-flag": "3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - } - }, "dependencies": { "@types/mocha": { "version": "5.2.5", @@ -236,7 +19,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -283,12 +66,12 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "growl": { @@ -311,8 +94,8 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -325,7 +108,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -369,7 +152,7 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "path-is-absolute": { @@ -382,7 +165,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "requires": { - "has-flag": "3.0.0" + "has-flag": "^3.0.0" } }, "wrappy": { From 761361f440821e8554610dcb9e3d525c46798dbe Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Thu, 7 Oct 2021 10:52:48 +0300 Subject: [PATCH 26/29] Revert "fix string template" This reverts commit 12d30fc27d1ca015cfab076e4787225483b0e213. --- Tasks/JavaToolInstallerV0/javatoolinstaller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index 90563ffa12eb..00d1dd6badee 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -64,7 +64,7 @@ async function getJava(versionSpec: string, jdkArchitectureOption: string): Prom await taskutils.sleepFor(250); //Wait for the file to be released before extracting it. let jdkArchiveName = path.basename(fileNameAndPath); jdkFileName = path.join(extractLocation, jdkArchiveName); - toolLib.debug(`jdkFileName: ${jdkFileName}`); + toolLib.debug('jdkFileName: ${jdkFileName}'); } else { // get from local directory console.log(taskLib.loc('RetrievingJdkFromLocalPath')); From 76637d59c5564915d74f6d3da28d522e3489dac6 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Thu, 7 Oct 2021 10:55:36 +0300 Subject: [PATCH 27/29] Revert "fix path" This reverts commit c462a180fc74f0e6e9b5fb2a6436674d9756a7cb. --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 2 +- .../Tests/L0DownloadsJdkFromAzureStorage.ts | 3 +- ...L0DownloadsJdkFromAzureStorageSubFolder.ts | 3 +- .../Tests/package-lock.json | 243 +++++++++++++++++- 4 files changed, 233 insertions(+), 18 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 349f6e58392b..b9dd48e39bfe 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -37,7 +37,7 @@ describe('JavaToolInstaller L0 Suite', function () { testRunner.run(); - assert(testRunner.stdOutContained('jdkFileName: DestinationDirectory\\JDKname.tar.gz'), 'JDK archive should unpack in the right destination directory'); + assert(testRunner.stdOutContained('jdkArchiveName: DestinationDirectory\\JDKname.tar.gz'), 'JDK archive should unpack in the right destination directory'); assert(testRunner.succeeded, 'task should have succeeded.'); }); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index f9e120613fd7..9fcdd89a2afd 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -35,7 +35,6 @@ process.env['ENDPOINT_DATA_ARM1_subscriptionId'] = 'dummySubscriptionId'; const a: ma.TaskLibAnswers = { "stats": { - "DestinationDirectory/JDKname.tar.gz": true, "DestinationDirectory\\JDKname.tar.gz": true, }, "find": { @@ -109,7 +108,7 @@ mfsClone.lstatSync = function(variable: string) { }; mfsClone.existsSync = function (variable: string) { - if (variable === "DestinationDirectory/econdlevelJDK2" || variable === "DestinationDirectory\\econdlevelJDK2" ) { + if (variable === "DestinationDirectory\\econdlevelJDK2") { return false; } else return true; } diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index a06f71369175..01d8b656ad07 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -37,7 +37,6 @@ process.env['ENDPOINT_DATA_ARM1_subscriptionId'] = 'dummySubscriptionId'; const a: ma.TaskLibAnswers = { "stats": { "DestinationDirectory\\JDKname.tar.gz": true, - "DestinationDirectory/JDKname.tar.gz": true, }, "find": { "DestinationDirectory": ["rootJDK/", "rootJDK/secondlevelJDK2"], @@ -110,7 +109,7 @@ mfsClone.lstatSync = function(variable: string) { }; mfsClone.existsSync = function (variable: string) { - if (variable === "DestinationDirectory/econdlevelJDK2" || variable === "DestinationDirectory\\econdlevelJDK2" ) { + if (variable === "DestinationDirectory\\econdlevelJDK2") { return false; } else return true; } diff --git a/Tasks/JavaToolInstallerV0/Tests/package-lock.json b/Tasks/JavaToolInstallerV0/Tests/package-lock.json index 68efce07e850..85ae602809a5 100644 --- a/Tasks/JavaToolInstallerV0/Tests/package-lock.json +++ b/Tasks/JavaToolInstallerV0/Tests/package-lock.json @@ -1,8 +1,225 @@ { "name": "java-tool-installer", "version": "0.134.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "java-tool-installer", + "version": "0.134.0", + "license": "MIT", + "dependencies": { + "@types/mocha": "5.2.5", + "mocha": "5.2.0" + } + }, + "node_modules/@types/mocha": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", + "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==" + }, + "node_modules/balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" + }, + "node_modules/commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "node_modules/debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "node_modules/glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dependencies": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "engines": { + "node": ">=4.x" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "engines": { + "node": ">=4" + } + }, + "node_modules/he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "bin": { + "he": "bin/he" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dependencies": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dependencies": { + "brace-expansion": "1.1.11" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + }, + "node_modules/mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dependencies": { + "minimist": "0.0.8" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dependencies": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1.0.2" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dependencies": { + "has-flag": "3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + }, "dependencies": { "@types/mocha": { "version": "5.2.5", @@ -19,7 +236,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "requires": { - "balanced-match": "^1.0.0", + "balanced-match": "1.0.0", "concat-map": "0.0.1" } }, @@ -66,12 +283,12 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" } }, "growl": { @@ -94,8 +311,8 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "requires": { - "once": "^1.3.0", - "wrappy": "1" + "once": "1.4.0", + "wrappy": "1.0.2" } }, "inherits": { @@ -108,7 +325,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "1.1.11" } }, "minimist": { @@ -152,7 +369,7 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { - "wrappy": "1" + "wrappy": "1.0.2" } }, "path-is-absolute": { @@ -165,7 +382,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "requires": { - "has-flag": "^3.0.0" + "has-flag": "3.0.0" } }, "wrappy": { From 6ae9f4f00e105906dea3a159c8d154cb142772a2 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Thu, 7 Oct 2021 10:59:52 +0300 Subject: [PATCH 28/29] fix path --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 2 +- .../Tests/L0DownloadsJdkFromAzureStorage.ts | 3 ++- .../Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts | 3 ++- Tasks/JavaToolInstallerV0/javatoolinstaller.ts | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index b9dd48e39bfe..349f6e58392b 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -37,7 +37,7 @@ describe('JavaToolInstaller L0 Suite', function () { testRunner.run(); - assert(testRunner.stdOutContained('jdkArchiveName: DestinationDirectory\\JDKname.tar.gz'), 'JDK archive should unpack in the right destination directory'); + assert(testRunner.stdOutContained('jdkFileName: DestinationDirectory\\JDKname.tar.gz'), 'JDK archive should unpack in the right destination directory'); assert(testRunner.succeeded, 'task should have succeeded.'); }); diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts index 9fcdd89a2afd..c2e7c681bda9 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorage.ts @@ -36,6 +36,7 @@ process.env['ENDPOINT_DATA_ARM1_subscriptionId'] = 'dummySubscriptionId'; const a: ma.TaskLibAnswers = { "stats": { "DestinationDirectory\\JDKname.tar.gz": true, + "DestinationDirectory/JDKname.tar.gz": true, }, "find": { "DestinationDirectory": ["rootJDK/", "rootJDK/secondlevelJDK2"], @@ -108,7 +109,7 @@ mfsClone.lstatSync = function(variable: string) { }; mfsClone.existsSync = function (variable: string) { - if (variable === "DestinationDirectory\\econdlevelJDK2") { + if (variable === "DestinationDirectory\\econdlevelJDK2" || variable === "DestinationDirectory/econdlevelJDK2") { return false; } else return true; } diff --git a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts index 01d8b656ad07..028d013e8d46 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0DownloadsJdkFromAzureStorageSubFolder.ts @@ -37,6 +37,7 @@ process.env['ENDPOINT_DATA_ARM1_subscriptionId'] = 'dummySubscriptionId'; const a: ma.TaskLibAnswers = { "stats": { "DestinationDirectory\\JDKname.tar.gz": true, + "DestinationDirectory/JDKname.tar.gz": true, }, "find": { "DestinationDirectory": ["rootJDK/", "rootJDK/secondlevelJDK2"], @@ -109,7 +110,7 @@ mfsClone.lstatSync = function(variable: string) { }; mfsClone.existsSync = function (variable: string) { - if (variable === "DestinationDirectory\\econdlevelJDK2") { + if (variable === "DestinationDirectory\\econdlevelJDK2" || variable === "DestinationDirectory/econdlevelJDK2" ) { return false; } else return true; } diff --git a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts index 00d1dd6badee..90563ffa12eb 100644 --- a/Tasks/JavaToolInstallerV0/javatoolinstaller.ts +++ b/Tasks/JavaToolInstallerV0/javatoolinstaller.ts @@ -64,7 +64,7 @@ async function getJava(versionSpec: string, jdkArchitectureOption: string): Prom await taskutils.sleepFor(250); //Wait for the file to be released before extracting it. let jdkArchiveName = path.basename(fileNameAndPath); jdkFileName = path.join(extractLocation, jdkArchiveName); - toolLib.debug('jdkFileName: ${jdkFileName}'); + toolLib.debug(`jdkFileName: ${jdkFileName}`); } else { // get from local directory console.log(taskLib.loc('RetrievingJdkFromLocalPath')); From 388c71634ac421387325c10888646180e098fea4 Mon Sep 17 00:00:00 2001 From: Anna Opareva Date: Thu, 7 Oct 2021 11:11:22 +0300 Subject: [PATCH 29/29] fix conduction --- Tasks/JavaToolInstallerV0/Tests/L0.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tasks/JavaToolInstallerV0/Tests/L0.ts b/Tasks/JavaToolInstallerV0/Tests/L0.ts index 349f6e58392b..b392114a571d 100644 --- a/Tasks/JavaToolInstallerV0/Tests/L0.ts +++ b/Tasks/JavaToolInstallerV0/Tests/L0.ts @@ -37,7 +37,7 @@ describe('JavaToolInstaller L0 Suite', function () { testRunner.run(); - assert(testRunner.stdOutContained('jdkFileName: DestinationDirectory\\JDKname.tar.gz'), 'JDK archive should unpack in the right destination directory'); + assert((testRunner.stdOutContained('jdkFileName: DestinationDirectory\\JDKname.tar.gz') || testRunner.stdOutContained('jdkFileName: DestinationDirectory/JDKname.tar.gz')) , 'JDK archive should unpack in the right destination directory'); assert(testRunner.succeeded, 'task should have succeeded.'); });