Skip to content

Commit

Permalink
Merge branch 'main' into fix/renameSeqDs
Browse files Browse the repository at this point in the history
  • Loading branch information
JillieBeanSim authored Feb 18, 2025
2 parents a6db56b + 8944fe3 commit f395734
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Fixed an issue where the 'Delete' key binding for the USS tree returns a 'contextValue' error. [#2796](https://github.com/zowe/zowe-explorer-vscode/issues/2796)
- Fixed an issue where cancelling Unix, MVS or TSO command still submits the command. [#3422](https://github.com/zowe/zowe-explorer-vscode/issues/3422)
- Fixed an issue where user is unable to open a renamed sequential data set from the Data Sets tree view.. [#3345](https://github.com/zowe/zowe-explorer-vscode/issues/3345)
- Fixed an issue seen with outdated profile information in the z/OS tree view data during upload and download of data set and USS files
[#3457](https://github.com/zowe/zowe-explorer-vscode/issues/3457)
- Fixed issue where deleting too many nodes at once would cause the confirmation prompt to be oversized. [#3254](https://github.com/zowe/zowe-explorer-vscode/issues/3254)

## `3.1.1`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
import { MockedProperty } from "../../../__mocks__/mockUtils";
import { DatasetFSProvider } from "../../../../src/trees/dataset/DatasetFSProvider";
import { ZoweExplorerApiRegister } from "../../../../src/extending/ZoweExplorerApiRegister";
import { Profiles } from "../../../../src/configuration/Profiles";
import { AuthUtils } from "../../../../src/utils/AuthUtils";
import * as path from "path";
const dayjs = require("dayjs");
Expand Down Expand Up @@ -202,6 +203,17 @@ describe("readDirectory", () => {
});
});
describe("fetchDatasetAtUri", () => {
beforeEach(() => {
Object.defineProperty(Profiles, "getInstance", {
value: jest.fn(() => {
return {
loadNamedProfile: jest.fn(() => {
return testProfile;
}),
};
}),
});
});
it("fetches a data set at the given URI", async () => {
const contents = "dataset contents";
const mockMvsApi = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,17 @@ describe("readDirectory", () => {
});

describe("fetchFileAtUri", () => {
beforeEach(() => {
Object.defineProperty(Profiles, "getInstance", {
value: jest.fn(() => {
return {
loadNamedProfile: jest.fn(() => {
return testProfile;
}),
};
}),
});
});
it("calls getContents to get the data for a file entry", async () => {
const fileEntry = { ...testEntries.file };
const lookupAsFileMock = jest.spyOn((UssFSProvider as any).prototype, "_lookupAsFile").mockReturnValueOnce(fileEntry);
Expand Down
6 changes: 4 additions & 2 deletions packages/zowe-explorer/src/trees/dataset/DatasetFSProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
let dsEntry = this._lookupAsFile(uri, { silent: true }) as DsEntry | undefined;
const bufBuilder = new BufferBuilder();
const metadata = dsEntry?.metadata ?? this._getInfoFromUri(uri);
const profileEncoding = dsEntry?.encoding ? null : dsEntry?.metadata.profile.profile?.encoding;
const profile = Profiles.getInstance().loadNamedProfile(dsEntry?.metadata.profile.name);
const profileEncoding = dsEntry?.encoding ? null : profile.profile?.encoding; // use profile encoding rather than metadata encoding
try {
await AuthHandler.waitForUnlock(metadata.profile);
const resp = await ZoweExplorerApiRegister.getMvsApi(metadata.profile).getContents(metadata.dsName, {
Expand Down Expand Up @@ -510,7 +511,8 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
let resp: IZosFilesResponse;
try {
const mvsApi = ZoweExplorerApiRegister.getMvsApi(entry.metadata.profile);
const profileEncoding = entry.encoding ? null : entry.metadata.profile.profile?.encoding;
const profile = Profiles.getInstance().loadNamedProfile(entry?.metadata.profile.name);
const profileEncoding = entry.encoding ? null : profile.profile?.encoding; // use profile encoding rather than metadata encoding
resp = await mvsApi.uploadFromBuffer(Buffer.from(content), entry.metadata.dsName, {
binary: entry.encoding?.kind === "binary",
encoding: entry.encoding?.kind === "other" ? entry.encoding.codepage : profileEncoding,
Expand Down
6 changes: 4 additions & 2 deletions packages/zowe-explorer/src/trees/uss/UssFSProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ export class UssFSProvider extends BaseProvider implements vscode.FileSystemProv
let resp: IZosFilesResponse;
try {
await this.autoDetectEncoding(file as UssFile);
const profileEncoding = file.encoding ? null : file.metadata.profile.profile?.encoding;
const profile = Profiles.getInstance().loadNamedProfile(file?.metadata.profile.name);
const profileEncoding = file.encoding ? null : profile.profile?.encoding; // use profile encoding rather than metadata encoding
await AuthHandler.waitForUnlock(file.metadata.profile);
resp = await ZoweExplorerApiRegister.getUssApi(metadata.profile).getContents(filePath, {
binary: file.encoding?.kind === "binary",
Expand Down Expand Up @@ -408,7 +409,8 @@ export class UssFSProvider extends BaseProvider implements vscode.FileSystemProv
try {
const ussApi = ZoweExplorerApiRegister.getUssApi(entry.metadata.profile);
await this.autoDetectEncoding(entry);
const profileEncoding = entry.encoding ? null : entry.metadata.profile.profile?.encoding;
const profile = Profiles.getInstance().loadNamedProfile(entry?.metadata.profile.name);
const profileEncoding = entry.encoding ? null : profile.profile?.encoding; // use profile encoding rather than metadata encoding

resp = await ussApi.uploadFromBuffer(Buffer.from(content), entry.metadata.path, {
binary: entry.encoding?.kind === "binary",
Expand Down

0 comments on commit f395734

Please sign in to comment.