Skip to content

Commit

Permalink
Merge pull request #159 from zowe/fix-list-spoolfiles-hang-problem
Browse files Browse the repository at this point in the history
fix list spool file hang problem.
  • Loading branch information
zFernand0 authored Jun 4, 2024
2 parents 4dea27d + 7827720 commit 59c5773
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 35 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the z/OS FTP Plug-in for Zowe CLI will be documented in this file.

## Recent Changes

- Fix list spool file hang problem.

## `3.0.0-next.202403191358`

- Major: Zowe V3 release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import TestUtils from "../../TestUtils";

describe("List spool files by job id handler", () => {

// eslint-disable-next-line jest/no-focused-tests
it("should return no spool file if the no spool file is not found.", async () => {
const handler = new ListSpoolFilesByJobidHandler();
const files: any[] = [];
Expand All @@ -34,9 +35,7 @@ describe("List spool files by job id handler", () => {
response: mockResponse
};
await handler.processFTP(mockParams);
expect(mockResponse.data.setMessage.mock.calls[0][0]).toBe("\"0\" spool files obtained for job \"jobName1(jobId1)\"");
expect(mockResponse.data.setObj.mock.calls[0][0]).toMatchSnapshot();
expect(mockResponse.format.output.mock.calls[0][0]).toMatchSnapshot();
expect(mockResponse.console.log.mock.calls[0]).toContain("No spool file.");
});

it("should return correct message if at least one spool file is found.", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,3 @@ Object {
],
}
`;

exports[`List spool files by job id handler should return no spool file if the no spool file is not found. 1`] = `Array []`;

exports[`List spool files by job id handler should return no spool file if the no spool file is not found. 2`] = `
Object {
"fields": Array [
"id",
"ddName",
"procStep",
"stepName",
],
"format": "table",
"output": Array [],
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Object {
"status",
"rc",
"retcode",
"extra",
],
"format": "object",
"output": Object {
Expand Down
8 changes: 4 additions & 4 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@zowe/imperative": ">=8.0.0-next.0 <8.0.0"
},
"dependencies": {
"zos-node-accessor": "2.0.9"
"zos-node-accessor": "2.0.11"
},
"devDependencies": {
"@types/jest": "^29.5.12",
Expand Down
27 changes: 16 additions & 11 deletions src/cli/list/spool-files-by-jobid/SpoolFilesByJobid.Handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,22 @@ export default class ListSpoolFilesByJobidHandler extends FTPBaseHandler {
this.log.debug("Listing spool files for job ID %s", params.arguments.jobId);
const job = await JobUtils.findJobByID(params.connection, params.arguments.jobId);
const files = job.spoolFiles;
if (files?.length > 0) {
const successMessage = this.log.info(`"${files.length}" spool files obtained for job "${job.jobName}(${job.jobId})"`);
// Set the object, message, and log the prettified object
params.response.data.setObj(files);
params.response.data.setMessage(successMessage);

const successMessage = this.log.info(`"${files.length}" spool files obtained for job "${job.jobName}(${job.jobId})"`);
// Set the object, message, and log the prettified object
params.response.data.setObj(files);
params.response.data.setMessage(successMessage);

// Format & print the response
params.response.format.output({
fields: ["id", "ddName", "procStep", "stepName"],
output: files,
format: "table",
});
// Format & print the response
params.response.format.output({
fields: ["id", "ddName", "procStep", "stepName"],
output: files,
format: "table",
});
} else {
const failedMessage = params.response.console.log("No spool file.");
params.response.data.setMessage(failedMessage);
this.log.info(failedMessage);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class ViewJobStatusByJobIdHandler extends FTPBaseHandler {
params.response.data.setObj(jobDetails);
params.response.format.output(
{
fields: ["jobName", "jobId", "owner", "status", "rc", "retcode"],
fields: ["jobName", "jobId", "owner", "status", "rc", "retcode", "extra"],
output: jobDetails,
format: "object"
}
Expand Down

0 comments on commit 59c5773

Please sign in to comment.