diff options
4 files changed, 14 insertions, 9 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/DmiDataOperations.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/DmiDataOperations.java index 41348aea3f..1e66ff6cd2 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/DmiDataOperations.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/DmiDataOperations.java @@ -52,7 +52,7 @@ import org.onap.cps.ncmp.impl.models.DmiRequestBody; import org.onap.cps.ncmp.impl.utils.http.RestServiceUrlTemplateBuilder; import org.onap.cps.ncmp.impl.utils.http.UrlTemplateParameters; import org.onap.cps.spi.exceptions.CpsException; -import org.onap.cps.spi.exceptions.DataNodeNotFoundException; +import org.onap.cps.spi.exceptions.DataValidationException; import org.onap.cps.utils.JsonObjectMapper; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; @@ -285,7 +285,7 @@ public class DmiDataOperations { String cmHandleId = cmResourceAddress.getCmHandleReference(); try { return getYangModelCmHandle(cmHandleId); - } catch (final DataNodeNotFoundException ignored) { + } catch (final DataValidationException ignored) { cmHandleId = cmResourceAddress.resolveCmHandleReferenceToId(); return getYangModelCmHandle(cmHandleId); } diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy index 71054dce41..0d1cfb7c2d 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/data/DmiDataOperationsSpec.groovy @@ -36,6 +36,7 @@ import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher import org.onap.cps.ncmp.impl.utils.http.UrlTemplateParameters import org.onap.cps.ncmp.utils.TestUtils import org.onap.cps.spi.exceptions.DataNodeNotFoundException +import org.onap.cps.spi.exceptions.DataValidationException import org.onap.cps.utils.JsonObjectMapper import org.spockframework.spring.SpringBean import org.springframework.beans.factory.annotation.Autowired @@ -214,17 +215,21 @@ class DmiDataOperationsSpec extends DmiOperationsBaseSpec { assert objectUnderTest.resolveYangModelCmHandleFromCmHandleReference(cmResourceAddress) == yangModelCmHandle } - def 'Resolving cm handle references with alternate id.'() { + def 'Resolving cm handle references with alternate id #scenario.'() { given: 'a resource with a alternate id' - def cmResourceAddress = new CmResourceAddress('some store', 'alternate-id', 'some resource') - and: 'the alternate id cannot be found in the inventory directly and that results in a data node not found exception' - mockInventoryPersistence.getYangModelCmHandle('alternate-id') >> { throw new DataNodeNotFoundException('','') } + def cmResourceAddress = new CmResourceAddress('some store', alternateId, 'some resource') + and: 'the alternate id cannot be found in the inventory directly and that results in an exception' + mockInventoryPersistence.getYangModelCmHandle(alternateId) >> { throw errorThrownDuringCmHandleIdSearch } and: 'the alternate id can be matched to a cm handle id' - alternateIdMatcher.getCmHandleId('alternate-id') >> 'cm-handle-id' + alternateIdMatcher.getCmHandleId(alternateId) >> 'cm-handle-id' and: 'that cm handle id is available in the inventory' mockInventoryPersistence.getYangModelCmHandle('cm-handle-id') >> yangModelCmHandle expect: 'resolving that cm handle id returns the cm handle' assert objectUnderTest.resolveYangModelCmHandleFromCmHandleReference(cmResourceAddress) == yangModelCmHandle + where: 'the following alternate ids are used' + scenario | alternateId | errorThrownDuringCmHandleIdSearch + 'alternate id with no special characters' | 'alternate-id' | new DataNodeNotFoundException('','') + 'alternate id with special characters' | 'alternate#id' | new DataValidationException('','') } diff --git a/csit/plans/cps/test.properties b/csit/plans/cps/test.properties index e7b9519c2d..52e82bdb85 100644 --- a/csit/plans/cps/test.properties +++ b/csit/plans/cps/test.properties @@ -21,7 +21,7 @@ DMI_SERVICE_URL=http://$LOCAL_IP:$DMI_PORT DOCKER_REPO=nexus3.onap.org:10003 CPS_VERSION=latest -DMI_VERSION=1.5.1-SNAPSHOT-latest +DMI_VERSION=latest ADVISED_MODULES_SYNC_SLEEP_TIME_MS=2000 CMHANDLE_DATA_SYNC_SLEEP_TIME_MS=2000 diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index feb58d849d..ae34fc3606 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -142,7 +142,7 @@ services: ncmp-dmi-plugin-demo-and-csit-stub: container_name: ${NCMP_DMI_PLUGIN_DEMO_AND_CSIT_STUB_CONTAINER_NAME:-ncmp-dmi-plugin-demo-and-csit-stub} - image: ${DOCKER_REPO:-nexus3.onap.org:10003}/onap/dmi-plugin-demo-and-csit-stub:${DMI_DEMO_STUB_VERSION:-latest} + image: ${DOCKER_REPO:-nexus3.onap.org:10003}/onap/dmi-stub:${DMI_DEMO_STUB_VERSION:-latest} ports: - ${DMI_DEMO_STUB_PORT:-8784}:8092 environment: |