Skip to content

Commit 276ab00

Browse files
authored
Merge pull request #24 from pcoop/branch1
Initial Deploy/Undeploy code
2 parents c5edf89 + a280c2e commit 276ab00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1945
-60
lines changed

__tests__/__src__/TestUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function runCliScript(scriptPath: string, testEnvironment: ITestEnvironme
3737

3838
fs.chmodSync(scriptPath, "755");
3939
// Execute the command synchronously
40-
return spawnSync(scriptPath, [].concat(args), {cwd: testEnvironment.workingDir, env: childEnv, shell: true});
40+
return spawnSync(scriptPath, [].concat(args), {cwd: testEnvironment.workingDir, env: childEnv, shell: true, stdio: ["pipe", "pipe", "pipe"], windowsHide: true});
4141
} else {
4242
throw new Error(`The script file ${scriptPath} doesn't exist`);
4343

__tests__/api/AutoBundler.test.ts renamed to __tests__/api/BundleContent/AutoBundler.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
*
1010
*/
1111

12-
import { AutoBundler } from "../../src/api/AutoBundler";
12+
import { AutoBundler } from "../../../src/api/BundleContent/AutoBundler";
1313
import { IHandlerParameters } from "@brightside/imperative";
14-
import * as BundleDefinition from "../../src/cli/generate/bundle/Bundle.definition";
14+
import * as GenerateBundleDefinition from "../../../src/cli/generate/bundle/GenerateBundle.definition";
1515
import * as fse from "fs-extra";
1616

1717

@@ -48,14 +48,14 @@ const DEFAULT_PARAMTERS: IHandlerParameters = {
4848
endBar: jest.fn(() => undefined)
4949
}
5050
} as any,
51-
definition: BundleDefinition.BundleDefinition,
52-
fullDefinition: BundleDefinition.BundleDefinition,
51+
definition: GenerateBundleDefinition.GenerateBundleDefinition,
52+
fullDefinition: GenerateBundleDefinition.GenerateBundleDefinition,
5353
};
5454

5555
describe("AutoBundler01", () => {
5656

5757
beforeAll(() => {
58-
// Git does not commit empty dirs, so make they exist
58+
// Git does not commit empty dirs, so make sure they exist
5959
fse.ensureDir("__tests__/__resources__/EmptyBundle01");
6060
});
6161

__tests__/api/Bundle.test.ts renamed to __tests__/api/BundleContent/Bundle.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*/
1111

12-
import { Bundle } from "../../src/api/Bundle";
12+
import { Bundle } from "../../../src/api/BundleContent/Bundle";
1313
describe("Bundle01", () => {
1414
it("should read an existing bundle", () => {
1515

__tests__/api/Manifest.test.ts renamed to __tests__/api/BundleContent/Manifest.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*/
1111

12-
import { Manifest } from "../../src/api/Manifest";
12+
import { Manifest } from "../../../src/api/BundleContent/Manifest";
1313
describe("Manifest01", () => {
1414
it("should read an existing manifest", () => {
1515

__tests__/api/Nodejsapp.test.ts renamed to __tests__/api/BundleContent/Nodejsapp.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*/
1111

12-
import { NodejsappBundlePart } from "../../src/api/NodejsappBundlePart";
12+
import { NodejsappBundlePart } from "../../../src/api/BundleContent/NodejsappBundlePart";
1313
describe("NodejsappBundlePart01", () => {
1414
it("Create a NodejsappBundlePart", () => {
1515

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* This program and the accompanying materials are made available under the terms of the
3+
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
4+
* https://www.eclipse.org/legal/epl-v20.html
5+
*
6+
* SPDX-License-Identifier: EPL-2.0
7+
*
8+
* Copyright Contributors to the Zowe Project.
9+
* Copyright IBM Corp, 2019
10+
*
11+
*/
12+
13+
import * as fs from "fs";
14+
import { Imperative } from "@brightside/imperative";
15+
16+
describe("Deploy definition", () => {
17+
it("should match the snapshot", () => {
18+
19+
// Attempt to read the full file contents. We could require the module here, however there is normally non
20+
// deterministic data (filepaths, etc.) that are resolved when the module is loaded, so it is simpler to
21+
// check the contents for changes (sanity/protection against undesired changes to the definition)
22+
let contents: string;
23+
let error;
24+
try {
25+
contents = fs.readFileSync(__dirname + "/../../../src/cli/deploy/Deploy.definition.ts").toString();
26+
} catch (e) {
27+
error = e;
28+
Imperative.console.error(`Error reading Deploy.definition.ts Did you move the file? Details: ${e.message}`);
29+
}
30+
expect(error).toBeUndefined();
31+
expect(contents).toMatchSnapshot();
32+
});
33+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Deploy definition should match the snapshot 1`] = `
4+
"/*
5+
* This program and the accompanying materials are made available under the terms of the
6+
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-v20.html
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Copyright IBM Corp, 2019
12+
*
13+
*/
14+
15+
import { ICommandDefinition } from \\"@brightside/imperative\\";
16+
import { DeployBundleDefinition } from \\"./bundle/DeployBundle.definition\\";
17+
/**
18+
* Imperative command to \\"deploy\\" a Bundle, etc.
19+
*
20+
*/
21+
const DeployDefinition: ICommandDefinition = {
22+
name: \\"deploy\\",
23+
aliases: [\\"d\\", \\"dep\\"],
24+
summary: \\"Deploy a CICS bundle to a CPSM managed (group of) CICS region(s)\\",
25+
description: \\"Deploy a CICS bundle from zFS into a CPSM managed set of CICS regions. \\" +
26+
\\"A BUNDLE resource is installed and ENABLED and made AVAILABLE in the \\" +
27+
\\"target CICSplex and scope.\\",
28+
type: \\"group\\",
29+
children: [DeployBundleDefinition],
30+
};
31+
32+
export = DeployDefinition;
33+
"
34+
`;

__tests__/cli/generate/bundle/Bundle.definition.test.ts renamed to __tests__/cli/deploy/bundle/DeployBundle.definition.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ describe("bundle definition", () => {
1818

1919
// Attempt to read the full file contents. We could require the module here, however there is normally non
2020
// deterministic data (filepaths, etc.) that are resolved when the module is loaded, so it is simpler to
21-
// check the contents for changes (sanity/protection agaisnt undesired changes to the definition)
21+
// check the contents for changes (sanity/protection against undesired changes to the definition)
2222
let contents: string;
2323
let error;
2424
try {
25-
contents = fs.readFileSync(__dirname + "/../../../../src/cli/generate/bundle/Bundle.definition.ts").toString();
25+
contents = fs.readFileSync(__dirname + "/../../../../src/cli/deploy/bundle/DeployBundle.definition.ts").toString();
2626
} catch (e) {
2727
error = e;
28-
Imperative.console.error(`Error reading Bundle.definition.ts Did you move the file? Details: ${e.message}`);
28+
Imperative.console.error(`Error reading DeployBundle.definition.ts Did you move the file? Details: ${e.message}`);
2929
}
3030
expect(error).toBeUndefined();
3131
expect(contents).toMatchSnapshot();

0 commit comments

Comments
 (0)