@@ -1039,6 +1039,43 @@ describe("BundlePusher01", () => {
1039
1039
expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1040
1040
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1041
1041
} ) ;
1042
+ it ( "should query scope even with no NODEJSAPPs" , async ( ) => {
1043
+ zosmfProfile = { host : "wibble" , user : "user" } ;
1044
+ sshProfile = { host : "wibble" , user : "user" } ;
1045
+ cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" } ;
1046
+ cmciSpy . mockImplementation ( ( cicsSession : any , regionData : cmci . IResourceParms ) => {
1047
+ if ( regionData . name === "CICSRegion" ) {
1048
+ return { response : {
1049
+ records : {
1050
+ cicsregion : {
1051
+ applid : "ABCDEFG" , jobid : "JOB12345" , jobname : "MYCICS"
1052
+ }
1053
+ }
1054
+ }
1055
+ } ;
1056
+ }
1057
+ else {
1058
+ return { } ;
1059
+ }
1060
+ } ) ;
1061
+
1062
+ await runPushTest ( "__tests__/__resources__/ExampleBundle01" , false , "PUSH operation completed." ) ;
1063
+
1064
+ expect ( consoleText ) . toContain ( "CICS Regions in Scope '12345678' of CICSplex '12345678':" ) ;
1065
+ expect ( consoleText ) . toContain ( "Applid: ABCDEFG jobname: MYCICS jobid: JOB12345" ) ;
1066
+ expect ( consoleText ) . not . toContain ( "NODEJSAPP" ) ;
1067
+ expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1068
+ expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1069
+ expect ( listSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1070
+ expect ( createSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1071
+ expect ( shellSpy ) . toHaveBeenCalledTimes ( 0 ) ;
1072
+ expect ( membersSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1073
+ expect ( submitSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1074
+ expect ( existsSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1075
+ expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1076
+ expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1077
+ expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1078
+ } ) ;
1042
1079
it ( "should cope with a NODEJSAPP in the bundle with a CICS profile specified and --verbose" , async ( ) => {
1043
1080
zosmfProfile = { host : "wibble" , user : "user" } ;
1044
1081
sshProfile = { host : "wibble" , user : "user" } ;
@@ -1056,7 +1093,8 @@ describe("BundlePusher01", () => {
1056
1093
expect ( consoleText ) . toContain ( "WARNING: No .zosAttributes file found in the bundle directory, default values will be applied" ) ;
1057
1094
expect ( consoleText ) . toContain ( "Deploying bundle '12345678' to CICS" ) ;
1058
1095
expect ( consoleText ) . toContain ( "Deploy complete" ) ;
1059
- expect ( consoleText ) . toContain ( "Gathering Node.js diagnostics" ) ;
1096
+ expect ( consoleText ) . toContain ( "Gathering Scope information" ) ;
1097
+ expect ( consoleText ) . toContain ( "Querying Regions in Scope over CMCI" ) ;
1060
1098
expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1061
1099
expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1062
1100
expect ( listSpy ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -1075,6 +1113,22 @@ describe("BundlePusher01", () => {
1075
1113
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" } ;
1076
1114
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1077
1115
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2055I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP" } ] ) ;
1116
+ cmciSpy . mockImplementation ( ( cicsSession : any , regionData : cmci . IResourceParms ) => {
1117
+ if ( regionData . name === "CICSRegion" ) {
1118
+ return { response : {
1119
+ records : {
1120
+ cicsregion : {
1121
+ applid : "ABCDEFG" , jobid : "JOB12345" , jobname : "MYCICS"
1122
+ }
1123
+ }
1124
+ }
1125
+ } ;
1126
+ }
1127
+ else {
1128
+ return { } ;
1129
+ }
1130
+ } ) ;
1131
+
1078
1132
const parms = getCommonParmsForPushTests ( ) ;
1079
1133
parms . arguments . verbose = true ;
1080
1134
@@ -1087,7 +1141,12 @@ describe("BundlePusher01", () => {
1087
1141
expect ( consoleText ) . toContain ( "WARNING: No .zosAttributes file found in the bundle directory, default values will be applied" ) ;
1088
1142
expect ( consoleText ) . toContain ( "Deploying bundle '12345678' to CICS" ) ;
1089
1143
expect ( consoleText ) . toContain ( "Deploy ended with errors" ) ;
1090
- expect ( consoleText ) . toContain ( "Gathering Node.js diagnostics" ) ;
1144
+ expect ( consoleText ) . toContain ( "Gathering Scope information" ) ;
1145
+ expect ( consoleText ) . toContain ( "Querying Regions in Scope over CMCI" ) ;
1146
+ expect ( consoleText ) . toContain ( "CICS Regions in Scope '12345678' of CICSplex '12345678':" ) ;
1147
+ expect ( consoleText ) . toContain ( "Applid: ABCDEFG jobname: MYCICS jobid: JOB12345" ) ;
1148
+ expect ( consoleText ) . toContain ( "Querying NODEJSAPP resources over CMCI" ) ;
1149
+ expect ( consoleText ) . toContain ( "zowe cics get resource CICSNodejsapp --region-name 12345678 --criteria \"BUNDLE=12345678\" --cics-plex 12345678" ) ;
1091
1150
expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1092
1151
expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1093
1152
expect ( listSpy ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -1098,7 +1157,7 @@ describe("BundlePusher01", () => {
1098
1157
expect ( existsSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1099
1158
expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1100
1159
expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1101
- expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1160
+ expect ( cmciSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1102
1161
} ) ;
1103
1162
it ( "should tolerate a Node.js diagnostics generation failure - region" , async ( ) => {
1104
1163
zosmfProfile = { host : "wibble" , user : "user" } ;
@@ -1110,7 +1169,6 @@ describe("BundlePusher01", () => {
1110
1169
1111
1170
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , false , "PUSH operation completed." ) ;
1112
1171
1113
- expect ( consoleText ) . toContain ( "zowe cics get resource CICSNodejsapp --region-name 12345678 --criteria \"BUNDLE=12345678\" --cics-plex 12345678" ) ;
1114
1172
expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1115
1173
expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1116
1174
expect ( listSpy ) . toHaveBeenCalledTimes ( 1 ) ;
0 commit comments