From f39c458844188866d9c0cd7bbd59ce8f15b66cb7 Mon Sep 17 00:00:00 2001 From: "Mnushkin, Dmitry" Date: Mon, 4 Nov 2019 08:17:31 -0500 Subject: Add patch method add patch method to requests db client remove null values from junit mock matching Issue-ID: SO-2506 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I3d6c0b05943958a9e77557cbf643a90cf5bb556b --- .../java/org/onap/so/db/request/beans/InfraActiveRequests.java | 3 +++ .../main/java/org/onap/so/db/request/client/RequestsDbClient.java | 8 ++++++++ 2 files changed, 11 insertions(+) (limited to 'mso-api-handlers/mso-requests-db/src/main/java/org') diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java index 1f5fb8f77e..84eaf38da7 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java @@ -25,6 +25,8 @@ import javax.persistence.Entity; import javax.persistence.Table; import org.apache.commons.lang3.builder.ToStringBuilder; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; /** * InfraActiveRequests generated by hbm2java @@ -32,6 +34,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) @Entity @Table(name = "infra_active_requests") +@JsonInclude(Include.NON_NULL) public class InfraActiveRequests extends InfraRequests { private static final long serialVersionUID = -6818265918910035170L; diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java index 99c1d1ea72..e17ba54a7c 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java @@ -343,6 +343,14 @@ public class RequestsDbClient { restTemplate.put(uri, entity); } + public void patchInfraActiveRequests(InfraActiveRequests request) { + HttpHeaders headers = getHttpHeaders(); + URI uri = getUri(infraActiveRequestURI + request.getRequestId()); + HttpEntity entity = new HttpEntity<>(request, headers); + restTemplate.exchange(uri, HttpMethod.PATCH, new HttpEntity(request, headers), + String.class); + } + protected URI getUri(String uri) { return URI.create(uri); } -- cgit 1.2.3-korg