Skip to content

Commit eb7b647

Browse files
Merge pull request #38 from pcoop/branch1
support \n in jobcard
2 parents 25c5123 + 10294c3 commit eb7b647

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

__tests__/api/BundleDeploy/BundleDeployer.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ import { ZosmfSession, SubmitJobs, List } from "@brightside/core";
1919
const DEFAULT_PARAMTERS: IHandlerParameters = {
2020
arguments: {
2121
$0: "bright",
22-
_: ["zowe-cli-cics-deploy-plugin", "deploy", "bundle"],
23-
jobcard: "//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT"
22+
_: ["zowe-cli-cics-deploy-plugin", "deploy", "bundle"]
2423
},
2524
profiles: {
2625
get: (type: string) => {
@@ -191,6 +190,16 @@ describe("BundleDeployer01", () => {
191190
parms.arguments.timeout = 1500;
192191
await testDeployJCL(parms);
193192
});
193+
it("should support multi-line jobcard", async () => {
194+
195+
let parms: IHandlerParameters;
196+
parms = DEFAULT_PARAMTERS;
197+
setCommonParmsForDeployTests(parms);
198+
parms.arguments.resgroup = "12345678";
199+
parms.arguments.jobcard = "//DFHDPLOY JOB DFHDPLOY,CLASS=A,\n" +
200+
"// MSGCLASS=X,TIME=NOLIMIT";
201+
await testDeployJCL(parms);
202+
});
194203
it("should support long bundledir", async () => {
195204

196205
let parms: IHandlerParameters;
@@ -312,6 +321,7 @@ function setCommonParmsForUndeployTests(parms: IHandlerParameters) {
312321
parms.arguments.resgroup = undefined;
313322
parms.arguments.timeout = undefined;
314323
parms.arguments.name = "12345678";
324+
parms.arguments.jobcard = "//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT";
315325
}
316326

317327
async function testDeployJCL(parms: IHandlerParameters) {

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,33 @@ DEPLOY BUNDLE(12345678)
248248
"
249249
`;
250250

251+
exports[`BundleDeployer01 should support multi-line jobcard 1`] = `"DFHRL2037I"`;
252+
253+
exports[`BundleDeployer01 should support multi-line jobcard 2`] = `
254+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,
255+
// MSGCLASS=X,TIME=NOLIMIT
256+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
257+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
258+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
259+
//SYSTSPRT DD SYSOUT=*
260+
//SYSIN DD *
261+
*
262+
SET CICSPLEX(12345678);
263+
*
264+
UNDEPLOY BUNDLE(12345678)
265+
SCOPE(12345678)
266+
STATE(DISCARDED)
267+
RESGROUP(12345678);
268+
*
269+
DEPLOY BUNDLE(12345678)
270+
BUNDLEDIR(1234567890)
271+
SCOPE(12345678)
272+
STATE(AVAILABLE)
273+
RESGROUP(12345678);
274+
/*
275+
"
276+
`;
277+
251278
exports[`BundleDeployer01 should tolerate empty output from DFHDPLOY 1`] = `"undefined"`;
252279

253280
exports[`BundleDeployer01 should tolerate empty output from DFHDPLOY 2`] = `"DFHDPLOY did not generate any output. Most recent status update: 'Submitting DFHDPLOY JCL'."`;

src/api/BundleDeploy/ParmValidator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ export class ParmValidator {
281281
throw new Error("--jobcard parameter is empty");
282282
}
283283

284+
// resolve any new line escape sequences embedded in the jobcard
285+
params.arguments.jobcard = params.arguments.jobcard.replace("\\n", "\n");
286+
284287
// split the jobcard into a comma separated list
285288
const jobcardParts = params.arguments.jobcard.split(",");
286289
const firstPart = jobcardParts[0].trim();

0 commit comments

Comments
 (0)