Skip to content

Commit 53e3f00

Browse files
author
Chris Wiechmann
committed
#22 Bugfix - Handling the V-Host as any other proxy property
as it's supported with version 7.6.2 >SP3
1 parent 03f4d9f commit 53e3f00

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

modules/api-import/src/test/java/com/axway/apim/test/vhost/VhostConfigTestIT.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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");

modules/apim-adapter/src/main/java/com/axway/apim/api/API.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public class API {
118118
@APIPropertyAnnotation(isBreaking = false, writableStates = {API.STATE_UNPUBLISHED})
119119
protected String version;
120120

121-
@APIPropertyAnnotation(isBreaking = true, copyProp = false, writableStates = {API.STATE_UNPUBLISHED, API.STATE_PUBLISHED, API.STATE_DEPRECATED})
121+
@APIPropertyAnnotation(isBreaking = true, writableStates = {API.STATE_UNPUBLISHED, API.STATE_PUBLISHED, API.STATE_DEPRECATED})
122122
protected String vhost = null;
123123

124124
@APIPropertyAnnotation(isBreaking = false, writableStates = {API.STATE_UNPUBLISHED})

0 commit comments

Comments
 (0)