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

V3 Conformance + zos-node-accessor update #155

Merged
merged 18 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
68 changes: 0 additions & 68 deletions .eslintrc.js

This file was deleted.

51 changes: 51 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
env:
es2021: true
node: true
extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended
ignorePatterns:
- "**/*.js"
- "**/*.d.ts"
overrides:
- extends:
- "plugin:jest/recommended"
files:
- "**/__tests__/**/*.ts"
rules:
jest/expect-expect: ["warn", { "assertFunctionNames": ["expect*", "**.*expect*"] }]
jest/no-conditional-expect: off
jest/no-standalone-expect: off
jest/no-try-expect: off
unused-imports/no-unused-vars: off
"@typescript-eslint/no-explicit-any": off
"@typescript-eslint/no-magic-numbers": off
parser: "@typescript-eslint/parser"
parserOptions:
ecmaVersion: 12
sourceType: module
plugins:
- "@typescript-eslint"
- jest
- unused-imports
rules:
max-len: ["warn", 150]
no-console: error
no-multiple-empty-lines: warn
no-trailing-spaces: warn
"@typescript-eslint/ban-types": off
"@typescript-eslint/comma-dangle": ["warn", "only-multiline"]
"@typescript-eslint/explicit-module-boundary-types": off
"@typescript-eslint/indent": ["warn", 4]
"@typescript-eslint/no-explicit-any": warn
"@typescript-eslint/no-inferrable-types": off
"@typescript-eslint/no-magic-numbers": ["warn", {
"ignore": [-1, 0, 1, 2],
"ignoreDefaultValues": true,
"ignoreReadonlyClassProperties": true
}]
"@typescript-eslint/no-unused-vars": off
"@typescript-eslint/no-var-requires": off
"@typescript-eslint/semi": warn
"unused-imports/no-unused-imports": warn
"unused-imports/no-unused-vars": ["warn", { "args": "none" }]
66 changes: 66 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,72 @@

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

## Recent Changes

- Major: Zowe V3 release

- **Enhancements**:
- The following properties, interfaces, and/or functions were added:
- `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)
- **Breaking**:
- Removed the following constants, interfaces, and other values:
- `IGetSpoolFileOption.jobName`
- `JobUtils.parseJobDetails`
- Added proper typing to the parameters of the following functions:
- `CoreUtils.addLowerCaseKeysToObject`
- Return type changed: `any --> IDatasetEntry`
- `CreateDataset.create`
- `DataSetUtils.listDataSets`
- `FTPConfig.connectFromArguments`
- Return type changed: `Promise<any> --> Promise<ZosAccessor>`
- `FTPConfig.createConfigFromArguments`
- Return type changed: `any --> IConnectionOption`
- `JobUtils.getSpoolFileContent`
- Return type changed: `Promise<Buffer> --> Promise<string>`
- `JobUtils.getSpoolFiles`
- `JobUtils.submitJob`
- `JobUtils.submitJobFromDataset`
- `JobUtils.findJobByID`
- `JobUtils.listJobs`
- `JobUtils.deleteJob`
- `UssUtils.listFiles`
- Return type changed: `Promise<any[]> --> Promise<IDatasetEntry[]>`
- `UssUtils.makeDirectory`
- `UssUtils.renameFile`
- `UssUtils.deleteFile`
- `UssUtils.downloadFile`
- `UssUtils.uploadFile`
- `UssUtils.deleteDirectory`
- `DataSetUtils.listDataSets`
- Return type changed: `Promise<any[]> --> Promise<IDatasetEntry[]>`
- `DataSetUtils.listMembers`
- Return type changed: `Promise<any[]> --> Promise<IDatasetEntry[]>`
- `DataSetUtils.deleteDataSet`
- `DataSetUtils.renameDataSet`
- `DataSetUtils.downloadDataSet`
- `DataSetUtils.uploadDataSet`
- `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`
- `ISpoolFile.id: string` to `ISpoolFile.id: number`
- `ISpoolFile.stepname: string` to `ISpoolFile.stepName: string`
- `ISpoolFile.procstep: string` to `ISpoolFile.procStep: string`
- `ISpoolFile.ddname: string` to `ISpoolFile.ddName: string`
- `ISpoolFile.ddname: string` to `ISpoolFile.ddName: string`
- `IJobStatus.jobname: string` to `IJobStatus.jobName: string`
- `IJobStatus.jobid: string` to `IJobStatus.jobId: string`
- `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
34 changes: 3 additions & 31 deletions __tests__/__src__/doc/ITestPropertiesSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*
*/

import { ICommandArguments } from "@zowe/imperative";

