From 2c8783c596060fc772120a7981bf9a7ca57222ed Mon Sep 17 00:00:00 2001 From: Pujal Date: Wed, 11 Dec 2024 16:09:42 -0500 Subject: [PATCH 01/17] updated copy pds functionality and system tests Signed-off-by: Pujal --- .../methods/copy/Copy.system.test.ts | 58 ++++++++++++- .../__unit__/methods/copy/Copy.unit.test.ts | 71 ++++++++++++++- packages/zosfiles/src/methods/copy/Copy.ts | 86 ++++++++++++++++++- 3 files changed, 208 insertions(+), 7 deletions(-) diff --git a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts index 312fd5dd0b..3b7c47bc42 100644 --- a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts @@ -10,14 +10,18 @@ */ import { Create, Upload, Delete, CreateDataSetTypeEnum, Copy, ZosFilesMessages, Get, IDataSet, - ICrossLparCopyDatasetOptions, IGetOptions, IZosFilesResponse } from "../../../../src"; -import { Imperative, Session } from "@zowe/imperative"; + ICrossLparCopyDatasetOptions, IGetOptions, IZosFilesResponse, + ZosFilesUtils} from "../../../../src"; +import { Imperative, IO, Session } from "@zowe/imperative"; import { inspect } from "util"; import { TestEnvironment } from "../../../../../../__tests__/__src__/environment/TestEnvironment"; import { ITestPropertiesSchema } from "../../../../../../__tests__/__src__/properties/ITestPropertiesSchema"; import { join } from "path"; import { readFileSync } from "fs"; import { ITestEnvironment } from "../../../../../../__tests__/__src__/environment/ITestEnvironment"; +import { tmpdir } from "os"; +import path = require("path"); +import * as fs from "fs"; let REAL_SESSION: Session; let REAL_TARGET_SESSION: Session; @@ -98,6 +102,56 @@ describe("Copy", () => { expect(contents1.toString()).toEqual(contents2.toString()); }); }); + describe("Partioned > Partioned", () => { + beforeEach(async () => { + try { + const downloadDir = path.join(tmpdir(), fromDataSetName); + fs.mkdirSync(downloadDir, { recursive: true }); + const mockFile = path.join(downloadDir, "mockFile.txt"); + fs.writeFileSync(mockFile, "test file content"); + + const uploadFileList: string[] = ZosFilesUtils.getFileListFromPath(downloadDir); + const stream = IO.createReadStream(uploadFileList[0]); + await Create.dataSet(REAL_SESSION, CreateDataSetTypeEnum.DATA_SET_SEQUENTIAL, fromDataSetName); + await Create.dataSet(REAL_SESSION, CreateDataSetTypeEnum.DATA_SET_SEQUENTIAL, toDataSetName); + await Upload.streamToDataSet(REAL_SESSION, stream, fromDataSetName); + } catch (err) { + Imperative.console.info(`Error: ${inspect(err)}`); + } + }); + it("Should copy a partitioned data set", async () => { + let error; + let response; + let contents1; + let contents2; + + try { + response = await Copy.dataSet( + REAL_SESSION, + {dsn: toDataSetName}, + {"from-dataset": { + dsn:fromDataSetName + }} + ); + contents1 = await Get.dataSet(REAL_SESSION, fromDataSetName); + contents2 = await Get.dataSet(REAL_SESSION, toDataSetName); + Imperative.console.info(`Response: ${inspect(response)}`); + } catch (err) { + error = err; + Imperative.console.info(`Error: ${inspect(err)}`); + } + + expect(error).toBeFalsy(); + + expect(response).toBeTruthy(); + expect(response.success).toBe(true); + expect(response.commandResponse).toContain(ZosFilesMessages.datasetCopiedSuccessfully.message); + + expect(contents1).toBeTruthy(); + expect(contents2).toBeTruthy(); + expect(contents1.toString()).toEqual(contents2.toString()); + }); + }); describe("Member > Member", () => { beforeEach(async () => { try { diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index d3413f7860..938a36e9c4 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -11,11 +11,13 @@ import { Session, ImperativeError } from "@zowe/imperative"; import { posix } from "path"; - +import * as fs from "fs"; import { error } from "console"; -import { Copy, Create, Get, List, Upload, ZosFilesConstants, ZosFilesMessages, IZosFilesResponse } from "../../../../src"; +import { Copy, Create, Get, List, Upload, ZosFilesConstants, ZosFilesMessages, IZosFilesResponse, Download, ZosFilesUtils } from "../../../../src"; import { ZosmfHeaders, ZosmfRestClient } from "@zowe/core-for-zowe-sdk"; +import { tmpdir } from "os"; +import path = require("path"); describe("Copy", () => { const dummySession = new Session({ @@ -29,6 +31,8 @@ describe("Copy", () => { describe("Data Set", () => { const copyExpectStringSpy = jest.spyOn(ZosmfRestClient, "putExpectString"); + let copyPDSSpy = jest.spyOn(Copy, "copyPDS"); + let isPDSSpy: jest.SpyInstance; const fromDataSetName = "USER.DATA.FROM"; const fromMemberName = "mem1"; const toDataSetName = "USER.DATA.TO"; @@ -39,6 +43,12 @@ describe("Copy", () => { copyExpectStringSpy.mockImplementation(async () => { return ""; }); + copyPDSSpy.mockClear(); + copyPDSSpy = jest.spyOn(Copy, "copyPDS").mockResolvedValue({ + success:true, + commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message, + }); + isPDSSpy = jest.spyOn(Copy as any, "isPDS").mockResolvedValue(true); }); describe("Success Scenarios", () => { @@ -438,6 +448,28 @@ describe("Copy", () => { expect(lastArgumentOfCall).toHaveProperty("replace", false); }); }); + describe("Partitioned > Partitioned", () => { + it("should call copyPDS to copy members of source PDS to target PDS", async () => { + const response = await Copy.dataSet( + dummySession, + {dsn: toDataSetName}, + {"from-dataset": { + dsn:fromDataSetName + }} + ); + expect(isPDSSpy).toHaveBeenCalledTimes(2); + expect(isPDSSpy).toHaveBeenNthCalledWith(1, dummySession, fromDataSetName); + expect(isPDSSpy).toHaveBeenNthCalledWith(2, dummySession, toDataSetName); + + expect(copyPDSSpy).toHaveBeenCalledTimes(1); + expect(copyPDSSpy).toHaveBeenCalledWith(dummySession, fromDataSetName, toDataSetName); + + expect(response).toEqual({ + success: true, + commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message + }); + }); + }); }); describe("Failure Scenarios", () => { it("should fail if the zOSMF REST client fails", async () => { @@ -515,6 +547,41 @@ describe("Copy", () => { }); }); + describe("Copy Partitioned Data Set", () => { + const listAllMembersSpy = jest.spyOn(List, "allMembers"); + const downloadAllMembersSpy = jest.spyOn(Download, "allMembers"); + const uploadSpy = jest.spyOn(Upload, "streamToDataSet"); + const fileListPathSpy = jest.spyOn(ZosFilesUtils, "getFileListFromPath"); + const fromDataSetName = "USER.DATA.FROM"; + const toDataSetName = "USER.DATA.TO"; + it("should successfully copy members from source to target PDS", async () => { + // listAllMembersSpy.mockImplementation(async (): Promise => ({ + // apiResponse: { + // items: [ + // {member: "mem1"}, + // {member: "mem2"} + // ] + // } + // })); + // downloadAllMembersSpy.mockImplementation(async (): Promise => undefined); + + // uploadSpy.mockImplementation(async (): Promise => undefined); + + // const response = await Copy.copyPDS(dummySession, fromDataSetName, toDataSetName); + // // const downloadDir = path.join(tmpdir(), fromDataSetName); + // expect(listAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName); + // expect(downloadAllMembersSpy).toHaveBeenCalled(); + // // expect(fileListPathSpy).toHaveBeenCalledWith(path.join(tmpdir(), fromDataSetName)); + // expect(uploadSpy).toHaveBeenCalledTimes(2); + + // // expect(fs.rmSync).toHaveBeenCalled(); + // expect(response).toEqual({ + // success: true, + // commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message, + // }); + }); + }); + describe("Data Set Cross LPAR", () => { const getDatasetSpy = jest.spyOn(Get, "dataSet"); const listDatasetSpy = jest.spyOn(List, "dataSet"); diff --git a/packages/zosfiles/src/methods/copy/Copy.ts b/packages/zosfiles/src/methods/copy/Copy.ts index 2f29a329c0..0b7e9f84f9 100644 --- a/packages/zosfiles/src/methods/copy/Copy.ts +++ b/packages/zosfiles/src/methods/copy/Copy.ts @@ -9,10 +9,10 @@ * */ -import { AbstractSession, ImperativeError, ImperativeExpect, ITaskWithStatus, Logger, Headers, - IHeaderContent, TaskStage } from "@zowe/imperative"; +import { AbstractSession, ImperativeError, ImperativeExpect, ITaskWithStatus, + Logger, Headers, IHeaderContent, TaskStage, IO} from "@zowe/imperative"; import { posix } from "path"; - +import * as fs from "fs"; import { Create, CreateDataSetTypeEnum, ICreateDataSetOptions } from "../create"; import { Get } from "../get"; import { Upload } from "../upload"; @@ -26,6 +26,10 @@ import { IZosmfListResponse } from "../list/doc/IZosmfListResponse"; import { IDataSet } from "../../doc/IDataSet"; import { ICopyDatasetOptions } from "./doc/ICopyDatasetOptions"; import { ICrossLparCopyDatasetOptions } from "./doc/ICrossLparCopyDatasetOptions"; +import { Download } from "../download"; +import { ZosFilesUtils } from "../../utils/ZosFilesUtils"; +import { tmpdir } from "os"; +import path = require("path"); /** * This class holds helper functions that are used to copy the contents of datasets through the * z/OSMF APIs. @@ -53,6 +57,12 @@ export class Copy { ImperativeExpect.toBeDefinedAndNonBlank(options["from-dataset"].dsn, "fromDataSetName"); ImperativeExpect.toBeDefinedAndNonBlank(toDataSetName, "toDataSetName"); + const sourceIsPds = await Copy.isPDS(session, options["from-dataset"].dsn); + const targetIsPds = await Copy.isPDS(session, toDataSetName); + + if(sourceIsPds && targetIsPds) { + return await Copy.copyPDS(session, options["from-dataset"].dsn, toDataSetName); + } const endpoint: string = posix.join( ZosFilesConstants.RESOURCE, ZosFilesConstants.RES_DS_FILES, @@ -93,6 +103,76 @@ export class Copy { } } + /** + * Private function that checks if a dataset is type PDS + **/ + private static async isPDS( + session: AbstractSession, + dataSetName: string + ): Promise { + try { + const response = await List.dataSet(session, dataSetName, {attributes: true}); + const dsntp = response.apiResponse.items[0].dsntp; + const dsorg = response.apiResponse.items[0].dsorg; + return dsntp === "PDS" && dsorg === "PO"; + } + catch(error) { + Logger.getAppLogger().error(error); + throw error; + } + } + + /** + * Copy the members of a Partitioned dataset into another Partitioned dataset + * + * @param {AbstractSession} session - z/OSMF connection info + * @param {IDataSet} toDataSet - The data set to copy to + * @param {IDataSetOptions} options - Options + * + * @returns {Promise} A response indicating the status of the copying + * + * @throws {ImperativeError} Data set name must be specified as a non-empty string + * @throws {Error} When the {@link ZosmfRestClient} throws an error + * + * @see https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.izua700/IZUHPINFO_API_PutDataSetMemberUtilities.htm + */ + + public static async copyPDS ( + session: AbstractSession, + fromPds: string, + toPds: string + ): Promise { + try { + const sourceResponse = await List.allMembers(session, fromPds); + const sourceMemberList: Array<{ member: string }> = sourceResponse.apiResponse.items; + + if(sourceMemberList.length == 0) { + return { + success: false, + commandResponse: `Source dataset (${fromPds}) - ` + ZosFilesMessages.noMembersFound.message + }; + } + + const downloadDir = path.join(tmpdir(), fromPds); + await Download.allMembers(session, fromPds, {directory:downloadDir}); + const uploadFileList: string[] = ZosFilesUtils.getFileListFromPath(downloadDir); + + for (const file of uploadFileList) { + const uploadingDsn = `${toPds}(${ZosFilesUtils.generateMemberName(file)})`; + const uploadStream = IO.createReadStream(file); + await Upload.streamToDataSet(session, uploadStream, uploadingDsn); + } + fs.rmSync(downloadDir, {recursive: true}); + return { + success:true, + commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message + }; + } + catch (error) { + Logger.getAppLogger().error(error); + throw error; + } + } /** * Copy the contents of a dataset from one LPAR to another LPAR From 236d3813ec21cedcac64b903319a6ad4f0ef977c Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 12 Dec 2024 10:05:11 -0500 Subject: [PATCH 02/17] updated system tests + unit test Signed-off-by: Pujal --- packages/zosfiles/CHANGELOG.md | 1 + .../__unit__/methods/copy/Copy.unit.test.ts | 68 +++++++++---------- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 3dff530c4f..788db8adb1 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. ## Recent Changes +-Enhancement: `Copy.dataset` method now recognizes Partioned data sets and can copy members of source PDS into an existing target PDS. - Enhancement: Added a `List.membersMatchingPattern` method to download all members that match a specific pattern.[#2359](https://github.com/zowe/zowe-cli/pull/2359) diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index 938a36e9c4..aafe4f956d 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -547,40 +547,40 @@ describe("Copy", () => { }); }); - describe("Copy Partitioned Data Set", () => { - const listAllMembersSpy = jest.spyOn(List, "allMembers"); - const downloadAllMembersSpy = jest.spyOn(Download, "allMembers"); - const uploadSpy = jest.spyOn(Upload, "streamToDataSet"); - const fileListPathSpy = jest.spyOn(ZosFilesUtils, "getFileListFromPath"); - const fromDataSetName = "USER.DATA.FROM"; - const toDataSetName = "USER.DATA.TO"; - it("should successfully copy members from source to target PDS", async () => { - // listAllMembersSpy.mockImplementation(async (): Promise => ({ - // apiResponse: { - // items: [ - // {member: "mem1"}, - // {member: "mem2"} - // ] - // } - // })); - // downloadAllMembersSpy.mockImplementation(async (): Promise => undefined); - - // uploadSpy.mockImplementation(async (): Promise => undefined); - - // const response = await Copy.copyPDS(dummySession, fromDataSetName, toDataSetName); - // // const downloadDir = path.join(tmpdir(), fromDataSetName); - // expect(listAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName); - // expect(downloadAllMembersSpy).toHaveBeenCalled(); - // // expect(fileListPathSpy).toHaveBeenCalledWith(path.join(tmpdir(), fromDataSetName)); - // expect(uploadSpy).toHaveBeenCalledTimes(2); - - // // expect(fs.rmSync).toHaveBeenCalled(); - // expect(response).toEqual({ - // success: true, - // commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message, - // }); - }); - }); + // describe("Copy Partitioned Data Set", () => { + // const listAllMembersSpy = jest.spyOn(List, "allMembers"); + // const downloadAllMembersSpy = jest.spyOn(Download, "allMembers"); + // const uploadSpy = jest.spyOn(Upload, "streamToDataSet"); + // const fileListPathSpy = jest.spyOn(ZosFilesUtils, "getFileListFromPath"); + // const fromDataSetName = "USER.DATA.FROM"; + // const toDataSetName = "USER.DATA.TO"; + // it("should successfully copy members from source to target PDS", async () => { + // listAllMembersSpy.mockImplementation(async (): Promise => ({ + // apiResponse: { + // items: [ + // {member: "mem1"}, + // {member: "mem2"} + // ] + // } + // })); + // downloadAllMembersSpy.mockImplementation(async (): Promise => undefined); + + // uploadSpy.mockImplementation(async (): Promise => undefined); + + // const response = await Copy.copyPDS(dummySession, fromDataSetName, toDataSetName); + // // const downloadDir = path.join(tmpdir(), fromDataSetName); + // expect(listAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName); + // expect(downloadAllMembersSpy).toHaveBeenCalled(); + // // expect(fileListPathSpy).toHaveBeenCalledWith(path.join(tmpdir(), fromDataSetName)); + // expect(uploadSpy).toHaveBeenCalledTimes(2); + + // // expect(fs.rmSync).toHaveBeenCalled(); + // expect(response).toEqual({ + // success: true, + // commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message, + // }); + // }); + // }); describe("Data Set Cross LPAR", () => { const getDatasetSpy = jest.spyOn(Get, "dataSet"); From f189856573aab00bc02dc1c97307f6d7af6927e2 Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 12 Dec 2024 10:06:41 -0500 Subject: [PATCH 03/17] updated changelog Signed-off-by: Pujal --- packages/zosfiles/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 788db8adb1..2c6e2ad594 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. ## Recent Changes --Enhancement: `Copy.dataset` method now recognizes Partioned data sets and can copy members of source PDS into an existing target PDS. +-Enhancement: `Copy.dataset` method now recognizes Partioned data sets and can copy members of source PDS into an existing target PDS. [#2386](https://github.com/zowe/zowe-cli/pull/2386) - Enhancement: Added a `List.membersMatchingPattern` method to download all members that match a specific pattern.[#2359](https://github.com/zowe/zowe-cli/pull/2359) From 5e1b416a43a12f0a04a0eb4509b94bda7974ac5d Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 12 Dec 2024 15:01:18 -0500 Subject: [PATCH 04/17] updated unit tests Signed-off-by: Pujal --- .../methods/copy/Copy.system.test.ts | 6 +- .../__unit__/methods/copy/Copy.unit.test.ts | 101 ++++++++++-------- packages/zosfiles/src/methods/copy/Copy.ts | 11 +- 3 files changed, 68 insertions(+), 50 deletions(-) diff --git a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts index 3b7c47bc42..a91ee75683 100644 --- a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts @@ -103,9 +103,10 @@ describe("Copy", () => { }); }); describe("Partioned > Partioned", () => { + let downloadDir: string; beforeEach(async () => { try { - const downloadDir = path.join(tmpdir(), fromDataSetName); + downloadDir = path.join(tmpdir(), fromDataSetName); fs.mkdirSync(downloadDir, { recursive: true }); const mockFile = path.join(downloadDir, "mockFile.txt"); fs.writeFileSync(mockFile, "test file content"); @@ -151,6 +152,9 @@ describe("Copy", () => { expect(contents2).toBeTruthy(); expect(contents1.toString()).toEqual(contents2.toString()); }); + afterEach(() => { + fs.rmSync(downloadDir, { recursive: true, force: true }); + }); }); describe("Member > Member", () => { beforeEach(async () => { diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index aafe4f956d..df53897966 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -9,7 +9,7 @@ * */ -import { Session, ImperativeError } from "@zowe/imperative"; +import { Session, ImperativeError, IO } from "@zowe/imperative"; import { posix } from "path"; import * as fs from "fs"; import { error } from "console"; @@ -31,24 +31,18 @@ describe("Copy", () => { describe("Data Set", () => { const copyExpectStringSpy = jest.spyOn(ZosmfRestClient, "putExpectString"); - let copyPDSSpy = jest.spyOn(Copy, "copyPDS"); - let isPDSSpy: jest.SpyInstance; const fromDataSetName = "USER.DATA.FROM"; const fromMemberName = "mem1"; const toDataSetName = "USER.DATA.TO"; const toMemberName = "mem2"; + let isPDSSpy: jest.SpyInstance; beforeEach(() => { copyExpectStringSpy.mockClear(); copyExpectStringSpy.mockImplementation(async () => { return ""; }); - copyPDSSpy.mockClear(); - copyPDSSpy = jest.spyOn(Copy, "copyPDS").mockResolvedValue({ - success:true, - commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message, - }); - isPDSSpy = jest.spyOn(Copy as any, "isPDS").mockResolvedValue(true); + isPDSSpy = jest.spyOn(Copy as any, "isPDS").mockResolvedValue(false); }); describe("Success Scenarios", () => { @@ -449,6 +443,18 @@ describe("Copy", () => { }); }); describe("Partitioned > Partitioned", () => { + let copyPDSSpy = jest.spyOn(Copy, "copyPDS"); + beforeEach(() => { + copyPDSSpy.mockClear(); + copyPDSSpy = jest.spyOn(Copy, "copyPDS").mockResolvedValue({ + success:true, + commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message, + }); + isPDSSpy = jest.spyOn(Copy as any, "isPDS").mockResolvedValue(true); + }); + afterEach(() => { + copyPDSSpy.mockRestore(); + }) it("should call copyPDS to copy members of source PDS to target PDS", async () => { const response = await Copy.dataSet( dummySession, @@ -457,7 +463,6 @@ describe("Copy", () => { dsn:fromDataSetName }} ); - expect(isPDSSpy).toHaveBeenCalledTimes(2); expect(isPDSSpy).toHaveBeenNthCalledWith(1, dummySession, fromDataSetName); expect(isPDSSpy).toHaveBeenNthCalledWith(2, dummySession, toDataSetName); @@ -547,40 +552,48 @@ describe("Copy", () => { }); }); - // describe("Copy Partitioned Data Set", () => { - // const listAllMembersSpy = jest.spyOn(List, "allMembers"); - // const downloadAllMembersSpy = jest.spyOn(Download, "allMembers"); - // const uploadSpy = jest.spyOn(Upload, "streamToDataSet"); - // const fileListPathSpy = jest.spyOn(ZosFilesUtils, "getFileListFromPath"); - // const fromDataSetName = "USER.DATA.FROM"; - // const toDataSetName = "USER.DATA.TO"; - // it("should successfully copy members from source to target PDS", async () => { - // listAllMembersSpy.mockImplementation(async (): Promise => ({ - // apiResponse: { - // items: [ - // {member: "mem1"}, - // {member: "mem2"} - // ] - // } - // })); - // downloadAllMembersSpy.mockImplementation(async (): Promise => undefined); - - // uploadSpy.mockImplementation(async (): Promise => undefined); - - // const response = await Copy.copyPDS(dummySession, fromDataSetName, toDataSetName); - // // const downloadDir = path.join(tmpdir(), fromDataSetName); - // expect(listAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName); - // expect(downloadAllMembersSpy).toHaveBeenCalled(); - // // expect(fileListPathSpy).toHaveBeenCalledWith(path.join(tmpdir(), fromDataSetName)); - // expect(uploadSpy).toHaveBeenCalledTimes(2); - - // // expect(fs.rmSync).toHaveBeenCalled(); - // expect(response).toEqual({ - // success: true, - // commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message, - // }); - // }); - // }); + describe("Copy Partitioned Data Set", () => { + const listAllMembersSpy = jest.spyOn(List, "allMembers"); + const downloadAllMembersSpy = jest.spyOn(Download, "allMembers"); + const uploadSpy = jest.spyOn(Upload, "streamToDataSet"); + const fileListPathSpy = jest.spyOn(ZosFilesUtils, "getFileListFromPath"); + const generateMemName = jest.spyOn(ZosFilesUtils, "generateMemberName"); + const fromDataSetName = "USER.DATA.FROM"; + const toDataSetName = "USER.DATA.TO"; + const readStream = jest.spyOn(IO, "createReadStream"); + const rmSync = jest.spyOn(fs, "rmSync"); + + it("should successfully copy members from source to target PDS", async () => { + const sourceResponse = { + apiResponse: { + items: [ + { member: "mem1" }, + { member: "mem2" }, + ] + } + }; + const fileList = ["mem1", "mem2"]; + + listAllMembersSpy.mockImplementation(async (): Promise => (sourceResponse)); + downloadAllMembersSpy.mockImplementation(async (): Promise => (undefined)); + fileListPathSpy.mockReturnValue(fileList); + generateMemName.mockReturnValue("mem1"); + readStream.mockReturnValue("test" as any); + uploadSpy.mockResolvedValue(undefined); + rmSync.mockImplementation(jest.fn()); + + const response = await Copy.copyPDS(dummySession, fromDataSetName, toDataSetName); + expect(listAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName); + expect(downloadAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName, expect.any(Object)); + expect(fileListPathSpy).toHaveBeenCalled(); + expect(uploadSpy).toHaveBeenCalledTimes(fileList.length); + expect(rmSync).toHaveBeenCalled(); + expect(response).toEqual({ + success: true, + commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message, + }); + }); + }); describe("Data Set Cross LPAR", () => { const getDatasetSpy = jest.spyOn(Get, "dataSet"); diff --git a/packages/zosfiles/src/methods/copy/Copy.ts b/packages/zosfiles/src/methods/copy/Copy.ts index 0b7e9f84f9..98ad3e22d6 100644 --- a/packages/zosfiles/src/methods/copy/Copy.ts +++ b/packages/zosfiles/src/methods/copy/Copy.ts @@ -57,12 +57,12 @@ export class Copy { ImperativeExpect.toBeDefinedAndNonBlank(options["from-dataset"].dsn, "fromDataSetName"); ImperativeExpect.toBeDefinedAndNonBlank(toDataSetName, "toDataSetName"); - const sourceIsPds = await Copy.isPDS(session, options["from-dataset"].dsn); - const targetIsPds = await Copy.isPDS(session, toDataSetName); - - if(sourceIsPds && targetIsPds) { - return await Copy.copyPDS(session, options["from-dataset"].dsn, toDataSetName); + const sourceIsPds = await this.isPDS(session, options["from-dataset"].dsn); + const targetIsPds = await this.isPDS(session, toDataSetName); + if (sourceIsPds && targetIsPds) { + return await this.copyPDS(session, options["from-dataset"].dsn, toDataSetName); } + const endpoint: string = posix.join( ZosFilesConstants.RESOURCE, ZosFilesConstants.RES_DS_FILES, @@ -115,6 +115,7 @@ export class Copy { const dsntp = response.apiResponse.items[0].dsntp; const dsorg = response.apiResponse.items[0].dsorg; return dsntp === "PDS" && dsorg === "PO"; + // return response; } catch(error) { Logger.getAppLogger().error(error); From 8e1a82810e98b8496689967345aca0bd9308e432 Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 12 Dec 2024 15:11:14 -0500 Subject: [PATCH 05/17] fixed lint errors Signed-off-by: Pujal --- .../__system__/methods/copy/Copy.system.test.ts | 2 +- .../__unit__/methods/copy/Copy.unit.test.ts | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts index a91ee75683..893b40f268 100644 --- a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts @@ -10,7 +10,7 @@ */ import { Create, Upload, Delete, CreateDataSetTypeEnum, Copy, ZosFilesMessages, Get, IDataSet, - ICrossLparCopyDatasetOptions, IGetOptions, IZosFilesResponse, + ICrossLparCopyDatasetOptions, IGetOptions, IZosFilesResponse, ZosFilesUtils} from "../../../../src"; import { Imperative, IO, Session } from "@zowe/imperative"; import { inspect } from "util"; diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index df53897966..b3e4f9fc46 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -16,7 +16,6 @@ import { error } from "console"; import { Copy, Create, Get, List, Upload, ZosFilesConstants, ZosFilesMessages, IZosFilesResponse, Download, ZosFilesUtils } from "../../../../src"; import { ZosmfHeaders, ZosmfRestClient } from "@zowe/core-for-zowe-sdk"; -import { tmpdir } from "os"; import path = require("path"); describe("Copy", () => { @@ -454,7 +453,7 @@ describe("Copy", () => { }); afterEach(() => { copyPDSSpy.mockRestore(); - }) + }); it("should call copyPDS to copy members of source PDS to target PDS", async () => { const response = await Copy.dataSet( dummySession, @@ -566,16 +565,16 @@ describe("Copy", () => { it("should successfully copy members from source to target PDS", async () => { const sourceResponse = { apiResponse: { - items: [ - { member: "mem1" }, - { member: "mem2" }, - ] + items: [ + { member: "mem1" }, + { member: "mem2" }, + ] } }; const fileList = ["mem1", "mem2"]; - listAllMembersSpy.mockImplementation(async (): Promise => (sourceResponse)); - downloadAllMembersSpy.mockImplementation(async (): Promise => (undefined)); + listAllMembersSpy.mockImplementation(async (): Promise => sourceResponse); + downloadAllMembersSpy.mockImplementation(async (): Promise => undefined); fileListPathSpy.mockReturnValue(fileList); generateMemName.mockReturnValue("mem1"); readStream.mockReturnValue("test" as any); From a4972b1c01201f80fa91126511aee0d44659917c Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 12 Dec 2024 16:50:06 -0500 Subject: [PATCH 06/17] updates for code coverage Signed-off-by: Pujal --- .../__unit__/methods/copy/Copy.unit.test.ts | 43 ++++++++++++++++++- packages/zosfiles/src/methods/copy/Copy.ts | 6 +-- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index b3e4f9fc46..6568444356 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -43,7 +43,9 @@ describe("Copy", () => { }); isPDSSpy = jest.spyOn(Copy as any, "isPDS").mockResolvedValue(false); }); - + afterAll(() => { + isPDSSpy.mockRestore(); + }); describe("Success Scenarios", () => { describe("Sequential > Sequential", () => { it("should send a request", async () => { @@ -451,8 +453,9 @@ describe("Copy", () => { }); isPDSSpy = jest.spyOn(Copy as any, "isPDS").mockResolvedValue(true); }); - afterEach(() => { + afterAll(() => { copyPDSSpy.mockRestore(); + isPDSSpy.mockRestore(); }); it("should call copyPDS to copy members of source PDS to target PDS", async () => { const response = await Copy.dataSet( @@ -561,6 +564,42 @@ describe("Copy", () => { const toDataSetName = "USER.DATA.TO"; const readStream = jest.spyOn(IO, "createReadStream"); const rmSync = jest.spyOn(fs, "rmSync"); + const listDatasetSpy = jest.spyOn(List, "dataSet"); + + const dsPO = { + dsname: fromDataSetName, + dsorg: "PO", + }; + const dsPS = { + dsname: fromDataSetName, + dsorg: "PS", + }; + + it("should detect PDS datasets correctly during copy", async () => { + listDatasetSpy.mockImplementation(async (): Promise => { + return { + apiResponse: { + items: [dsPO] + } + }; + }); + const response = await Copy.isPDS(dummySession, dsPO.dsname); + expect(response).toEqual(true); + expect(listDatasetSpy).toHaveBeenCalledWith(dummySession, dsPO.dsname, { attributes: true }); + }); + + it("should return false if the data set is not partitioned", async () => { + listDatasetSpy.mockImplementation(async (): Promise => { + return { + apiResponse: { + items: [dsPS] + } + }; + }); + const response = await Copy.isPDS(dummySession, dsPS.dsname); + expect(response).toEqual(false); + expect(listDatasetSpy).toHaveBeenCalledWith(dummySession, dsPS.dsname, { attributes: true }); + }); it("should successfully copy members from source to target PDS", async () => { const sourceResponse = { diff --git a/packages/zosfiles/src/methods/copy/Copy.ts b/packages/zosfiles/src/methods/copy/Copy.ts index 98ad3e22d6..61b8e07fd0 100644 --- a/packages/zosfiles/src/methods/copy/Copy.ts +++ b/packages/zosfiles/src/methods/copy/Copy.ts @@ -106,16 +106,14 @@ export class Copy { /** * Private function that checks if a dataset is type PDS **/ - private static async isPDS( + public static async isPDS( session: AbstractSession, dataSetName: string ): Promise { try { const response = await List.dataSet(session, dataSetName, {attributes: true}); - const dsntp = response.apiResponse.items[0].dsntp; const dsorg = response.apiResponse.items[0].dsorg; - return dsntp === "PDS" && dsorg === "PO"; - // return response; + return dsorg === "POE" || dsorg === "PO"; } catch(error) { Logger.getAppLogger().error(error); From fcde3f12f6f0cb2c5b2eab929e056d53f1580a62 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 13 Dec 2024 09:07:38 -0500 Subject: [PATCH 07/17] removed unused import Signed-off-by: Pujal --- .../zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index 6568444356..e7c27b5aa1 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -16,7 +16,6 @@ import { error } from "console"; import { Copy, Create, Get, List, Upload, ZosFilesConstants, ZosFilesMessages, IZosFilesResponse, Download, ZosFilesUtils } from "../../../../src"; import { ZosmfHeaders, ZosmfRestClient } from "@zowe/core-for-zowe-sdk"; -import path = require("path"); describe("Copy", () => { const dummySession = new Session({ From 85611f5ab564b0bb11d18b7e80810cddb44d92c6 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 13 Dec 2024 09:44:05 -0500 Subject: [PATCH 08/17] updated code coverage Signed-off-by: Pujal --- .../__unit__/methods/copy/Copy.unit.test.ts | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index e7c27b5aa1..767b66a118 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -575,6 +575,8 @@ describe("Copy", () => { }; it("should detect PDS datasets correctly during copy", async () => { + let caughtError; + let response; listDatasetSpy.mockImplementation(async (): Promise => { return { apiResponse: { @@ -582,12 +584,19 @@ describe("Copy", () => { } }; }); - const response = await Copy.isPDS(dummySession, dsPO.dsname); + try { + response = await Copy.isPDS(dummySession, dsPO.dsname); + } + catch(e) { + caughtError = e; + } expect(response).toEqual(true); expect(listDatasetSpy).toHaveBeenCalledWith(dummySession, dsPO.dsname, { attributes: true }); }); it("should return false if the data set is not partitioned", async () => { + let response; + let caughtError; listDatasetSpy.mockImplementation(async (): Promise => { return { apiResponse: { @@ -595,12 +604,19 @@ describe("Copy", () => { } }; }); - const response = await Copy.isPDS(dummySession, dsPS.dsname); + try { + response = await Copy.isPDS(dummySession, dsPS.dsname); + } + catch(e) { + caughtError = e; + } expect(response).toEqual(false); expect(listDatasetSpy).toHaveBeenCalledWith(dummySession, dsPS.dsname, { attributes: true }); }); it("should successfully copy members from source to target PDS", async () => { + let caughtError; + let response; const sourceResponse = { apiResponse: { items: [ @@ -619,7 +635,13 @@ describe("Copy", () => { uploadSpy.mockResolvedValue(undefined); rmSync.mockImplementation(jest.fn()); - const response = await Copy.copyPDS(dummySession, fromDataSetName, toDataSetName); + + try{ + response = await Copy.copyPDS(dummySession, fromDataSetName, toDataSetName); + } + catch(e) { + caughtError = e; + } expect(listAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName); expect(downloadAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName, expect.any(Object)); expect(fileListPathSpy).toHaveBeenCalled(); From ecfea278987c11274c94fd3c0b7ed886a23e5c07 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 13 Dec 2024 14:27:53 -0500 Subject: [PATCH 09/17] updated with PR comments Signed-off-by: Pujal --- packages/cli/src/zosfiles/-strings-/en.ts | 7 ++++--- packages/zosfiles/src/methods/copy/Copy.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/zosfiles/-strings-/en.ts b/packages/cli/src/zosfiles/-strings-/en.ts index bd65b59d95..803eb27554 100644 --- a/packages/cli/src/zosfiles/-strings-/en.ts +++ b/packages/cli/src/zosfiles/-strings-/en.ts @@ -188,8 +188,8 @@ export default { DESCRIPTION: "Copy a data set.", ACTIONS: { DATA_SET: { - SUMMARY: "Copy a data set to another data set", - DESCRIPTION: "Copy a data set to another data set.", + SUMMARY: "Copy a data set/partitioned data set to another data set/partitioned data set", + DESCRIPTION: "Copy a data set/partitioned data set to another data set/partitioned data set.", POSITIONALS: { FROMDSNAME: "The name of the data set that you want to copy from", TODSNAME: "The name of the data set that you want to copy to (data set must be preallocated)" @@ -202,7 +202,8 @@ export default { EX2: "Copy the data set member named 'USER.FROM.SET(MEM1)' to the data set member named 'USER.TO.SET(MEM2)'", EX3: "Copy the data set named 'USER.FROM.SET' to the data set member named 'USER.TO.SET(MEM2)'", EX4: "Copy the data set member named 'USER.FROM.SET(MEM1)' to the data set named 'USER.TO.SET'", - EX5: "Copy the data set named 'USER.FROM.SET' to the data set named 'USER.TO.SET' and replace like-named members" + EX5: "Copy the data set named 'USER.FROM.SET' to the data set named 'USER.TO.SET' and replace like-named members", + EX6: "Copy the partitioned data set named 'TEST.PDS1' to the partitioned data set named 'TEST.PDS2'" } }, DATA_SET_CROSS_LPAR: { diff --git a/packages/zosfiles/src/methods/copy/Copy.ts b/packages/zosfiles/src/methods/copy/Copy.ts index 61b8e07fd0..704b18aeb8 100644 --- a/packages/zosfiles/src/methods/copy/Copy.ts +++ b/packages/zosfiles/src/methods/copy/Copy.ts @@ -113,7 +113,7 @@ export class Copy { try { const response = await List.dataSet(session, dataSetName, {attributes: true}); const dsorg = response.apiResponse.items[0].dsorg; - return dsorg === "POE" || dsorg === "PO"; + return dsorg.startsWith("PO"); } catch(error) { Logger.getAppLogger().error(error); From d54f1fe0f9f2bf6beb81cf1fa2abdd4cabee492c Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 13 Dec 2024 14:31:53 -0500 Subject: [PATCH 10/17] updated to changelog Signed-off-by: Pujal --- packages/cli/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 6779cd3d06..daf67ad989 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -2,6 +2,7 @@ All notable changes to the Zowe CLI package will be documented in this file. ## Recent Changes +-Enhancement: Updated the help text with PDS enhancement of `zowe zos-files copy data-set` command.[#2386](https://github.com/zowe/zowe-cli/pull/2386) -Enhancement: Added new command zowe zos-files download all-members-matching, (zowe files dl amm), to download members matching specified pattern(s). The success message for the Download.allMembers API was changed from originally "Data set downloaded successfully" to "Member(s) downloaded successfully." The change also alters the commandResponse when using the --rfj flag. [#2359](https://github.com/zowe/zowe-cli/pull/2359) From 6d17adbb179324b6bc09654986f4945b1f523586 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 13 Dec 2024 14:45:04 -0500 Subject: [PATCH 11/17] updates for PR comments Signed-off-by: Pujal --- packages/zosfiles/src/methods/copy/Copy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/src/methods/copy/Copy.ts b/packages/zosfiles/src/methods/copy/Copy.ts index 704b18aeb8..fc419ca27e 100644 --- a/packages/zosfiles/src/methods/copy/Copy.ts +++ b/packages/zosfiles/src/methods/copy/Copy.ts @@ -147,7 +147,7 @@ export class Copy { if(sourceMemberList.length == 0) { return { - success: false, + success: true, commandResponse: `Source dataset (${fromPds}) - ` + ZosFilesMessages.noMembersFound.message }; } From abd1044035d3e4aab5a0003262408cbfbe2f2294 Mon Sep 17 00:00:00 2001 From: Pujal Date: Mon, 16 Dec 2024 10:25:17 -0500 Subject: [PATCH 12/17] updated snapshots Signed-off-by: Pujal --- ...imperative.secure.integration.test.ts.snap | 98 ++----------------- ...cli.files.copy.ds.integration.test.ts.snap | 6 +- 2 files changed, 10 insertions(+), 94 deletions(-) diff --git a/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap b/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap index 1500ca567e..81f10fdf84 100644 --- a/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap +++ b/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap @@ -16,100 +16,16 @@ Use \\"imperative-test-cli config import --help\\" to view command description, " `; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the configuration 1`] = ` -"profiles: - secured: - type: secured - properties: - info: - secure: - (empty array) - project_base: - type: base - properties: - secure: - - secret - global_base: - type: base - properties: - secure: - - secret -defaults: - secured: secured - base: project_base -autoStore: true -" -`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the configuration 1`] = `""`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the configuration without showing secure values 1`] = ` -"profiles: - secured: - type: secured - properties: - info: - secure: - (empty array) - project_base: - type: base - properties: - secret: (secure value) - secure: - - secret - global_base: - type: base - properties: - secure: - - secret -defaults: - secured: secured - base: project_base -autoStore: true -" -`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the configuration without showing secure values 1`] = `""`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the defaults configuration property 1`] = ` -"secured: secured -base: project_base -" -`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the defaults configuration property 1`] = `""`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the profiles configuration property 1`] = ` -"secured: - type: secured - properties: - info: - secure: - (empty array) -project_base: - type: base - properties: - secure: - - secret -global_base: - type: base - properties: - secure: - - secret -" -`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the profiles configuration property 1`] = `""`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the root level property names only 1 1`] = ` -"profiles -defaults -autoStore -" -`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the root level property names only 1 1`] = `""`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the root level property names only 2 1`] = ` -"profiles -defaults -autoStore -" -`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the root level property names only 2 1`] = `""`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config profiles should list profiles 1`] = ` -"secured -project_base -global_base -" -`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config profiles should list profiles 1`] = `""`; diff --git a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap index abf6986543..6a4e1020b7 100644 --- a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap @@ -11,7 +11,7 @@ exports[`Copy Data Set should display the help 1`] = ` DESCRIPTION ----------- - Copy a data set to another data set. + Copy a data set/partitioned data set to another data set/partitioned data set. USAGE ----- @@ -171,8 +171,8 @@ exports[`Copy Data Set should display the help in json format 1`] = ` \\"success\\": true, \\"exitCode\\": 0, \\"message\\": \\"The help was constructed for command: data-set.\\", - \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set to another data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to (data set must be\\\\n preallocated)\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n\\", + \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to (data set must be\\\\n preallocated)\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n\\", \\"stderr\\": \\"\\", - \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set to another data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to (data set must be\\\\n preallocated)\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n\\" + \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to (data set must be\\\\n preallocated)\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n\\" }" `; From 04fe3808657ceeb804143955e40d636e1041e580 Mon Sep 17 00:00:00 2001 From: Pujal Date: Mon, 16 Dec 2024 12:30:11 -0500 Subject: [PATCH 13/17] updated snapshots Signed-off-by: Pujal --- packages/cli/CHANGELOG.md | 5 +++-- packages/zosfiles/CHANGELOG.md | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index daf67ad989..f98bd7f182 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -2,9 +2,10 @@ All notable changes to the Zowe CLI package will be documented in this file. ## Recent Changes --Enhancement: Updated the help text with PDS enhancement of `zowe zos-files copy data-set` command.[#2386](https://github.com/zowe/zowe-cli/pull/2386) +-Enhancement: The `zowe zos-files copy data-set` command now copies members from a source partitioned data set to an existing target partitioned data set.[#2386](https://github.com/zowe/zowe-cli/pull/2386) --Enhancement: Added new command zowe zos-files download all-members-matching, (zowe files dl amm), to download members matching specified pattern(s). The success message for the Download.allMembers API was changed from originally "Data set downloaded successfully" to "Member(s) downloaded successfully." The change also alters the commandResponse when using the --rfj flag. [#2359](https://github.com/zowe/zowe-cli/pull/2359) +## Recent Changes +- Enhancement: Added new command zowe zos-files download all-members-matching, (zowe files dl amm), to download members matching specified pattern(s). The success message for the Download.allMembers API was changed from originally "Data set downloaded successfully" to "Member(s) downloaded successfully." The change also alters the commandResponse when using the --rfj flag. [#2359](https://github.com/zowe/zowe-cli/pull/2359) ## `8.8.0` diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 2c6e2ad594..41566769a6 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -3,8 +3,9 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. ## Recent Changes --Enhancement: `Copy.dataset` method now recognizes Partioned data sets and can copy members of source PDS into an existing target PDS. [#2386](https://github.com/zowe/zowe-cli/pull/2386) +- Enhancement: The `Copy.dataset` method now recognizes partioned data sets and can copy members of a source PDS into an existing target PDS. [#2386](https://github.com/zowe/zowe-cli/pull/2386) +## Recent Changes - Enhancement: Added a `List.membersMatchingPattern` method to download all members that match a specific pattern.[#2359](https://github.com/zowe/zowe-cli/pull/2359) ## `8.8.4` From 16f6ed9ace2fcc86b6f7d4e0e2de773fe04922b2 Mon Sep 17 00:00:00 2001 From: Pujal Date: Mon, 16 Dec 2024 13:03:25 -0500 Subject: [PATCH 14/17] updated snapshots Signed-off-by: Pujal --- .../Cmd.cli.invalid.no-handler.integration.test.ts.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.no-handler.integration.test.ts.snap b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.no-handler.integration.test.ts.snap index 47f5a32dec..dc2db46c51 100644 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.no-handler.integration.test.ts.snap +++ b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.no-handler.integration.test.ts.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`cmd-cli invalid no-handler should fail the command with a message if the command definition of type command omits a handler 1`] = ` -"Internal Command Error: -Expect Error: Command Processor Error: The definition supplied is of type \\"command\\", but no handler was specified. +"/Users/pujalgandhi/Documents/ZOWE/zowe-cli/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__scripts__/no-handler.sh: line 2: /Users/pujalgandhi/Documents/ZOWE/zowe-cli/.npm-global/bin/cmd-cli: Permission denied +/Users/pujalgandhi/Documents/ZOWE/zowe-cli/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__scripts__/no-handler.sh: line 3: /Users/pujalgandhi/Documents/ZOWE/zowe-cli/.npm-global/bin/cmd-cli: Permission denied " `; From 4dfe07f24c26632ac381cfd81c7ab567ce13081d Mon Sep 17 00:00:00 2001 From: Pujal Date: Mon, 16 Dec 2024 13:27:05 -0500 Subject: [PATCH 15/17] updated snapshots Signed-off-by: Pujal --- .../Cmd.cli.invalid.no-handler.integration.test.ts.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.no-handler.integration.test.ts.snap b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.no-handler.integration.test.ts.snap index dc2db46c51..47f5a32dec 100644 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.no-handler.integration.test.ts.snap +++ b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.no-handler.integration.test.ts.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`cmd-cli invalid no-handler should fail the command with a message if the command definition of type command omits a handler 1`] = ` -"/Users/pujalgandhi/Documents/ZOWE/zowe-cli/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__scripts__/no-handler.sh: line 2: /Users/pujalgandhi/Documents/ZOWE/zowe-cli/.npm-global/bin/cmd-cli: Permission denied -/Users/pujalgandhi/Documents/ZOWE/zowe-cli/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__scripts__/no-handler.sh: line 3: /Users/pujalgandhi/Documents/ZOWE/zowe-cli/.npm-global/bin/cmd-cli: Permission denied +"Internal Command Error: +Expect Error: Command Processor Error: The definition supplied is of type \\"command\\", but no handler was specified. " `; From 48fb141b05109eb714ea3d65902c176506e14064 Mon Sep 17 00:00:00 2001 From: Pujal Date: Mon, 16 Dec 2024 13:28:11 -0500 Subject: [PATCH 16/17] updated snapshots Signed-off-by: Pujal --- ...imperative.secure.integration.test.ts.snap | 98 +++++++++++++++++-- 1 file changed, 91 insertions(+), 7 deletions(-) diff --git a/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap b/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap index 81f10fdf84..1500ca567e 100644 --- a/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap +++ b/__tests__/__integration__/__snapshots__/imperative.secure.integration.test.ts.snap @@ -16,16 +16,100 @@ Use \\"imperative-test-cli config import --help\\" to view command description, " `; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the configuration 1`] = `""`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the configuration 1`] = ` +"profiles: + secured: + type: secured + properties: + info: + secure: + (empty array) + project_base: + type: base + properties: + secure: + - secret + global_base: + type: base + properties: + secure: + - secret +defaults: + secured: secured + base: project_base +autoStore: true +" +`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the configuration without showing secure values 1`] = `""`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the configuration without showing secure values 1`] = ` +"profiles: + secured: + type: secured + properties: + info: + secure: + (empty array) + project_base: + type: base + properties: + secret: (secure value) + secure: + - secret + global_base: + type: base + properties: + secure: + - secret +defaults: + secured: secured + base: project_base +autoStore: true +" +`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the defaults configuration property 1`] = `""`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the defaults configuration property 1`] = ` +"secured: secured +base: project_base +" +`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the profiles configuration property 1`] = `""`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the profiles configuration property 1`] = ` +"secured: + type: secured + properties: + info: + secure: + (empty array) +project_base: + type: base + properties: + secure: + - secret +global_base: + type: base + properties: + secure: + - secret +" +`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the root level property names only 1 1`] = `""`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the root level property names only 1 1`] = ` +"profiles +defaults +autoStore +" +`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the root level property names only 2 1`] = `""`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config list should list the root level property names only 2 1`] = ` +"profiles +defaults +autoStore +" +`; -exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config profiles should list profiles 1`] = `""`; +exports[`Imperative Secure Tests Imperative Test CLI Secure Tests imperative-test-cli config profiles should list profiles 1`] = ` +"secured +project_base +global_base +" +`; From 903fa3055e19417fc0102e52e02bbab0efb025d7 Mon Sep 17 00:00:00 2001 From: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:50:14 -0500 Subject: [PATCH 17/17] Update packages/zosfiles/CHANGELOG.md Co-authored-by: Trae Yelovich Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> --- packages/zosfiles/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 52ed872de6..50a6326d17 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. ## Recent Changes -- Enhancement: The `Copy.dataset` method now recognizes partioned data sets and can copy members of a source PDS into an existing target PDS. [#2386](https://github.com/zowe/zowe-cli/pull/2386) +- Enhancement: The `Copy.dataset` method now recognizes partitioned data sets and can copy members of a source PDS into an existing target PDS. [#2386](https://github.com/zowe/zowe-cli/pull/2386) ## `8.9.1`