From 19e3dd58fced7a2b6a773d0302571e837948c239 Mon Sep 17 00:00:00 2001 From: ShobhaJayanna <36433611+Shobhajayanna@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:00:11 +0200 Subject: [PATCH] refactor: Refactor mapper.ts in zowe-cli-id-federation (#3772) * refactor mapper.ts Signed-off-by: sj895092 * Update Mapper.ts Signed-off-by: ShobhaJayanna <36433611+Shobhajayanna@users.noreply.github.com> * updating actions/upload-artifact v2 to v3 Signed-off-by: sj895092 --------- Signed-off-by: sj895092 Signed-off-by: ShobhaJayanna <36433611+Shobhajayanna@users.noreply.github.com> --- .github/workflows/docs.yml | 2 +- .github/workflows/integration-tests.yml | 38 +++++++++---------- .github/workflows/service-registration.yml | 2 +- .../src/api/Mapper.ts | 15 ++------ 4 files changed, 25 insertions(+), 32 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 769af5db4f..6e25f738a7 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -40,7 +40,7 @@ jobs: - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ErrorMessage-${{ env.JOB_ID }} path: | diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index cb1de8a926..b33ebc1f62 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -180,7 +180,7 @@ jobs: java -jar ./scripts/jacococli.jar dump --address cloud-gateway-service --port 6310 --destfile ./results/cloud-gateway-service.exec - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CloudGatewayProxy-${{ env.JOB_ID }} @@ -224,7 +224,7 @@ jobs: java -jar ./scripts/jacococli.jar dump --address cloud-gateway-service --port 6310 --destfile ./results/cloud-gateway-service.exec - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CloudGatewayServiceRouting-${{ env.JOB_ID }} @@ -304,7 +304,7 @@ jobs: java -jar ./scripts/jacococli.jar dump --address cloud-gateway-service --port 6310 --destfile ./results/cloud-gateway-service.exec - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CloudGatewayCentralRegistry-${{ env.JOB_ID }} @@ -352,7 +352,7 @@ jobs: # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: ContainerCITestsRegistration-${{ env.JOB_ID }} @@ -535,7 +535,7 @@ jobs: -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CITestsZosmfPH34201-${{ env.JOB_ID }} @@ -587,7 +587,7 @@ jobs: -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: ContainerCITestsZosmfWithoutJwt-${{ env.JOB_ID }} @@ -640,7 +640,7 @@ jobs: -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: ContainerCITestsZosmfWithoutJwtWithAuthenticateEndpoint-${{ env.JOB_ID }} @@ -696,7 +696,7 @@ jobs: if: always() - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: ContainerCITestsInternalPort-${{ env.JOB_ID }} @@ -759,7 +759,7 @@ jobs: # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: ContainerCITestsWithRedisReplica-${{ env.JOB_ID }} @@ -827,7 +827,7 @@ jobs: # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: ContainerCITestsWithRedisSentinel-${{ env.JOB_ID }} @@ -907,7 +907,7 @@ jobs: chmod 755 -R .gradle # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CITestsHA-${{ env.JOB_ID }} @@ -1002,7 +1002,7 @@ jobs: chmod 755 -R .gradle # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: LbHaTests-${{ env.JOB_ID }} @@ -1072,7 +1072,7 @@ jobs: chmod 755 -R .gradle # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CITestsDiscoveryChaoticHA-${{ env.JOB_ID }} @@ -1142,7 +1142,7 @@ jobs: chmod 755 -R .gradle # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CITestsGatewayChaoticHA-${{ env.JOB_ID }} @@ -1216,7 +1216,7 @@ jobs: chmod 755 -R .gradle # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CITestsDiscoverableClientChaoticHA-${{ env.JOB_ID }} @@ -1297,7 +1297,7 @@ jobs: chmod 755 -R .gradle # Coverage results are not stored in this job as it would not provide much additional data - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CITestsWebSocketChaoticHA-${{ env.JOB_ID }} @@ -1459,13 +1459,13 @@ jobs: cd metrics-service-ui/frontend npm run cy:e2e:ci - name: Upload screenshots API Catalog - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: failure() with: name: cypress-snapshots path: api-catalog-ui/frontend/cypress/screenshots - name: Upload screenshots Metrics service - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: failure() with: name: cypress-snapshots @@ -1508,7 +1508,7 @@ jobs: -Partifactory_user=${{ secrets.ARTIFACTORY_USERNAME }} -Partifactory_password=${{ secrets.ARTIFACTORY_PASSWORD }} - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CITestsServicePrefixReplacer-${{ env.JOB_ID }} diff --git a/.github/workflows/service-registration.yml b/.github/workflows/service-registration.yml index a7153c25cf..a31c6c49f8 100644 --- a/.github/workflows/service-registration.yml +++ b/.github/workflows/service-registration.yml @@ -33,7 +33,7 @@ jobs: run: > ./gradlew runStartUpCheck --info --scan - name: Store results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CITests-${{ env.JOB_ID }} diff --git a/zowe-cli-id-federation-plugin/src/api/Mapper.ts b/zowe-cli-id-federation-plugin/src/api/Mapper.ts index 567d8e3f26..b9e70b6645 100644 --- a/zowe-cli-id-federation-plugin/src/api/Mapper.ts +++ b/zowe-cli-id-federation-plugin/src/api/Mapper.ts @@ -54,19 +54,16 @@ export class Mapper { } createSafCommands(identities: IIdentity[]): string[] { - let commandProcessor; + switch (this.esm.toLowerCase()) { case "racf": { - commandProcessor = new RacfCommands(this.registry, identities, this.response); - break; + return new RacfCommands(this.registry, identities, this.response).getCommands(); } case "tss": { - commandProcessor = new TssCommands(this.registry, identities, this.response); - break; + return new TssCommands(this.registry, identities, this.response).getCommands(); } case "acf2": { - commandProcessor = new Acf2Commands(this.registry, identities, this.response); - break; + return new Acf2Commands(this.registry, identities, this.response).getCommands(); } default: { this.response.data.setExitCode(Constants.FATAL_CODE); @@ -75,9 +72,5 @@ export class Mapper { throw new ImperativeError({msg}); } } - - return commandProcessor ? commandProcessor.getCommands() : []; } - - }