aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-04-01 13:18:25 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-01 13:18:25 +0000
commit24117e55159518d2e3599fd7cf6705d476cfda81 (patch)
tree630eaf9c925a1e2f941ed36f5470488613e6089d
parent5460204e37d824d363ea4557f70f5ac366ba3dcc (diff)
parent3225f51c16843cc9de7a485ad37d37d9cbd4f973 (diff)
Merge "delete with payload does not work"
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java9
-rw-r--r--common/src/main/java/org/onap/so/client/RestRequest.java5
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java2
4 files changed, 14 insertions, 11 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java
index 1bcc464fa0..d362996948 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java
@@ -21,6 +21,7 @@
package org.onap.so.client.adapter.network;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
@@ -104,7 +105,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{
DeleteNetworkResponse mockResponse = new DeleteNetworkResponse();
mockResponse.setNetworkDeleted(true);
- stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
+ stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
@@ -119,7 +120,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{
DeleteNetworkError mockResponse = new DeleteNetworkError();
mockResponse.setMessage("Error in delete network");
- stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
+ stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
@@ -136,7 +137,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{
RollbackNetworkResponse mockResponse = new RollbackNetworkResponse();
mockResponse.setNetworkRolledBack(true);
- stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
+ stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
@@ -154,7 +155,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{
RollbackNetworkError mockResponse = new RollbackNetworkError();
mockResponse.setMessage("Error in rollback network");
- stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
+ stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java
index 3387920d40..cb3d91b82a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java
@@ -21,6 +21,7 @@
package org.onap.so.client.adapter.vnf;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
@@ -102,7 +103,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{
RollbackVfModuleResponse mockResponse = new RollbackVfModuleResponse();
mockResponse.setVfModuleRolledback(true);
stubFor(
- post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback"))
+ delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
@@ -120,7 +121,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{
VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
mockResponse.setMessage("Error in rollback Vf module");
stubFor(
- post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback"))
+ delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
@@ -134,7 +135,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{
DeleteVfModuleResponse mockResponse = new DeleteVfModuleResponse();
mockResponse.setVfModuleDeleted(true);
- stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
+ stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
@@ -149,7 +150,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{
VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse();
mockResponse.setMessage("Error in delete Vf module");
- stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
+ stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(mapper.writeValueAsString(mockResponse)).withStatus(500)));
diff --git a/common/src/main/java/org/onap/so/client/RestRequest.java b/common/src/main/java/org/onap/so/client/RestRequest.java
index 6f0d71cabf..3864f2e5cc 100644
--- a/common/src/main/java/org/onap/so/client/RestRequest.java
+++ b/common/src/main/java/org/onap/so/client/RestRequest.java
@@ -25,6 +25,7 @@ package org.onap.so.client;
import java.util.Optional;
import java.util.concurrent.Callable;
+import javax.ws.rs.HttpMethod;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
@@ -60,8 +61,8 @@ public class RestRequest implements Callable<Response> {
response = this.client.getBuilder().accept(this.client.getAccept()).delete();
} else {
- response = this.client.getBuilder().header("X-HTTP-Method-Override", "DELETE").accept(this.client.getAccept())
- .post(Entity.entity(entity, this.client.getContentType()));
+ response = this.client.getBuilder().accept(this.client.getAccept())
+ .build(HttpMethod.DELETE, Entity.entity(entity, this.client.getContentType())).invoke();
}
} else if ("PUT".equals(method)) {
response = this.client.getBuilder().accept(this.client.getAccept()).put(Entity.entity(entity, this.client.getContentType()));
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
index 174c76b1ef..c63d602bca 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
@@ -150,7 +150,7 @@ public class AAIResourcesClientTest {
AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
- wireMockRule.stubFor(post(
+ wireMockRule.stubFor(delete(
urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build() + "/relationship-list/relationship"))
.willReturn(
aResponse()