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

fix list spool file hang problem. #159

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 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.");
zFernand0 marked this conversation as resolved.
Show resolved Hide resolved
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"],
zFernand0 marked this conversation as resolved.
Show resolved Hide resolved
output: jobDetails,
format: "object"
}
Expand Down
Loading