Skip to content

Commit

Permalink
Merge pull request #2347 from zowe/address-space-app-out-fix
Browse files Browse the repository at this point in the history
fixed start tso app and send tso app output formatting
  • Loading branch information
zFernand0 authored Nov 8, 2024
2 parents fdf1e70 + bca9cdf commit 6ed09fc
Show file tree
Hide file tree
Showing 12 changed files with 318 additions and 114 deletions.
2 changes: 2 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
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` commands by parsing and displaying relevant data rather than the entire JSON response. [#2347](https://github.com/zowe/zowe-cli/pull/2347)
- Enhancement: Add the --ignore-not-found flag to avoid file-not-found error messages when deleting files so scripts are not interupted during automated batch processing. The flag bypasses warning prompts to confirm delete actions. [#2254](https://github.com/zowe/zowe-cli/pull/2254)

## `8.7.0`
Expand Down
Original file line number Diff line number Diff line change
@@ -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",
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
}
`;
6 changes: 1 addition & 5 deletions packages/cli/src/zostso/receive/app/ReceiveASApp.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 5 additions & 3 deletions packages/cli/src/zostso/send/as-app/SendASApp.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ 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) => {
commandParameters.response.console.log(typeof data === 'string' ? data : data?.DATA ?? "");
});
commandParameters.response.data.setObj(response);
}
}
11 changes: 9 additions & 2 deletions packages/cli/src/zostso/start/as-app/StartASApp.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { IHandlerParameters } from "@zowe/imperative";
import { IHandlerParameters, TextUtils } from "@zowe/imperative";
import { ZosTsoBaseHandler, AddressSpaceApps } from "@zowe/zos-tso-for-zowe-sdk";

/**
Expand All @@ -32,6 +32,13 @@ export default class Handler extends ZosTsoBaseHandler {
},
this.mTsoStart
);
commandParameters.response.console.log(JSON.stringify(response,null,2));
commandParameters.response.console.log(TextUtils.chalk.yellow.bold("\n" + "Servlet Key: ") + response.servletKey);
commandParameters.response.console.log(TextUtils.chalk.yellow.bold("Queue ID: ") + response.queueID + "\n");

response.tsoData.forEach((data) => {
commandParameters.response.console.log(typeof data === 'string' ? data : data?.DATA ?? "");
});

commandParameters.response.data.setObj(response);
}
}
Original file line number Diff line number Diff line change
@@ -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 $?
Original file line number Diff line number Diff line change
Expand Up @@ -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
exit $?
Original file line number Diff line number Diff line change
@@ -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 $?
Original file line number Diff line number Diff line change
Expand Up @@ -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=$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 $?
Loading

0 comments on commit 6ed09fc

Please sign in to comment.