Skip to content

Commit

Permalink
Merge branch 'main' into add-profile-4all-trees
Browse files Browse the repository at this point in the history
  • Loading branch information
rudyflores authored Nov 29, 2023
2 parents f3929e9 + 68c9167 commit 8e9467c
Show file tree
Hide file tree
Showing 29 changed files with 211 additions and 282 deletions.
13 changes: 0 additions & 13 deletions CODEOWNERS

This file was deleted.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,9 @@ For more information on how to contribute, see [Contributor Guidance](https://gi
## External Links

Check out more about using Zowe Explorer and Zowe on [Medium](https://medium.com/zowe) and [Awesome Zowe](https://github.com/tucker01/awesome-zowe).

## Project Structure and Governance

Zowe Explorer is a component of the Zowe Open Mainframe Project, part of the Linux Foundation.

To learn more about how Zowe is structured and governed, see the [Technical Steering Committee Strucutre and Governance documentation](https://github.com/zowe/community/blob/master/Technical-Steering-Committee/tsc-governance.md).
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"vscode": "^1.53.2"
},
"dependencies": {
"@zowe/cli": "7.18.0",
"@zowe/cli": "7.19.0",
"vscode-nls": "4.1.2"
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/eslint-plugin-zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All notable changes to the "eslint-plugin-zowe-explorer" package will be documen

### Bug fixes

## `2.12.2`

## `2.12.1`

## `2.12.0`
Expand Down
2 changes: 2 additions & 0 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t

### Bug fixes

## `2.12.2`

## `2.12.1`

## `2.12.0`
Expand Down
4 changes: 2 additions & 2 deletions packages/zowe-explorer-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
},
"dependencies": {
"@types/vscode": "^1.53.2",
"@zowe/cli": "^7.18.0",
"@zowe/secrets-for-zowe-sdk": "7.18.4",
"@zowe/cli": "7.19.0",
"@zowe/secrets-for-zowe-sdk": "7.18.6",
"handlebars": "^4.7.7",
"semver": "^7.5.3"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/zowe-explorer-ftp-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum

### Bug fixes

## `2.12.2`

## `2.12.1`

### Bug fixes
Expand Down
6 changes: 6 additions & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

### Bug fixes

## `2.12.2`

### Bug fixes

- Fixed issue where etag was not updated for USS files after conflict is detected and user selects Overwrite option.

## `2.12.1`

### Bug fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1900,24 +1900,18 @@ describe("Profiles Unit Tests - function disableValidation", () => {

it("should disable validation for the profile on all trees", async () => {
const globalMocks = await createGlobalMocks();
const disableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "disableValidtionContextForAllTrees");
jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([
createMockNode("test2", globals.DS_SESSION_CONTEXT),
globalMocks.testNode,
]);
jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([globalMocks.testNode]);
expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT);
expect(Profiles.getInstance().disableValidation(globalMocks.testNode, true)).toEqual(globalMocks.testNode);
expect(disableValidationContextForAllTreesSpy).toBeCalledTimes(1);
expect(Profiles.getInstance().disableValidation(globalMocks.testNode)).toEqual(globalMocks.testNode);
expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX);
});

it("should disable validation for the profile on the current tree", async () => {
const globalMocks = await createGlobalMocks();
const disableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "disableValidtionContextForAllTrees");
jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([globalMocks.testNode]);
const disableValidationContextSpy = jest.spyOn(Profiles.getInstance(), "disableValidationContext");
expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT);
expect(Profiles.getInstance().disableValidation(globalMocks.testNode, false)).toEqual(globalMocks.testNode);
expect(disableValidationContextForAllTreesSpy).toBeCalledTimes(0);
expect(Profiles.getInstance().disableValidation(globalMocks.testNode)).toEqual(globalMocks.testNode);
expect(disableValidationContextSpy).toBeCalledTimes(1);
expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX);
});
Expand All @@ -1932,24 +1926,21 @@ describe("Profiles Unit Tests - function enableValidation", () => {

it("should enable validation for the profile on all trees", async () => {
const globalMocks = await createGlobalMocks();
const enableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "enableValidationContextForAllTrees");
jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([
createMockNode("test2", globals.DS_SESSION_CONTEXT),
globalMocks.testNode,
]);
expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT);
expect(Profiles.getInstance().enableValidation(globalMocks.testNode, true)).toEqual(globalMocks.testNode);
expect(enableValidationContextForAllTreesSpy).toBeCalledTimes(1);
expect(Profiles.getInstance().enableValidation(globalMocks.testNode)).toEqual(globalMocks.testNode);
expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX);
});

