@@ -105,6 +105,13 @@ public void run(@Optional @CitrusResource TestContext context) throws IOExceptio
105105
106106 echo ("####### API has been created with ID: '${apiId}' #######" );
107107
108+ echo ("####### Validate API with ID: '${apiId}' is granted to Org2: ${orgName2} (${orgId2}) #######" );
109+ http (builder -> builder .client ("apiManager" ).send ().get ("/organizations/${orgId2}/apis" ).header ("Content-Type" , "application/json" ));
110+
111+ http (builder -> builder .client ("apiManager" ).receive ().response (HttpStatus .OK ).messageType (MessageType .JSON )
112+ .validate ("$.[?(@.apiId=='${apiId}')].state" , "approved" )
113+ .validate ("$.[?(@.apiId=='${apiId}')].enabled" , "true" ));
114+
108115 echo ("####### Validate created application 3 has an active subscription to the API (Based on the name) #######" );
109116 http (builder -> builder .client ("apiManager" ).send ().get ("/applications/${consumingTestApp3Id}/apis" ).header ("Content-Type" , "application/json" ));
110117
@@ -140,7 +147,7 @@ public void run(@Optional @CitrusResource TestContext context) throws IOExceptio
140147 .validate ("$.[?(@.path=='${apiPath}')].name" , "${apiName}" )
141148 .validate ("$.[?(@.path=='${apiPath}')].id" , "${apiId}" )); // Must be the same API-ID as before!
142149
143- echo ("####### Changin FE-API Settings only for: '${apiName}' - Mode: Unpublish/Publish and make sure subscriptions stay #######" );
150+ echo ("####### Changing FE-API Settings only for: '${apiName}' - Mode: Unpublish/Publish and make sure subscriptions stay #######" );
144151 createVariable (ImportTestAction .API_DEFINITION , "/com/axway/apim/test/files/basic/petstore.json" );
145152 createVariable (ImportTestAction .API_CONFIG , "/com/axway/apim/test/files/applications/1_api-with-1-org-some-apps.json" );
146153 createVariable ("state" , "published" );
@@ -156,6 +163,13 @@ public void run(@Optional @CitrusResource TestContext context) throws IOExceptio
156163 .validate ("$.[?(@.id=='${apiId}')].name" , "${apiName}" )
157164 .validate ("$.[?(@.id=='${apiId}')].state" , "published" ));
158165
166+ echo ("####### Validate Re-Puslished API with ID: '${apiId}' is still granted to Org2: ${orgName2} (${orgId2}) #######" );
167+ http (builder -> builder .client ("apiManager" ).send ().get ("/organizations/${orgId2}/apis" ).header ("Content-Type" , "application/json" ));
168+
169+ http (builder -> builder .client ("apiManager" ).receive ().response (HttpStatus .OK ).messageType (MessageType .JSON )
170+ .validate ("$.[?(@.apiId=='${apiId}')].state" , "approved" )
171+ .validate ("$.[?(@.apiId=='${apiId}')].enabled" , "true" ));
172+
159173 echo ("####### Validate Application 3 still has an active subscription to the API (Based on the name) #######" );
160174 http (builder -> builder .client ("apiManager" ).send ().get ("/applications/${consumingTestApp3Id}/apis" ).header ("Content-Type" , "application/json" ));
161175
@@ -239,23 +253,24 @@ public void run(@Optional @CitrusResource TestContext context) throws IOExceptio
239253
240254 echo ("####### API has been RE-CREATED with ID: '${newApiId}' #######" );
241255
242- echo ("####### Validate created application 3 STILL has an active subscription to the API (Based on the name ) #######" );
243- http (builder -> builder .client ("apiManager" ).send ().get ("/applications/${consumingTestApp3Id }/apis" ).header ("Content-Type" , "application/json" ));
256+ echo ("####### Validate Application 1 STILL has an active subscription to the API (based on the API-Key ) #######" );
257+ http (builder -> builder .client ("apiManager" ).send ().get ("/applications/${consumingTestApp1Id }/apis" ).header ("Content-Type" , "application/json" ));
244258
245259 http (builder -> builder .client ("apiManager" ).receive ().response (HttpStatus .OK ).messageType (MessageType .JSON )
246260 .validate ("$.*.apiId" , "${newApiId}" ));
247261
248- echo ("####### Validate Application 1 STILL has an active subscription to the API (based on the API-Key) #######" );
249- http (builder -> builder .client ("apiManager" ).send ().get ("/applications/${consumingTestApp1Id}/apis" ).header ("Content-Type" , "application/json" ));
262+ // As the apps 3 & 2 now belong to a different organization the org-admin cannot see / re-subscribe them
263+ /*
264+ echo("####### Validate created application 3 STILL has an active subscription to the API (Based on the name) #######");
265+ http(builder -> builder.client("apiManager").send().get("/applications/${consumingTestApp3Id}/apis").header("Content-Type", "application/json"));
250266
251267 http(builder -> builder.client("apiManager").receive().response(HttpStatus.OK).messageType(MessageType.JSON)
252268 .validate("$.*.apiId", "${newApiId}"));
253-
254- echo ("####### Validate Application 2 STILL has an active subscription to the API (based on the Ext-Client-Id) #######" );
269+ echo("####### Validate Application 2 STILL has an active subscription to the API (based on the Ext-Client-Id) #######");
255270 http(builder -> builder.client("apiManager").send().get("/applications/${consumingTestApp2Id}/apis")
256271 .header("Content-Type", "application/json"));
257272
258273 http(builder -> builder.client("apiManager").receive().response(HttpStatus.OK).messageType(MessageType.JSON)
259- .validate ("$.*.apiId" , "${newApiId}" ));
274+ .validate("$.*.apiId", "${newApiId}")); */
260275 }
261276}
0 commit comments