From 6be7d1b1ee4b08728291e48edb9924289e224bdd Mon Sep 17 00:00:00 2001 From: shikha0203 Date: Thu, 27 Nov 2025 10:32:33 +0000 Subject: [PATCH] Move ConditionProperties from CPS to NCMP Issue-ID: CPS-2729 Change-Id: Iba04f16a000dd461165ab8db18bd71e168a64eb2 Signed-off-by: shikha0203 --- .../models/CmHandleQueryServiceParameters.java | 3 +-- .../api/inventory/models}/ConditionProperties.java | 4 ++-- .../ParameterizedCmHandleQueryServiceImpl.java | 2 +- .../inventory/models}/ConditionPropertiesSpec.groovy | 5 +++-- ...CmHandleQueryParametersParameterMapperSpec.groovy | 20 ++++++++++---------- .../NetworkCmProxyInventoryFacadeSpec.groovy | 2 +- .../ParameterizedCmHandleQueryServiceSpec.groovy | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) rename {cps-service/src/main/java/org/onap/cps/api/model => cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models}/ConditionProperties.java (92%) rename {cps-service/src/test/groovy/org/onap/cps/api/model => cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/models}/ConditionPropertiesSpec.groovy (92%) diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/CmHandleQueryServiceParameters.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/CmHandleQueryServiceParameters.java index c4e9eeff6f..dc05d85521 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/CmHandleQueryServiceParameters.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/CmHandleQueryServiceParameters.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation + * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,6 @@ import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; -import org.onap.cps.api.model.ConditionProperties; @Setter @Getter diff --git a/cps-service/src/main/java/org/onap/cps/api/model/ConditionProperties.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/ConditionProperties.java similarity index 92% rename from cps-service/src/main/java/org/onap/cps/api/model/ConditionProperties.java rename to cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/ConditionProperties.java index a995ba17b4..5a24f5cf7f 100644 --- a/cps-service/src/main/java/org/onap/cps/api/model/ConditionProperties.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/ConditionProperties.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation + * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.api.model; +package org.onap.cps.ncmp.api.inventory.models; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java index a34a89f568..be9627c1b4 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java @@ -36,9 +36,9 @@ import java.util.Map; import java.util.function.BiFunction; import lombok.RequiredArgsConstructor; import org.onap.cps.api.exceptions.DataValidationException; -import org.onap.cps.api.model.ConditionProperties; import org.onap.cps.cpspath.parser.PathParsingException; import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters; +import org.onap.cps.ncmp.api.inventory.models.ConditionProperties; import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle; import org.onap.cps.ncmp.impl.inventory.models.PropertyType; import org.onap.cps.ncmp.impl.inventory.models.SouthboundCmHandleQuerySupportedConditions; diff --git a/cps-service/src/test/groovy/org/onap/cps/api/model/ConditionPropertiesSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/models/ConditionPropertiesSpec.groovy similarity index 92% rename from cps-service/src/test/groovy/org/onap/cps/api/model/ConditionPropertiesSpec.groovy rename to cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/models/ConditionPropertiesSpec.groovy index 9c6bca6e83..2dcee314de 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/model/ConditionPropertiesSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/models/ConditionPropertiesSpec.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2023 Nordix Foundation + * Copyright (C) 2023-2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.api.model +package org.onap.cps.ncmp.api.inventory.models import com.fasterxml.jackson.databind.ObjectMapper import spock.lang.Specification + class ConditionPropertiesSpec extends Specification { ObjectMapper objectMapper = new ObjectMapper() diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleQueryParametersParameterMapperSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleQueryParametersParameterMapperSpec.groovy index e2ce433185..aa9a0d3fe5 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleQueryParametersParameterMapperSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleQueryParametersParameterMapperSpec.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation + * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,9 @@ package org.onap.cps.ncmp.impl.inventory -import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters import org.onap.cps.api.exceptions.DataValidationException -import org.onap.cps.api.model.ConditionProperties +import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters +import org.onap.cps.ncmp.api.inventory.models.ConditionProperties import spock.lang.Specification class CmHandleQueryParametersParameterMapperSpec extends Specification { @@ -41,8 +41,8 @@ class CmHandleQueryParametersParameterMapperSpec extends Specification { def cmHandleQueryParameters = new CmHandleQueryServiceParameters() def condition = new ConditionProperties() condition.conditionName = 'validConditionName' - condition.conditionParameters = [['key':'value']] - cmHandleQueryParameters.cmHandleQueryParameters = [condition] + condition.conditionParameters = [['key': 'value']] + cmHandleQueryParameters.cmHandleQueryParameters = [condition] when: 'validator is invoked' CmHandleQueryParametersValidator.validateCmHandleQueryParameters(cmHandleQueryParameters, ['validConditionName']) then: 'data validation exception is not thrown' @@ -100,10 +100,10 @@ class CmHandleQueryParametersParameterMapperSpec extends Specification { and: 'exception message matches the expected message' e.details.contains(exceptionMessage) where: - scenario | conditionProperty || exceptionMessage - 'more than one condition is supplied' | ['cpsPath':'some-path', 'cpsPath2':'some-path'] || 'Only one condition property is allowed for the CPS path query.' - 'cpsPath key not supplied' | ['wrong-key':'some-path'] || 'Wrong CPS path condition property. - expecting "cpsPath" as the condition property.' - 'cpsPath not supplied' | ['cpsPath':''] || 'Wrong CPS path. - please supply a valid CPS path.' + scenario | conditionProperty || exceptionMessage + 'more than one condition is supplied' | ['cpsPath': 'some-path', 'cpsPath2': 'some-path'] || 'Only one condition property is allowed for the CPS path query.' + 'cpsPath key not supplied' | ['wrong-key': 'some-path'] || 'Wrong CPS path condition property. - expecting "cpsPath" as the condition property.' + 'cpsPath not supplied' | ['cpsPath': ''] || 'Wrong CPS path. - please supply a valid CPS path.' } def 'No conditions.'() { @@ -113,7 +113,7 @@ class CmHandleQueryParametersParameterMapperSpec extends Specification { def 'Validate CmHandle where #scenario.'() { when: 'the validator is called on a cps path condition property' - def result = CmHandleQueryParametersValidator.validateCpsPathConditionProperties(['cpsPath':cpsPath]) + def result = CmHandleQueryParametersValidator.validateCpsPathConditionProperties(['cpsPath': cpsPath]) then: 'the expected boolean value is returned' result == expectedBoolean where: diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy index 75fed667df..ec24eb5415 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy @@ -25,7 +25,6 @@ package org.onap.cps.ncmp.impl.inventory import com.fasterxml.jackson.databind.ObjectMapper import org.onap.cps.api.exceptions.DataValidationException -import org.onap.cps.api.model.ConditionProperties import org.onap.cps.ncmp.api.exceptions.CmHandleNotFoundException import org.onap.cps.ncmp.api.inventory.DataStoreSyncState import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryApiParameters @@ -33,6 +32,7 @@ import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters import org.onap.cps.ncmp.api.inventory.models.CmHandleState import org.onap.cps.ncmp.api.inventory.models.CompositeState import org.onap.cps.ncmp.api.inventory.models.ConditionApiProperties +import org.onap.cps.ncmp.api.inventory.models.ConditionProperties import org.onap.cps.ncmp.api.inventory.models.DmiPluginRegistration import org.onap.cps.ncmp.api.inventory.models.LockReasonCategory import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy index 1d69aabb11..b0100ca07b 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceSpec.groovy @@ -22,10 +22,10 @@ package org.onap.cps.ncmp.impl.inventory import org.onap.cps.api.exceptions.DataInUseException import org.onap.cps.api.exceptions.DataValidationException -import org.onap.cps.api.model.ConditionProperties import org.onap.cps.api.model.DataNode import org.onap.cps.cpspath.parser.PathParsingException import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters +import org.onap.cps.ncmp.api.inventory.models.ConditionProperties import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle import org.onap.cps.ncmp.impl.inventory.trustlevel.TrustLevelManager -- 2.16.6