@@ -1100,7 +1100,7 @@ describe("BundlePusher01", () => {
1100
1100
expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1101
1101
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1102
1102
} ) ;
1103
- it ( "should tolerate a Node.js diagnostics generation failure" , async ( ) => {
1103
+ it ( "should tolerate a Node.js diagnostics generation failure - region " , async ( ) => {
1104
1104
zosmfProfile = { host : "wibble" , user : "user" } ;
1105
1105
sshProfile = { host : "wibble" , user : "user" } ;
1106
1106
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
@@ -1123,26 +1123,124 @@ describe("BundlePusher01", () => {
1123
1123
expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1124
1124
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1125
1125
} ) ;
1126
+ it ( "should tolerate a Node.js diagnostics generation failure - nodejsapp" , async ( ) => {
1127
+ zosmfProfile = { host : "wibble" , user : "user" } ;
1128
+ sshProfile = { host : "wibble" , user : "user" } ;
1129
+ cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1130
+ submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1131
+ [ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP" } ] ) ;
1132
+ cmciSpy . mockImplementation ( ( cicsSession : any , nodejsData : cmci . IResourceParms ) => {
1133
+ if ( nodejsData . name === "CICSNodejsapp" ) {
1134
+ throw new Error ( "Injected CMCI GET error" ) ;
1135
+ }
1136
+ else if ( nodejsData . name === "CICSRegion" ) {
1137
+ return { response : {
1138
+ records : {
1139
+ cicsregion : {
1140
+ applid : "ABCDEFG" , jobid : "JOB12345" , jobname : "MYCICS"
1141
+ }
1142
+ }
1143
+ }
1144
+ } ;
1145
+ }
1146
+ else {
1147
+ return { } ;
1148
+ }
1149
+ } ) ;
1150
+
1151
+ await runPushTest ( "__tests__/__resources__/ExampleBundle01" , false , "PUSH operation completed." ) ;
1152
+
1153
+ expect ( consoleText ) . toContain ( "zowe cics get resource CICSNodejsapp --region-name 12345678 --criteria \"BUNDLE=12345678\" --cics-plex 12345678" ) ;
1154
+ expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1155
+ expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1156
+ expect ( listSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1157
+ expect ( createSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1158
+ expect ( shellSpy ) . toHaveBeenCalledTimes ( 0 ) ;
1159
+ expect ( membersSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1160
+ expect ( submitSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1161
+ expect ( existsSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1162
+ expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1163
+ expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1164
+ expect ( cmciSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1165
+ } ) ;
1166
+ it ( "should tolerate a Node.js diagnostics generation failure - nodejsapp empty" , async ( ) => {
1167
+ zosmfProfile = { host : "wibble" , user : "user" } ;
1168
+ sshProfile = { host : "wibble" , user : "user" } ;
1169
+ cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1170
+ submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1171
+ [ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP" } ] ) ;
1172
+ cmciSpy . mockImplementation ( ( cicsSession : any , nodejsData : cmci . IResourceParms ) => {
1173
+ if ( nodejsData . name === "CICSNodejsapp" ) {
1174
+ return { } ;
1175
+ }
1176
+ else if ( nodejsData . name === "CICSRegion" ) {
1177
+ return { response : {
1178
+ records : {
1179
+ cicsregion : {
1180
+ applid : "ABCDEFG" , jobid : "JOB12345" , jobname : "MYCICS"
1181
+ }
1182
+ }
1183
+ }
1184
+ } ;
1185
+ }
1186
+ else {
1187
+ return { } ;
1188
+ }
1189
+ } ) ;
1190
+
1191
+ await runPushTest ( "__tests__/__resources__/ExampleBundle01" , false , "PUSH operation completed." ) ;
1192
+
1193
+ expect ( consoleText ) . toContain ( "zowe cics get resource CICSNodejsapp --region-name 12345678 --criteria \"BUNDLE=12345678\" --cics-plex 12345678" ) ;
1194
+ expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1195
+ expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1196
+ expect ( listSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1197
+ expect ( createSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1198
+ expect ( shellSpy ) . toHaveBeenCalledTimes ( 0 ) ;
1199
+ expect ( membersSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1200
+ expect ( submitSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1201
+ expect ( existsSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1202
+ expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1203
+ expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1204
+ expect ( cmciSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1205
+ } ) ;
1126
1206
it ( "should generate Node.js diagnostics for 1 enabled NODEJSAPP" , async ( ) => {
1127
1207
zosmfProfile = { host : "wibble" , user : "user" } ;
1128
1208
sshProfile = { host : "wibble" , user : "user" } ;
1129
1209
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1130
1210
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1131
1211
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP" } ] ) ;
1132
- cmciSpy . mockImplementationOnce ( ( ) => (
1133
- { response : {
1134
- records : {
1135
- cicsnodejsapp : {
1136
- name : "name" , pid : "22" , enablestatus : "ENABLED" , stderr : "/tmp/stderr" , stdout : "/tmp/stdout" , eyu_cicsname : "1"
1212
+ cmciSpy . mockImplementation ( ( cicsSession : any , nodejsData : cmci . IResourceParms ) => {
1213
+ if ( nodejsData . name === "CICSNodejsapp" ) {
1214
+ return { response : {
1215
+ records : {
1216
+ cicsnodejsapp : {
1217
+ name : "name" , pid : "22" , enablestatus : "ENABLED" , stderr : "/tmp/stderr" , stdout : "/tmp/stdout" , eyu_cicsname : "1"
1218
+ }
1137
1219
}
1138
1220
}
1139
- }
1140
- } )
1141
- ) ;
1221
+ } ;
1222
+ }
1223
+ else if ( nodejsData . name === "CICSRegion" ) {
1224
+ return { response : {
1225
+ records : {
1226
+ cicsregion : {
1227
+ applid : "ABCDEFG" , jobid : "JOB12345" , jobname : "MYCICS"
1228
+ }
1229
+ }
1230
+ }
1231
+ } ;
1232
+ }
1233
+ else {
1234
+ return { } ;
1235
+ }
1236
+ } ) ;
1142
1237
1143
1238
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , false , "PUSH operation completed." ) ;
1144
1239
1145
- expect ( consoleText ) . toContain ( "CICS NODEJSAPP resource 'name' is in 'ENABLED' state in region '1' with process id '22'." ) ;
1240
+ expect ( consoleText ) . toContain ( "CICS Regions in Scope '12345678' of CICSplex '12345678':" ) ;
1241
+ expect ( consoleText ) . toContain ( "Applid: ABCDEFG jobname: MYCICS jobid: JOB12345" ) ;
1242
+ expect ( consoleText ) . toContain ( "NODEJSAPP resources for Bundle '12345678' in Scope '12345678':" ) ;
1243
+ expect ( consoleText ) . toContain ( "CICS NODEJSAPP resource 'name' is in 'ENABLED' state in region '1' with process id '22'" ) ;
1146
1244
expect ( consoleText ) . toContain ( "stdout: /tmp/stdout" ) ;
1147
1245
expect ( consoleText ) . toContain ( "stderr: /tmp/stderr" ) ;
1148
1246
expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -1155,27 +1253,45 @@ describe("BundlePusher01", () => {
1155
1253
expect ( existsSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1156
1254
expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1157
1255
expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1158
- expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1256
+ expect ( cmciSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1159
1257
} ) ;
1160
1258
it ( "should generate Node.js diagnostics for 1 disabled NODEJSAPP" , async ( ) => {
1161
1259
zosmfProfile = { host : "wibble" , user : "user" } ;
1162
1260
sshProfile = { host : "wibble" , user : "user" } ;
1163
1261
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1164
1262
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1165
1263
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP" } ] ) ;
1166
- cmciSpy . mockImplementationOnce ( ( ) => (
1167
- { response : {
1168
- records : {
1169
- cicsnodejsapp : {
1170
- name : "name" , pid : "0" , enablestatus : "DISABLED" , stderr : "" , stdout : "" , eyu_cicsname : "1"
1264
+ cmciSpy . mockImplementation ( ( cicsSession : any , nodejsData : cmci . IResourceParms ) => {
1265
+ if ( nodejsData . name === "CICSNodejsapp" ) {
1266
+ return { response : {
1267
+ records : {
1268
+ cicsnodejsapp : {
1269
+ name : "name" , pid : "0" , enablestatus : "DISABLED" , stderr : "" , stdout : "" , eyu_cicsname : "1"
1270
+ }
1171
1271
}
1172
1272
}
1173
- }
1174
- } )
1175
- ) ;
1273
+ } ;
1274
+ }
1275
+ else if ( nodejsData . name === "CICSRegion" ) {
1276
+ return { response : {
1277
+ records : {
1278
+ cicsregion : {
1279
+ applid : "ABCD" , jobid : "JOB12345" , jobname : "MYCICS"
1280
+ }
1281
+ }
1282
+ }
1283
+ } ;
1284
+ }
1285
+ else {
1286
+ return { } ;
1287
+ }
1288
+ } ) ;
1176
1289
1177
1290
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , false , "PUSH operation completed." ) ;
1178
1291
1292
+ expect ( consoleText ) . toContain ( "CICS Regions in Scope '12345678' of CICSplex '12345678':" ) ;
1293
+ expect ( consoleText ) . toContain ( "Applid: ABCD jobname: MYCICS jobid: JOB12345" ) ;
1294
+ expect ( consoleText ) . toContain ( "NODEJSAPP resources for Bundle '12345678' in Scope '12345678':" ) ;
1179
1295
expect ( consoleText ) . toContain ( "CICS NODEJSAPP resource 'name' is in 'DISABLED' state in region '1' with process id '0'." ) ;
1180
1296
expect ( consoleText ) . toContain ( "stdout: <not available>" ) ;
1181
1297
expect ( consoleText ) . toContain ( "stderr: <not available>" ) ;
@@ -1189,32 +1305,56 @@ describe("BundlePusher01", () => {
1189
1305
expect ( existsSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1190
1306
expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1191
1307
expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1192
- expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1308
+ expect ( cmciSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1193
1309
} ) ;
1194
1310
it ( "should generate Node.js diagnostics for 2 NODEJSAPPs" , async ( ) => {
1195
1311
zosmfProfile = { host : "wibble" , user : "user" } ;
1196
1312
sshProfile = { host : "wibble" , user : "user" } ;
1197
1313
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1198
1314
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1199
1315
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP" } ] ) ;
1200
- cmciSpy . mockImplementationOnce ( ( ) => (
1201
- { response : {
1202
- records : {
1203
- cicsnodejsapp : [
1204
- {
1205
- name : "name" , pid : "22" , enablestatus : "ENABLED" , stderr : "/tmp/stderr" , stdout : "/tmp/stdout" , eyu_cicsname : "1"
1206
- } ,
1207
- {
1208
- name : "name2" , pid : "33" , enablestatus : "ENABLED" , stderr : "/tmp/name2err" , stdout : "/tmp/name2out" , eyu_cicsname : "1"
1209
- }
1210
- ]
1316
+ cmciSpy . mockImplementation ( ( cicsSession : any , nodejsData : cmci . IResourceParms ) => {
1317
+ if ( nodejsData . name === "CICSNodejsapp" ) {
1318
+ return { response : {
1319
+ records : {
1320
+ cicsnodejsapp : [
1321
+ {
1322
+ name : "name" , pid : "22" , enablestatus : "ENABLED" , stderr : "/tmp/stderr" , stdout : "/tmp/stdout" , eyu_cicsname : "1"
1323
+ } ,
1324
+ {
1325
+ name : "name2" , pid : "33" , enablestatus : "ENABLED" , stderr : "/tmp/name2err" , stdout : "/tmp/name2out" , eyu_cicsname : "1"
1326
+ }
1327
+ ]
1328
+ }
1211
1329
}
1212
- }
1213
- } )
1214
- ) ;
1330
+ } ;
1331
+ }
1332
+ else if ( nodejsData . name === "CICSRegion" ) {
1333
+ return { response : {
1334
+ records : {
1335
+ cicsregion : [
1336
+ {
1337
+ applid : "ABCD" , jobid : "JOB12345" , jobname : "MYCICS"
1338
+ } ,
1339
+ {
1340
+ applid : "EFGHIHJK" , jobid : "JOB54321" , jobname : "MYCICS2"
1341
+ } ,
1342
+ ]
1343
+ }
1344
+ }
1345
+ } ;
1346
+ }
1347
+ else {
1348
+ return { } ;
1349
+ }
1350
+ } ) ;
1215
1351
1216
1352
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , false , "PUSH operation completed." ) ;
1217
1353
1354
+ expect ( consoleText ) . toContain ( "CICS Regions in Scope '12345678' of CICSplex '12345678':" ) ;
1355
+ expect ( consoleText ) . toContain ( "Applid: ABCD jobname: MYCICS jobid: JOB12345" ) ;
1356
+ expect ( consoleText ) . toContain ( "Applid: EFGHIHJK jobname: MYCICS2 jobid: JOB54321" ) ;
1357
+ expect ( consoleText ) . toContain ( "NODEJSAPP resources for Bundle '12345678' in Scope '12345678':" ) ;
1218
1358
expect ( consoleText ) . toContain ( "CICS NODEJSAPP resource 'name' is in 'ENABLED' state in region '1' with process id '22'." ) ;
1219
1359
expect ( consoleText ) . toContain ( "stdout: /tmp/stdout" ) ;
1220
1360
expect ( consoleText ) . toContain ( "stderr: /tmp/stderr" ) ;
@@ -1231,7 +1371,7 @@ describe("BundlePusher01", () => {
1231
1371
expect ( existsSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1232
1372
expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1233
1373
expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1234
- expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1374
+ expect ( cmciSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1235
1375
} ) ;
1236
1376
} ) ;
1237
1377
0 commit comments