diff --git a/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/utils/bean/APIRequest.java b/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/utils/bean/APIRequest.java
index 74d1a78142..51e694f404 100644
--- a/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/utils/bean/APIRequest.java
+++ b/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/utils/bean/APIRequest.java
@@ -435,6 +435,10 @@ public String getName() {
return name;
}
+ public void setName(String name) {
+ this.name = name;
+ }
+
public org.json.simple.JSONObject getEndpointConfig() {
return endpoint;
}
diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/publisher/APIM520UpdateAnAPIThroughThePublisherRestAPITestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/publisher/APIM520UpdateAnAPIThroughThePublisherRestAPITestCase.java
index dd0ec20573..cd8417f364 100644
--- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/publisher/APIM520UpdateAnAPIThroughThePublisherRestAPITestCase.java
+++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/publisher/APIM520UpdateAnAPIThroughThePublisherRestAPITestCase.java
@@ -47,6 +47,8 @@
public class APIM520UpdateAnAPIThroughThePublisherRestAPITestCase extends APIMIntegrationBaseTest {
private final String apiNameTest = "APIM520PublisherTest";
+ private final String apiUpdatedNameTest = "PublisherTestRenameAPI";
+ private final String updatedApiName = "PublisherNewTestRenameAPI";
private final String apiVersion = "1.0.0";
private APIPublisherRestClient apiPublisher;
private String apiProviderName;
@@ -138,6 +140,46 @@ public void testUpdateAnAPIThroughThePublisherRest() throws Exception {
}
+ @Test(groups = {"wso2.am"}, description = "Update an API Through the Publisher Rest API after renaming the API")
+ public void testUpdateAnAPIThroughThePublisherRestAfterRename() throws Exception {
+
+ String apiContextTest = "apiRenamingContext";
+ String apiDescription = "This is Test API Created by API Manager Integration Test for API Renaming";
+
+ //Create an API
+ APIRequest apiCreationRequestBean = new APIRequest(apiUpdatedNameTest, apiContextTest,
+ new URL(apiProductionEndPointUrl));
+ apiCreationRequestBean.setVersion(apiVersion);
+ apiCreationRequestBean.setProvider(apiProviderName);
+ apiCreationRequestBean.setDescription(apiDescription);
+ apiCreationRequestBean.setTiersCollection("Gold,Bronze");
+
+ HttpResponse apiCreationResponse = restAPIPublisher.addAPI(apiCreationRequestBean);
+ id = apiCreationResponse.getData();
+ assertEquals(apiCreationResponse.getResponseCode(), Response.Status.CREATED.getStatusCode(),
+ "Response Code miss matched when creating the API");
+
+ //Check availability of the API in publisher
+ HttpResponse apiResponsePublisher = restAPIPublisher.getAPI(id);
+ assertTrue(apiResponsePublisher.getData().contains(apiUpdatedNameTest),
+ apiUpdatedNameTest + " is not visible in publisher");
+
+ //Update API with name change
+ apiCreationRequestBean.setName(updatedApiName);
+
+ HttpResponse apiUpdateResponse = restAPIPublisher.updateAPI(apiCreationRequestBean, id);
+ assertEquals(apiUpdateResponse.getResponseCode(), Response.Status.OK.getStatusCode(),
+ "Response Code miss matched when creating the API");
+ waitForAPIDeployment();
+
+ // Check whether API is updated from the above request. This API Name should not get updated
+ // when not in a cloud scenario
+ HttpResponse apiUpdateResponsePublisher = restAPIPublisher.getAPI(id);
+
+ assertTrue(apiUpdateResponsePublisher.getData().contains(apiUpdatedNameTest),
+ apiUpdatedNameTest + " is updated");
+ }
+
@AfterClass(alwaysRun = true)
public void destroyAPIs() throws Exception {
restAPIPublisher.deleteAPI(id);
diff --git a/pom.xml b/pom.xml
index 00397f06f4..d65ec8751b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1340,7 +1340,7 @@
1.8
3.0-FINAL
1.0.0.M8-wso2v1
- 2.1.7-wso2v227
+ 3.0.1
1.0.2
1.6.1-wso2v63
1.2.11-wso2v16