diff options
Diffstat (limited to 'cps-ncmp-service/src/main')
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 5594a2a7a5..d6aaf36d3a 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 363b0ef9b2..f7421cdb71 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) { |