diff options
author | 2021-10-12 11:06:06 +0000 | |
---|---|---|
committer | 2021-10-12 11:06:06 +0000 | |
commit | 4691481d530c46b67a7c65ee8942245e02ef6d49 (patch) | |
tree | 3edf01d33a4684e0f08fe2f7cb84ec822397a87d /cps-ncmp-service/src/main/java | |
parent | 937e5f49b2593b225b7c444b98aa745833d509d6 (diff) | |
parent | 7ad748f44a8f9624b53462850759804ffc185576 (diff) |
Merge "fix for sync and passthough usecase"
Diffstat (limited to 'cps-ncmp-service/src/main/java')
2 files changed, 11 insertions, 5 deletions
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 5594a2a7a..d6aaf36d3 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 @@ -284,7 +284,7 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } private static void handleResponseForPost(final @NotNull ResponseEntity<String> responseEntity) { - if (responseEntity.getStatusCode() != HttpStatus.OK) { + if (!HttpStatus.valueOf(responseEntity.getStatusCodeValue()).is2xxSuccessful()) { throw new NcmpException("Not able to create resource data.", "DMI status code: " + responseEntity.getStatusCodeValue() + ", DMI response body: " + responseEntity.getBody()); @@ -387,9 +387,13 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService final List<ModuleReference> unknownModuleReferences = new ArrayList<>(); prepareModuleSubsets(moduleReferencesFromCmHandle, existingModuleReferences, unknownModuleReferences); - final Map<String, String> newYangResourcesModuleNameToContentMap = - getNewYangResourcesFromDmi(persistenceCmHandle, unknownModuleReferences, cmHandlePropertiesAsMap); - + final Map<String, String> newYangResourcesModuleNameToContentMap; + if (unknownModuleReferences.size() > 0) { + newYangResourcesModuleNameToContentMap = getNewYangResourcesFromDmi(persistenceCmHandle, + unknownModuleReferences, cmHandlePropertiesAsMap); + } else { + newYangResourcesModuleNameToContentMap = new HashMap<>(); + } cpsModuleService.createSchemaSetFromModules(NF_PROXY_DATASPACE_NAME, persistenceCmHandle.getId(), newYangResourcesModuleNameToContentMap, existingModuleReferences); } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operation/DmiOperations.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operation/DmiOperations.java index 363b0ef9b..f7421cdb7 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operation/DmiOperations.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operation/DmiOperations.java @@ -203,7 +203,9 @@ public class DmiOperations { private void appendOptionsQuery(final StringBuilder stringBuilder, final String optionsParamInQuery) { - stringBuilder.append("&").append(OPTIONS_QUERY_KEY).append("=").append(optionsParamInQuery); + if (optionsParamInQuery != null) { + stringBuilder.append("&").append(OPTIONS_QUERY_KEY).append("=").append(optionsParamInQuery); + } } private HttpHeaders prepareHeader(final String acceptParam) { |