/*
* ============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.
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
-import org.onap.cps.api.model.ConditionProperties;
@Setter
@Getter
/*
* ============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.
* ============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;
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;
/*
* ============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.
* ============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()
/*
* ============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.
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 {
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'
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.'() {
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:
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
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
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