/**
* Interface representing the values in the custom_properties.yaml file
* see example_properties.yaml for descriptions and more details
Expand All @@ -19,37 +21,7 @@ export interface ITestPropertiesSchema {
* Properties related to basic zos-ftp (zos-node-accessor package) connection
* see zowe profiles create zftp --help for more info
*/
zftp: {
/**
* user ID to connect to FTP with
*/
user: string,
/**
* Password to connect to FTP with
*/
password: string,
/**
* host name for FTP
*/
host: string,
/**
* Port for FTP connection
*/
port?: number,
/**
* See zos-node-accessor doc - specification for secure FTP transfer
*/
secureFtp?: string,
/**
* How long to wait after attempting to connect before FTP connection times out
*/
connectionTimeout?: number
/**
* Local file containing a job card for submitting jobs for commands such as
* create data set
*/
jobCardFile: string;
};
zftp: ICommandArguments;
datasets: {
/**
* A PDS (partitioned data set) that new members can be written to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ 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";

let connection: any;
let connection: ZosAccessor;
let testEnvironment: ITestEnvironment<ITestPropertiesSchema>;
let iefbr14DataSet: string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ 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";

let connection: any;
let connection: ZosAccessor;
let ussTestDir: string;
let testEnvironment: ITestEnvironment<ITestPropertiesSchema>;

Expand All @@ -42,7 +44,7 @@ describe("submit job from local file command", () => {
const fileNameLength = 30;
const destination = ussTestDir + "/" + generateRandomAlphaNumericString(fileNameLength) + ".txt";
const uploadContent = generateRandomAlphaNumericString(CONTENT_LENGTH);
await connection.uploadDataset(uploadContent, destination, "ascii");
await connection.uploadDataset(uploadContent, destination, ITransferMode.ASCII);
const downloadFilePath = testEnvironment.workingDir + "/uss.txt";
const result = runCliScript(__dirname + "/__scripts__/command_download_uss_file.sh", testEnvironment,
[destination, downloadFilePath]);
Expand All @@ -59,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.uploadDataset(randomContent, destination, "binary");
await connection.uploadDataset(randomContent, destination, ITransferMode.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
Expand Up @@ -12,8 +12,9 @@
import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test-utils";
import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema";
import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { ZosAccessor } from "zos-node-accessor";

let connection: any;
let connection: ZosAccessor;
let testEnvironment: ITestEnvironment<ITestPropertiesSchema>;

describe("list data-set-members ftp command", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test-utils";
import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema";
import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { ZosAccessor } from "zos-node-accessor";

let connection: any;
let connection: ZosAccessor;
let testEnvironment: ITestEnvironment<ITestPropertiesSchema>;

describe("list data-set-classic ftp command", () => {
Expand Down
3 changes: 2 additions & 1 deletion __tests__/__system__/cli/list/job/cli.list.job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test-utils";
import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema";
import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { ZosAccessor } from "zos-node-accessor";

let connection: any;
let connection: ZosAccessor;
let testEnvironment: ITestEnvironment<ITestPropertiesSchema>;

describe("list job ftp command", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSc
import { FTPConfig } from "../../../../../src/api/FTPConfig";
import { CoreUtils } from "../../../../../src/api/CoreUtils";
import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets";
import { ZosAccessor } from "zos-node-accessor";

let connection: any;
let connection: ZosAccessor;
let testEnvironment: ITestEnvironment<ITestPropertiesSchema>;
let iefbr14DataSet: string;

Expand Down
7 changes: 0 additions & 7 deletions __tests__/__unit__/__snapshots__/imperative.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@ Object {
"pluginAliases": Array [
"zftp",
],
"pluginHealthCheck": "./lib/healthCheck.handler",
"pluginSummary": "z/OS Files and jobs via FTP",
"productDisplayName": "z/OS FTP Plugin",
"profiles": Array [
Object {
"createProfileExamples": Array [
Object {
"description": "Create a zftp profile called 'myprofile' with default settings (port, timeout, etc.) to connect with the host system 123.",
"options": "myprofile -u ibmuser -p ibmp4ss -H sys123",
},
],
"schema": Object {
"description": "Configuration profile for z/OS FTP",
"optional": Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ describe("Download all spool by job id handler", () => {
const mockGetSpoolDownloadFile = jest.fn().mockReturnValue("value");
const mockCreateDirsSyncFromFilePath = jest.fn();
const mockWriteFile = jest.fn();
DownloadJobs.getSpoolDownloadFile = mockGetSpoolDownloadFile;
DownloadJobs.getSpoolDownloadFilePath = mockGetSpoolDownloadFile;
IO.createDirsSyncFromFilePath = mockCreateDirsSyncFromFilePath;
IO.writeFile = mockWriteFile;

await handler.processFTP(mockParams);
expect(mockCreateDirsSyncFromFilePath).toBeCalled();
expect(mockWriteFile).toBeCalled();
expect(mockCreateDirsSyncFromFilePath).toHaveBeenCalled();
expect(mockWriteFile).toHaveBeenCalled();
expect(mockResponse.console.log.mock.calls[0][0]).toBe("Successfully downloaded %d spool files to %s");
expect(mockResponse.console.log.mock.calls[0][1]).toBe(1);
expect(mockResponse.console.log.mock.calls[0][2]).toBe("./output/");
Expand Down
Loading
Loading