Skip to content

Commit

Permalink
Merge branch 'master' into DocsUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
zFernand0 committed Dec 2, 2019
2 parents 0a2d5a8 + 5b08220 commit fce7d1b
Show file tree
Hide file tree
Showing 22 changed files with 2,425 additions and 745 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

[![codecov](https://codecov.io/gh/zowe/vscode-extension-for-zowe/branch/master/graph/badge.svg)](https://codecov.io/gh/zowe/vscode-extension-for-zowe)

Zowe™ Explorer extension modernizes the way developers and system administrators interact with z/OS mainframes. Working with data sets and USS files from VSC can be more convenient than using 3270 emulators, and complements your Zowe CLI experience. The extension provides the following benefits:
Zowe Explorer is a separately delivered component of Zowe belonging to the [Zowe CLI](https://github.com/zowe/community#zowe-cli) sub-project.
[Zowe](https://www.zowe.org/) is a project hosted by the [Open Mainframe Project](https://www.openmainframeproject.org/), a [Linux Foundation](https://www.linuxfoundation.org/) project.

The Zowe Explorer extension modernizes the way developers and system administrators interact with z/OS mainframes. Working with data sets and USS files from VSC can be more convenient than using 3270 emulators, and complements your Zowe CLI experience. The extension provides the following benefits:

* Enables developers to create, modify, rename, copy and upload data sets directly to a z/OS mainframe.
* Enables developers to create, modify, rename and upload USS files directly to a z/OS mainframe.
Expand Down
65 changes: 61 additions & 4 deletions __tests__/__integration__/extension.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ describe("Extension Integration Tests", () => {
);

// Mock user selecting first profile from list
const stub = sandbox.stub(vscode.window, "showQuickPick");
stub.returns(profileNamesList[0]);
const inputBoxStub1 = sandbox.stub(vscode.window, "showQuickPick");
inputBoxStub1.returns(new utils.FilterDescriptor("\uFF0B " + "Create a New Connection to z/OS"));
const stubresolve = sandbox.stub(utils, "resolveQuickPickHelper");
stubresolve.returns(new utils.FilterItem(profileNamesList[0]));

await extension.addSession(testTree);
expect(testTree.mSessionNodes[testTree.mSessionNodes.length - 1].label).to.equal(profileNamesList[0]);
Expand Down Expand Up @@ -425,6 +427,41 @@ describe("Extension Integration Tests", () => {
expect(afterList.apiResponse.returnedRows).to.equal(1);
}).timeout(TIMEOUT);
});
describe("Rename Member", () => {
beforeEach(async () => {
await zowe.Create.dataSet(
sessionNode.getSession(),
zowe.CreateDataSetTypeEnum.DATA_SET_PARTITIONED,
beforeDataSetName
).catch((err) => err);
await zowe.Upload.bufferToDataSet(
sessionNode.getSession(),
new Buffer("abc"),
`${beforeDataSetName}(mem1)`
);
});
it("should rename a data set member", async () => {
let error;
let list;

try {
const parentNode = new ZoweNode(beforeDataSetName, vscode.TreeItemCollapsibleState.None, sessionNode, session);
const childNode = new ZoweNode("mem1", vscode.TreeItemCollapsibleState.None, parentNode, session);
const inputBoxStub = sandbox.stub(vscode.window, "showInputBox");
inputBoxStub.returns("mem2");

await extension.renameDataSetMember(childNode, testTree);
list = await zowe.List.allMembers(sessionNode.getSession(), beforeDataSetName);
} catch (err) {
error = err;
}

expect(error).to.be.equal(undefined);

expect(list.apiResponse.returnedRows).to.equal(1);
expect(list.apiResponse.items[0].member).to.equal("MEM2");
}).timeout(TIMEOUT);
});
describe("Rename Partitioned Data Set", () => {
beforeEach(async () => {
await zowe.Create.dataSet(
Expand Down Expand Up @@ -473,6 +510,24 @@ describe("Extension Integration Tests", () => {
error = err;
}

expect(error).not.to.be.equal(undefined);
}).timeout(TIMEOUT);
});
describe("Rename Data Set Member", () => {
it("should throw an error if a missing data set name is provided", async () => {
let error;

try {
const parentNode = new ZoweNode(beforeDataSetName, vscode.TreeItemCollapsibleState.None, sessionNode, session);
const childNode = new ZoweNode("mem1", vscode.TreeItemCollapsibleState.None, parentNode, session);
const inputBoxStub = sandbox.stub(vscode.window, "showInputBox");
inputBoxStub.returns("mem2");

await extension.renameDataSetMember(childNode, testTree);
} catch (err) {
error = err;
}

expect(error).not.to.be.equal(undefined);
}).timeout(TIMEOUT);
});
Expand Down Expand Up @@ -882,8 +937,10 @@ describe("Extension Integration Tests - USS", () => {
);

// Mock user selecting first profile from list
const stub = sandbox.stub(vscode.window, "showQuickPick");
stub.returns(profileNamesList[0]);
const inputBoxStub1 = sandbox.stub(vscode.window, "showQuickPick");
inputBoxStub1.returns(new utils.FilterDescriptor("\uFF0B " + "Create a New Connection to z/OS"));
const stubresolve = sandbox.stub(utils, "resolveQuickPickHelper");
stubresolve.returns(new utils.FilterItem(profileNamesList[0]));

await extension.addUSSSession(ussTestTree);
expect(ussTestTree.mSessionNodes[ussTestTree.mSessionNodes.length - 1].label).to.equal(profileNamesList[0]);
Expand Down
66 changes: 66 additions & 0 deletions __tests__/__unit__/DatasetTree.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,72 @@ describe("DatasetTree Unit Tests", () => {
sessionNode.children.pop();
});

it("tests the dataset filter prompt credentials", async () => {
showQuickPick.mockReset();
showInputBox.mockReset();
const sessionwocred = new Session({
user: "",
password: "",
hostname: "fake",
port: 443,
protocol: "https",
type: "basic",
});
const sessNode = new ZoweNode("sestest", vscode.TreeItemCollapsibleState.Expanded, null, session);
sessNode.contextValue = extension.DS_SESSION_CONTEXT;
const dsNode = new ZoweNode("testSess", vscode.TreeItemCollapsibleState.Expanded, sessNode, sessionwocred);
dsNode.contextValue = extension.DS_SESSION_CONTEXT;
Object.defineProperty(Profiles, "getInstance", {
value: jest.fn(() => {
return {
allProfiles: [{name: "firstName", profile: {user:undefined, password: undefined}}, {name: "secondName"}],
defaultProfile: {name: "firstName"},
promptCredentials: jest.fn(()=> {
return [{values: "fake"}, {values: "fake"}, {values: "fake"}];
}),
};
})
});

showInputBox.mockReturnValueOnce("fake");
showInputBox.mockReturnValueOnce("fake");

await testTree.datasetFilterPrompt(dsNode);

expect(showInformationMessage.mock.calls[0][0]).toEqual("No selection made.");

});

it("tests the dataset filter prompt credentials error", async () => {
showQuickPick.mockReset();
showInputBox.mockReset();
const sessionwocred = new Session({
user: "",
password: "",
hostname: "fake",
port: 443,
protocol: "https",
type: "basic",
});
const sessNode = new ZoweNode("sestest", vscode.TreeItemCollapsibleState.Expanded, null, session);
sessNode.contextValue = extension.DS_SESSION_CONTEXT;
const dsNode = new ZoweNode("testSess", vscode.TreeItemCollapsibleState.Expanded, sessNode, sessionwocred);
dsNode.contextValue = extension.DS_SESSION_CONTEXT;
Object.defineProperty(Profiles, "getInstance", {
value: jest.fn(() => {
return {
allProfiles: [{name: "firstName", profile: {user:undefined, password: undefined}}, {name: "secondName"}],
defaultProfile: {name: "firstName"}
};
})
});

await testTree.datasetFilterPrompt(dsNode);

expect(showInformationMessage.mock.calls[0][0]).toEqual("No selection made.");

});

it("Should find a favorited node", async () => {
testTree.mFavorites = [];
const sessionNode = testTree.mSessionNodes[1];
Expand Down
Loading

0 comments on commit fce7d1b

Please sign in to comment.