diff options
author | Joseph Keenan <joseph.keenan@est.tech> | 2022-04-08 09:42:24 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-04-08 09:42:24 +0000 |
commit | 23bc326dde2667341e2c835929ef785ebd2ed834 (patch) | |
tree | db298c928ba3eb78cd401d85a82b1ff00c04c053 /src/main | |
parent | 08b499572102640cd6d298fec2abf443413803cb (diff) | |
parent | 0c42afde8120ddce873c99cec1a6a5ad8529dfe6 (diff) |
Merge "Fix SonarQube violations"
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java | 15 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java index 653ebf7f..cb2ac870 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java @@ -71,7 +71,7 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi { public ResponseEntity<ModuleSet> getModuleReferences(final String cmHandle, final @Valid ModuleReferencesRequest body) { // For onap-dmi-plugin we don't need cmHandleProperties, so DataAccessReadRequest is not used. - final var moduleSet = dmiService.getModulesForCmHandle(cmHandle); + final ModuleSet moduleSet = dmiService.getModulesForCmHandle(cmHandle); return ResponseEntity.ok(moduleSet); } diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java b/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java index 46a332cb..c2a4a7ed 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/operation/SdncOperations.java @@ -32,7 +32,7 @@ import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; +import java.util.EnumMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -54,8 +54,7 @@ import org.springframework.web.util.UriComponentsBuilder; @Component public class SdncOperations { - private static final String TOPOLOGY_URL_TEMPLATE_DATA = - "/rests/data/network-topology:network-topology/"; + private static final String TOPOLOGY_URL_TEMPLATE_DATA = "/rests/data/network-topology:network-topology/"; private static final String TOPOLOGY_URL_TEMPLATE_OPERATIONAL = "/rests/operations/network-topology:network-topology/"; private static final String GET_SCHEMA_URL = "ietf-netconf-monitoring:netconf-state/schemas"; @@ -65,7 +64,7 @@ public class SdncOperations { private static final int QUERY_PARAM_VALUE_INDEX = 1; private static final int QUERY_PARAM_NAME_INDEX = 0; - private static Map<OperationEnum, HttpMethod> operationToHttpMethodMap = new HashMap<>(5); + private static EnumMap<OperationEnum, HttpMethod> operationToHttpMethodMap = new EnumMap<>(OperationEnum.class); static { operationToHttpMethodMap.put(OperationEnum.READ, HttpMethod.GET); @@ -127,8 +126,8 @@ public class SdncOperations { * @return response entity */ public ResponseEntity<String> getModuleResource(final String nodeId, final String moduleProperties) { - final var getYangResourceUrl = prepareGetOperationSchemaUrl(nodeId); - final var httpHeaders = new HttpHeaders(); + final String getYangResourceUrl = prepareGetOperationSchemaUrl(nodeId); + final HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setContentType(MediaType.APPLICATION_JSON); return sdncRestconfClient.httpOperationWithJsonData( HttpMethod.POST, getYangResourceUrl, moduleProperties, httpHeaders); @@ -166,8 +165,8 @@ public class SdncOperations { final String resourceId, final String contentType, final String requestData) { - final var getResourceDataUrl = prepareWriteUrl(nodeId, resourceId); - final var httpHeaders = new HttpHeaders(); + final String getResourceDataUrl = prepareWriteUrl(nodeId, resourceId); + final HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setContentType(MediaType.parseMediaType(contentType)); final HttpMethod httpMethod = operationToHttpMethodMap.get(operation); return sdncRestconfClient.httpOperationWithJsonData(httpMethod, getResourceDataUrl, requestData, httpHeaders); |