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

Copying a PDS into existing PDS w/ no members #2386

Merged
merged 18 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 14 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
Original file line number Diff line number Diff line change
Expand Up @@ -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`] = `""`;
4 changes: 3 additions & 1 deletion packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
All notable changes to the Zowe CLI package will be documented in this file.

## Recent Changes
-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`

Expand Down

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions packages/cli/src/zosfiles/-strings-/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
"
`;

Expand Down
2 changes: 2 additions & 0 deletions packages/zosfiles/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
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)
pujal0909 marked this conversation as resolved.
Show resolved Hide resolved

## 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`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -98,6 +102,60 @@ describe("Copy", () => {
expect(contents1.toString()).toEqual(contents2.toString());
});
});
describe("Partioned > Partioned", () => {
let downloadDir: string;
beforeEach(async () => {
try {
downloadDir = path.join(tmpdir(), fromDataSetName);
fs.mkdirSync(downloadDir, { recursive: true });
const mockFile = path.join(downloadDir, "mockFile.txt");
fs.writeFileSync(mockFile, "test file content");
Dismissed Show dismissed Hide dismissed

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());
});
afterEach(() => {
fs.rmSync(downloadDir, { recursive: true, force: true });
});
});
describe("Member > Member", () => {
beforeEach(async () => {
try {
Expand Down
Loading
Loading