Skip to content

Commit a86e61f

Browse files
committed
make targetstate configurable
1 parent 8b5a320 commit a86e61f

File tree

12 files changed

+495
-24
lines changed

12 files changed

+495
-24
lines changed

__tests__/api/BundleDeploy/BundleDeployer.test.ts

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,19 +251,55 @@ describe("BundleDeployer01", () => {
251251
"1234567890123456789012345678901234567890123456789012345";
252252
await testDeployJCL(parms);
253253
});
254-
it("should generate undeploy JCL for csdgroup", async () => {
254+
it("should generate deploy JCL for AVAILABLE", async () => {
255+
256+
let parms: IHandlerParameters;
257+
parms = DEFAULT_PARAMTERS;
258+
setCommonParmsForDeployTests(parms);
259+
parms.arguments.targetstate = "AVAILABLE";
260+
parms.arguments.resgroup = "12345678";
261+
await testDeployJCL(parms);
262+
});
263+
it("should generate deploy JCL for ENABLED", async () => {
264+
265+
let parms: IHandlerParameters;
266+
parms = DEFAULT_PARAMTERS;
267+
setCommonParmsForDeployTests(parms);
268+
parms.arguments.targetstate = "ENABLED";
269+
parms.arguments.resgroup = "12345678";
270+
await testDeployJCL(parms);
271+
});
272+
it("should generate deploy JCL for DISABLED", async () => {
255273

256274
let parms: IHandlerParameters;
257275
parms = DEFAULT_PARAMTERS;
258276
setCommonParmsForDeployTests(parms);
277+
parms.arguments.targetstate = "DISABLED";
278+
parms.arguments.resgroup = "12345678";
279+
await testDeployJCL(parms);
280+
});
281+
it("should generate deploy JCL for mixed case", async () => {
282+
283+
let parms: IHandlerParameters;
284+
parms = DEFAULT_PARAMTERS;
285+
setCommonParmsForDeployTests(parms);
286+
parms.arguments.targetstate = "disabled";
287+
parms.arguments.resgroup = "12345678";
288+
await testDeployJCL(parms);
289+
});
290+
it("should generate undeploy JCL for csdgroup", async () => {
291+
292+
let parms: IHandlerParameters;
293+
parms = DEFAULT_PARAMTERS;
294+
setCommonParmsForUndeployTests(parms);
259295
parms.arguments.csdgroup = "12345678";
260296
await testUndeployJCL(parms);
261297
});
262298
it("should generate undeploy JCL for csdgroup with timeout", async () => {
263299

264300
let parms: IHandlerParameters;
265301
parms = DEFAULT_PARAMTERS;
266-
setCommonParmsForDeployTests(parms);
302+
setCommonParmsForUndeployTests(parms);
267303
parms.arguments.csdgroup = "12345678";
268304
parms.arguments.timeout = 1500;
269305
await testUndeployJCL(parms);
@@ -272,19 +308,55 @@ describe("BundleDeployer01", () => {
272308

273309
let parms: IHandlerParameters;
274310
parms = DEFAULT_PARAMTERS;
275-
setCommonParmsForDeployTests(parms);
311+
setCommonParmsForUndeployTests(parms);
276312
parms.arguments.resgroup = "12345678";
277313
await testUndeployJCL(parms);
278314
});
279315
it("should generate undeploy JCL for resgroup with timeout", async () => {
280316

281317
let parms: IHandlerParameters;
282318
parms = DEFAULT_PARAMTERS;
283-
setCommonParmsForDeployTests(parms);
319+
setCommonParmsForUndeployTests(parms);
284320
parms.arguments.resgroup = "12345678";
285321
parms.arguments.timeout = 1500;
286322
await testUndeployJCL(parms);
287323
});
324+
it("should generate undeploy JCL for UNAVAILABLE", async () => {
325+
326+
let parms: IHandlerParameters;
327+
parms = DEFAULT_PARAMTERS;
328+
setCommonParmsForDeployTests(parms);
329+
parms.arguments.targetstate = "UNAVAILABLE";
330+
parms.arguments.resgroup = "12345678";
331+
await testUndeployJCL(parms);
332+
});
333+
it("should generate undeploy JCL for DISABLED", async () => {
334+
335+
let parms: IHandlerParameters;
336+
parms = DEFAULT_PARAMTERS;
337+
setCommonParmsForDeployTests(parms);
338+
parms.arguments.targetstate = "DISABLED";
339+
parms.arguments.resgroup = "12345678";
340+
await testUndeployJCL(parms);
341+
});
342+
it("should generate undeploy JCL for DISCARDED", async () => {
343+
344+
let parms: IHandlerParameters;
345+
parms = DEFAULT_PARAMTERS;
346+
setCommonParmsForDeployTests(parms);
347+
parms.arguments.targetstate = "DISCARDED";
348+
parms.arguments.resgroup = "12345678";
349+
await testUndeployJCL(parms);
350+
});
351+
it("should generate undeploy JCL for mixed case", async () => {
352+
353+
let parms: IHandlerParameters;
354+
parms = DEFAULT_PARAMTERS;
355+
setCommonParmsForDeployTests(parms);
356+
parms.arguments.targetstate = "discarded";
357+
parms.arguments.resgroup = "12345678";
358+
await testUndeployJCL(parms);
359+
});
288360
});
289361

290362
async function runDeployTestWithError() {
@@ -348,6 +420,7 @@ async function runUndeployTest() {
348420
function setCommonParmsForDeployTests(parms: IHandlerParameters) {
349421
setCommonParmsForUndeployTests(parms);
350422
parms.arguments.bundledir = "1234567890";
423+
parms.arguments.targetstate = "ENABLED";
351424
}
352425

353426
function setCommonParmsForUndeployTests(parms: IHandlerParameters) {
@@ -360,6 +433,7 @@ function setCommonParmsForUndeployTests(parms: IHandlerParameters) {
360433
parms.arguments.timeout = undefined;
361434
parms.arguments.name = "12345678";
362435
parms.arguments.jobcard = "//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT";
436+
parms.arguments.targetstate = "DISCARDED";
363437
}
364438

365439
async function testDeployJCL(parms: IHandlerParameters) {

__tests__/api/BundleDeploy/__snapshots__/BundleDeployer.test.ts.snap

Lines changed: 172 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,69 @@ exports[`BundleDeployer01 should deploy successfully 2`] = `"DFHDPLOY DEPLOY com
3232

3333
exports[`BundleDeployer01 should fail with overlong jobcard 1`] = `"--jobcard parameter section cannot be split into 72 character lines: '// 73CHARS=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1'."`;
3434

35+
exports[`BundleDeployer01 should generate deploy JCL for AVAILABLE 1`] = `"DFHRL2037I"`;
36+
37+
exports[`BundleDeployer01 should generate deploy JCL for AVAILABLE 2`] = `
38+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
39+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
40+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
41+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
42+
//SYSTSPRT DD SYSOUT=*
43+
//SYSIN DD *
44+
*
45+
SET CICSPLEX(12345678);
46+
*
47+
DEPLOY BUNDLE(12345678)
48+
BUNDLEDIR(1234567890)
49+
SCOPE(12345678)
50+
STATE(AVAILABLE)
51+
RESGROUP(12345678);
52+
/*
53+
"
54+
`;
55+
56+
exports[`BundleDeployer01 should generate deploy JCL for DISABLED 1`] = `"DFHRL2037I"`;
57+
58+
exports[`BundleDeployer01 should generate deploy JCL for DISABLED 2`] = `
59+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
60+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
61+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
62+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
63+
//SYSTSPRT DD SYSOUT=*
64+
//SYSIN DD *
65+
*
66+
SET CICSPLEX(12345678);
67+
*
68+
DEPLOY BUNDLE(12345678)
69+
BUNDLEDIR(1234567890)
70+
SCOPE(12345678)
71+
STATE(DISABLED)
72+
RESGROUP(12345678);
73+
/*
74+
"
75+
`;
76+
77+
exports[`BundleDeployer01 should generate deploy JCL for ENABLED 1`] = `"DFHRL2037I"`;
78+
79+
exports[`BundleDeployer01 should generate deploy JCL for ENABLED 2`] = `
80+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
81+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
82+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
83+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
84+
//SYSTSPRT DD SYSOUT=*
85+
//SYSIN DD *
86+
*
87+
SET CICSPLEX(12345678);
88+
*
89+
DEPLOY BUNDLE(12345678)
90+
BUNDLEDIR(1234567890)
91+
SCOPE(12345678)
92+
STATE(ENABLED)
93+
RESGROUP(12345678);
94+
/*
95+
"
96+
`;
97+
3598
exports[`BundleDeployer01 should generate deploy JCL for csdgroup 1`] = `"DFHRL2037I"`;
3699

37100
exports[`BundleDeployer01 should generate deploy JCL for csdgroup 2`] = `
@@ -47,7 +110,7 @@ SET CICSPLEX(12345678);
47110
DEPLOY BUNDLE(12345678)
48111
BUNDLEDIR(1234567890)
49112
SCOPE(12345678)
50-
STATE(AVAILABLE)
113+
STATE(ENABLED)
51114
CSDGROUP(12345678);
52115
/*
53116
"
@@ -68,13 +131,34 @@ SET CICSPLEX(12345678);
68131
DEPLOY BUNDLE(12345678)
69132
BUNDLEDIR(1234567890)
70133
SCOPE(12345678)
71-
STATE(AVAILABLE)
134+
STATE(ENABLED)
72135
TIMEOUT(1500)
73136
CSDGROUP(12345678);
74137
/*
75138
"
76139
`;
77140

141+
exports[`BundleDeployer01 should generate deploy JCL for mixed case 1`] = `"DFHRL2037I"`;
142+
143+
exports[`BundleDeployer01 should generate deploy JCL for mixed case 2`] = `
144+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
145+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
146+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
147+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
148+
//SYSTSPRT DD SYSOUT=*
149+
//SYSIN DD *
150+
*
151+
SET CICSPLEX(12345678);
152+
*
153+
DEPLOY BUNDLE(12345678)
154+
BUNDLEDIR(1234567890)
155+
SCOPE(12345678)
156+
STATE(DISABLED)
157+
RESGROUP(12345678);
158+
/*
159+
"
160+
`;
161+
78162
exports[`BundleDeployer01 should generate deploy JCL for resgroup 1`] = `"DFHRL2037I"`;
79163

80164
exports[`BundleDeployer01 should generate deploy JCL for resgroup 2`] = `
@@ -90,7 +174,7 @@ SET CICSPLEX(12345678);
90174
DEPLOY BUNDLE(12345678)
91175
BUNDLEDIR(1234567890)
92176
SCOPE(12345678)
93-
STATE(AVAILABLE)
177+
STATE(ENABLED)
94178
RESGROUP(12345678);
95179
/*
96180
"
@@ -111,13 +195,73 @@ SET CICSPLEX(12345678);
111195
DEPLOY BUNDLE(12345678)
112196
BUNDLEDIR(1234567890)
113197
SCOPE(12345678)
114-
STATE(AVAILABLE)
198+
STATE(ENABLED)
115199
TIMEOUT(1500)
116200
RESGROUP(12345678);
117201
/*
118202
"
119203
`;
120204

205+
exports[`BundleDeployer01 should generate undeploy JCL for DISABLED 1`] = `"DFHRL2037I"`;
206+
207+
exports[`BundleDeployer01 should generate undeploy JCL for DISABLED 2`] = `
208+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
209+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
210+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
211+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
212+
//SYSTSPRT DD SYSOUT=*
213+
//SYSIN DD *
214+
*
215+
SET CICSPLEX(12345678);
216+
*
217+
UNDEPLOY BUNDLE(12345678)
218+
SCOPE(12345678)
219+
STATE(DISABLED)
220+
RESGROUP(12345678);
221+
/*
222+
"
223+
`;
224+
225+
exports[`BundleDeployer01 should generate undeploy JCL for DISCARDED 1`] = `"DFHRL2037I"`;
226+
227+
exports[`BundleDeployer01 should generate undeploy JCL for DISCARDED 2`] = `
228+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
229+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
230+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
231+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
232+
//SYSTSPRT DD SYSOUT=*
233+
//SYSIN DD *
234+
*
235+
SET CICSPLEX(12345678);
236+
*
237+
UNDEPLOY BUNDLE(12345678)
238+
SCOPE(12345678)
239+
STATE(DISCARDED)
240+
RESGROUP(12345678);
241+
/*
242+
"
243+
`;
244+
245+
exports[`BundleDeployer01 should generate undeploy JCL for UNAVAILABLE 1`] = `"DFHRL2037I"`;
246+
247+
exports[`BundleDeployer01 should generate undeploy JCL for UNAVAILABLE 2`] = `
248+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
249+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
250+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
251+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
252+
//SYSTSPRT DD SYSOUT=*
253+
//SYSIN DD *
254+
*
255+
SET CICSPLEX(12345678);
256+
*
257+
UNDEPLOY BUNDLE(12345678)
258+
SCOPE(12345678)
259+
STATE(UNAVAILABLE)
260+
RESGROUP(12345678);
261+
/*
262+
"
263+
`;
264+
121265
exports[`BundleDeployer01 should generate undeploy JCL for csdgroup 1`] = `"DFHRL2037I"`;
122266

123267
exports[`BundleDeployer01 should generate undeploy JCL for csdgroup 2`] = `
@@ -159,6 +303,26 @@ UNDEPLOY BUNDLE(12345678)
159303
"
160304
`;
161305

306+
exports[`BundleDeployer01 should generate undeploy JCL for mixed case 1`] = `"DFHRL2037I"`;
307+
308+
exports[`BundleDeployer01 should generate undeploy JCL for mixed case 2`] = `
309+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
310+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
311+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
312+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
313+
//SYSTSPRT DD SYSOUT=*
314+
//SYSIN DD *
315+
*
316+
SET CICSPLEX(12345678);
317+
*
318+
UNDEPLOY BUNDLE(12345678)
319+
SCOPE(12345678)
320+
STATE(DISCARDED)
321+
RESGROUP(12345678);
322+
/*
323+
"
324+
`;
325+
162326
exports[`BundleDeployer01 should generate undeploy JCL for resgroup 1`] = `"DFHRL2037I"`;
163327

164328
exports[`BundleDeployer01 should generate undeploy JCL for resgroup 2`] = `
@@ -221,7 +385,7 @@ DEPLOY BUNDLE(12345678)
221385
123456789012345678901234567890123456789012345678901234567890123
222386
456789012345)
223387
SCOPE(12345678)
224-
STATE(AVAILABLE)
388+
STATE(ENABLED)
225389
RESGROUP(12345678);
226390
/*
227391
"
@@ -243,7 +407,7 @@ SET CICSPLEX(12345678);
243407
DEPLOY BUNDLE(12345678)
244408
BUNDLEDIR(1234567890)
245409
SCOPE(12345678)
246-
STATE(AVAILABLE)
410+
STATE(ENABLED)
247411
RESGROUP(12345678);
248412
/*
249413
"
@@ -265,7 +429,7 @@ SET CICSPLEX(12345678);
265429
DEPLOY BUNDLE(12345678)
266430
BUNDLEDIR(1234567890)
267431
SCOPE(12345678)
268-
STATE(AVAILABLE)
432+
STATE(ENABLED)
269433
RESGROUP(12345678);
270434
/*
271435
"
@@ -289,7 +453,7 @@ SET CICSPLEX(12345678);
289453
DEPLOY BUNDLE(12345678)
290454
BUNDLEDIR(1234567890)
291455
SCOPE(12345678)
292-
STATE(AVAILABLE)
456+
STATE(ENABLED)
293457
RESGROUP(12345678);
294458
/*
295459
"

0 commit comments

Comments
 (0)