From 08a47195fb3882e396b2dd01b01afa5da42255fb Mon Sep 17 00:00:00 2001 From: ToineSiebelink Date: Wed, 3 May 2023 18:21:46 +0100 Subject: Refactor datatrore handling in API requests - Fully parameterized datastore(name) - Improved controler testing to verify all parameter handling - Simplified service inject (alwasy using contructors instead of @AutoWire) - Added delay to fix isuse with intermitting failign test that tests invocation of a method that is executed on a separate thread Signed-off-by: ToineSiebelink Change-Id: Iba5d118d2484badee9c7c90ec7694882f6557d16 --- .../cps/ncmp/api/NetworkCmProxyDataService.java | 26 +++++++++++----------- .../api/impl/NetworkCmProxyDataServiceImpl.java | 12 +++++----- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'cps-ncmp-service/src/main/java/org/onap') diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java index 03737bc51b..05490d8fc9 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java @@ -53,7 +53,7 @@ public interface NetworkCmProxyDataService { /** * Get resource data for given data store using dmi. * - * @param dataStoreName data store name + * @param datastoreName datastore name * @param cmHandleId cm handle identifier * @param resourceIdentifier resource identifier * @param optionsParamInQuery options query @@ -61,7 +61,7 @@ public interface NetworkCmProxyDataService { * @param requestId unique requestId for async request * @return {@code Object} resource data */ - Object getResourceDataForCmHandle(String dataStoreName, + Object getResourceDataForCmHandle(String datastoreName, String cmHandleId, String resourceIdentifier, String optionsParamInQuery, @@ -71,13 +71,13 @@ public interface NetworkCmProxyDataService { /** * Get resource data for operational. * - * @param dataStoreName data store name - * @param cmHandleId cm handle identifier + * @param datastoreName datastore name + * @param cmHandleId cm handle identifier * @param resourceIdentifier resource identifier * @Link FetchDescendantsOption fetch descendants option * @return {@code Object} resource data */ - Object getResourceDataForCmHandle(String dataStoreName, + Object getResourceDataForCmHandle(String datastoreName, String cmHandleId, String resourceIdentifier, FetchDescendantsOption fetchDescendantsOption); @@ -85,7 +85,7 @@ public interface NetworkCmProxyDataService { /** * Get resource data for given batch of cm handles using dmi. * - * @param dataStoreName data store name + * @param datastoreName datastore name * @param cmHandleIds cm handle identifiers * @param resourceIdentifier resource identifier * @param optionsParamInQuery options query @@ -93,7 +93,7 @@ public interface NetworkCmProxyDataService { * @param requestId unique requestId for async request * @return {@code Object} resource data */ - Object getResourceDataForCmHandleBatch(String dataStoreName, + Object getResourceDataForCmHandleBatch(String datastoreName, List cmHandleIds, String resourceIdentifier, String optionsParamInQuery, @@ -102,13 +102,13 @@ public interface NetworkCmProxyDataService { /** - * Write resource data for data store pass-through running - * using dmi for given cm-handle. - * @param cmHandleId cm handle identifier + * Write resource data for data store pass-through running using dmi for given cm-handle. + * + * @param cmHandleId cm handle identifier * @param resourceIdentifier resource identifier - * @param operation required operation - * @param requestBody request body to create resource - * @param contentType content type in body + * @param operation required operation + * @param requestBody request body to create resource + * @param contentType content type in body * @return {@code Object} return data */ Object writeResourceDataPassThroughRunningForCmHandle(String cmHandleId, diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java index 1b1997f23a..e478b0053b 100755 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java @@ -114,13 +114,13 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } @Override - public Object getResourceDataForCmHandle(final String dataStoreName, + public Object getResourceDataForCmHandle(final String datastoreName, final String cmHandleId, final String resourceIdentifier, final String optionsParamInQuery, final String topicParamInQuery, final String requestId) { - final ResponseEntity responseEntity = dmiDataOperations.getResourceDataFromDmi(dataStoreName, cmHandleId, + final ResponseEntity responseEntity = dmiDataOperations.getResourceDataFromDmi(datastoreName, cmHandleId, resourceIdentifier, optionsParamInQuery, topicParamInQuery, @@ -129,22 +129,22 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } @Override - public Object getResourceDataForCmHandle(final String dataStoreName, + public Object getResourceDataForCmHandle(final String datastoreName, final String cmHandleId, final String resourceIdentifier, final FetchDescendantsOption fetchDescendantsOption) { - return cpsDataService.getDataNodes(dataStoreName, cmHandleId, resourceIdentifier, + return cpsDataService.getDataNodes(datastoreName, cmHandleId, resourceIdentifier, fetchDescendantsOption).iterator().next(); } @Override - public Object getResourceDataForCmHandleBatch(final String dataStoreName, + public Object getResourceDataForCmHandleBatch(final String datastoreName, final List cmHandleIds, final String resourceIdentifier, final String optionsParamInQuery, final String topicParamInQuery, final String requestId) { - final ResponseEntity responseEntity = dmiDataOperations.getResourceDataFromDmi(dataStoreName, cmHandleIds, + final ResponseEntity responseEntity = dmiDataOperations.getResourceDataFromDmi(datastoreName, cmHandleIds, resourceIdentifier, optionsParamInQuery, topicParamInQuery, -- cgit 1.2.3-korg