@@ -31,24 +31,40 @@ public void run(@Optional @CitrusResource TestContext context) throws IOExceptio
3131 variable ("apiNumber" , RandomNumberFunction .getRandomNumber (3 , true ));
3232 variable ("apiPath" , "/vhost-test-${apiNumber}" );
3333 variable ("apiName" , "VHost Test ${apiNumber}" );
34-
35- echo ("####### Importing API: '${apiName}' on path: '${apiPath}' with following settings: #######" );
36- createVariable ("status" , "published " );
34+
35+ echo ("####### Importing unpublised API: '${apiName}' on path: '${apiPath}' with following settings: #######" );
36+ createVariable ("status" , "unpublished " );
3737 createVariable ("vhost" , "api123.customer.com" );
3838 createVariable (ImportTestAction .API_DEFINITION , "/com/axway/apim/test/files/security/petstore.json" );
3939 createVariable (ImportTestAction .API_CONFIG , "/com/axway/apim/test/files/vhost/1_vhost-config.json" );
4040 createVariable ("expectedReturnCode" , "0" );
4141 swaggerImport .doExecute (context );
42-
43- echo ("####### Validate API: '${apiName}' on path: '${apiPath}' has correct settings #######" );
42+
43+ echo ("####### Validate unpublished API: '${apiName}' on path: '${apiPath}' is configured with V-Host #######" );
4444 http (builder -> builder .client ("apiManager" ).send ().get ("/proxies" ).header ("Content-Type" , "application/json" ));
4545
4646 http (builder -> builder .client ("apiManager" ).receive ().response (HttpStatus .OK ).messageType (MessageType .JSON )
4747 .validate ("$.[?(@.path=='${apiPath}')].name" , "${apiName}" )
48- .validate ("$.[?(@.path=='${apiPath}')].state" , "published " )
48+ .validate ("$.[?(@.path=='${apiPath}')].state" , "unpublished " )
4949 .validate ("$.[?(@.path=='${apiPath}')].vhost" , "api123.customer.com" )
5050 .extractFromPayload ("$.[?(@.path=='${apiPath}')].id" , "apiId" ));
5151
52+ echo ("####### Importing API: '${apiName}' on path: '${apiPath}' with following settings: #######" );
53+ createVariable ("status" , "published" );
54+ createVariable ("vhost" , "api123.customer.com" );
55+ createVariable (ImportTestAction .API_DEFINITION , "/com/axway/apim/test/files/security/petstore.json" );
56+ createVariable (ImportTestAction .API_CONFIG , "/com/axway/apim/test/files/vhost/1_vhost-config.json" );
57+ createVariable ("expectedReturnCode" , "0" );
58+ swaggerImport .doExecute (context );
59+
60+ echo ("####### Validate published API: '${apiName}' on path: '${apiPath}' has V-Host configured #######" );
61+ http (builder -> builder .client ("apiManager" ).send ().get ("/proxies/${apiId}" ).header ("Content-Type" , "application/json" ));
62+
63+ http (builder -> builder .client ("apiManager" ).receive ().response (HttpStatus .OK ).messageType (MessageType .JSON )
64+ .validate ("$.[?(@.id=='${apiId}')].name" , "${apiName}" )
65+ .validate ("$.[?(@.id=='${apiId}')].state" , "published" )
66+ .validate ("$.[?(@.id=='${apiId}')].vhost" , "api123.customer.com" ));
67+
5268 echo ("####### Importing API: '${apiName}' on path: '${apiPath}' with following settings: #######" );
5369 createVariable ("status" , "unpublished" );
5470 createVariable ("vhost" , "api123.customer.com" );
0 commit comments