summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest
diff options
context:
space:
mode:
authorSourabh Sourabh <sourabh.sourabh@est.tech>2023-06-23 10:15:25 +0000
committerGerrit Code Review <gerrit@onap.org>2023-06-23 10:15:25 +0000
commit0aec08e870c767e345db5c2ac2dc8550dea88cb5 (patch)
tree1d707522470157a6b123a33afdc59a989a2f87bc /cps-ncmp-rest
parentddeaf09e830c03ddda1e153131c29e1579e4b767 (diff)
parent977f7c395cee52cdecd0b01cb0412ebfeb9db048 (diff)
Merge "NCMP : Replacing the word 'Batch' as 'DataOperation'."
Diffstat (limited to 'cps-ncmp-rest')
-rw-r--r--cps-ncmp-rest/docs/openapi/components.yaml12
-rwxr-xr-xcps-ncmp-rest/docs/openapi/ncmp.yml8
-rwxr-xr-xcps-ncmp-rest/docs/openapi/openapi.yml2
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java14
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java42
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java12
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java10
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/DataOperationRequestMapper.java (renamed from cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/ResourceDataBatchRequestMapper.java)16
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy75
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy6
10 files changed, 99 insertions, 98 deletions
diff --git a/cps-ncmp-rest/docs/openapi/components.yaml b/cps-ncmp-rest/docs/openapi/components.yaml
index 2781f572f2..d45b8da288 100644
--- a/cps-ncmp-rest/docs/openapi/components.yaml
+++ b/cps-ncmp-rest/docs/openapi/components.yaml
@@ -285,18 +285,18 @@ components:
properties:
state:
$ref: '#/components/schemas/CmHandleCompositeState'
- # Batch Request Schemas
- ResourceDataBatchRequest:
+ # Data Operation Request Schemas
+ DataOperationRequest:
type: object
- title: get resource data for given array of operations
+ title: execute data operation for given array of operations
properties:
operations:
type: array
items:
type: object
- $ref: '#/components/schemas/BatchOperationDefinition'
- description: contains batch request details
- BatchOperationDefinition:
+ $ref: '#/components/schemas/DataOperationDefinition'
+ description: contains group of data operation requests
+ DataOperationDefinition:
required:
- operation
- datastore
diff --git a/cps-ncmp-rest/docs/openapi/ncmp.yml b/cps-ncmp-rest/docs/openapi/ncmp.yml
index 957a3b8735..95ca6ccdc7 100755
--- a/cps-ncmp-rest/docs/openapi/ncmp.yml
+++ b/cps-ncmp-rest/docs/openapi/ncmp.yml
@@ -194,13 +194,13 @@ resourceDataForCmHandle:
502:
$ref: 'components.yaml#/components/responses/BadGateway'
-getResourceDataForCmHandleBatch:
+dataOperationForCmHandle:
post:
tags:
- network-cm-proxy
- summary: Get resource data for batch of cm handle ids
+ summary: Execute a data operation for group of cm handle ids
description: This request will be handled asynchronously using messaging to the supplied topic. The rest response will be an acknowledge with a requestId to identify the relevant messages.
- operationId: getResourceDataForCmHandleBatch
+ operationId: executeDataOperationForCmHandles
parameters:
- $ref: 'components.yaml#/components/parameters/requiredTopicParamInQuery'
requestBody:
@@ -208,7 +208,7 @@ getResourceDataForCmHandleBatch:
content:
application/json:
schema:
- $ref: 'components.yaml#/components/schemas/ResourceDataBatchRequest'
+ $ref: 'components.yaml#/components/schemas/DataOperationRequest'
responses:
200:
description: OK
diff --git a/cps-ncmp-rest/docs/openapi/openapi.yml b/cps-ncmp-rest/docs/openapi/openapi.yml
index b63b568234..84d86fffbb 100755
--- a/cps-ncmp-rest/docs/openapi/openapi.yml
+++ b/cps-ncmp-rest/docs/openapi/openapi.yml
@@ -35,7 +35,7 @@ paths:
$ref: 'ncmp.yml#/resourceDataForCmHandle'
/v1/data:
- $ref: 'ncmp.yml#/getResourceDataForCmHandleBatch'
+ $ref: 'ncmp.yml#/dataOperationForCmHandle'
/v1/ch/{cm-handle}/data/ds/{datastore-name}/query:
$ref: 'ncmp.yml#/queryResourceDataForCmHandle'
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
index 1b78fa0343..3c22b81ef7 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
@@ -46,10 +46,10 @@ import org.onap.cps.ncmp.rest.controller.handlers.NcmpCachedResourceRequestHandl
import org.onap.cps.ncmp.rest.controller.handlers.NcmpDatastoreRequestHandler;
import org.onap.cps.ncmp.rest.controller.handlers.NcmpPassthroughResourceRequestHandler;
import org.onap.cps.ncmp.rest.mapper.CmHandleStateMapper;
-import org.onap.cps.ncmp.rest.mapper.ResourceDataBatchRequestMapper;
+import org.onap.cps.ncmp.rest.mapper.DataOperationRequestMapper;
import org.onap.cps.ncmp.rest.model.CmHandlePublicProperties;
import org.onap.cps.ncmp.rest.model.CmHandleQueryParameters;
-import org.onap.cps.ncmp.rest.model.ResourceDataBatchRequest;
+import org.onap.cps.ncmp.rest.model.DataOperationRequest;
import org.onap.cps.ncmp.rest.model.RestModuleDefinition;
import org.onap.cps.ncmp.rest.model.RestModuleReference;
import org.onap.cps.ncmp.rest.model.RestOutputCmHandle;
@@ -76,7 +76,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
private final CmHandleStateMapper cmHandleStateMapper;
private final NcmpCachedResourceRequestHandler ncmpCachedResourceRequestHandler;
private final NcmpPassthroughResourceRequestHandler ncmpPassthroughResourceRequestHandler;
- private final ResourceDataBatchRequestMapper resourceDataBatchRequestMapper;
+ private final DataOperationRequestMapper dataOperationRequestMapper;
/**
* Get resource data from datastore.
@@ -105,11 +105,11 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
}
@Override
- public ResponseEntity<Object> getResourceDataForCmHandleBatch(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest) {
+ public ResponseEntity<Object> executeDataOperationForCmHandles(final String topicParamInQuery,
+ final DataOperationRequest
+ dataOperationRequest) {
return ncmpPassthroughResourceRequestHandler.executeRequest(topicParamInQuery,
- resourceDataBatchRequestMapper.toResourceDataBatchRequest(resourceDataBatchRequest));
+ dataOperationRequestMapper.toDataOperationRequest(dataOperationRequest));
}
/**
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java
index a8ca13a752..101be45d37 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java
@@ -31,7 +31,7 @@ import lombok.extern.slf4j.Slf4j;
import org.onap.cps.ncmp.api.impl.exception.InvalidDatastoreException;
import org.onap.cps.ncmp.api.impl.operations.DatastoreType;
import org.onap.cps.ncmp.api.impl.operations.OperationType;
-import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest;
+import org.onap.cps.ncmp.api.models.DataOperationRequest;
import org.onap.cps.ncmp.rest.exceptions.OperationNotSupportedException;
import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor;
import org.onap.cps.ncmp.rest.util.TopicValidator;
@@ -105,21 +105,21 @@ public class NcmpDatastoreRequestHandler implements TaskManagementDefaultHandler
}
/**
- * Executes asynchronous request for batch of cm handles to resource data.
+ * Executes asynchronous request for group of cm handles to resource data.
*
* @param topicParamInQuery the topic param in query
- * @param resourceDataBatchRequest batch request details for resource data
+ * @param dataOperationRequest data operation request details for resource data
* @return the response entity
*/
public ResponseEntity<Object> executeRequest(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest) {
- validateBatchRequest(topicParamInQuery, resourceDataBatchRequest);
+ final DataOperationRequest
+ dataOperationRequest) {
+ validateDataOperationRequest(topicParamInQuery, dataOperationRequest);
if (!notificationFeatureEnabled) {
return ResponseEntity.ok(Map.of("status",
"Asynchronous request is unavailable as notification feature is currently disabled."));
}
- return getRequestIdAndSendBatchRequestToDmiService(topicParamInQuery, resourceDataBatchRequest);
+ return getRequestIdAndSendDataOperationRequestToDmiService(topicParamInQuery, dataOperationRequest);
}
protected ResponseEntity<Object> executeTaskAsync(final String topicParamInQuery,
@@ -152,27 +152,27 @@ public class NcmpDatastoreRequestHandler implements TaskManagementDefaultHandler
return executeTaskAsync(topicParamInQuery, requestId, taskSupplier);
}
- private ResponseEntity<Object> getRequestIdAndSendBatchRequestToDmiService(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest) {
+ private ResponseEntity<Object> getRequestIdAndSendDataOperationRequestToDmiService(final String topicParamInQuery,
+ final DataOperationRequest
+ dataOperationRequest) {
final String requestId = UUID.randomUUID().toString();
- sendResourceDataBatchRequestAsynchronously(topicParamInQuery, resourceDataBatchRequest, requestId);
+ sendDataOperationRequestAsynchronously(topicParamInQuery, dataOperationRequest, requestId);
return ResponseEntity.ok(Map.of("requestId", requestId));
}
- private void validateBatchRequest(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest) {
+ private void validateDataOperationRequest(final String topicParamInQuery,
+ final DataOperationRequest
+ dataOperationRequest) {
TopicValidator.validateTopicName(topicParamInQuery);
- resourceDataBatchRequest.getBatchOperationDefinitions().forEach(batchOperationDetail -> {
- if (OperationType.fromOperationName(batchOperationDetail.getOperation()) != READ) {
+ dataOperationRequest.getDataOperationDefinitions().forEach(dataOperationDetail -> {
+ if (OperationType.fromOperationName(dataOperationDetail.getOperation()) != READ) {
throw new OperationNotSupportedException(
- batchOperationDetail.getOperation() + " operation not yet supported for target ids :"
- + batchOperationDetail.getCmHandleIds());
- } else if (DatastoreType.fromDatastoreName(batchOperationDetail.getDatastore()) == OPERATIONAL) {
- throw new InvalidDatastoreException(batchOperationDetail.getDatastore()
+ dataOperationDetail.getOperation() + " operation not yet supported for target ids :"
+ + dataOperationDetail.getCmHandleIds());
+ } else if (DatastoreType.fromDatastoreName(dataOperationDetail.getDatastore()) == OPERATIONAL) {
+ throw new InvalidDatastoreException(dataOperationDetail.getDatastore()
+ " datastore is not supported for target ids : "
- + batchOperationDetail.getCmHandleIds());
+ + dataOperationDetail.getCmHandleIds());
}
});
}
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java
index 5c35818a3a..0e49c6df13 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java
@@ -22,7 +22,7 @@ package org.onap.cps.ncmp.rest.controller.handlers;
import java.util.function.Supplier;
import org.onap.cps.ncmp.api.NetworkCmProxyDataService;
-import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest;
+import org.onap.cps.ncmp.api.models.DataOperationRequest;
import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@@ -59,11 +59,11 @@ public class NcmpPassthroughResourceRequestHandler extends NcmpDatastoreRequestH
@Async
@Override
- public void sendResourceDataBatchRequestAsynchronously(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest,
- final String requestId) {
- networkCmProxyDataService.requestResourceDataForCmHandleBatch(topicParamInQuery, resourceDataBatchRequest,
+ public void sendDataOperationRequestAsynchronously(final String topicParamInQuery,
+ final DataOperationRequest
+ dataOperationRequest,
+ final String requestId) {
+ networkCmProxyDataService.executeDataOperationForCmHandles(topicParamInQuery, dataOperationRequest,
requestId);
}
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java
index 937935bec4..b2520b1609 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java
@@ -21,7 +21,7 @@
package org.onap.cps.ncmp.rest.controller.handlers;
import java.util.function.Supplier;
-import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest;
+import org.onap.cps.ncmp.api.models.DataOperationRequest;
import org.onap.cps.spi.FetchDescendantsOption;
public interface TaskManagementDefaultHandler {
@@ -46,10 +46,10 @@ public interface TaskManagementDefaultHandler {
return NO_OBJECT_SUPPLIER;
}
- default void sendResourceDataBatchRequestAsynchronously(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest,
- final String requestId) {
+ default void sendDataOperationRequestAsynchronously(final String topicParamInQuery,
+ final DataOperationRequest
+ dataOperationRequest,
+ final String requestId) {
}
static FetchDescendantsOption getFetchDescendantsOption(final boolean includeDescendants) {
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/ResourceDataBatchRequestMapper.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/DataOperationRequestMapper.java
index d045e31610..51ee8ca174 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/ResourceDataBatchRequestMapper.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/DataOperationRequestMapper.java
@@ -24,18 +24,18 @@ import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
-import org.onap.cps.ncmp.api.models.BatchOperationDefinition;
-import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest;
+import org.onap.cps.ncmp.api.models.DataOperationDefinition;
+import org.onap.cps.ncmp.api.models.DataOperationRequest;
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.SET_TO_DEFAULT)
-public interface ResourceDataBatchRequestMapper {
+public interface DataOperationRequestMapper {
- @Mapping(source = "operations", target = "batchOperationDefinitions")
- ResourceDataBatchRequest toResourceDataBatchRequest(
- org.onap.cps.ncmp.rest.model.ResourceDataBatchRequest resourceDataBatchRequest);
+ @Mapping(source = "operations", target = "dataOperationDefinitions")
+ DataOperationRequest toDataOperationRequest(
+ org.onap.cps.ncmp.rest.model.DataOperationRequest dataOperationRequest);
@Mapping(source = "targetIds", target = "cmHandleIds")
- BatchOperationDefinition toBatchOperationDefinition(
- org.onap.cps.ncmp.rest.model.BatchOperationDefinition batchOperationDefinition);
+ DataOperationDefinition toDataOperationDefinition(
+ org.onap.cps.ncmp.rest.model.DataOperationDefinition dataOperationDefinition);
}
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
index 31e83aa7a1..4ee31e1ec5 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
@@ -32,14 +32,14 @@ import org.onap.cps.ncmp.api.inventory.CmHandleState
import org.onap.cps.ncmp.api.inventory.CompositeState
import org.onap.cps.ncmp.api.inventory.DataStoreSyncState
import org.onap.cps.ncmp.api.inventory.LockReasonCategory
-import org.onap.cps.ncmp.rest.model.BatchOperationDefinition
+import org.onap.cps.ncmp.rest.model.DataOperationRequest
+import org.onap.cps.ncmp.rest.model.DataOperationDefinition
import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle
import org.onap.cps.ncmp.rest.controller.handlers.NcmpCachedResourceRequestHandler
import org.onap.cps.ncmp.rest.controller.handlers.NcmpPassthroughResourceRequestHandler
import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor
import org.onap.cps.ncmp.rest.mapper.CmHandleStateMapper
-import org.onap.cps.ncmp.rest.mapper.ResourceDataBatchRequestMapper
-import org.onap.cps.ncmp.rest.model.ResourceDataBatchRequest
+import org.onap.cps.ncmp.rest.mapper.DataOperationRequestMapper
import org.onap.cps.ncmp.rest.util.DeprecationHelper
import org.onap.cps.spi.FetchDescendantsOption
import org.onap.cps.spi.model.ModuleDefinition
@@ -101,7 +101,7 @@ class NetworkCmProxyControllerSpec extends Specification {
CmHandleStateMapper cmHandleStateMapper = Mappers.getMapper(CmHandleStateMapper)
@SpringBean
- ResourceDataBatchRequestMapper resourceDataBatchRequestMapper = Mappers.getMapper(ResourceDataBatchRequestMapper)
+ DataOperationRequestMapper dataOperationRequestMapper = Mappers.getMapper(DataOperationRequestMapper)
@SpringBean
CpsNcmpTaskExecutor spiedCpsTaskExecutor = Spy()
@@ -205,18 +205,18 @@ class NetworkCmProxyControllerSpec extends Specification {
'invalid non-empty topic value in url' | 'passthrough-operational' | '&topic=1_5_*_#'
}
- def 'Get (async) batch resource data from dmi service.'() {
- given: 'batch resource data url'
+ def 'Execute (async) data operation to read data from dmi service.'() {
+ given: 'data operation url'
def getUrl = "$ncmpBasePathV1/data?topic=my-topic-name"
- def resourceDataBatchRequestJsonData = jsonObjectMapper.asJsonString(
- getResourceDataBatchRequest("read", datastore.datastoreName))
- def expectedDmiResourceDataBatchRequest
- = jsonObjectMapper.convertJsonString(resourceDataBatchRequestJsonData, org.onap.cps.ncmp.api.models.ResourceDataBatchRequest.class)
- when: 'post data resource request is performed'
+ def dataOperationRequestJsonData = jsonObjectMapper.asJsonString(
+ getDataOperationRequest("read", datastore.datastoreName))
+ def expectedDmiDataOperationRequest
+ = jsonObjectMapper.convertJsonString(dataOperationRequestJsonData, org.onap.cps.ncmp.api.models.DataOperationRequest.class)
+ when: 'post data operation request is performed'
def response = mvc.perform(
post(getUrl)
.contentType(MediaType.APPLICATION_JSON)
- .content(resourceDataBatchRequestJsonData)
+ .content(dataOperationRequestJsonData)
).andReturn().response
then: 'response status is Ok'
response.status == HttpStatus.OK.value()
@@ -225,21 +225,21 @@ class NetworkCmProxyControllerSpec extends Specification {
then: 'wait a little to allow execution of service method by task executor (on separate thread)'
Thread.sleep(100)
then: 'the service has been invoked with the correct parameters '
- 1 * mockNetworkCmProxyDataService.requestResourceDataForCmHandleBatch('my-topic-name', expectedDmiResourceDataBatchRequest, _)
+ 1 * mockNetworkCmProxyDataService.executeDataOperationForCmHandles('my-topic-name', expectedDmiDataOperationRequest, _)
where: 'the following data stores are used'
datastore << [PASSTHROUGH_RUNNING, PASSTHROUGH_OPERATIONAL]
}
- def 'Get batch resource data for #scenario from dmi service.'() {
- given: 'batch resource data url'
+ def 'Execute (async) data operation for #scenario from dmi service.'() {
+ given: 'data operation url'
def getUrl = "$ncmpBasePathV1/data?topic=my-topic-name"
- def resourceDataBatchRequestJsonData = jsonObjectMapper.asJsonString(
- getResourceDataBatchRequest(operation, datastore))
+ def dataOperationRequestJsonData = jsonObjectMapper.asJsonString(
+ getDataOperationRequest(operation, datastore))
when: 'post data resource request is performed'
def response = mvc.perform(
post(getUrl)
.contentType(MediaType.APPLICATION_JSON)
- .content(resourceDataBatchRequestJsonData)
+ .content(dataOperationRequestJsonData)
).andReturn().response
then: 'response status is BAD_REQUEST'
response.status == HttpStatus.BAD_REQUEST.value()
@@ -250,17 +250,17 @@ class NetworkCmProxyControllerSpec extends Specification {
'non-supported operation (passthrough-operational)' | PASSTHROUGH_OPERATIONAL.datastoreName | 'create'
}
- def 'Get batch resource data when notification feature is disabled for datastore: #datastore.'() {
- given: 'batch resource data url'
+ def 'Get data operation resource data when notification feature is disabled for datastore: #datastore.'() {
+ given: 'data operation url'
def getUrl = "$ncmpBasePathV1/data?topic=my-topic-name"
- def resourceDataBatchRequestJsonData = jsonObjectMapper.asJsonString(
- getResourceDataBatchRequest("read", datastore.datastoreName))
+ def dataOperationRequestJsonData = jsonObjectMapper.asJsonString(
+ getDataOperationRequest("read", datastore.datastoreName))
ncmpPassthroughResourceRequestHandler.notificationFeatureEnabled = false
when: 'post data resource request is performed'
def response = mvc.perform(
post(getUrl)
.contentType(MediaType.APPLICATION_JSON)
- .content(resourceDataBatchRequestJsonData)
+ .content(dataOperationRequestJsonData)
).andReturn().response
then: 'response status is Ok'
response.status == HttpStatus.OK.value()
@@ -686,22 +686,23 @@ class NetworkCmProxyControllerSpec extends Specification {
return assertContainsAll(response, expectedContent)
}
- def getResourceDataBatchRequest(operation, datastore) {
- def resourceDataBatchRequest = new ResourceDataBatchRequest()
- def batchOperationDefinitions = new ArrayList()
- batchOperationDefinitions.add(getBatchOperationDefinition(operation, datastore))
- resourceDataBatchRequest.addOperationsItem(batchOperationDefinitions)
+ def getDataOperationRequest(operation, datastore) {
+ def dataOperationRequest = new DataOperationRequest()
+ def dataOperationDefinitions = new ArrayList()
+ dataOperationDefinitions.add(getDataOperationDefinition(operation, datastore))
+ dataOperationRequest.addOperationsItem(dataOperationDefinitions)
+ return dataOperationRequest
}
- def getBatchOperationDefinition(operation, datastore) {
- def batchOperationDefinition = new BatchOperationDefinition()
- batchOperationDefinition.setOperation(operation)
- batchOperationDefinition.setOperationId("operational-12")
- batchOperationDefinition.setDatastore(datastore)
- batchOperationDefinition.setOptions("some option")
- batchOperationDefinition.setResourceIdentifier("some resource identifier")
- batchOperationDefinition.addTargetIdsItem("some-cm-handle")
- return batchOperationDefinition
+ def getDataOperationDefinition(operation, datastore) {
+ def dataOperationDefinition = new DataOperationDefinition()
+ dataOperationDefinition.setOperation(operation)
+ dataOperationDefinition.setOperationId("operational-12")
+ dataOperationDefinition.setDatastore(datastore)
+ dataOperationDefinition.setOptions("some option")
+ dataOperationDefinition.setResourceIdentifier("some resource identifier")
+ dataOperationDefinition.addTargetIdsItem("some-cm-handle")
+ return dataOperationDefinition
}
}
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
index a3afc5546f..6dc537c8d2 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 highstreet technologies GmbH
- * Modifications Copyright (C) 2021-2022 Nordix Foundation
+ * Modifications Copyright (C) 2021-2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ import org.onap.cps.ncmp.rest.controller.handlers.NcmpCachedResourceRequestHandl
import org.onap.cps.ncmp.rest.controller.handlers.NcmpPassthroughResourceRequestHandler
import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor
import org.onap.cps.ncmp.rest.mapper.CmHandleStateMapper
-import org.onap.cps.ncmp.rest.mapper.ResourceDataBatchRequestMapper
+import org.onap.cps.ncmp.rest.mapper.DataOperationRequestMapper
import org.onap.cps.ncmp.rest.util.DeprecationHelper
import org.onap.cps.spi.exceptions.AlreadyDefinedException
import org.onap.cps.spi.exceptions.AlreadyDefinedExceptionBatch
@@ -76,7 +76,7 @@ class NetworkCmProxyRestExceptionHandlerSpec extends Specification {
CmHandleStateMapper cmHandleStateMapper = Mappers.getMapper(CmHandleStateMapper)
@SpringBean
- ResourceDataBatchRequestMapper resourceDataBatchRequestMapper = Mappers.getMapper(ResourceDataBatchRequestMapper)
+ DataOperationRequestMapper dataOperationRequestMapper = Mappers.getMapper(DataOperationRequestMapper)
@SpringBean
CpsNcmpTaskExecutor stubbedCpsTaskExecutor = Stub()