Skip to content

Commit

Permalink
compare data set files
Browse files Browse the repository at this point in the history
Signed-off-by: Billie Simmons <[email protected]>
  • Loading branch information
JillieBeanSim committed Sep 20, 2023
1 parent 0ab92b8 commit f4586d4
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,7 @@ describe("Dataset Actions Unit Tests - Function copyDataSets", () => {
);

const label = node.getParent().getLabel().toString() + "(" + node.getLabel().toString() + ")";
const filePathSpy = jest.spyOn(sharedUtils, "getDocumentFilePath");
const filePathSpy = jest.spyOn(sharedUtils, "getDsDocumentFilePath");
await dsActions.downloadDs(node);
expect(filePathSpy).toBeCalledWith(label, node);
});
Expand Down Expand Up @@ -3329,7 +3329,7 @@ describe("Dataset Actions Unit Tests - Function openPS", () => {
await dsActions.openPS(node, true, blockMocks.testDatasetTree);

expect(mocked(fs.existsSync)).toBeCalledWith(path.join(globals.DS_DIR, node.getSessionNode().label.toString(), node.label.toString()));
expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith(sharedUtils.getDocumentFilePath(node.label.toString(), node));
expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith(sharedUtils.getDsDocumentFilePath(node.label.toString(), node));
});

