- Renamed related methods and Enum using terms north (client facing) and southbound (dmi) for more clarity
- Northbound Cm Handle search was using the wrong Enum for validation (this caused the issue)
- Grouped and ordered renamed methods in facade impl
- Enums also had the wrong values: unsupported values in one and missing values in the other
(southbound can/should support all possible queries, no reason not too)
TODO (separate subtasks and commits)
- Update RTD documentation to properly describe options in each ifc
- Update Postman collection to have cleared separation between north and southbound interfaces
Issue-ID: CPS-2864
Change-Id: I6523b368e504b5e99dde794e7e716193d2cadf23
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
final CmHandleQueryApiParameters cmHandleQueryApiParameters =
deprecationHelper.mapOldConditionProperties(cmHandleQueryParameters);
final List<RestOutputCmHandle> restOutputCmHandles =
- networkCmProxyInventoryFacade.executeCmHandleSearch(cmHandleQueryApiParameters)
- .map(handle -> restOutputCmHandleMapper
- .toRestOutputCmHandle(handle, false)).collectList().block();
+ networkCmProxyInventoryFacade.northboundCmHandleSearch(cmHandleQueryApiParameters)
+ .map(ncmpServiceCmHandle -> restOutputCmHandleMapper
+ .toRestOutputCmHandle(ncmpServiceCmHandle, false)).collectList().block();
return ResponseEntity.ok(restOutputCmHandles);
}
final CmHandleQueryApiParameters cmHandleQueryApiParameters =
jsonObjectMapper.convertToValueType(cmHandleQueryParameters, CmHandleQueryApiParameters.class);
final Collection<String> cmHandleIds
- = networkCmProxyInventoryFacade.executeCmHandleIdSearch(cmHandleQueryApiParameters, outputAlternateId);
+ = networkCmProxyInventoryFacade.northboundCmHandleIdSearch(cmHandleQueryApiParameters, outputAlternateId);
return ResponseEntity.ok(List.copyOf(cmHandleIds));
}
.toCmHandleQueryServiceParameters(cmHandleQueryParameters);
final Collection<String> cmHandleIds = networkCmProxyInventoryFacade
- .executeParameterizedCmHandleIdSearch(cmHandleQueryServiceParameters, outputAlternateId);
+ .southboundCmHandleIdSearch(cmHandleQueryServiceParameters, outputAlternateId);
return ResponseEntity.ok(List.copyOf(cmHandleIds));
}
deprecationHelper.mapOldConditionProperties(cmHandleQueryParameters);
final boolean includeCmHandlePropertiesParameter = Boolean.TRUE.equals(includeCmHandlePropertiesInQuery);
final List<RestOutputCmHandle> restOutputCmHandles =
- networkCmProxyInventoryFacade.executeCmHandleInventorySearch(cmHandleQueryApiParameters)
- .map(ncmpServiceCmHandle -> restOutputCmHandleMapper
- .toRestOutputCmHandle(ncmpServiceCmHandle, includeCmHandlePropertiesParameter))
+ networkCmProxyInventoryFacade.southboundCmHandleSearch(cmHandleQueryApiParameters)
+ .map(handle -> restOutputCmHandleMapper
+ .toRestOutputCmHandle(handle, includeCmHandlePropertiesParameter))
.collectList().block();
return ResponseEntity.ok(restOutputCmHandles);
}
and: 'the inventory facade returns two cm handles'
def ncmpServiceCmHandle1 = new NcmpServiceCmHandle(cmHandleId: 'ch-1')
def ncmpServiceCmHandle2 = new NcmpServiceCmHandle(cmHandleId: 'ch-2')
- mockNetworkCmProxyInventoryFacade.executeCmHandleSearch(_) >> Flux.fromIterable([ncmpServiceCmHandle1, ncmpServiceCmHandle2])
+ mockNetworkCmProxyInventoryFacade.northboundCmHandleSearch(_) >> Flux.fromIterable([ncmpServiceCmHandle1, ncmpServiceCmHandle2])
and: 'mapper converts cm handles without private properties'
def restHandle1 = new RestOutputCmHandle(cmHandle: 'rest ch-1')
def restHandle2 = new RestOutputCmHandle(cmHandle: 'rest ch-2')
when: 'the searches api is invoked'
mvc.perform(post(searchesEndpoint).contentType(MediaType.APPLICATION_JSON).content(jsonString))
then: 'the request was still accepted and forwarded to the correct services'
- 1 * mockNetworkCmProxyInventoryFacade.executeCmHandleSearch(_) >> Flux.fromIterable([new NcmpServiceCmHandle()])
+ 1 * mockNetworkCmProxyInventoryFacade.northboundCmHandleSearch(_) >> Flux.fromIterable([new NcmpServiceCmHandle()])
1 * mockRestOutputCmHandleMapper.toRestOutputCmHandle(_, _) >> new RestOutputCmHandle(cmHandle: 'some cm handle')
}
given: 'an endpoint and json data'
def searchesEndpoint = "$ncmpBasePathV1/ch/id-searches"
and: 'the service method is invoked with module names and returns cm handle ids'
- 1 * mockNetworkCmProxyInventoryFacade.executeCmHandleIdSearch(_, _) >> ['ch-1', 'ch-2']
+ 1 * mockNetworkCmProxyInventoryFacade.northboundCmHandleIdSearch(_, _) >> ['ch-1', 'ch-2']
when: 'the searches api is invoked'
def response = mvc.perform(post(searchesEndpoint).contentType(MediaType.APPLICATION_JSON).content('{}')).andReturn().response
then: 'cm handle ids are returned'
and: 'the mapper service returns a converted object'
ncmpRestInputMapper.toCmHandleQueryServiceParameters(_) >> cmHandleQueryServiceParameters
and: 'the service returns the desired results'
- mockNetworkCmProxyInventoryFacade.executeParameterizedCmHandleIdSearch(cmHandleQueryServiceParameters, _) >> serviceMockResponse
+ mockNetworkCmProxyInventoryFacade.southboundCmHandleIdSearch(cmHandleQueryServiceParameters, _) >> serviceMockResponse
when: 'post request is performed & search is called with the given request parameters'
def response = mvc.perform(
post("$ncmpBasePathV1/ch/searches")
and: 'the mapper service returns a converted object'
ncmpRestInputMapper.toCmHandleQueryServiceParameters(_) >> cmHandleQueryServiceParameters
and: 'the service returns the desired results'
- mockNetworkCmProxyInventoryFacade.executeParameterizedCmHandleIdSearch(cmHandleQueryServiceParameters, _) >> serviceMockResponse
+ mockNetworkCmProxyInventoryFacade.southboundCmHandleIdSearch(cmHandleQueryServiceParameters, _) >> serviceMockResponse
when: 'post request is performed & search is called with the given request parameters'
def response = mvc.perform(
post("$ncmpBasePathV1/ch/searches")
given: 'the mapper service returns a converted object'
ncmpRestInputMapper.toCmHandleQueryServiceParameters(_) >> cmHandleQueryServiceParameters
and: 'the service returns the desired results'
- mockNetworkCmProxyInventoryFacade.executeParameterizedCmHandleIdSearch(cmHandleQueryServiceParameters) >> []
+ mockNetworkCmProxyInventoryFacade.southboundCmHandleIdSearch(cmHandleQueryServiceParameters) >> []
when: 'post request is performed & search is called with the given request parameters'
def response = mvc.perform(
post("$ncmpBasePathV1/ch/searches")
String jsonString = TestUtils.getResourceFileContent('cm-handle-search-by-dmi-service.json')
and: 'a cm handle is returned'
def ncmpServiceCmHandle = new NcmpServiceCmHandle(additionalProperties: ['someName': 'my dmi'])
- mockNetworkCmProxyInventoryFacade.executeCmHandleInventorySearch(_) >> Flux.fromIterable([ncmpServiceCmHandle])
+ mockNetworkCmProxyInventoryFacade.southboundCmHandleSearch(_) >> Flux.fromIterable([ncmpServiceCmHandle])
and: 'the mapper is requested to convert the object with additional properties'
mockRestOutputCmHandleMapper.toRestOutputCmHandle(ncmpServiceCmHandle, true) >> new RestOutputCmHandle()
when: 'the endpoint is invoked'
* cm handle id (false) or alternate id (true)
* @return collection of cm handle references
*/
- Collection<String> executeParameterizedCmHandleIdSearch(final CmHandleQueryServiceParameters
+ Collection<String> southboundCmHandleIdSearch(final CmHandleQueryServiceParameters
cmHandleQueryServiceParameters,
- final boolean outputAlternateId);
+ final boolean outputAlternateId);
/**
* Retrieve module references for the given cm handle reference.
* @param cmHandleQueryApiParameters cm handle query parameters
* @return cm handle objects as a reactive stream (flux)
*/
- Flux<NcmpServiceCmHandle> executeCmHandleSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters);
+ Flux<NcmpServiceCmHandle> northboundCmHandleSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters);
/**
* Retrieve cm handle ids for the given query parameters.
* @param outputAlternateId boolean for cm handle reference type either cmHandleId (false) or AlternateId (true)
* @return cm handle ids
*/
- Collection<String> executeCmHandleIdSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters,
- final boolean outputAlternateId);
+ Collection<String> northboundCmHandleIdSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters,
+ final boolean outputAlternateId);
/**
* Set the data sync enabled flag, along with the data sync state
* @param cmHandleQueryApiParameters cm handle query parameters
* @return cm handle objects as a reactive stream (flux)
*/
- Flux<NcmpServiceCmHandle> executeCmHandleInventorySearch(final CmHandleQueryApiParameters
+ Flux<NcmpServiceCmHandle> southboundCmHandleSearch(final CmHandleQueryApiParameters
cmHandleQueryApiParameters);
}
import org.onap.cps.ncmp.impl.inventory.CmHandleRegistrationService;
import org.onap.cps.ncmp.impl.inventory.InventoryPersistence;
import org.onap.cps.ncmp.impl.inventory.ParameterizedCmHandleQueryService;
-import org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions;
-import org.onap.cps.ncmp.impl.inventory.models.InventoryQueryConditions;
+import org.onap.cps.ncmp.impl.inventory.models.NorthboundCmHandleQuerySupportedConditions;
+import org.onap.cps.ncmp.impl.inventory.models.SouthboundCmHandleQuerySupportedConditions;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
import org.onap.cps.ncmp.impl.inventory.trustlevel.TrustLevelManager;
import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher;
return cmHandleQueryService.getCmHandleReferencesByDmiPluginIdentifier(dmiPluginIdentifier, outputAlternateId);
}
- @Override
- public Collection<String> executeParameterizedCmHandleIdSearch(
- final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) {
- validateCmHandleQueryParameters(cmHandleQueryServiceParameters, InventoryQueryConditions.ALL_CONDITION_NAMES);
-
- return parameterizedCmHandleQueryService.queryCmHandleIdsForInventory(cmHandleQueryServiceParameters,
- outputAlternateId);
- }
@Override
public Collection<ModuleReference> getYangResourcesModuleReferences(final String cmHandleReference) {
}
@Override
- public Flux<NcmpServiceCmHandle> executeCmHandleSearch(
- final CmHandleQueryApiParameters cmHandleQueryApiParameters) {
+ public Collection<String> northboundCmHandleIdSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters,
+ final boolean outputAlternateId) {
+ final CmHandleQueryServiceParameters cmHandleQueryServiceParameters = jsonObjectMapper.convertToValueType(
+ cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class);
+ validateCmHandleQueryParameters(cmHandleQueryServiceParameters,
+ NorthboundCmHandleQuerySupportedConditions.CONDITION_NAMES);
+ return parameterizedCmHandleQueryService.queryCmHandleReferenceIds(cmHandleQueryServiceParameters,
+ outputAlternateId);
+ }
+
+ @Override
+ public Flux<NcmpServiceCmHandle> northboundCmHandleSearch(
+ final CmHandleQueryApiParameters cmHandleQueryApiParameters) {
final CmHandleQueryServiceParameters cmHandleQueryServiceParameters =
jsonObjectMapper.convertToValueType(cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class);
- validateCmHandleQueryParameters(cmHandleQueryServiceParameters, CmHandleQueryConditions.ALL_CONDITION_NAMES);
+ validateCmHandleQueryParameters(cmHandleQueryServiceParameters,
+ NorthboundCmHandleQuerySupportedConditions.CONDITION_NAMES);
return parameterizedCmHandleQueryService.queryCmHandles(cmHandleQueryServiceParameters);
}
@Override
- public Flux<NcmpServiceCmHandle> executeCmHandleInventorySearch(
+ public Flux<NcmpServiceCmHandle> southboundCmHandleSearch(
final CmHandleQueryApiParameters cmHandleQueryApiParameters) {
final CmHandleQueryServiceParameters cmHandleQueryServiceParameters =
jsonObjectMapper.convertToValueType(cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class);
- validateCmHandleQueryParameters(cmHandleQueryServiceParameters, CmHandleQueryConditions.ALL_CONDITION_NAMES);
+ validateCmHandleQueryParameters(cmHandleQueryServiceParameters,
+ SouthboundCmHandleQuerySupportedConditions.CONDITION_NAMES);
return parameterizedCmHandleQueryService.queryInventoryForCmHandles(cmHandleQueryServiceParameters);
}
@Override
- public Collection<String> executeCmHandleIdSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters,
- final boolean outputAlternateId) {
- final CmHandleQueryServiceParameters cmHandleQueryServiceParameters = jsonObjectMapper.convertToValueType(
- cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class);
- validateCmHandleQueryParameters(cmHandleQueryServiceParameters, CmHandleQueryConditions.ALL_CONDITION_NAMES);
- return parameterizedCmHandleQueryService.queryCmHandleReferenceIds(cmHandleQueryServiceParameters,
+ public Collection<String> southboundCmHandleIdSearch(
+ final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) {
+ validateCmHandleQueryParameters(cmHandleQueryServiceParameters,
+ SouthboundCmHandleQuerySupportedConditions.CONDITION_NAMES);
+ return parameterizedCmHandleQueryService.queryCmHandleIdsForInventory(cmHandleQueryServiceParameters,
outputAlternateId);
}
import static org.onap.cps.ncmp.impl.inventory.CmHandleQueryParametersValidator.validateCpsPathConditionProperties;
import static org.onap.cps.ncmp.impl.inventory.CmHandleQueryParametersValidator.validateModuleNameConditionProperties;
-import static org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions.HAS_ALL_MODULES;
-import static org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions.HAS_ALL_PROPERTIES;
-import static org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions.WITH_CPS_PATH;
-import static org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions.WITH_TRUST_LEVEL;
+import static org.onap.cps.ncmp.impl.inventory.models.NorthboundCmHandleQuerySupportedConditions.HAS_ALL_MODULES;
+import static org.onap.cps.ncmp.impl.inventory.models.NorthboundCmHandleQuerySupportedConditions.HAS_ALL_PROPERTIES;
+import static org.onap.cps.ncmp.impl.inventory.models.NorthboundCmHandleQuerySupportedConditions.WITH_CPS_PATH;
+import static org.onap.cps.ncmp.impl.inventory.models.NorthboundCmHandleQuerySupportedConditions.WITH_TRUST_LEVEL;
import java.util.ArrayList;
import java.util.Collection;
import org.onap.cps.cpspath.parser.PathParsingException;
import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters;
import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle;
-import org.onap.cps.ncmp.impl.inventory.models.InventoryQueryConditions;
import org.onap.cps.ncmp.impl.inventory.models.PropertyType;
+import org.onap.cps.ncmp.impl.inventory.models.SouthboundCmHandleQuerySupportedConditions;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
import org.onap.cps.ncmp.impl.inventory.trustlevel.TrustLevelManager;
import org.onap.cps.ncmp.impl.utils.YangDataConverter;
final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) {
final Map<String, String> dmiPropertyQueryPairs =
getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(),
- InventoryQueryConditions.CM_HANDLE_WITH_DMI_PLUGIN.getName());
+ SouthboundCmHandleQuerySupportedConditions.WITH_DMI_SERVICE.getConditionName());
if (dmiPropertyQueryPairs.isEmpty()) {
return NO_QUERY_TO_EXECUTE;
}
final Map<String, String> additionalPropertyQueryPairs =
getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(),
- InventoryQueryConditions.HAS_ALL_ADDITIONAL_PROPERTIES.getName());
+ SouthboundCmHandleQuerySupportedConditions.HAS_ALL_ADDITIONAL_PROPERTIES.getConditionName());
if (additionalPropertyQueryPairs.isEmpty()) {
return NO_QUERY_TO_EXECUTE;
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022-2023 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 java.util.Arrays;
import java.util.Collection;
import java.util.stream.Collectors;
+import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
-public enum CmHandleQueryConditions {
- HAS_ALL_PROPERTIES("hasAllProperties"),
+@AllArgsConstructor
+
+public enum NorthboundCmHandleQuerySupportedConditions {
HAS_ALL_MODULES("hasAllModules"),
+ HAS_ALL_PROPERTIES("hasAllProperties"),
WITH_CPS_PATH("cmHandleWithCpsPath"),
- WITH_TRUST_LEVEL("cmHandleWithTrustLevel"),
- WITH_DMI_SERVICE("cmHandleWithDmiPlugin");
+ WITH_TRUST_LEVEL("cmHandleWithTrustLevel");
- public static final Collection<String> ALL_CONDITION_NAMES = Arrays.stream(CmHandleQueryConditions.values())
- .map(CmHandleQueryConditions::getConditionName).collect(Collectors.toList());
+ public static final Collection<String> CONDITION_NAMES =
+ Arrays.stream(NorthboundCmHandleQuerySupportedConditions.values())
+ .map(NorthboundCmHandleQuerySupportedConditions::getConditionName).collect(Collectors.toList());
private final String conditionName;
- CmHandleQueryConditions(final String conditionName) {
- this.conditionName = conditionName;
- }
}
/*
* ============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.
@Getter
@AllArgsConstructor
-public enum InventoryQueryConditions {
-
+public enum SouthboundCmHandleQuerySupportedConditions {
+ HAS_ALL_MODULES("hasAllModules"),
HAS_ALL_PROPERTIES("hasAllProperties"),
HAS_ALL_ADDITIONAL_PROPERTIES("hasAllAdditionalProperties"),
- CM_HANDLE_WITH_DMI_PLUGIN("cmHandleWithDmiPlugin"),
- WITH_CPS_PATH("cmHandleWithCpsPath");
+ WITH_CPS_PATH("cmHandleWithCpsPath"),
+ WITH_DMI_SERVICE("cmHandleWithDmiPlugin"),
+ WITH_TRUST_LEVEL("cmHandleWithTrustLevel");
- public static final List<String> ALL_CONDITION_NAMES = Arrays.stream(InventoryQueryConditions.values())
- .map(InventoryQueryConditions::getName).collect(Collectors.toList());
+ public static final List<String> CONDITION_NAMES =
+ Arrays.stream(SouthboundCmHandleQuerySupportedConditions.values())
+ .map(SouthboundCmHandleQuerySupportedConditions::getConditionName).collect(Collectors.toList());
- private final String name;
+ private final String conditionName;
}
1 * mockCmHandleRegistrationService.updateDmiRegistration(dmiPluginRegistration)
}
- def 'Execute cm handle reference search for inventory'() {
+ def 'Execute southbound handle reference search (dmi)'() {
given: 'a ConditionApiProperties object'
def conditionProperties = new ConditionProperties()
conditionProperties.conditionName = 'hasAllProperties'
and: 'the system returns an set of cmHandle ids'
mockParameterizedCmHandleQueryService.queryCmHandleIdsForInventory(*_) >> [ 'cmHandle1', 'cmHandle2' ]
when: 'executing the search'
- def result = objectUnderTest.executeParameterizedCmHandleIdSearch(cmHandleQueryServiceParameters, false)
+ def result = objectUnderTest.southboundCmHandleIdSearch(cmHandleQueryServiceParameters, false)
then: 'the result returns the correct 2 elements'
assert result.size() == 2
assert result.contains('cmHandle1')
'Cm Handle Reference as alternate-id' | 'some-alternate-id'
}
- def 'Execute cm handle reference search'() {
+ def 'Execute northbound cm handle reference search'() {
given: 'valid CmHandleQueryApiParameters input'
def cmHandleQueryApiParameters = new CmHandleQueryApiParameters()
def conditionApiProperties = new ConditionApiProperties()
mockParameterizedCmHandleQueryService.queryCmHandleReferenceIds(
spiedJsonObjectMapper.convertToValueType(cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class), false)
>> ['cm-handle-id-1']
- when: 'execute cm handle search is called'
- def result = objectUnderTest.executeCmHandleIdSearch(cmHandleQueryApiParameters, false)
+ when: 'cm handle id search is called'
+ def result = objectUnderTest.northboundCmHandleIdSearch(cmHandleQueryApiParameters, false)
then: 'result is the same collection as returned by the CPS Data Service'
assert result == ['cm-handle-id-1']
}
'Cm Handle Reference as alternate-id' | 'some-alternate-id'
}
- def 'Execute cm handle search'() {
+ def 'Execute northbound cm handle search'() {
given: 'valid CmHandleQueryApiParameters input'
def cmHandleQueryApiParameters = new CmHandleQueryApiParameters()
def conditionApiProperties = new ConditionApiProperties()
spiedJsonObjectMapper.convertToValueType(cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class))
>> Flux.fromIterable([new NcmpServiceCmHandle(cmHandleId: 'ch-0', currentTrustLevel: TrustLevel.COMPLETE),
new NcmpServiceCmHandle(cmHandleId: 'ch-1', currentTrustLevel: TrustLevel.COMPLETE)])
- when: 'execute cm handle search is called'
- def result = objectUnderTest.executeCmHandleSearch(cmHandleQueryApiParameters).collectList().block()
+ when: 'the cm handle search is called'
+ def result = objectUnderTest.northboundCmHandleSearch(cmHandleQueryApiParameters).collectList().block()
then: 'result consists of the two cm handles returned by the CPS Data Service'
assert result.size() == 2
assert result[0].cmHandleId == 'ch-0'
assert result[1].currentTrustLevel == TrustLevel.COMPLETE
}
- def 'Execute cm handle reference search with a valid condition name'() {
+ def 'Execute southbound cm handle reference search with a valid condition name'() {
given: 'a valid API parameter with a supported condition'
def apiParams = new CmHandleQueryApiParameters(
cmHandleQueryParameters: [
mockParameterizedCmHandleQueryService.queryInventoryForCmHandles(_)
>> Flux.fromIterable([new NcmpServiceCmHandle(cmHandleId: 'cm handle from the query service')])
when: 'executing the cm handle search'
- def result = objectUnderTest.executeCmHandleInventorySearch(apiParams).collectList().block()
+ def result = objectUnderTest.southboundCmHandleSearch(apiParams).collectList().block()
then: 'the result returns the cm handle from the query service'
assert result.size() == 1
assert result[0].cmHandleId == 'cm handle from the query service'
]
)
when: 'executing the search'
- objectUnderTest.executeCmHandleInventorySearch(apiParams).collectList().block()
+ objectUnderTest.southboundCmHandleSearch(apiParams).collectList().block()
then: 'a data validation exception will be thrown'
def exception = thrown(DataValidationException)
assert exception.message == 'Invalid Query Parameter.'
/*
* ============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 spock.lang.Specification
-class CmHandleQueryConditionsSpec extends Specification {
+class NorthboundCmHandleQuerySupportedConditionsSpec extends Specification {
- def 'CmHandle query condition names.'() {
- expect: '5 conditions with the correct names'
- assert CmHandleQueryConditions.ALL_CONDITION_NAMES.size() == 5
- assert CmHandleQueryConditions.ALL_CONDITION_NAMES.containsAll('hasAllProperties',
+ def 'Northbound cm handle query condition names.'() {
+ expect: '4 conditions with the correct names'
+ assert NorthboundCmHandleQuerySupportedConditions.CONDITION_NAMES.size() == 4
+ assert NorthboundCmHandleQuerySupportedConditions.CONDITION_NAMES.containsAll('hasAllProperties',
'hasAllModules',
'cmHandleWithCpsPath',
- 'cmHandleWithDmiPlugin',
- 'cmHandleWithTrustLevel')
+ 'cmHandleWithTrustLevel')
}
}
/*
* ============LICENSE_START========================================================
- * Copyright (c) 2022-2024 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 spock.lang.Specification
-class InventoryQueryConditionsSpec extends Specification {
+class SouthboundCmHandleQuerySupportedConditionsSpec extends Specification {
- def 'Inventory query condition names.'() {
- expect: '4 conditions with the correct names'
- assert InventoryQueryConditions.ALL_CONDITION_NAMES.size() == 4
- assert InventoryQueryConditions.ALL_CONDITION_NAMES.containsAll('hasAllProperties',
+ def 'Southbound cm handle query condition names.'() {
+ expect: '6 conditions with the correct names'
+ assert SouthboundCmHandleQuerySupportedConditions.CONDITION_NAMES.size() == 6
+ assert SouthboundCmHandleQuerySupportedConditions.CONDITION_NAMES.containsAll('hasAllModules',
+ 'hasAllProperties',
'hasAllAdditionalProperties',
+ 'cmHandleWithCpsPath',
'cmHandleWithDmiPlugin',
- 'cmHandleWithCpsPath')
+ 'cmHandleWithTrustLevel')
}
}