Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed start tso app and send tso app output formatting #2347

Merged
merged 18 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Can we say that these are commands? Like: "Improved output formatting for the AAA and BBB commands by ... "
  • Sentence should end w/ a period.


## `8.7.0`

- Enhancement: Added --wait-for-active and --wait-for-output to download options on zosjobs. [#2328](https://github.com/zowe/zowe-cli/pull/2328)
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);
}
}
10 changes: 9 additions & 1 deletion packages/cli/src/zostso/start/as-app/StartASApp.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import { IHandlerParameters } from "@zowe/imperative";
import { ZosTsoBaseHandler, AddressSpaceApps } from "@zowe/zos-tso-for-zowe-sdk";
import chalk = require("chalk");
jace-roell marked this conversation as resolved.
Show resolved Hide resolved

/**
* Handler to start app at an address space
Expand All @@ -32,6 +33,13 @@ 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);
jace-roell marked this conversation as resolved.
Show resolved Hide resolved
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.data.setObj(response);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for being picky, but should we also have a system test for the non---rfj approach?

Original file line number Diff line number Diff line change
Expand Up @@ -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 $?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as previous comment

Original file line number Diff line number Diff line change
Expand Up @@ -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 $?
15 changes: 4 additions & 11 deletions packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
});

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down