it("should enable validation for the profile on the current tree", async () => {
const globalMocks = await createGlobalMocks();
const enableValidationContextForAllTreesSpy = jest.spyOn(Profiles.getInstance(), "enableValidationContextForAllTrees");
const enableValidationContextSpy = jest.spyOn(Profiles.getInstance(), "enableValidationContext");
jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([globalMocks.testNode]);
expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT);
expect(Profiles.getInstance().enableValidation(globalMocks.testNode, false)).toEqual(globalMocks.testNode);
expect(enableValidationContextForAllTreesSpy).toBeCalledTimes(0);
expect(Profiles.getInstance().enableValidation(globalMocks.testNode)).toEqual(globalMocks.testNode);
expect(enableValidationContextSpy).toBeCalledTimes(1);
expect(globalMocks.testNode.contextValue).toEqual(globals.DS_SESSION_CONTEXT + globals.VALIDATE_SUFFIX);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3733,17 +3733,15 @@ describe("Dataset Actions Unit Tests - Function allocateLike", () => {
});

describe("Dataset Actions Unit Tests - Function confirmJobSubmission", () => {
function createBlockMocks() {
function createBlockMocks(): void {
mocked(vscode.window.showInputBox).mockImplementation((options) => {
options.validateInput("test");
return Promise.resolve("test");
});

return {};
}
it("Should use use local JCL doc name for confirmJobSubmission", async () => {
createGlobalMocks();
const blockMocks = createBlockMocks();
createBlockMocks();
jest.spyOn(vscode.workspace, "getConfiguration").mockImplementation(
() =>
({
Expand All @@ -3753,6 +3751,6 @@ describe("Dataset Actions Unit Tests - Function confirmJobSubmission", () => {
jest.spyOn(Gui, "warningMessage").mockResolvedValue({
title: "Submit",
});
await expect(dsActions.confirmJobSubmission(null, true, "Profile\\test.jcl")).resolves.toEqual(true);
await expect(dsActions.confirmJobSubmission("Profile\\test.jcl", true)).resolves.toEqual(true);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

import { createTreeView } from "../../../__mocks__/mockCreators/shared";
import { DS_SESSION_CONTEXT, JOBS_SESSION_CONTEXT, USS_SESSION_CONTEXT, VALIDATE_SUFFIX } from "../../../src/globals";
import { TreeProviders } from "../../../src/shared/TreeProviders";

describe("TreeProvider Unit Tests - Function getters", () => {
Expand Down Expand Up @@ -45,10 +46,26 @@ describe("TreeProvider Unit Tests - Function getters", () => {
describe("TreeProvider Unit Tests - Function sessionIsPresentInOtherTrees", () => {
it("should return true if session is present in another tree", async () => {
await TreeProviders.initializeProviders({} as any, {
ds: () => ({ mSessionNodes: [{ getLabel: () => "test1" }, { getLabel: () => "test2" }] } as any),
uss: () => ({ mSessionNodes: [{ getLabel: () => "test3" }, { getLabel: () => "test4" }] } as any),
job: () => ({ mSessionNodes: [{ getLabel: () => "test5" }, { getLabel: () => "test1" }] } as any),
ds: (): any => ({ mSessionNodes: [{ getLabel: () => "test1" }, { getLabel: () => "test2" }] } as any),
uss: (): any => ({ mSessionNodes: [{ getLabel: () => "test3" }, { getLabel: () => "test4" }] } as any),
job: (): any => ({ mSessionNodes: [{ getLabel: () => "test5" }, { getLabel: () => "test1" }] } as any),
});
expect(TreeProviders.sessionIsPresentInOtherTrees("test1")).toEqual(true);
});
});

describe("TreeProvider Unit Tests - Function contextValueExistsAcrossTrees", () => {
it("should return true if the context value passed in exists across other trees", () => {
jest.spyOn(TreeProviders, "getSessionForAllTrees").mockReturnValue([
{ getLabel: () => "test1", contextValue: DS_SESSION_CONTEXT + VALIDATE_SUFFIX } as any,
{ getLabel: () => "test1", contextValue: USS_SESSION_CONTEXT + VALIDATE_SUFFIX } as any,
{ getLabel: () => "test1", contextValue: JOBS_SESSION_CONTEXT + VALIDATE_SUFFIX } as any,
]);
expect(
TreeProviders.contextValueExistsAcrossTrees(
{ getLabel: () => "test1", contextValue: DS_SESSION_CONTEXT + VALIDATE_SUFFIX } as any,
VALIDATE_SUFFIX
)
).toEqual(true);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,12 @@ describe("Test uploadContents", () => {
{
fileName: "whatever",
} as any,
null
null,
{
profile: {
encoding: 123,
},
} as any
);
expect(ZoweExplorerApiRegister.getUssApi(null).putContents).toBeCalled();
});
Expand All @@ -264,7 +269,12 @@ describe("Test uploadContents", () => {
{
fileName: "whatever",
} as any,
null
null,
{
profile: {
encoding: codepage,
},
} as any
);
expect(ZoweExplorerApiRegister.getMvsApi(null).putContents).toBeCalled();
});
Expand Down
16 changes: 16 additions & 0 deletions packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
createTextDocument,
createFileResponse,
createValidIProfile,
createInstanceOfProfile,
} from "../../../__mocks__/mockCreators/shared";
import { ZoweExplorerApiRegister } from "../../../src/ZoweExplorerApiRegister";
import { Profiles } from "../../../src/Profiles";
Expand Down Expand Up @@ -427,6 +428,7 @@ describe("USS Action Unit Tests - Function saveUSSFile", () => {
const newMocks = {
node: null,
mockGetEtag: null,
profileInstance: createInstanceOfProfile(globalMocks.testProfile),
testUSSTree: null,
testResponse: createFileResponse({ items: [] }),
testDoc: createTextDocument(path.join(globals.USS_DIR, "usstest", "u", "myuser", "testFile")),
Expand Down Expand Up @@ -528,6 +530,20 @@ describe("USS Action Unit Tests - Function saveUSSFile", () => {
expect(globalMocks.showErrorMessage.mock.calls[0][0]).toBe("Error: Test Error");
expect(mocked(vscode.workspace.applyEdit)).toHaveBeenCalledTimes(2);
});

it("Tests that saveUSSFile fails when session cannot be located", async () => {
const globalMocks = createGlobalMocks();
const blockMocks = await createBlockMocks(globalMocks);

blockMocks.profileInstance.loadNamedProfile.mockReturnValueOnce(undefined);
mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance);
const testDocument = createTextDocument("u/myuser/testFile", blockMocks.node);
(testDocument as any).fileName = path.join(globals.USS_DIR, testDocument.fileName);

await ussNodeActions.saveUSSFile(testDocument, blockMocks.testUSSTree);
expect(globalMocks.showErrorMessage.mock.calls.length).toBe(1);
expect(globalMocks.showErrorMessage.mock.calls[0][0]).toBe("Could not locate session when saving USS file.");
});
});

describe("USS Action Unit Tests - Functions uploadDialog & uploadFile", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,15 @@ describe("ProfileManagement unit tests", () => {
mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[1]);
await ProfileManagement.manageProfile(mocks.mockTreeProviders.uss.mSessionNodes[0]);
expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg.replace("sestest", "zosmf"));
expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.enableValidation", mocks.mockTreeProviders.uss.mSessionNodes[0], false);
expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.enableValidation", mocks.mockTreeProviders.uss.mSessionNodes[0]);
});
it("profile using token authentication should see correct command called for disabling validation a unix tree session node", async () => {
const mocks = createBlockMocks(createGlobalMocks());
mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockDisableValidationChosen);
mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[1]);
await ProfileManagement.manageProfile(mocks.mockUnixSessionNode);
expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg);
expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.disableValidation", mocks.mockUnixSessionNode, false);
expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.uss.disableValidation", mocks.mockUnixSessionNode);
});
});
describe("unit tests around no auth declared selections", () => {
Expand Down Expand Up @@ -263,15 +263,15 @@ describe("ProfileManagement unit tests", () => {
mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[0]);
await ProfileManagement.manageProfile(mocks.mockTreeProviders.ds.mSessionNodes[1]);
expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg.replace("sestest", "zosmf2"));
expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.enableValidation", mocks.mockTreeProviders.ds.mSessionNodes[1], true);
expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.enableValidation", mocks.mockTreeProviders.ds.mSessionNodes[1]);
});
it("profile using token authentication should see correct command called for disabling validation a data set tree session node", async () => {
const mocks = createBlockMocks(createGlobalMocks());
mocks.mockResolveQp.mockResolvedValueOnce(mocks.mockDisableValidationChosen);
mocks.mockResolveQp.mockResolvedValueOnce(ProfileManagement["getPromptChangeForAllTreesOptions"]()[0]);
await ProfileManagement.manageProfile(mocks.mockTreeProviders.ds.mSessionNodes[0]);
expect(mocks.debugLogSpy).toBeCalledWith(mocks.logMsg.replace("sestest", "zosmf"));
expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.disableValidation", mocks.mockTreeProviders.ds.mSessionNodes[0], true);
expect(mocks.commandSpy).toHaveBeenLastCalledWith("zowe.ds.disableValidation", mocks.mockTreeProviders.ds.mSessionNodes[0]);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"uploadFile.putContents": "Uploading USS file",
"copyPath.infoMessage": "Copy Path is not yet supported in Theia.",
"saveUSSFile.log.debug.saveRequest": "save requested for USS file ",
"saveUSSFile.session.error": "Could not locate session when saving USS file.",
"saveUSSFile.response.title": "Saving file...",
"deleteUssPrompt.confirmation.delete": "Delete",
"deleteUssPrompt.confirmation.message": "Are you sure you want to delete the following item?\nThis will permanently remove the following file or folder from your system.\n\n{0}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
"ProfileManagement.getPromptChangeForAllTreesOptions.currentDesc": "Apply to current tree selected",
"ProfileManagement.promptChangeForAllTrees.howToChange": "Do you wish to apply this for all trees?",
"ProfileManagement.handleHideProfiles.cancelled": "Operation Cancelled",
"ProfileManagement.handleEnableProfileValidation.cancelled": "Operation Cancelled",
"ProfileManagement.handleDisableProfileValidation.cancelled": "Operation Cancelled",
"addBasicAuthQpItem.addCredentials.qpLabel": "$(plus) Add Credentials",
"addBasicAuthQpItem.addCredentials.qpDetail": "Add username and password for basic authentication",
"updateBasicAuthQpItem.updateCredentials.qpLabel": "$(refresh) Update Credentials",
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1994,7 +1994,7 @@
"webpack-cli": "^3.3.11"
},
"dependencies": {
"@zowe/secrets-for-zowe-sdk": "7.18.4",
"@zowe/secrets-for-zowe-sdk": "7.18.6",
"@zowe/zowe-explorer-api": "2.13.0-SNAPSHOT",
"dayjs": "^1.11.10",
"fs-extra": "8.0.1",
Expand Down
Loading

0 comments on commit 8e9467c

Please sign in to comment.