Skip to content

Commit

Permalink
Merge pull request #13078 from shnrndk/validation_vhost_test
Browse files Browse the repository at this point in the history
Test validation on vhost
  • Loading branch information
npamudika authored Jun 14, 2023
2 parents cb709c3 + b2f05d9 commit 1081695
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<APIRevisionDeployUndeployRequest> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1081695

Please sign in to comment.