it("Checking of opening for common dataset with unverified profile", async () => {
Expand Down Expand Up @@ -3357,7 +3357,7 @@ describe("Dataset Actions Unit Tests - Function openPS", () => {
await dsActions.openPS(node, true, blockMocks.testDatasetTree);

expect(mocked(fs.existsSync)).toBeCalledWith(path.join(globals.DS_DIR, node.getSessionNode().label.toString(), node.label.toString()));
expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith(sharedUtils.getDocumentFilePath(node.label.toString(), node));
expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith(sharedUtils.getDsDocumentFilePath(node.label.toString(), node));
});

it("Checking of failed attempt to open dataset", async () => {
Expand Down Expand Up @@ -3400,7 +3400,7 @@ describe("Dataset Actions Unit Tests - Function openPS", () => {
path.join(globals.DS_DIR, child.getSessionNode().label.toString(), `${parent.label.toString()}(${child.label.toString()})`)
);
expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith(
sharedUtils.getDocumentFilePath(`${parent.label.toString()}(${child.label.toString()})`, child)
sharedUtils.getDsDocumentFilePath(`${parent.label.toString()}(${child.label.toString()})`, child)
);
});
it("Checking of opening for PDS Member of favorite dataset", async () => {
Expand All @@ -3427,7 +3427,7 @@ describe("Dataset Actions Unit Tests - Function openPS", () => {
path.join(globals.DS_DIR, child.getSessionNode().label.toString(), `${parent.label.toString()}(${child.label.toString()})`)
);
expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith(
sharedUtils.getDocumentFilePath(`${parent.label.toString()}(${child.label.toString()})`, child)
sharedUtils.getDsDocumentFilePath(`${parent.label.toString()}(${child.label.toString()})`, child)
);
});
it("Checking of opening for sequential DS of favorite session", async () => {
Expand Down Expand Up @@ -3459,7 +3459,7 @@ describe("Dataset Actions Unit Tests - Function openPS", () => {
await dsActions.openPS(child, true, blockMocks.testDatasetTree);

expect(mocked(fs.existsSync)).toBeCalledWith(path.join(globals.DS_DIR, blockMocks.imperativeProfile.name, child.label.toString()));
expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith(sharedUtils.getDocumentFilePath(child.label.toString(), child));
expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith(sharedUtils.getDsDocumentFilePath(child.label.toString(), child));
});
it("Checks that openPS fails if called from an invalid node", async () => {
globals.defineGlobals("");
Expand Down
40 changes: 20 additions & 20 deletions packages/zowe-explorer/__tests__/__unit__/shared/utils.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,68 +374,68 @@ describe("Shared Utils Unit Tests - Function getDocumentFilePath", () => {
globals.defineGlobals("/test/path/");

let node = new ZoweDatasetNode("AUSER.TEST.JCL(member)", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.TEST.JCL(member).jcl")
);
node = new ZoweDatasetNode("AUSER.TEST.ASM(member)", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.TEST.ASM(member).asm")
);
node = new ZoweDatasetNode("AUSER.COBOL.TEST(member)", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.COBOL.TEST(member).cbl")
);
node = new ZoweDatasetNode("AUSER.PROD.PLI(member)", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.PROD.PLI(member).pli")
);
node = new ZoweDatasetNode("AUSER.PROD.PLX(member)", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.PROD.PLX(member).pli")
);
node = new ZoweDatasetNode("AUSER.PROD.SH(member)", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.PROD.SH(member).sh")
);
node = new ZoweDatasetNode("AUSER.REXX.EXEC(member)", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.REXX.EXEC(member).rexx")
);
node = new ZoweDatasetNode("AUSER.TEST.XML(member)", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.TEST.XML(member).xml")
);

node = new ZoweDatasetNode("AUSER.TEST.XML", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.TEST.XML.xml")
);
node = new ZoweDatasetNode("AUSER.TEST.TXML", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.TEST.TXML")
);
node = new ZoweDatasetNode("AUSER.XML.TGML", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.XML.TGML.xml")
);
node = new ZoweDatasetNode("AUSER.XML.ASM", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.XML.ASM.asm")
);
node = new ZoweDatasetNode("AUSER", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER")
);
node = new ZoweDatasetNode("AUSER.XML.TEST(member)", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.XML.TEST(member).xml")
);
node = new ZoweDatasetNode("XML.AUSER.TEST(member)", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "XML.AUSER.TEST(member)")
);
node = new ZoweDatasetNode("AUSER.COBOL.PL1.XML.TEST(member)", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.COBOL.PL1.XML.TEST(member).xml")
);
node = new ZoweDatasetNode(
Expand All @@ -444,19 +444,19 @@ describe("Shared Utils Unit Tests - Function getDocumentFilePath", () => {
blockMocks.datasetSessionNode,
null
);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.COBOL.PL1.XML.ASSEMBLER.TEST(member).asm")
);
node = new ZoweDatasetNode("AUSER.TEST.COPYBOOK", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.TEST.COPYBOOK.cpy")
);
node = new ZoweDatasetNode("AUSER.TEST.PLINC", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toBe(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toBe(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.TEST.PLINC.inc")
);
node = new ZoweDatasetNode("AUSER.TEST.SPFLOG1", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null);
expect(sharedUtils.getDocumentFilePath(node.label.toString(), node)).toEqual(
expect(sharedUtils.getDsDocumentFilePath(node.label.toString(), node)).toEqual(
path.join(path.sep, "test", "path", "temp", "_D_", "sestest", "AUSER.TEST.SPFLOG1.log")
);
});
Expand Down
5 changes: 4 additions & 1 deletion packages/zowe-explorer/i18n/sample/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,8 @@
"createZoweSchema.reload.button": "Reload Window",
"createZoweSchema.reload.infoMessage": "Team Configuration file created. Location: {0}. \n Please reload your window.",
"copyFile": "Copy",
"pasteFile": "Paste"
"pasteFile": "Paste",
"selectForCompare": "Select for Compare",
"compareWithSelected": "Compare with Selected",
"compareFileStarted": "Compare files has begun, first file chosen"
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"createMember.creating": "Creating new data set member {0}",
"createMember.error": "Unable to create member.",
"openPS.error": "Invalid data set or member.",
"openPS.openDataSet": "Opening {0}",
"dataSet.opening": "$(sync~spin) Opening data set...",
"dsActions.downloadPS.downloading.log": "Downloading {0}",
"dsActions.downloadPS.downloading.message": "$(sync~spin) Downloading data set...",
"createFile.allocatingNewDataSet": "Attempting to allocate new data set",
"handleUserSelection.qp.prompt": "Click on parameters to change them",
"createFile.inputBox.placeHolder": "Name of Data Set",
Expand Down
1 change: 0 additions & 1 deletion packages/zowe-explorer/src/Profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export class Profiles extends ProfilesCache {
* contents will be loaded.
*/
public async getProfileInfo(): Promise<zowe.imperative.ProfileInfo> {
ZoweLogger.trace("Profiles.getProfileInfo called.");
this.mProfileInfo = await super.getProfileInfo();
return this.mProfileInfo;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/zowe-explorer/src/dataset/DatasetTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
import { Profiles } from "../Profiles";
import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister";
import { FilterDescriptor, FilterItem, errorHandling, syncSessionNode } from "../utils/ProfilesUtils";
import { sortTreeItems, getAppName, getDocumentFilePath } from "../shared/utils";
import { sortTreeItems, getAppName, getDsDocumentFilePath } from "../shared/utils";
import { ZoweTreeProvider } from "../abstract/ZoweTreeProvider";
import { ZoweDatasetNode } from "./ZoweDatasetNode";
import { getIconById, getIconByNode, IconId, IIconItem } from "../generators/icons";
Expand Down Expand Up @@ -1162,7 +1162,7 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree<IZoweData
return;
}
afterMemberName = afterMemberName.toUpperCase();
const beforeFullPath = getDocumentFilePath(`${dataSetName}(${node.getLabel().toString()})`, node);
const beforeFullPath = getDsDocumentFilePath(`${dataSetName}(${node.getLabel().toString()})`, node);
const closedOpenedInstance = await closeOpenedTextFile(beforeFullPath);

ZoweLogger.debug(localize("renameDataSet.log.debug", "Renaming data set ") + afterMemberName);
Expand Down Expand Up @@ -1216,7 +1216,7 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree<IZoweData
return;
}
afterDataSetName = afterDataSetName.toUpperCase();
const beforeFullPath = getDocumentFilePath(node.getLabel() as string, node);
const beforeFullPath = getDsDocumentFilePath(node.getLabel() as string, node);
const closedOpenedInstance = await closeOpenedTextFile(beforeFullPath);

ZoweLogger.debug(localize("renameDataSet.log.debug", "Renaming data set ") + afterDataSetName);
Expand Down
Loading

0 comments on commit f4586d4

Please sign in to comment.