aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-service')
-rwxr-xr-xcps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java18
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy12
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/moduleReferenceSpec.groovy6
3 files changed, 18 insertions, 18 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 c840c0a7d4..6e1e7275bb 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
@@ -349,13 +349,13 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
protected void createAnchorAndSyncModel(final PersistenceCmHandle cmHandle) {
final var modulesForCmHandle =
dmiOperations.getResourceFromDmi(cmHandle.getDmiServiceName(), cmHandle.getId(), "modules");
-
- final List<ModuleReference> moduleReferencesFromDmiForCmHandle = getModuleReferences(modulesForCmHandle);
-
- final var knownModuleReferencesInCps = cpsModuleService.getAllYangResourcesModuleReferences();
-
+ final List<ModuleReference> moduleReferencesFromDmiForCmHandle =
+ getModuleReferences(modulesForCmHandle);
+ final var knownModuleReferencesInCps =
+ cpsModuleService.getAllYangResourceModuleReferences(NF_PROXY_DATASPACE_NAME);
final List<ModuleReference> existingModuleReferences = new ArrayList<>();
- for (final ModuleReference moduleReferenceFromDmiForCmHandle : moduleReferencesFromDmiForCmHandle) {
+ for (final ModuleReference moduleReferenceFromDmiForCmHandle :
+ moduleReferencesFromDmiForCmHandle) {
if (knownModuleReferencesInCps.contains(moduleReferenceFromDmiForCmHandle)) {
existingModuleReferences.add(moduleReferenceFromDmiForCmHandle);
}
@@ -396,7 +396,8 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
final JsonObject convertedObject = new Gson().fromJson(response.getBody(), JsonObject.class);
final JsonArray moduleReferencesAsJson = convertedObject.getAsJsonArray("schemas");
for (final JsonElement moduleReferenceAsJson : moduleReferencesAsJson) {
- final ModuleReference moduleReference = toModuleReference((JsonObject) moduleReferenceAsJson);
+ final ModuleReference moduleReference =
+ toModuleReference((JsonObject) moduleReferenceAsJson);
modulesFromDmiForCmHandle.add(moduleReference);
}
return modulesFromDmiForCmHandle;
@@ -404,8 +405,7 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
private ModuleReference toModuleReference(final JsonObject moduleReferenceAsJson) {
final var moduleReference = new ModuleReference();
- moduleReference.setName(moduleReferenceAsJson.get("moduleName").getAsString());
- moduleReference.setNamespace(NO_NAMESPACE);
+ moduleReference.setModuleName(moduleReferenceAsJson.get("moduleName").getAsString());
moduleReference.setRevision(moduleReferenceAsJson.get("revision").getAsString());
return moduleReference;
}
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 b42db57233..ff3e0cd157 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
@@ -357,23 +357,23 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
def 'Sync model for a (new) cm handle with #scenario'() {
given: 'DMI PLug-in returns a list of module references'
getModulesForCmHandle()
- def knownModule1 = new ModuleReference('module1', NO_NAMESPACE, '1')
- def knownOtherModule = new ModuleReference('some other module', NO_NAMESPACE, 'some revision')
+ def knownModule1 = new ModuleReference('module1', '1')
+ def knownOtherModule = new ModuleReference('some other module', 'some revision')
and: 'CPS-Core returns list of known modules'
- mockCpsModuleService.getAllYangResourcesModuleReferences() >> [knownModule1, knownOtherModule]
+ mockCpsModuleService.getAllYangResourceModuleReferences(_) >> [knownModule1, knownOtherModule]
and: 'DMI-Plugin returns resource(s) for "new" module(s)'
def moduleResources = new ResponseEntity<String>(sdncReponseBody, HttpStatus.OK)
mockDmiOperations.getResourceFromDmi(_, cmHandleForModelSync.getId(), 'moduleResources') >> moduleResources
when: 'module Sync is triggered'
objectUnderTest.createAnchorAndSyncModel(cmHandleForModelSync)
then: 'the CPS module service is called once with the correct parameters'
- 1 * mockCpsModuleService.createSchemaSetFromModules(expectedDataspaceNameForModleSync, cmHandleForModelSync.getId(), expectedYangResourceToContentMap , [knownModule1])
+ 1 * mockCpsModuleService.createSchemaSetFromModules(expectedDataspaceNameForModleSync, cmHandleForModelSync.getId(), expectedYangResourceToContentMap, [knownModule1])
and: 'admin service create anchor method has been called with correct parameters'
1 * mockCpsAdminService.createAnchor(expectedDataspaceNameForModleSync, cmHandleForModelSync.getId(), cmHandleForModelSync.getId())
where: 'the following responses are recieved from SDNC'
- scenario | sdncReponseBody || expectedYangResourceToContentMap
+ scenario | sdncReponseBody || expectedYangResourceToContentMap
'one unknown module' | '[{"moduleName" : "someModule", "revision" : "1","yangSource": "someResource"}]' || [someModule: 'someResource']
- 'no unknown module' | '[]' || [:]
+ 'no unknown module' | '[]' || [:]
}
def getModulesForCmHandle() {
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/moduleReferenceSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/moduleReferenceSpec.groovy
index d6cb4635d8..9f161a9e53 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/moduleReferenceSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/moduleReferenceSpec.groovy
@@ -1,14 +1,14 @@
package org.onap.cps.ncmp.api.models
-import org.onap.cps.spi.model.ModuleReference
+import org.onap.cps.spi.model.ExtendedModuleReference
import spock.lang.Specification
class moduleReferenceSpec extends Specification {
def 'lombok data annotation correctly implements toString() and hashCode() methods'() {
given: 'two moduleReference objects'
- def moduleReference1 = new ModuleReference('module1', "some namespace", '1')
- def moduleReference2 = new ModuleReference('module1', "some namespace", '1')
+ def moduleReference1 = new ExtendedModuleReference('module1', "some namespace", '1')
+ def moduleReference2 = new ExtendedModuleReference('module1', "some namespace", '1')
when: 'lombok generated methods are called'
then: 'the methods exist and behaviour is accurate'
assert moduleReference1.toString() == moduleReference2.toString()