aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlukegleeson <luke.gleeson@est.tech>2021-08-16 12:30:26 +0100
committerlukegleeson <luke.gleeson@est.tech>2021-08-17 11:54:08 +0100
commit4571ab67d1b3d24d5f046a38055bcf34910cc785 (patch)
treee6b0da17516efb266cafa6df48836ef7698133c8
parentdca30738006c456afd807512a2f80c207b53d3c6 (diff)
Fix Sonar Qube Violations
Issue-ID: CPS-475 Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: I9673fe8ff5373a1ea50df148ac2a3d8af235e508
-rwxr-xr-xcps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java12
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/CmHandle.java4
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy2
-rw-r--r--cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java2
4 files changed, 10 insertions, 10 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 f97ea029db..d6d1ec75ce 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
@@ -51,8 +51,6 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
private static final String NCMP_ANCHOR_NAME = "ncmp-dmi-registry";
- private static final String NCMP_DATA_TOP_PATH = "/dmi-registry";
-
private CpsDataService cpsDataService;
private ObjectMapper objectMapper;
@@ -118,16 +116,16 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
final List<PersistenceCmHandle> persistenceCmHandles =
new ArrayList<>();
for (final CmHandle cmHandle: dmiPluginRegistration.getCreatedCmHandles()) {
- final PersistenceCmHandle persistenceCmHandle = new PersistenceCmHandle();
+ final var persistenceCmHandle = new PersistenceCmHandle();
persistenceCmHandle.setDmiServiceName(dmiPluginRegistration.getDmiPlugin());
- persistenceCmHandle.setId(cmHandle.getCmHandle());
+ persistenceCmHandle.setId(cmHandle.getCmHandleID());
persistenceCmHandle.setAdditionalProperties(cmHandle.getCmHandleProperties());
persistenceCmHandles.add(persistenceCmHandle);
}
- final PersistenceCmHandlesList persistenceCmHandlesList = new PersistenceCmHandlesList();
+ final var persistenceCmHandlesList = new PersistenceCmHandlesList();
persistenceCmHandlesList.setCmHandles(persistenceCmHandles);
- final String cmHandleJsonData = objectMapper.writeValueAsString(persistenceCmHandlesList);
- cpsDataService.saveListNodeData(NCMP_DATASPACE_NAME, NCMP_ANCHOR_NAME, NCMP_DATA_TOP_PATH,
+ final var cmHandleJsonData = objectMapper.writeValueAsString(persistenceCmHandlesList);
+ cpsDataService.saveListNodeData(NCMP_DATASPACE_NAME, NCMP_ANCHOR_NAME, "/dmi-registry",
cmHandleJsonData);
} catch (final JsonProcessingException e) {
throw new DataValidationException(
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/CmHandle.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/CmHandle.java
index 0d1c7693a6..84227ed6b3 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/CmHandle.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/CmHandle.java
@@ -20,6 +20,7 @@
package org.onap.cps.ncmp.api.models;
+import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
@@ -33,7 +34,8 @@ import org.springframework.validation.annotation.Validated;
@Setter
public class CmHandle {
- private String cmHandle;
+ @JsonProperty("cmHandle")
+ private String cmHandleID;
private Map<String, String> cmHandleProperties;
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
index d3c67cd20c..6d53e4067e 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
@@ -99,7 +99,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
def dmiPluginRegistration = new DmiPluginRegistration()
dmiPluginRegistration.dmiPlugin = 'my-server'
def cmHandle = new CmHandle()
- cmHandle.cmHandle = '123'
+ cmHandle.cmHandleID = '123'
cmHandle.cmHandleProperties = [ name1: 'value1', name2: 'value2']
dmiPluginRegistration.createdCmHandles = [ cmHandle ]
def expectedJsonData = '{"cm-handles":[{"id":"123","dmi-service-name":"my-server","additional-properties":[{"name":"name1","value":"value1"},{"name":"name2","value":"value2"}]}]}'
diff --git a/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java b/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java
index 67d5ffb033..3a65369dc7 100644
--- a/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java
+++ b/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java
@@ -97,7 +97,7 @@ public final class YangTextSchemaSourceSetBuilder {
private static ModuleReference toModuleReference(final Module module) {
return ModuleReference.builder()
.name(module.getName())
- .namespace(module.getNamespace().toString())
+ .namespace(module.getQNameModule().getNamespace().toString())
.revision(module.getRevision().map(Revision::toString).orElse(null))
.build();
}