Skip to content

Commit

Permalink
export zosNodeAccessor as zna
Browse files Browse the repository at this point in the history
Signed-off-by: zFernand0 <[email protected]>
  • Loading branch information
zFernand0 committed Mar 15, 2024
1 parent f584d5d commit 1dd3d5f
Show file tree
Hide file tree
Showing 27 changed files with 89 additions and 104 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ All notable changes to the z/OS FTP Plug-in for Zowe CLI will be documented in t

- **Enhancements**:
- The following properties, interfaces, and/or functions were added:
- `zosNodeAccessor` and `zna` as namespaces for the entire `zos-node-accessor` package.
- `JobUtils.downloadSpoolContent`
- `JobUtils.getSpoolDownloadFilePath`
- `IListJobOption.jobName`
- `IListJobOption.jobId`
- `ITransferMode`
- For a full list of transfer modes, see [TransferMode by `zos-node-accessor`](https://github.com/IBM/zos-node-accessor/blob/faf55873f37cc40e927f1b1c19f697de8cf08b95/src/zosAccessor.ts#L67)
- `IConnectionOption`
- For a full list of transfer modes, see [ConnectionOption by `zos-node-accessor`](https://github.com/IBM/zos-node-accessor/blob/faf55873f37cc40e927f1b1c19f697de8cf08b95/src/interfaces/ConnectionOption.ts#L17)
- `IDatasetEntry`
Expand Down Expand Up @@ -57,9 +58,9 @@ All notable changes to the z/OS FTP Plug-in for Zowe CLI will be documented in t
- `DataSetUtils.allocateDataSet`
- `AbstractTemplatedJCL.getJcl`
- The properties in the interfaces below have changed:
- `IDownloadFileOption.transferType?: string` to `IDownloadFileOption.transferType?: ITransferMode`
- `IUploadFileOption.transferType?: string` to `IUploadFileOption.transferType?: ITransferMode`
- `IUploadDataSetOption.transferType?: string` to `IUploadDataSetOption.transferType?: ITransferMode`
- `IDownloadFileOption.transferType?: string` to `IDownloadFileOption.transferType?: zna.TransferMode`
- `IUploadFileOption.transferType?: string` to `IUploadFileOption.transferType?: zna.TransferMode`
- `IUploadDataSetOption.transferType?: string` to `IUploadDataSetOption.transferType?: zna.TransferMode`
- `ISpoolFile.id: string` to `ISpoolFile.id: number`
- `ISpoolFile.stepname: string` to `ISpoolFile.stepName: string`
- `ISpoolFile.procstep: string` to `ISpoolFile.procStep: string`
Expand All @@ -70,7 +71,6 @@ All notable changes to the z/OS FTP Plug-in for Zowe CLI will be documented in t
- `IJob.jobname: string` to `IJob.jobName: string`
- `IJob.jobid: string` to `IJob.jobId: string`
- `IGetSpoolFileOption.fileId: string` to `IGetSpoolFileOption.fileId: number`
-

## `2.1.8`

Expand Down
5 changes: 3 additions & 2 deletions __tests__/__system__/cli/PrepareTestJclDatasets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
*
*/

import { ITransferMode, IUploadDataSetOption } from "../../../src/api";
import { TransferMode } from "zos-node-accessor";
import { IUploadDataSetOption } from "../../../src/api";
import { DataSetUtils } from "../../../src/api/DataSetUtils";

export async function prepareTestJclDataSet(connection: any, pds: string, jclName: string): Promise<string> {
Expand All @@ -18,7 +19,7 @@ export async function prepareTestJclDataSet(connection: any, pds: string, jclNam
if (filteredMembers.find(member => member.name === jclName) === undefined) {
const options: IUploadDataSetOption = {
localFile: `${__dirname}/../../../__tests__/__resources__/${jclName}.JCL`,
transferType: ITransferMode.ASCII as unknown as ITransferMode,
transferType: TransferMode.ASCII,
};
await DataSetUtils.uploadDataSet(connection, datasetName, options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test-
import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema";
import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { generateRandomAlphaNumericString } from "../../../../__src__/TestUtils";
import { ZosAccessor } from "zos-node-accessor";
import { ITransferMode } from "../../../../../src/api";
import { TransferMode, ZosAccessor } from "zos-node-accessor";

let connection: ZosAccessor;
let testDataSet: string;
Expand Down Expand Up @@ -42,7 +41,7 @@ describe("delete data set command", () => {
const memberSuffixLength = 6;
const destination = testDataSet + "(R" + generateRandomAlphaNumericString(memberSuffixLength) + ")";
const randomContentLength = 60;
await connection.uploadDataset(generateRandomAlphaNumericString(randomContentLength), "'" + destination + "'", ITransferMode.ASCII);
await connection.uploadDataset(generateRandomAlphaNumericString(randomContentLength), "'" + destination + "'", TransferMode.ASCII);
const result = runCliScript(__dirname + "/__scripts__/command_delete_data_set.sh", testEnvironment,
[destination]);
expect(result.stderr.toString()).toEqual("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test-
import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema";
import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { generateRandomAlphaNumericString } from "../../../../__src__/TestUtils";
import { ZosAccessor } from "zos-node-accessor";
import { ITransferMode } from "../../../../../src/api";
import { TransferMode, ZosAccessor } from "zos-node-accessor";

let connection: ZosAccessor;
let ussTestDir: string;
Expand Down Expand Up @@ -43,7 +42,7 @@ describe("delete uss file command", () => {
const fileNameLength = 30;
const destination = ussTestDir + "/" + generateRandomAlphaNumericString(fileNameLength) + ".txt";
const uploadContent = generateRandomAlphaNumericString(CONTENT_LENGTH);
await connection.uploadDataset(uploadContent, destination, ITransferMode.ASCII);
await connection.uploadDataset(uploadContent, destination, TransferMode.ASCII);
const result = runCliScript(__dirname + "/__scripts__/command_delete_uss_file.sh", testEnvironment,
[destination]);
expect(result.stderr.toString()).toEqual("");
Expand Down Expand Up @@ -77,7 +76,7 @@ describe("delete uss file command", () => {

let uploadContent = generateRandomAlphaNumericString(CONTENT_LENGTH);
const file = destination + "/" + generateRandomAlphaNumericString(fileNameLength) + ".txt";
await connection.uploadDataset(uploadContent, file, ITransferMode.ASCII);
await connection.uploadDataset(uploadContent, file, TransferMode.ASCII);

const subDirectoryDestination1 = destination + "/" + generateRandomAlphaNumericString(fileNameLength);
await connection.makeDirectory(subDirectoryDestination1);
Expand All @@ -87,11 +86,11 @@ describe("delete uss file command", () => {

uploadContent = generateRandomAlphaNumericString(CONTENT_LENGTH);
const file1 = subDirectoryDestination1 + "/" + generateRandomAlphaNumericString(fileNameLength) + ".txt";
await connection.uploadDataset(uploadContent, file1, ITransferMode.ASCII);
await connection.uploadDataset(uploadContent, file1, TransferMode.ASCII);

uploadContent = generateRandomAlphaNumericString(CONTENT_LENGTH);
const file2 = subDirectoryDestination2 + "/" + generateRandomAlphaNumericString(fileNameLength) + ".txt";
await connection.uploadDataset(uploadContent, file2, ITransferMode.ASCII);
await connection.uploadDataset(uploadContent, file2, TransferMode.ASCII);

const result = runCliScript(__dirname + "/__scripts__/command_delete_uss_directory_recursively.sh", testEnvironment,
[destination]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { generateRandomAlphaNumericString, generateRandomBytes } from "../../../../__src__/TestUtils";
import { IO } from "@zowe/imperative";
import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets";
import { ZosAccessor } from "zos-node-accessor";
import { ITransferMode } from "../../../../../src/api";
import { TransferMode, ZosAccessor } from "zos-node-accessor";

let connection: ZosAccessor;
let testEnvironment: ITestEnvironment<ITestPropertiesSchema>;
Expand Down Expand Up @@ -63,7 +62,7 @@ describe("submit job from local file command", () => {
const randomContent = await generateRandomBytes(randomContentLength);
const memberSuffixLength = 6;
const binaryMember = testDataSet + "(R" + generateRandomAlphaNumericString(memberSuffixLength) + ")";
await connection.uploadDataset(randomContent, "'" + binaryMember + "'", ITransferMode.BINARY);
await connection.uploadDataset(randomContent, "'" + binaryMember + "'", TransferMode.BINARY);
const downloadFilePath = testEnvironment.workingDir + "/iefbr14.txt";
const result = runCliScript(__dirname + "/__scripts__/command_download_data_set_binary.sh", testEnvironment,
[binaryMember, downloadFilePath]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSc
import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { generateRandomAlphaNumericString, generateRandomBytes } from "../../../../__src__/TestUtils";
import { IO } from "@zowe/imperative";
import { ZosAccessor } from "zos-node-accessor";
import { ITransferMode } from "../../../../../src/api";
import { TransferMode, ZosAccessor } from "zos-node-accessor";

let connection: ZosAccessor;
let ussTestDir: string;
Expand Down Expand Up @@ -44,7 +43,7 @@ describe("submit job from local file command", () => {
const fileNameLength = 30;
const destination = ussTestDir + "/" + generateRandomAlphaNumericString(fileNameLength) + ".txt";
const uploadContent = generateRandomAlphaNumericString(CONTENT_LENGTH);
await connection.uploadFile(uploadContent, destination, ITransferMode.ASCII);
await connection.uploadFile(uploadContent, destination, TransferMode.ASCII);
const downloadFilePath = testEnvironment.workingDir + "/uss.txt";
const result = runCliScript(__dirname + "/__scripts__/command_download_uss_file.sh", testEnvironment,
[destination, downloadFilePath]);
Expand All @@ -62,7 +61,7 @@ describe("submit job from local file command", () => {
const randomContent = await generateRandomBytes(randomContentLength);
const fileNameLength = 30;
const destination = ussTestDir + "/" + generateRandomAlphaNumericString(fileNameLength) + ".bin";
await connection.uploadFile(randomContent, destination, ITransferMode.BINARY);
await connection.uploadFile(randomContent, destination, TransferMode.BINARY);
const downloadFilePath = testEnvironment.workingDir + "/iefbr14.txt";
const result = runCliScript(__dirname + "/__scripts__/command_download_uss_file_binary.sh", testEnvironment,
[destination, downloadFilePath]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
pre=$1
owner=$2
pre="$1"
owner="$2"
status=$3
set -e

zowe zos-ftp list jobs --prefix $pre --owner $owner --status $status
zowe zos-ftp list jobs --prefix "$pre" --owner "$owner" --status $status
4 changes: 2 additions & 2 deletions __tests__/__system__/cli/list/job/cli.list.job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ describe("list job ftp command", () => {
});

it("should be able to list the jobs with status from the test properties file", async () => {
const pre = "\"*\"";
const owner ="\"*\"";
const pre = '*';
const owner = '*';
const status = "ACTIVE";
const result = runCliScript(__dirname + "/__scripts__/command_list_job.sh", testEnvironment, [pre, owner, status]);
expect(result.stderr.toString()).toEqual("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSc
import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { generateRandomAlphaNumericString } from "../../../../__src__/TestUtils";
import * as path from "path";
import { ZosAccessor } from "zos-node-accessor";
import { ITransferMode } from "../../../../../src/api";
import { TransferMode, ZosAccessor } from "zos-node-accessor";

let connection: ZosAccessor;
let ussTestDir: string;
Expand Down Expand Up @@ -44,7 +43,7 @@ describe("list data-set-classic ftp command", () => {
const fileNameLength = 30;
const destination = ussTestDir + "/" + generateRandomAlphaNumericString(fileNameLength) + ".txt";
const uploadContent = generateRandomAlphaNumericString(CONTENT_LENGTH);
await connection.uploadFile(uploadContent, destination, ITransferMode.ASCII); // upload the USS file
await connection.uploadFile(uploadContent, destination, TransferMode.ASCII); // upload the USS file
const result = runCliScript(__dirname + "/__scripts__/command_list_uss_files.sh", testEnvironment, [ussTestDir]);
expect(result.stderr.toString()).toEqual("");
expect(result.status).toEqual(0);
Expand All @@ -58,7 +57,7 @@ describe("list data-set-classic ftp command", () => {
const fileName = generateRandomAlphaNumericString(fileNameLength);
const destination = ussTestDir + "/" + "prefix_" + fileName + "_suffix.txt";
const uploadContent = generateRandomAlphaNumericString(CONTENT_LENGTH);
await connection.uploadFile(uploadContent, destination, ITransferMode.ASCII); // upload the USS file
await connection.uploadFile(uploadContent, destination, TransferMode.ASCII); // upload the USS file

const ussTestDirPattern1 = ussTestDir + "/" + "prefix_*";
let result = runCliScript(__dirname + "/__scripts__/command_list_uss_files.sh", testEnvironment, [ussTestDirPattern1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { generateRandomAlphaNumericString, randomDsName } from "../../../../__src__/TestUtils";
import { inspect } from "util";
import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets";
import { ZosAccessor } from "zos-node-accessor";
import { ITransferMode } from "../../../../../src/api";
import { TransferMode, ZosAccessor } from "zos-node-accessor";

let connection: ZosAccessor;
let user: string;
Expand Down Expand Up @@ -50,7 +49,7 @@ describe("rename data set command", () => {
const iefbr14Content = (await connection.downloadDataset(iefbr14DataSet)).toString();
const memberSuffixLength = 6;
const originalMember = testDataSet + "(R" + generateRandomAlphaNumericString(memberSuffixLength) + ")";
await connection.uploadDataset(iefbr14Content, "'" + originalMember + "'", ITransferMode.ASCII); // upload the USS file
await connection.uploadDataset(iefbr14Content, "'" + originalMember + "'", TransferMode.ASCII); // upload the USS file
const renameDestination = testDataSet + "(R" + generateRandomAlphaNumericString(memberSuffixLength) + ")";
const result = runCliScript(__dirname + "/__scripts__/command_rename_data_set.sh", testEnvironment,
[originalMember, renameDestination]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test-
import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema";
import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { generateRandomAlphaNumericString } from "../../../../__src__/TestUtils";
import { ZosAccessor } from "zos-node-accessor";
import { ITransferMode } from "../../../../../src/api";
import { TransferMode, ZosAccessor } from "zos-node-accessor";

let connection: ZosAccessor;
let ussTestDir: string;
Expand Down Expand Up @@ -43,7 +42,7 @@ describe("rename uss file command", () => {
const fileNameLength = 30;
const destination = ussTestDir + "/" + generateRandomAlphaNumericString(fileNameLength) + ".txt";
const uploadContent = generateRandomAlphaNumericString(CONTENT_LENGTH);
await connection.uploadDataset(uploadContent, destination, ITransferMode.ASCII); // upload the USS file
await connection.uploadDataset(uploadContent, destination, TransferMode.ASCII); // upload the USS file
const renameDestination = ussTestDir + "/" + generateRandomAlphaNumericString(fileNameLength) + ".txt";
const result = runCliScript(__dirname + "/__scripts__/command_rename_uss_file.sh", testEnvironment,
[destination, renameDestination]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { generateRandomAlphaNumericString, generateRandomBytes } from "../../../../__src__/TestUtils";
import { IO } from "@zowe/imperative";
import * as fs from "fs";
import { ZosAccessor } from "zos-node-accessor";
import { ITransferMode } from "../../../../../src/api";
import { TransferMode, ZosAccessor } from "zos-node-accessor";

let connection: ZosAccessor;
let testDataSet: string;
Expand Down Expand Up @@ -72,7 +71,7 @@ describe("upload file to data set command", () => {
[fileToUpload, destination]);
expect(result.stderr.toString()).toEqual("");
expect(result.status).toEqual(0);
const uploadedContent = (await connection.downloadDataset("'" + destination + "'", ITransferMode.BINARY));
const uploadedContent = (await connection.downloadDataset("'" + destination + "'", TransferMode.BINARY));
// binary upload to a fixed record data set will fill a data set with zeroes for the remainder of the record
// so we can trim the zeroes off and still be accurate
const uploadedContentString = uploadedContent.toString("hex").replace(/0+$/, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { generateRandomAlphaNumericString, generateRandomBytes } from "../../../../__src__/TestUtils";
import { IO } from "@zowe/imperative";
import * as fs from "fs";
import { ZosAccessor } from "zos-node-accessor";
import { ITransferMode } from "../../../../../src/api";
import { TransferMode, ZosAccessor } from "zos-node-accessor";

let connection: ZosAccessor;
let ussTestDir: string;
Expand Down Expand Up @@ -69,7 +68,7 @@ describe("upload file to uss file command", () => {
[fileToUpload, destination]);
expect(result.stderr.toString()).toEqual("");
expect(result.status).toEqual(0);
const uploadedContent = (await connection.downloadFile(destination, ITransferMode.BINARY));
const uploadedContent = (await connection.downloadFile(destination, TransferMode.BINARY));
const uploadedContentString = uploadedContent.toString("hex");
expect(uploadedContentString).toEqual(randomContent.toString("hex"));
await connection.deleteFile(destination);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { generateRandomAlphaNumericString, generateRandomBytes } from "../../../../__src__/TestUtils";
import { IO } from "@zowe/imperative";
import * as fs from "fs";
import { ZosAccessor } from "zos-node-accessor";
import { ITransferMode } from "../../../../../src/api";
import { TransferMode, ZosAccessor } from "zos-node-accessor";

let connection: ZosAccessor;
let testDataSet: string;
Expand Down Expand Up @@ -69,7 +68,7 @@ describe("upload stdin to data set command", () => {
[fileToUpload, destination]);
expect(result.stderr.toString()).toEqual("");
expect(result.status).toEqual(0);
const uploadedContent = (await connection.downloadDataset("'" + destination + "'", ITransferMode.BINARY));
const uploadedContent = (await connection.downloadDataset("'" + destination + "'", TransferMode.BINARY));
// binary upload to a fixed record data set will fill a data set with zeroes for the remainder of the record
// so we can trim the zeroes off and still be accurate
const uploadedContentString = uploadedContent.toString("hex").replace(/0+$/, "");
Expand Down
Loading

0 comments on commit 1dd3d5f

Please sign in to comment.