diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/api/revision/APIRevisionTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/api/revision/APIRevisionTestCase.java index d090ef149d..ff80965e22 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/api/revision/APIRevisionTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/api/revision/APIRevisionTestCase.java @@ -70,6 +70,7 @@ public class APIRevisionTestCase extends APIMIntegrationBaseTest { private final String API_END_POINT_METHOD = "/customers/123"; private final String INVALID_API_UUID = "2C0q51h4-621g-3163-7eip-as246v8x681m"; private final String INVALID_REVISION_UUID = "4bm28320-l75v-3895-70ks-025294jd85a5"; + private final String INVALID_VHOST = "ws.wso2.com"; private String API_TRACES_LOCATION = "/_system/governance/apimgt/applicationdata/apis/"; private String apiEndPointUrl; private String apiId; @@ -241,6 +242,23 @@ public void testDeployAPIRevisionWithInvalidDeploymentInfo() throws Exception { "Unable to deploy API Revisions:" + apiRevisionsDeployResponse.getData()); } + @Test(groups = {"wso2.am"}, description = "Test deploying API Revision to gateway environments " + + "with invalid vhost", dependsOnMethods = "testDeployAPIRevisionWithInvalidDeploymentInfo", enabled = false) + public void testDeployAPIRevisionWithInvalidVhost() throws Exception { + + List apiRevisionDeployRequestList = new ArrayList<>(); + APIRevisionDeployUndeployRequest apiRevisionDeployRequest = new APIRevisionDeployUndeployRequest(); + apiRevisionDeployRequest.setName(Constants.GATEWAY_ENVIRONMENT); + apiRevisionDeployRequest.setVhost(INVALID_VHOST); + apiRevisionDeployRequest.setDisplayOnDevportal(true); + apiRevisionDeployRequestList.add(apiRevisionDeployRequest); + HttpResponse apiRevisionsDeployResponse = restAPIPublisher.deployAPIRevision(apiId, revisionUUID, + apiRevisionDeployRequestList, "API"); + assertEquals(apiRevisionsDeployResponse.getResponseCode(), HTTP_RESPONSE_CODE_BAD_REQUEST, + "Invalid response code for deploying API Revision with invalid Vhost:" + + apiRevisionsDeployResponse.getData()); + } + @Test(groups = {"wso2.am"}, description = "Test UnDeploying API Revision to gateway environments", dependsOnMethods = "testDeployAPIRevisionWithInvalidDeploymentInfo") public void testUnDeployAPIRevision() throws Exception { diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/AM/configFiles/applicationConsentPage/deployment.toml b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/AM/configFiles/applicationConsentPage/deployment.toml index adea060422..d98794ccd0 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/AM/configFiles/applicationConsentPage/deployment.toml +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/AM/configFiles/applicationConsentPage/deployment.toml @@ -46,7 +46,7 @@ service_url = "https://localhost:${mgt.transport.https.port}/services/" username = "admin" password = "admin" http_endpoint = "ws://wsserverhost:9797" -https_endpoint = "https://serverhost:9898" +https_endpoint = "https://localhost:9898" [[apim.gateway.environment]] name = "devportalEnv"