From 3d5fe3468764beb7d7d9c71e8724b9e47d938764 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Mon, 4 Nov 2024 12:31:52 -0500 Subject: [PATCH 01/13] fixed start tso app and send tso app output formatting Signed-off-by: jace-roell --- .../src/zostso/send/as-app/SendASApp.handler.ts | 12 +++++++++--- .../src/zostso/start/as-app/StartASApp.handler.ts | 14 +++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts b/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts index cb14bf80a..145791f7e 100644 --- a/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts +++ b/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts @@ -37,8 +37,14 @@ export default class Handler extends ZosTsoBaseHandler { commandParameters.response.progress.endSpinner(); - commandParameters.response.console.log( - JSON.stringify(response, null, 2) - ); + commandParameters.response.console.log("\n"); + response.tsoData.forEach((data) => { + if(typeof data === 'string') { + commandParameters.response.console.log(data); + } else if (data && data.DATA) { + commandParameters.response.console.log(data.DATA); + } + }); + commandParameters.response.data.setObj(response); } } diff --git a/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts b/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts index a5d4f4e54..073aee10d 100644 --- a/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts +++ b/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts @@ -11,6 +11,7 @@ import { IHandlerParameters } from "@zowe/imperative"; import { ZosTsoBaseHandler, AddressSpaceApps } from "@zowe/zos-tso-for-zowe-sdk"; +import chalk = require("chalk"); /** * Handler to start app at an address space @@ -32,6 +33,17 @@ export default class Handler extends ZosTsoBaseHandler { }, this.mTsoStart ); - commandParameters.response.console.log(JSON.stringify(response,null,2)); + commandParameters.response.console.log(chalk.yellow.bold("\n" + "Servlet Key: ") + response.servletKey); + commandParameters.response.console.log(chalk.yellow.bold("Queue ID: ") + response.queueID + "\n"); + + response.tsoData.forEach((data) => { + if(typeof data === 'string') { + commandParameters.response.console.log(data); + } else if (data && data.DATA) { + commandParameters.response.console.log(data.DATA); + } + }); + + commandParameters.response.data.setObj(response); } } From 4d5ddb524e9df4b3448e908a4dcfc2a62978a3b4 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Mon, 4 Nov 2024 12:34:35 -0500 Subject: [PATCH 02/13] changelog Signed-off-by: jace-roell --- packages/zosfiles/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index a7d879d22..6347c4952 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. +## Recent Changes + +- BugFix: Improved output formatting for `zowe zos-tso start app` and `zowe zos-tso send app`[#2347](https://github.com/zowe/zowe-cli/pull/2347) + ## `8.6.2` - BugFix: Resolved issue where encoding argument was missing from `FileToUss.handler.ts` options object. [#2234](https://github.com/zowe/zowe-cli/pull/2334) From e27f135c8c06543659108baaedba86b0c4c3fd8c Mon Sep 17 00:00:00 2001 From: jace-roell Date: Mon, 4 Nov 2024 12:37:59 -0500 Subject: [PATCH 03/13] snapshots Signed-off-by: jace-roell --- .../SendASApp.handler.unit.test.ts.snap | 41 +++-- .../StartASApp.handler.unit.test.ts.snap | 154 +++++++++++------- 2 files changed, 123 insertions(+), 72 deletions(-) diff --git a/packages/cli/__tests__/zostso/__unit__/send/app/__snapshots__/SendASApp.handler.unit.test.ts.snap b/packages/cli/__tests__/zostso/__unit__/send/app/__snapshots__/SendASApp.handler.unit.test.ts.snap index 7f6ec7a51..ee35db820 100644 --- a/packages/cli/__tests__/zostso/__unit__/send/app/__snapshots__/SendASApp.handler.unit.test.ts.snap +++ b/packages/cli/__tests__/zostso/__unit__/send/app/__snapshots__/SendASApp.handler.unit.test.ts.snap @@ -1,21 +1,30 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`receive TSO app handler behavior should properly receive and parse data from receive TSO response 1`] = ` -"{ - \\"version\\": \\"0100\\", - \\"reused\\": false, - \\"timeout\\": false, - \\"servletKey\\": \\"ZOWEUSER-127-aabeaaag\\", - \\"queueID\\": null, - \\"tsoData\\": [ - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"HELLOW exec processing has started.\\" +" +" +`; + +exports[`receive TSO app handler behavior should properly receive and parse data from receive TSO response 2`] = `"HELLOW exec processing has started."`; + +exports[`receive TSO app handler behavior should properly receive and parse data from receive TSO response 3`] = `"UNIX message queue id = 1048608"`; + +exports[`receive TSO app handler behavior should properly receive and parse data from receive TSO response 4`] = ` +Object { + "queueID": null, + "reused": false, + "servletKey": "ZOWEUSER-127-aabeaaag", + "timeout": false, + "tsoData": Array [ + Object { + "DATA": "HELLOW exec processing has started.", + "VERSION": "0100", + }, + Object { + "DATA": "UNIX message queue id = 1048608", + "VERSION": "0100", }, - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"UNIX message queue id = 1048608\\" - } - ] -}" + ], + "version": "0100", +} `; diff --git a/packages/cli/__tests__/zostso/__unit__/start/app/__snapshots__/StartASApp.handler.unit.test.ts.snap b/packages/cli/__tests__/zostso/__unit__/start/app/__snapshots__/StartASApp.handler.unit.test.ts.snap index ca5889138..8c65aeb59 100644 --- a/packages/cli/__tests__/zostso/__unit__/start/app/__snapshots__/StartASApp.handler.unit.test.ts.snap +++ b/packages/cli/__tests__/zostso/__unit__/start/app/__snapshots__/StartASApp.handler.unit.test.ts.snap @@ -1,63 +1,105 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`receive TSO app handler behavior should properly start TSO address space and run an application at the created address space 1`] = ` -"{ - \\"reused\\": false, - \\"timeout\\": false, - \\"servletKey\\": \\"ZOWEUSER-123-aaaaaa\\", - \\"queueID\\": \\"983068\\", - \\"tsoData\\": [ - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"HELLOW exec processing has started.\\" - }, - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"UNIX message queue id = 983068\\" - }, - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"Input message type = 32772\\" - }, - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"Output message type = 4\\" - }, - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"Reading application input from the UNIX message queue.\\" - } - ] -}" +" +Servlet Key: ZOWEUSER-123-aaaaaa" +`; + +exports[`receive TSO app handler behavior should properly start TSO address space and run an application at the created address space 2`] = ` +"Queue ID: 983068 +" +`; + +exports[`receive TSO app handler behavior should properly start TSO address space and run an application at the created address space 3`] = `"HELLOW exec processing has started."`; + +exports[`receive TSO app handler behavior should properly start TSO address space and run an application at the created address space 4`] = `"UNIX message queue id = 983068"`; + +exports[`receive TSO app handler behavior should properly start TSO address space and run an application at the created address space 5`] = `"Input message type = 32772"`; + +exports[`receive TSO app handler behavior should properly start TSO address space and run an application at the created address space 6`] = `"Output message type = 4"`; + +exports[`receive TSO app handler behavior should properly start TSO address space and run an application at the created address space 7`] = `"Reading application input from the UNIX message queue."`; + +exports[`receive TSO app handler behavior should properly start TSO address space and run an application at the created address space 8`] = ` +Object { + "queueID": "983068", + "reused": false, + "servletKey": "ZOWEUSER-123-aaaaaa", + "timeout": false, + "tsoData": Array [ + Object { + "DATA": "HELLOW exec processing has started.", + "VERSION": "0100", + }, + Object { + "DATA": "UNIX message queue id = 983068", + "VERSION": "0100", + }, + Object { + "DATA": "Input message type = 32772", + "VERSION": "0100", + }, + Object { + "DATA": "Output message type = 4", + "VERSION": "0100", + }, + Object { + "DATA": "Reading application input from the UNIX message queue.", + "VERSION": "0100", + }, + ], + "version": undefined, +} `; exports[`receive TSO app handler behavior should properly start TSO address space at an existing TSO address space 1`] = ` -"{ - \\"reused\\": false, - \\"timeout\\": false, - \\"servletKey\\": \\"ZOWEUSER-123-aaaaaa\\", - \\"queueID\\": \\"983068\\", - \\"tsoData\\": [ - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"HELLOW exec processing has started.\\" - }, - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"UNIX message queue id = 983068\\" - }, - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"Input message type = 32772\\" - }, - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"Output message type = 4\\" - }, - { - \\"VERSION\\": \\"0100\\", - \\"DATA\\": \\"Reading application input from the UNIX message queue.\\" - } - ] -}" +" +Servlet Key: ZOWEUSER-123-aaaaaa" +`; + +exports[`receive TSO app handler behavior should properly start TSO address space at an existing TSO address space 2`] = ` +"Queue ID: 983068 +" +`; + +exports[`receive TSO app handler behavior should properly start TSO address space at an existing TSO address space 3`] = `"HELLOW exec processing has started."`; + +exports[`receive TSO app handler behavior should properly start TSO address space at an existing TSO address space 4`] = `"UNIX message queue id = 983068"`; + +exports[`receive TSO app handler behavior should properly start TSO address space at an existing TSO address space 5`] = `"Input message type = 32772"`; + +exports[`receive TSO app handler behavior should properly start TSO address space at an existing TSO address space 6`] = `"Output message type = 4"`; + +exports[`receive TSO app handler behavior should properly start TSO address space at an existing TSO address space 7`] = `"Reading application input from the UNIX message queue."`; + +exports[`receive TSO app handler behavior should properly start TSO address space at an existing TSO address space 8`] = ` +Object { + "queueID": "983068", + "reused": false, + "servletKey": "ZOWEUSER-123-aaaaaa", + "timeout": false, + "tsoData": Array [ + Object { + "DATA": "HELLOW exec processing has started.", + "VERSION": "0100", + }, + Object { + "DATA": "UNIX message queue id = 983068", + "VERSION": "0100", + }, + Object { + "DATA": "Input message type = 32772", + "VERSION": "0100", + }, + Object { + "DATA": "Output message type = 4", + "VERSION": "0100", + }, + Object { + "DATA": "Reading application input from the UNIX message queue.", + "VERSION": "0100", + }, + ], + "version": undefined, +} `; From 88a3e8a78d8c74209780499ca5f6c7a0caed07bd Mon Sep 17 00:00:00 2001 From: jace-roell Date: Mon, 4 Nov 2024 12:47:32 -0500 Subject: [PATCH 04/13] changelog Signed-off-by: jace-roell --- packages/cli/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index f553ae64f..6cc79c82c 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to the Zowe CLI package will be documented in this file. +## Recent Changes + +- BugFix: Improved output formatting for `zowe zos-tso start app` and `zowe zos-tso send app`[#2347](https://github.com/zowe/zowe-cli/pull/2347) ## `8.6.2` From b8003535093c385bf747c94851eead8cb47f45df Mon Sep 17 00:00:00 2001 From: jace-roell Date: Tue, 5 Nov 2024 09:52:54 -0500 Subject: [PATCH 05/13] feedback fixes Signed-off-by: jace-roell --- packages/cli/src/zostso/send/as-app/SendASApp.handler.ts | 6 +----- packages/cli/src/zostso/start/as-app/StartASApp.handler.ts | 6 +----- packages/zosfiles/CHANGELOG.md | 4 ---- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts b/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts index 145791f7e..9a65ac051 100644 --- a/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts +++ b/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts @@ -39,11 +39,7 @@ export default class Handler extends ZosTsoBaseHandler { commandParameters.response.console.log("\n"); response.tsoData.forEach((data) => { - if(typeof data === 'string') { - commandParameters.response.console.log(data); - } else if (data && data.DATA) { - commandParameters.response.console.log(data.DATA); - } + commandParameters.response.console.log(typeof data === 'string' ? data : (data?.DATA ?? "")); }); commandParameters.response.data.setObj(response); } diff --git a/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts b/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts index 073aee10d..95a23a692 100644 --- a/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts +++ b/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts @@ -37,11 +37,7 @@ export default class Handler extends ZosTsoBaseHandler { commandParameters.response.console.log(chalk.yellow.bold("Queue ID: ") + response.queueID + "\n"); response.tsoData.forEach((data) => { - if(typeof data === 'string') { - commandParameters.response.console.log(data); - } else if (data && data.DATA) { - commandParameters.response.console.log(data.DATA); - } + commandParameters.response.console.log(typeof data === 'string' ? data : (data?.DATA ?? "")); }); commandParameters.response.data.setObj(response); diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 6347c4952..a7d879d22 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -2,10 +2,6 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. -## Recent Changes - -- BugFix: Improved output formatting for `zowe zos-tso start app` and `zowe zos-tso send app`[#2347](https://github.com/zowe/zowe-cli/pull/2347) - ## `8.6.2` - BugFix: Resolved issue where encoding argument was missing from `FileToUss.handler.ts` options object. [#2234](https://github.com/zowe/zowe-cli/pull/2334) From d21e857143fd6fb28bf8b30c604f44794bc56e36 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Tue, 5 Nov 2024 09:58:55 -0500 Subject: [PATCH 06/13] condensed recieve handler logic Signed-off-by: jace-roell --- packages/cli/src/zostso/receive/app/ReceiveASApp.handler.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/cli/src/zostso/receive/app/ReceiveASApp.handler.ts b/packages/cli/src/zostso/receive/app/ReceiveASApp.handler.ts index 03cd8e27f..bfa1dd2e4 100644 --- a/packages/cli/src/zostso/receive/app/ReceiveASApp.handler.ts +++ b/packages/cli/src/zostso/receive/app/ReceiveASApp.handler.ts @@ -39,11 +39,7 @@ export default class Handler extends ZosTsoBaseHandler { commandParameters.response.console.log("\n"); response.tsoData.forEach((data) => { - if(typeof data === 'string') { - commandParameters.response.console.log(data); - } else if (data && data.DATA) { - commandParameters.response.console.log(data.DATA); - } + commandParameters.response.console.log(typeof data === 'string' ? data : (data?.DATA ?? "")); }); commandParameters.response.data.setObj(response); } From 40390a2bf0bdd22bc69830a1452ad382bca2dae0 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Tue, 5 Nov 2024 11:07:51 -0500 Subject: [PATCH 07/13] refactor address space apps logging and linting Signed-off-by: jace-roell --- packages/cli/src/zostso/receive/app/ReceiveASApp.handler.ts | 2 +- packages/cli/src/zostso/send/as-app/SendASApp.handler.ts | 2 +- packages/cli/src/zostso/start/as-app/StartASApp.handler.ts | 2 +- packages/zosfiles/src/methods/upload/Upload.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/zostso/receive/app/ReceiveASApp.handler.ts b/packages/cli/src/zostso/receive/app/ReceiveASApp.handler.ts index bfa1dd2e4..e48211be2 100644 --- a/packages/cli/src/zostso/receive/app/ReceiveASApp.handler.ts +++ b/packages/cli/src/zostso/receive/app/ReceiveASApp.handler.ts @@ -39,7 +39,7 @@ export default class Handler extends ZosTsoBaseHandler { commandParameters.response.console.log("\n"); response.tsoData.forEach((data) => { - commandParameters.response.console.log(typeof data === 'string' ? data : (data?.DATA ?? "")); + commandParameters.response.console.log(typeof data === 'string' ? data : data?.DATA ?? ""); }); commandParameters.response.data.setObj(response); } diff --git a/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts b/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts index 9a65ac051..95676a810 100644 --- a/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts +++ b/packages/cli/src/zostso/send/as-app/SendASApp.handler.ts @@ -39,7 +39,7 @@ export default class Handler extends ZosTsoBaseHandler { commandParameters.response.console.log("\n"); response.tsoData.forEach((data) => { - commandParameters.response.console.log(typeof data === 'string' ? data : (data?.DATA ?? "")); + commandParameters.response.console.log(typeof data === 'string' ? data : data?.DATA ?? ""); }); commandParameters.response.data.setObj(response); } diff --git a/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts b/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts index 95a23a692..c4d445b86 100644 --- a/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts +++ b/packages/cli/src/zostso/start/as-app/StartASApp.handler.ts @@ -37,7 +37,7 @@ export default class Handler extends ZosTsoBaseHandler { commandParameters.response.console.log(chalk.yellow.bold("Queue ID: ") + response.queueID + "\n"); response.tsoData.forEach((data) => { - commandParameters.response.console.log(typeof data === 'string' ? data : (data?.DATA ?? "")); + commandParameters.response.console.log(typeof data === 'string' ? data : data?.DATA ?? ""); }); commandParameters.response.data.setObj(response); diff --git a/packages/zosfiles/src/methods/upload/Upload.ts b/packages/zosfiles/src/methods/upload/Upload.ts index 13a53abef..528150b96 100644 --- a/packages/zosfiles/src/methods/upload/Upload.ts +++ b/packages/zosfiles/src/methods/upload/Upload.ts @@ -877,7 +877,7 @@ export class Upload { } else if(options.filesMap?.fileNames.indexOf(path.basename(localPath)) > -1) { tempOptions.binary = options.filesMap.binary; - // Reset encoding to undefined if binary is true to avoid file tagging issues + // Reset encoding to undefined if binary is true to avoid file tagging issues if(tempOptions.binary) tempOptions.encoding = undefined; } From b9afe1c3bc083d91480b2d25c7b507d515a3b2fd Mon Sep 17 00:00:00 2001 From: jace-roell Date: Tue, 5 Nov 2024 11:28:41 -0500 Subject: [PATCH 08/13] duplicate header Signed-off-by: jace-roell --- .../start/app/StartASApp.handler.unit.test.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/packages/cli/__tests__/zostso/__unit__/start/app/StartASApp.handler.unit.test.ts b/packages/cli/__tests__/zostso/__unit__/start/app/StartASApp.handler.unit.test.ts index ddfc9cdcd..f5ef46273 100644 --- a/packages/cli/__tests__/zostso/__unit__/start/app/StartASApp.handler.unit.test.ts +++ b/packages/cli/__tests__/zostso/__unit__/start/app/StartASApp.handler.unit.test.ts @@ -9,17 +9,6 @@ * */ -/* - * This program and the accompanying materials are made available under the terms of the - * Eclipse Public License v2.0 which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-v20.html - * - * SPDX-License-Identifier: EPL-2.0 - * - * Copyright Contributors to the Zowe Project. - * - */ - import { ZosmfRestClient } from "@zowe/core-for-zowe-sdk"; import { StartTso, AddressSpaceApps, IStartStopResponses } from "@zowe/zos-tso-for-zowe-sdk"; import * as StartASAppHandler from "../../../../../src/zostso/start/as-app/StartASApp.handler"; From bd88347d4eb8a96740ec2cfdaa0a70b2323c7d15 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 6 Nov 2024 11:11:46 -0500 Subject: [PATCH 09/13] added --rfj to system testing scripts such that returned values can be properly passed to subsequent calls Signed-off-by: jace-roell --- .../__scripts__/start/start_app_existing_as.sh | 2 +- .../__scripts__/start/start_app_new_as.sh | 2 +- .../__system__/api.TsoASApp.system.test.ts | 15 ++++----------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as.sh b/packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as.sh index 1203459b1..80b171336 100755 --- a/packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as.sh +++ b/packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as.sh @@ -8,5 +8,5 @@ ru=$6 servletKey=$7 queueID=$8 file=$9 -zowe zos-tso start app --app-key "test2" --startup "EXEC '$file'" --servlet-key $servletKey --queue-id $queueID --account $account --host $host --port $port --user $user --password $password --ru $ru +zowe zos-tso start app --app-key "test2" --startup "EXEC '$file'" --servlet-key $servletKey --queue-id $queueID --account $account --host $host --port $port --user $user --password $password --ru $ru --rfj exit $? diff --git a/packages/zostso/__tests__/__system__/__scripts__/start/start_app_new_as.sh b/packages/zostso/__tests__/__system__/__scripts__/start/start_app_new_as.sh index d250cc7d9..ebc0be9a8 100755 --- a/packages/zostso/__tests__/__system__/__scripts__/start/start_app_new_as.sh +++ b/packages/zostso/__tests__/__system__/__scripts__/start/start_app_new_as.sh @@ -6,5 +6,5 @@ user=$4 password=$5 ru=$6 file=$7 -zowe zos-tso start app --app-key "test2" --startup "EXEC '$file'" --account $account --host $host --port $port --user $user --password $password --ru $ru +zowe zos-tso start app --app-key "test2" --startup "EXEC '$file'" --account $account --host $host --port $port --user $user --password $password --ru $ru --rfj exit $? diff --git a/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts b/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts index 199725d1a..ca26c1e88 100644 --- a/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts +++ b/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts @@ -68,7 +68,7 @@ describe("All test", () => { expect(error).toBeUndefined(); await StopTso.stop( REAL_SESSION, - JSON.parse(response.stdout.toString()).servletKey + JSON.parse(response.stdout.toString()).data.servletKey ); }); @@ -132,9 +132,7 @@ describe("All test", () => { ] ); - const startServletkey = JSON.parse( - startResponse.stdout.toString() - ).servletKey; + const startServletkey = JSON.parse(startResponse.stdout.toString()).data.servletKey; const response = runCliScript( __dirname + "/__scripts__/send/send_tso_app.sh", @@ -173,7 +171,6 @@ describe("All test", () => { expect(responses).toContain( "Application input = LONG 100" ); - expect(responses).toContain("servletKey"); expect(responses).toContain("READY "); //Clean up test @@ -195,9 +192,7 @@ describe("All test", () => { dsname+"(TESTAPP)" ] ); - const startServletkey = JSON.parse( - startResponse.stdout.toString() - ).servletKey; + const startServletkey = JSON.parse(startResponse.stdout.toString()).data.servletKey; runCliScript( __dirname + "/__scripts__/send/send_tso_app.sh", testEnvironment, @@ -248,9 +243,7 @@ describe("All test", () => { dsname+"(TESTAPP)" ] ); - const startServletkey = JSON.parse( - startResponse.stdout.toString() - ).servletKey; + const startServletkey = JSON.parse(startResponse.stdout.toString()).data.servletKey; runCliScript( __dirname + "/__scripts__/send/send_tso_app.sh", testEnvironment, From 3c3498d8487b31d0b8388c7babab21f813aa1240 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 6 Nov 2024 11:21:30 -0500 Subject: [PATCH 10/13] changelog Signed-off-by: jace-roell --- packages/zosfiles/src/methods/upload/Upload.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/src/methods/upload/Upload.ts b/packages/zosfiles/src/methods/upload/Upload.ts index 528150b96..13a53abef 100644 --- a/packages/zosfiles/src/methods/upload/Upload.ts +++ b/packages/zosfiles/src/methods/upload/Upload.ts @@ -877,7 +877,7 @@ export class Upload { } else if(options.filesMap?.fileNames.indexOf(path.basename(localPath)) > -1) { tempOptions.binary = options.filesMap.binary; - // Reset encoding to undefined if binary is true to avoid file tagging issues + // Reset encoding to undefined if binary is true to avoid file tagging issues if(tempOptions.binary) tempOptions.encoding = undefined; } From 9b0cb6f668442c4bcd5791cf564a8521df57a070 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 6 Nov 2024 14:14:55 -0500 Subject: [PATCH 11/13] changelog Signed-off-by: jace-roell --- packages/cli/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 0a24f3ac5..15e2bdbe3 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to the Zowe CLI package will be documented in this file. ## Recent Changes -- BugFix: Improved output formatting for `zowe zos-tso start app` and `zowe zos-tso send app`[#2347](https://github.com/zowe/zowe-cli/pull/2347) +- BugFix: Improved output formatting for `zowe zos-tso start app` and `zowe zos-tso send app` by parsing and displaying relevant data rather than the entire JSON response [#2347](https://github.com/zowe/zowe-cli/pull/2347) ## `8.7.0` From 8415cff7a01be310fd8fb15465b424d3f07c54ad Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 6 Nov 2024 15:13:55 -0500 Subject: [PATCH 12/13] changelog Signed-off-by: jace-roell --- packages/cli/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 15e2bdbe3..e82f7e2c8 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to the Zowe CLI package will be documented in this file. ## Recent Changes -- BugFix: Improved output formatting for `zowe zos-tso start app` and `zowe zos-tso send app` by parsing and displaying relevant data rather than the entire JSON response [#2347](https://github.com/zowe/zowe-cli/pull/2347) +- BugFix: Improved output formatting for `zowe zos-tso start app` and `zowe zos-tso send app` commands by parsing and displaying relevant data rather than the entire JSON response. [#2347](https://github.com/zowe/zowe-cli/pull/2347) ## `8.7.0` From 7f0dff7ad3fd36700f3b38f12f1d373072e17423 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Thu, 7 Nov 2024 11:03:16 -0500 Subject: [PATCH 13/13] added system tests for --no-rfj test cases Signed-off-by: jace-roell --- .../__scripts__/send/send_tso_app_rfj.sh | 13 ++ .../start/start_app_existing_as.sh | 3 +- .../start/start_app_existing_as_rfj.sh | 13 ++ .../__scripts__/start/start_app_new_as.sh | 4 +- .../__system__/api.TsoASApp.system.test.ts | 153 ++++++++++++++++-- 5 files changed, 175 insertions(+), 11 deletions(-) create mode 100755 packages/zostso/__tests__/__system__/__scripts__/send/send_tso_app_rfj.sh create mode 100755 packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as_rfj.sh diff --git a/packages/zostso/__tests__/__system__/__scripts__/send/send_tso_app_rfj.sh b/packages/zostso/__tests__/__system__/__scripts__/send/send_tso_app_rfj.sh new file mode 100755 index 000000000..e7309bd61 --- /dev/null +++ b/packages/zostso/__tests__/__system__/__scripts__/send/send_tso_app_rfj.sh @@ -0,0 +1,13 @@ +#!/bin/bash +account=$1 +host=$2 +port=$3 +user=$4 +password=$5 +ru=$6 +servletKey=$7 +message=$8 +appKey=$9 + +zowe zos-tso send app --ak "$appKey" --sk "$servletKey" --message "$message" --account $account --host $host --port $port --user $user --password $password --ru $ru --rfj +exit $? diff --git a/packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as.sh b/packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as.sh index 80b171336..20dd1850e 100755 --- a/packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as.sh +++ b/packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as.sh @@ -8,5 +8,6 @@ ru=$6 servletKey=$7 queueID=$8 file=$9 -zowe zos-tso start app --app-key "test2" --startup "EXEC '$file'" --servlet-key $servletKey --queue-id $queueID --account $account --host $host --port $port --user $user --password $password --ru $ru --rfj + +zowe zos-tso start app --app-key "test2" --startup "EXEC '$file'" --servlet-key $servletKey --queue-id $queueID --account $account --host $host --port $port --user $user --password $password --ru $ru exit $? diff --git a/packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as_rfj.sh b/packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as_rfj.sh new file mode 100755 index 000000000..a0f16124b --- /dev/null +++ b/packages/zostso/__tests__/__system__/__scripts__/start/start_app_existing_as_rfj.sh @@ -0,0 +1,13 @@ +#!/bin/bash +account=$1 +host=$2 +port=$3 +user=$4 +password=$5 +ru=$6 +servletKey=$7 +queueID=$8 +file=$9 + +zowe zos-tso start app --app-key "test2" --startup "EXEC '$file'" --servlet-key $servletKey --queue-id $queueID --account $account --host $host --port $port --user $user --password $password --ru $ru --rfj +exit $? diff --git a/packages/zostso/__tests__/__system__/__scripts__/start/start_app_new_as.sh b/packages/zostso/__tests__/__system__/__scripts__/start/start_app_new_as.sh index ebc0be9a8..b27dbd14f 100755 --- a/packages/zostso/__tests__/__system__/__scripts__/start/start_app_new_as.sh +++ b/packages/zostso/__tests__/__system__/__scripts__/start/start_app_new_as.sh @@ -6,5 +6,7 @@ user=$4 password=$5 ru=$6 file=$7 -zowe zos-tso start app --app-key "test2" --startup "EXEC '$file'" --account $account --host $host --port $port --user $user --password $password --ru $ru --rfj +rfj=$8 + +zowe zos-tso start app --app-key "test2" --startup "EXEC '$file'" --account $account --host $host --port $port --user $user --password $password --ru $ru --rfj $rfj exit $? diff --git a/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts b/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts index ca26c1e88..9ef1205df 100644 --- a/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts +++ b/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts @@ -44,7 +44,7 @@ describe("All test", () => { }); describe("Start TSO app tests", () => { - it("should create TSO address space and run an application instance at the created AS", async () => { + it("should create TSO address space and run an application instance at the created AS --rfj", async () => { let error: ImperativeError; const response = runCliScript( @@ -57,7 +57,8 @@ describe("All test", () => { defaultSystem.zosmf.user, defaultSystem.zosmf.password, defaultSystem.zosmf.rejectUnauthorized, - dsname+"(TESTAPP)" + dsname+"(TESTAPP)", + true ] ); @@ -71,8 +72,36 @@ describe("All test", () => { JSON.parse(response.stdout.toString()).data.servletKey ); }); + it("should create TSO address space and run an application instance at the created AS --no-rfj", async () => { + let error: ImperativeError; + + const response = runCliScript( + __dirname + "/__scripts__/start/start_app_new_as.sh", + testEnvironment, + [ + ACCOUNT_NUMBER, + defaultSystem.zosmf.host, + defaultSystem.zosmf.port, + defaultSystem.zosmf.user, + defaultSystem.zosmf.password, + defaultSystem.zosmf.rejectUnauthorized, + dsname+"(TESTAPP)", + false + ] + ); - it("should create TSO application instance on existing address space", async () => { + expect(response.stdout.toString()).toBeDefined(); + expect(response.stdout.toString()).toContain( + "HELLOW exec processing has started" + ); + expect(error).toBeUndefined(); + await StopTso.stop( + REAL_SESSION, + response.stdout.toString().match(/Servlet Key:\s*([A-Za-z0-9-]+)/)[1] + ); + }); + + it("should create TSO application instance on existing address space --rfj", async () => { dsname = getUniqueDatasetName(`${defaultSystem.zosmf.user}.ZOSTEST`); await Create.dataSet(REAL_SESSION, CreateDataSetTypeEnum.DATA_SET_PARTITIONED, dsname); await Upload.fileToDataset(REAL_SESSION, __dirname + "/__scripts__/start/test_app.rexx", dsname, {}); @@ -90,7 +119,7 @@ describe("All test", () => { }; const response = runCliScript( - __dirname + "/__scripts__/start/start_app_existing_as.sh", + __dirname + "/__scripts__/start/start_app_existing_as_rfj.sh", testEnvironment, [ ACCOUNT_NUMBER, @@ -101,7 +130,7 @@ describe("All test", () => { defaultSystem.zosmf.rejectUnauthorized, startResponse.startResponse.zosmfTsoResponse.servletKey, startResponse.startResponse.zosmfTsoResponse.queueID, - dsname+"(TESTAPP)" + dsname+"(TESTAPP)", ] ); expect(response.stdout.toString()).toBeDefined(); @@ -115,9 +144,52 @@ describe("All test", () => { startResponse.startResponse.zosmfTsoResponse.servletKey ); }); + it("should create TSO application instance on existing address space --no-rfj", async () => { + dsname = getUniqueDatasetName(`${defaultSystem.zosmf.user}.ZOSTEST`); + await Create.dataSet(REAL_SESSION, CreateDataSetTypeEnum.DATA_SET_PARTITIONED, dsname); + await Upload.fileToDataset(REAL_SESSION, __dirname + "/__scripts__/start/test_app.rexx", dsname, {}); + + const startResponse: IIssueResponse = { + success: false, + startResponse: await StartTso.start( + REAL_SESSION, + ACCOUNT_NUMBER + ), + startReady: false, + zosmfResponse: null, + commandResponse: null, + stopResponse: null, + }; + + const response = runCliScript( + __dirname + "/__scripts__/start/start_app_existing_as.sh", + testEnvironment, + [ + ACCOUNT_NUMBER, + defaultSystem.zosmf.host, + defaultSystem.zosmf.port, + defaultSystem.zosmf.user, + defaultSystem.zosmf.password, + defaultSystem.zosmf.rejectUnauthorized, + startResponse.startResponse.zosmfTsoResponse.servletKey, + startResponse.startResponse.zosmfTsoResponse.queueID, + dsname+"(TESTAPP)", + ] + ); + expect(response.stdout.toString()).toBeDefined(); + expect(response.stdout.toString()).toContain( + "HELLOW exec processing has started" + ); + + //Clean up test + await StopTso.stop( + REAL_SESSION, + response.stdout.toString().match(/Servlet Key:\s*([A-Za-z0-9-]+)/)[1] + ); + }); }); describe("Send TSO app tests", () => { - it("Should send message to TSO address space app", async () => { + it("Should send message to TSO address space app --no-rfj", async () => { const startResponse = runCliScript( __dirname + "/__scripts__/start/start_app_new_as.sh", testEnvironment, @@ -128,7 +200,8 @@ describe("All test", () => { defaultSystem.zosmf.user, defaultSystem.zosmf.password, defaultSystem.zosmf.rejectUnauthorized, - dsname+"(TESTAPP)" + dsname+"(TESTAPP)", + true ] ); @@ -173,6 +246,66 @@ describe("All test", () => { ); expect(responses).toContain("READY "); + //Clean up test + await StopTso.stop(REAL_SESSION, startServletkey); + }); + it("Should send message to TSO address space app --rfj", async () => { + const startResponse = runCliScript( + __dirname + "/__scripts__/start/start_app_new_as.sh", + testEnvironment, + [ + ACCOUNT_NUMBER, + defaultSystem.zosmf.host, + defaultSystem.zosmf.port, + defaultSystem.zosmf.user, + defaultSystem.zosmf.password, + defaultSystem.zosmf.rejectUnauthorized, + dsname+"(TESTAPP)", + true + ] + ); + + const startServletkey = JSON.parse(startResponse.stdout.toString()).data.servletKey; + + const response = runCliScript( + __dirname + "/__scripts__/send/send_tso_app_rfj.sh", + testEnvironment, + [ + ACCOUNT_NUMBER, + defaultSystem.zosmf.host, + defaultSystem.zosmf.port, + defaultSystem.zosmf.user, + defaultSystem.zosmf.password, + defaultSystem.zosmf.rejectUnauthorized, + startServletkey, + "LONG 100", + "test2", + ] + ); + const response2 = runCliScript( + __dirname + "/__scripts__/receive/receive_tso_app.sh", + testEnvironment, + [ + ACCOUNT_NUMBER, + defaultSystem.zosmf.host, + defaultSystem.zosmf.port, + defaultSystem.zosmf.user, + defaultSystem.zosmf.password, + defaultSystem.zosmf.rejectUnauthorized, + startServletkey, + "test2", + "true", + ] + ); + const responses = response.stdout.toString() + response2.stdout.toString(); + + expect(response.stdout.toString()).toBeDefined(); + expect(response2.stdout.toString()).toBeDefined(); + expect(responses).toContain( + "Application input = LONG 100" + ); + expect(responses).toContain("READY "); + //Clean up test await StopTso.stop(REAL_SESSION, startServletkey); }); @@ -189,7 +322,8 @@ describe("All test", () => { defaultSystem.zosmf.user, defaultSystem.zosmf.password, defaultSystem.zosmf.rejectUnauthorized, - dsname+"(TESTAPP)" + dsname+"(TESTAPP)", + true ] ); const startServletkey = JSON.parse(startResponse.stdout.toString()).data.servletKey; @@ -240,7 +374,8 @@ describe("All test", () => { defaultSystem.zosmf.user, defaultSystem.zosmf.password, defaultSystem.zosmf.rejectUnauthorized, - dsname+"(TESTAPP)" + dsname+"(TESTAPP)", + true ] ); const startServletkey = JSON.parse(startResponse.stdout.toString()).data.servletKey;