-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial vsc proxy work Signed-off-by: Billie Simmons <[email protected]> * fix circ dependency issues Signed-off-by: Billie Simmons <[email protected]> * update zosmf session obtaining methods Signed-off-by: Billie Simmons <[email protected]> * update workflow and fix some unit tests Signed-off-by: Billie Simmons <[email protected]> * fix ZE API unit tests Signed-off-by: Billie Simmons <[email protected]> * fix ZE unit tests Signed-off-by: Billie Simmons <[email protected]> * add VscSettings unit tests Signed-off-by: Billie Simmons <[email protected]> * profilesCache unit tests Signed-off-by: Billie Simmons <[email protected]> * add CHANGELOGs Signed-off-by: Billie Simmons <[email protected]> * update sdks Signed-off-by: Billie Simmons <[email protected]> * fix unit tests Signed-off-by: Billie Simmons <[email protected]> * update sdk version in changelogs Signed-off-by: Billie Simmons <[email protected]> * run prepublish Signed-off-by: Billie Simmons <[email protected]> * address comments Signed-off-by: Billie Simmons <[email protected]> * get lock from main Signed-off-by: Billie Simmons <[email protected]> * update sdk changelog entry in ftp extenstion to match other packages Signed-off-by: Billie Simmons <[email protected]> * address feedback Signed-off-by: Billie Simmons <[email protected]> * remove session check and undefined return type Signed-off-by: Billie Simmons <[email protected]> --------- Signed-off-by: Billie Simmons <[email protected]> Signed-off-by: Fernando Rijo Cedeno <[email protected]> Co-authored-by: Fernando Rijo Cedeno <[email protected]>
- Loading branch information
1 parent
07232b7
commit 3e75cfe
Showing
18 changed files
with
332 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
286 changes: 152 additions & 134 deletions
286
packages/zowe-explorer-api/__tests__/__unit__/profiles/ZoweExplorerZosmfApi.unit.test.ts
Large diffs are not rendered by default.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...orer-api/__tests__/__unit__/profiles/__snapshots__/ZoweExplorerZosmfApi.unit.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ZosmfUssApi constants should be unchanged 1`] = `"zosmf"`; | ||
exports[`ZosmfUssApi misc constants should be unchanged 1`] = `"zosmf"`; | ||
|
||
exports[`ZosmfUssApi constants should be unchanged 2`] = `"apimlAuthenticationToken"`; | ||
exports[`ZosmfUssApi misc constants should be unchanged 2`] = `"apimlAuthenticationToken"`; |
57 changes: 57 additions & 0 deletions
57
packages/zowe-explorer-api/__tests__/__unit__/vscode/doc/VscSettings.unit.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import * as vscode from "vscode"; | ||
import { VscSettings } from "../../../../src/vscode/doc/VscSettings"; | ||
|
||
function createGlobalMocks() { | ||
const globalMocks = { | ||
vscConfSpy: jest.spyOn(vscode.workspace, "getConfiguration"), | ||
getConfiguration: jest.fn(), | ||
testProxyVars: { | ||
http_proxy: "host.com", | ||
https_proxy: "host.com", | ||
no_proxy: ["fake.com"], | ||
proxy_authorization: null, | ||
proxy_strict_ssl: true, | ||
}, | ||
}; | ||
globalMocks.getConfiguration = jest.fn().mockReturnValue({ | ||
get: jest.fn(), | ||
}); | ||
globalMocks.vscConfSpy.mockImplementation(globalMocks.getConfiguration); | ||
|
||
return globalMocks; | ||
} | ||
|
||
describe("VscSettings", () => { | ||
describe("getVsCodeProxySettings", () => { | ||
beforeEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
it("should return undefined with VSC proxy support off", () => { | ||
const globalMocks = createGlobalMocks(); | ||
globalMocks.getConfiguration().get.mockReturnValueOnce("off"); | ||
const response = VscSettings.getVsCodeProxySettings(); | ||
expect(response).not.toBeDefined(); | ||
}); | ||
it("should return undefined with VSC proxy support off", () => { | ||
const globalMocks = createGlobalMocks(); | ||
globalMocks.getConfiguration().get.mockReturnValueOnce("on"); | ||
globalMocks.getConfiguration().get.mockReturnValueOnce("host.com"); | ||
globalMocks.getConfiguration().get.mockReturnValueOnce(["fake.com"]); | ||
globalMocks.getConfiguration().get.mockReturnValueOnce(true); | ||
globalMocks.getConfiguration().get.mockReturnValueOnce(null); | ||
const response = VscSettings.getVsCodeProxySettings(); | ||
expect(response).toEqual(globalMocks.testProxyVars); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import * as vscode from "vscode"; | ||
import * as imperative from "@zowe/imperative"; | ||
|
||
export class VscSettings { | ||
/** | ||
* Retrieves a generic setting either in user or workspace. | ||
* @param {string} key - The config property that needs retrieving | ||
* @param {T} defaultValue - Default value if config property is undefined | ||
*/ | ||
public static getDirectValue<T>(key: string, defaultValue?: T): T { | ||
const [first, ...rest] = key.split("."); | ||
return vscode.workspace.getConfiguration(first).get(rest.join("."), defaultValue); | ||
} | ||
|
||
public static getVsCodeProxySettings(): imperative.ProxyVariables { | ||
const proxySupport = this.getDirectValue("http.proxySupport"); | ||
if (proxySupport !== "on") { | ||
return; | ||
} | ||
const http_proxy: string = this.getDirectValue("http.proxy"); | ||
const no_proxy: string[] = this.getDirectValue("http.noProxy"); | ||
const proxy_strict_ssl: boolean = this.getDirectValue("http.proxyStrictSSL"); | ||
const proxy_authorization: string = this.getDirectValue("http.proxyAuthorization"); | ||
|
||
return { | ||
http_proxy, | ||
https_proxy: http_proxy, | ||
no_proxy, | ||
proxy_authorization, | ||
proxy_strict_ssl, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters