summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-service/src')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java15
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperations.java4
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy10
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operations/DmiDataOperationsSpec.groovy2
4 files changed, 3 insertions, 28 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java
index 62eca9451a..9f3df6b9a5 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java
@@ -47,21 +47,6 @@ public class DmiRestClient {
}
/**
- * Sends a PUT operation to DMI with JSON payload.
- *
- * @param dmiResourceUrl the DMI resource URL
- * @param jsonData the JSON payload
- * @param headers the HTTP headers
- * @return response entity of type Object
- */
- public ResponseEntity<Object> putOperationWithJsonData(final String dmiResourceUrl,
- final String jsonData, final HttpHeaders headers) {
- //TODO Toine Siebelink, should we use POST operation below instead (and return a String-Entity!)
- final var httpEntity = new HttpEntity<>(jsonData, configureHttpHeaders(headers));
- return restTemplate.exchange(dmiResourceUrl, HttpMethod.PUT, httpEntity, Object.class);
- }
-
- /**
* Sends POST operation to DMI with json body containing module references.
* @param dmiResourceUrl dmi resource url
* @param jsonData json data body
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperations.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperations.java
index b8336455c2..eccb9a0987 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperations.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperations.java
@@ -62,7 +62,7 @@ public class DmiDataOperations extends DmiOperations {
* @param dataStore data store enum
* @return {@code ResponseEntity} response entity
*/
- public ResponseEntity<Object> getResourceDataFromDmi(final String cmHandle,
+ public ResponseEntity<String> getResourceDataFromDmi(final String cmHandle,
final String resourceId,
final String optionsParamInQuery,
final String acceptParamInHeader,
@@ -79,7 +79,7 @@ public class DmiDataOperations extends DmiOperations {
persistenceCmHandle.resolveDmiServiceName(DATA), cmHandle, resourceId,
optionsParamInQuery, dataStore);
final var httpHeaders = prepareHeader(acceptParamInHeader);
- return dmiRestClient.putOperationWithJsonData(dmiResourceDataUrl, jsonBody, httpHeaders);
+ return dmiRestClient.postOperationWithJsonData(dmiResourceDataUrl, jsonBody, httpHeaders);
}
/**
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy
index a1779a7576..8c46178ddd 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy
@@ -43,16 +43,6 @@ class DmiRestClientSpec extends Specification {
DmiRestClient objectUnderTest
def resourceUrl = 'some url'
- def 'DMI PUT operation.'() {
- given: 'the rest template returns a valid response entity'
- def mockResponseEntity = Mock(ResponseEntity)
- mockRestTemplate.exchange(resourceUrl, HttpMethod.PUT, _ as HttpEntity, Object.class) >> mockResponseEntity
- when: 'PUT operation is invoked'
- def result = objectUnderTest.putOperationWithJsonData(resourceUrl, 'json-data', new HttpHeaders())
- then: 'the output of the method is equal to the output from the test template'
- result == mockResponseEntity
- }
-
def 'DMI POST operation'() {
given: 'the rest template returns a valid response entity'
def mockResponseEntity = Mock(ResponseEntity)
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operations/DmiDataOperationsSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operations/DmiDataOperationsSpec.groovy
index 674a442383..b9704b1ea0 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operations/DmiDataOperationsSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operations/DmiDataOperationsSpec.groovy
@@ -45,7 +45,7 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec {
mockPersistenceCmHandleRetrieval(additionalProperties)
and: 'a positive response from dmi service when it is called with the expected parameters'
def responseFromDmi = new ResponseEntity<Object>(HttpStatus.OK)
- mockDmiRestClient.putOperationWithJsonData(
+ mockDmiRestClient.postOperationWithJsonData(
"${dmiServiceName}/dmi/v1/ch/${cmHandleId}/data/ds/ncmp-datastore:${expectedDatastoreInUrl}?resourceIdentifier=${resourceIdentifier}${expectedOptionsInUrl}",
expectedJson, [Accept:['sample accept header']]) >> responseFromDmi
when: 'get resource data is invoked'