From 9060818e7974ca09a06b715533161876b94fde84 Mon Sep 17 00:00:00 2001 From: seanbeirne Date: Wed, 20 Nov 2024 11:00:49 +0000 Subject: Update error response for ncmp endpoints Issue-ID: CPS-2386 Change-Id: I0d1f09cff202e055be255b365fc2271a5ee43b37 Signed-off-by: seanbeirne --- cps-ncmp-rest/docs/openapi/components.yaml | 2 +- cps-ncmp-rest/docs/openapi/ncmp.yml | 2 +- .../NetworkCmProxyRestExceptionHandler.java | 5 +-- .../org/onap/cps/ncmp/api/NcmpResponseStatus.java | 4 +-- .../api/exceptions/CmHandleNotFoundException.java | 38 ++++++++++++++++++++++ .../inventory/NetworkCmProxyInventoryFacade.java | 6 ++-- .../ncmp/impl/inventory/CmHandleQueryService.java | 4 +-- .../ncmp/impl/inventory/InventoryPersistence.java | 6 ++-- .../impl/inventory/InventoryPersistenceImpl.java | 8 ++--- .../cps/ncmp/impl/utils/AlternateIdMatcher.java | 4 +-- ...leRegistrationServicePropertyHandlerSpec.groovy | 6 ++-- .../CmHandleRegistrationServiceSpec.groovy | 8 ++--- .../inventory/InventoryPersistenceImplSpec.groovy | 7 ++-- .../ncmp/impl/utils/AlternateIdMatcherSpec.groovy | 4 +-- .../test/resources/dataOperationResponseEvent.json | 2 +- docs/api/swagger/ncmp/openapi-inventory.yaml | 6 ++-- docs/api/swagger/ncmp/openapi.yaml | 12 +++---- 17 files changed, 82 insertions(+), 42 deletions(-) create mode 100644 cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/exceptions/CmHandleNotFoundException.java diff --git a/cps-ncmp-rest/docs/openapi/components.yaml b/cps-ncmp-rest/docs/openapi/components.yaml index e564c6b0cf..637a1386f4 100644 --- a/cps-ncmp-rest/docs/openapi/components.yaml +++ b/cps-ncmp-rest/docs/openapi/components.yaml @@ -516,7 +516,7 @@ components: outputAlternateIdOptionInQuery: name: outputAlternateId in: query - description: Boolean parameter to determine if returned value(s) will be cm handle Ids or alternate Ids for a given query + description: Boolean parameter to determine if returned value(s) will be cm handle ids or alternate ids for a given query required: false schema: type: boolean diff --git a/cps-ncmp-rest/docs/openapi/ncmp.yml b/cps-ncmp-rest/docs/openapi/ncmp.yml index 4624bc1060..15b8b37231 100755 --- a/cps-ncmp-rest/docs/openapi/ncmp.yml +++ b/cps-ncmp-rest/docs/openapi/ncmp.yml @@ -417,7 +417,7 @@ getCmHandleStateById: searchCmHandleIds: post: - description: Execute cm handle query search and return a list of cm handle references. Any number of conditions can be applied. To be included in the result a cm-handle must fulfill ALL the conditions. An empty collection will be returned in the case that the cm handle does not match a condition. For more on cm handle query search please refer to cm handle query search Read the Docs.
By supplying a CPS Path it is possible to query on any data related to the cm handle. For more on CPS Path please refer to CPS Path Read the Docs. The cm handle ancestor is automatically returned for this query. + description: Execute cm handle query search and return a list of cm handle references. Any number of conditions can be applied. To be included in the result a cm handle must fulfill ALL the conditions. An empty collection will be returned in the case that the cm handle does not match a condition. For more on cm handle query search please refer to cm handle query search Read the Docs.
By supplying a CPS Path it is possible to query on any data related to the cm handle. For more on CPS Path please refer to CPS Path Read the Docs. The cm handle ancestor is automatically returned for this query. tags: - network-cm-proxy summary: Execute cm handle query upon a given set of query parameters diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyRestExceptionHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyRestExceptionHandler.java index 6910003c54..7255743c67 100644 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyRestExceptionHandler.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyRestExceptionHandler.java @@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j; import org.onap.cps.ncmp.api.data.exceptions.InvalidDatastoreException; import org.onap.cps.ncmp.api.data.exceptions.InvalidOperationException; import org.onap.cps.ncmp.api.data.exceptions.OperationNotSupportedException; +import org.onap.cps.ncmp.api.exceptions.CmHandleNotFoundException; import org.onap.cps.ncmp.api.exceptions.DmiClientRequestException; import org.onap.cps.ncmp.api.exceptions.DmiRequestException; import org.onap.cps.ncmp.api.exceptions.InvalidTopicException; @@ -90,8 +91,8 @@ public class NetworkCmProxyRestExceptionHandler { return buildErrorResponse(HttpStatus.CONFLICT, exception); } - @ExceptionHandler({DataNodeNotFoundException.class}) - public static ResponseEntity handleNotFoundExceptions(final Exception exception) { + @ExceptionHandler({CmHandleNotFoundException.class, DataNodeNotFoundException.class}) + public static ResponseEntity cmHandleNotFoundExceptions(final Exception exception) { return buildErrorResponse(HttpStatus.NOT_FOUND, exception); } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpResponseStatus.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpResponseStatus.java index 8cfad7dbf6..be22752882 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpResponseStatus.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpResponseStatus.java @@ -27,14 +27,14 @@ public enum NcmpResponseStatus { SUCCESS("0", "Successfully applied changes"), CM_DATA_SUBSCRIPTION_ACCEPTED("1", "ACCEPTED"), - CM_HANDLES_NOT_FOUND("100", "cm handle id(s) not found"), + CM_HANDLES_NOT_FOUND("100", "cm handle reference(s) not found"), CM_HANDLES_NOT_READY("101", "cm handle(s) not ready"), DMI_SERVICE_NOT_RESPONDING("102", "dmi plugin service is not responding"), UNABLE_TO_READ_RESOURCE_DATA("103", "dmi plugin service is not able to read resource data"), CM_DATA_SUBSCRIPTION_REJECTED("104", "REJECTED"), UNKNOWN_ERROR("108", "Unknown error"), CM_HANDLE_ALREADY_EXIST("109", "cm-handle already exists"), - CM_HANDLE_INVALID_ID("110", "cm-handle has an invalid character(s) in id"), + CM_HANDLE_INVALID_ID("110", "cm handle reference has an invalid character(s) in id"), ALTERNATE_ID_ALREADY_ASSOCIATED("111", "alternate id already associated"), MESSAGE_TOO_LARGE("112", "message too large"); diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/exceptions/CmHandleNotFoundException.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/exceptions/CmHandleNotFoundException.java new file mode 100644 index 0000000000..715e1a00db --- /dev/null +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/exceptions/CmHandleNotFoundException.java @@ -0,0 +1,38 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.ncmp.api.exceptions; + +public class CmHandleNotFoundException extends NcmpException { + + private static final String CM_HANDLE_NOT_FOUND_DETAILS_FORMAT = + "No cm handles found with reference %s"; + + /** + * Constructor. + * + * @param cmHandleReference cm handle reference either cm handle id or alternate id + */ + public CmHandleNotFoundException(final String cmHandleReference) { + super("Cm handle not found", String.format(CM_HANDLE_NOT_FOUND_DETAILS_FORMAT, + cmHandleReference)); + } + +} diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java index a8996874ff..f0547d3d24 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java @@ -78,7 +78,7 @@ public class NetworkCmProxyInventoryFacade { * Get all cm handle references by DMI plugin identifier. * * @param dmiPluginIdentifier DMI plugin identifier - * @param outputAlternateId Boolean for cm handle reference type either + * @param outputAlternateId boolean for cm handle reference type either * cm handle id (false) or alternate id (true) * @return collection of cm handle references */ @@ -91,7 +91,7 @@ public class NetworkCmProxyInventoryFacade { * Get all cm handle IDs by various properties. * * @param cmHandleQueryServiceParameters cm handle query parameters - * @param outputAlternateId Boolean for cm handle reference type either + * @param outputAlternateId boolean for cm handle reference type either * cm handle id (false) or alternate id (true) * @return collection of cm handle references */ @@ -162,7 +162,7 @@ public class NetworkCmProxyInventoryFacade { * Retrieve cm handle ids for the given query parameters. * * @param cmHandleQueryApiParameters cm handle query parameters - * @param outputAlternateId Boolean for cm handle reference type either cmHandleId (false) or AlternateId (true) + * @param outputAlternateId boolean for cm handle reference type either cmHandleId (false) or AlternateId (true) * @return cm handle ids */ public Collection executeCmHandleIdSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters, diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java index 74c04928ed..415153ddf7 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java @@ -103,8 +103,8 @@ public interface CmHandleQueryService { * Get collection of all cm handles references by DMI plugin identifier and alternate id output option. * * @param dmiPluginIdentifier DMI plugin identifier - * @param outputAlternateId Boolean for cm handle reference type either cmHandleId (false) or AlternateId (true) - * @return collection of cm handle ids + * @param outputAlternateId boolean for cm handle reference type either cmHandleId (false) or AlternateId (true) + * @return collection of cm handle references */ Collection getCmHandleReferencesByDmiPluginIdentifier(String dmiPluginIdentifier, boolean outputAlternateId); diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java index 61d7df923e..e5dd937cc0 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java @@ -157,12 +157,12 @@ public interface InventoryPersistence extends NcmpPersistence { * get CM handles that has given module names. * * @param moduleNamesForQuery module names - * @param outputAlternateIds Boolean for cm handle reference type either + * @param outputAlternateId boolean for cm handle reference type either * cm handle id (false or null) or alternate id (true) - * @return Collection of CM handle Ids + * @return Collection of CM handle references */ Collection getCmHandleReferencesWithGivenModules(Collection moduleNamesForQuery, - boolean outputAlternateIds); + boolean outputAlternateId); /** * Check database if cm handle id exists if not return false. diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java index c4765ff53d..e468ed100a 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java @@ -40,6 +40,7 @@ import org.onap.cps.api.CpsAnchorService; import org.onap.cps.api.CpsDataService; import org.onap.cps.api.CpsModuleService; import org.onap.cps.impl.utils.CpsValidator; +import org.onap.cps.ncmp.api.exceptions.CmHandleNotFoundException; import org.onap.cps.ncmp.api.inventory.models.CompositeState; import org.onap.cps.ncmp.api.inventory.models.CompositeStateBuilder; import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle; @@ -193,8 +194,7 @@ public class InventoryPersistenceImpl extends NcmpPersistenceImpl implements Inv final Collection dataNodes = cmHandleQueryService .queryNcmpRegistryByCpsPath(cpsPathForCmHandleByAlternateId, OMIT_DESCENDANTS); if (dataNodes.isEmpty()) { - throw new DataNodeNotFoundException(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, - cpsPathForCmHandleByAlternateId); + throw new CmHandleNotFoundException(alternateId); } return dataNodes.iterator().next(); } @@ -218,8 +218,8 @@ public class InventoryPersistenceImpl extends NcmpPersistenceImpl implements Inv @Override public Collection getCmHandleReferencesWithGivenModules(final Collection moduleNamesForQuery, - final boolean outputAlternateIds) { - if (outputAlternateIds) { + final boolean outputAlternateId) { + if (outputAlternateId) { final Collection cmHandleIds = cpsAnchorService.queryAnchorNames(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME, moduleNamesForQuery); return getAlternateIdsFromDataNodes(getCmHandleDataNodes(cmHandleIds)); diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/AlternateIdMatcher.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/AlternateIdMatcher.java index 9facd630a2..36c0cfa756 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/AlternateIdMatcher.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/AlternateIdMatcher.java @@ -23,9 +23,9 @@ package org.onap.cps.ncmp.impl.utils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.onap.cps.ncmp.api.exceptions.CmHandleNotFoundException; import org.onap.cps.ncmp.exceptions.NoAlternateIdMatchFoundException; import org.onap.cps.ncmp.impl.inventory.InventoryPersistence; -import org.onap.cps.spi.exceptions.DataNodeNotFoundException; import org.onap.cps.spi.model.DataNode; import org.springframework.stereotype.Service; @@ -50,7 +50,7 @@ public class AlternateIdMatcher { while (StringUtils.isNotEmpty(bestMatch)) { try { return inventoryPersistence.getCmHandleDataNodeByAlternateId(bestMatch); - } catch (final DataNodeNotFoundException ignored) { + } catch (final CmHandleNotFoundException ignored) { bestMatch = getParentPath(bestMatch, separator); } } diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationServicePropertyHandlerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationServicePropertyHandlerSpec.groovy index 1beab20def..6213258303 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationServicePropertyHandlerSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationServicePropertyHandlerSpec.groovy @@ -162,9 +162,9 @@ class CmHandleRegistrationServicePropertyHandlerSpec extends Specification { } where: scenario | cmHandleId | exception || expectedError | expectedErrorText - 'Cm Handle does not exist' | 'cmHandleId' | new DataNodeNotFoundException(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR) || CM_HANDLES_NOT_FOUND | 'cm handle id(s) not found' + 'Cm Handle does not exist' | 'cmHandleId' | new DataNodeNotFoundException(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR) || CM_HANDLES_NOT_FOUND | 'cm handle reference(s) not found' 'Unknown' | 'cmHandleId' | new RuntimeException('Failed') || UNKNOWN_ERROR | 'Failed' - 'Invalid cm handle id' | 'cmHandleId with spaces' | new DataValidationException('Name Validation Error.', cmHandleId + 'contains an invalid character') || CM_HANDLE_INVALID_ID | 'cm-handle has an invalid character(s) in id' + 'Invalid cm handle id' | 'cmHandleId with spaces' | new DataValidationException('Name Validation Error.', cmHandleId + 'contains an invalid character') || CM_HANDLE_INVALID_ID | 'cm handle reference has an invalid character(s) in id' } def 'Multiple update operations in a single request'() { @@ -193,7 +193,7 @@ class CmHandleRegistrationServicePropertyHandlerSpec extends Specification { assert it.status == Status.FAILURE assert it.cmHandle == cmHandleId assert it.ncmpResponseStatus == CM_HANDLES_NOT_FOUND - assert it.errorText == 'cm handle id(s) not found' + assert it.errorText == 'cm handle reference(s) not found' } then: 'the replace list method is called twice' 2 * mockInventoryPersistence.replaceListContent(cmHandleXpath, _) diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationServiceSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationServiceSpec.groovy index 70e26d993c..a69721b6aa 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationServiceSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationServiceSpec.groovy @@ -399,10 +399,10 @@ class CmHandleRegistrationServiceSpec extends Specification { and: 'the cm handle state is not updated to "DELETED"' 0 * mockLcmEventsCmHandleStateHandler.updateCmHandleStateBatch(_, CmHandleState.DELETED) where: - scenario | cmHandleId | deleteListElementException || expectedError | expectedErrorText - 'cm-handle does not exist' | 'cmhandle' | new DataNodeNotFoundException('', '', '') || CM_HANDLES_NOT_FOUND | 'cm handle id(s) not found' - 'cm-handle has invalid name' | 'cm handle with space' | new DataValidationException('', '') || CM_HANDLE_INVALID_ID | 'cm-handle has an invalid character(s) in id' - 'an unexpected exception' | 'cmhandle' | new RuntimeException('Failed') || UNKNOWN_ERROR | 'Failed' + scenario | deleteListElementException || expectedError | expectedErrorText + 'cm-handle does not exist' | new DataNodeNotFoundException('', '', '') || CM_HANDLES_NOT_FOUND | 'cm handle reference(s) not found' + 'cm-handle has invalid name' | new DataValidationException('', '') || CM_HANDLE_INVALID_ID | 'cm handle reference has an invalid character(s) in id' + 'an unexpected exception' | new RuntimeException('Failed') || UNKNOWN_ERROR | 'Failed' } def 'Set Cm Handle Data Sync Enabled Flag where data sync flag is #scenario'() { diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy index 00f092ff75..4d8855c4b2 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy @@ -27,12 +27,12 @@ import org.onap.cps.api.CpsAnchorService import org.onap.cps.api.CpsDataService import org.onap.cps.api.CpsModuleService import org.onap.cps.impl.utils.CpsValidator +import org.onap.cps.ncmp.api.exceptions.CmHandleNotFoundException import org.onap.cps.ncmp.api.inventory.models.CompositeState import org.onap.cps.ncmp.impl.inventory.models.CmHandleState import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle import org.onap.cps.spi.CascadeDeleteAllowed import org.onap.cps.spi.FetchDescendantsOption -import org.onap.cps.spi.exceptions.DataNodeNotFoundException import org.onap.cps.spi.model.DataNode import org.onap.cps.spi.model.ModuleDefinition import org.onap.cps.spi.model.ModuleReference @@ -327,8 +327,9 @@ class InventoryPersistenceImplSpec extends Specification { when: 'getting the cm handle data node' objectUnderTest.getCmHandleDataNodeByAlternateId('alternate id') then: 'no data found exception thrown' - def thrownException = thrown(DataNodeNotFoundException) - assert thrownException.getMessage().contains('DataNode not found') + def thrownException = thrown(CmHandleNotFoundException) + assert thrownException.getMessage().contains('Cm handle not found') + assert thrownException.getDetails().contains('No cm handles found with reference alternate id') } def 'Get multiple cm handle data nodes by alternate ids, passing empty collection'() { diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/utils/AlternateIdMatcherSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/utils/AlternateIdMatcherSpec.groovy index bd1faa2705..0a58039d8a 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/utils/AlternateIdMatcherSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/utils/AlternateIdMatcherSpec.groovy @@ -20,9 +20,9 @@ package org.onap.cps.ncmp.impl.utils +import org.onap.cps.ncmp.api.exceptions.CmHandleNotFoundException import org.onap.cps.ncmp.exceptions.NoAlternateIdMatchFoundException import org.onap.cps.ncmp.impl.inventory.InventoryPersistence -import org.onap.cps.spi.exceptions.DataNodeNotFoundException import org.onap.cps.spi.model.DataNode import spock.lang.Specification @@ -35,7 +35,7 @@ class AlternateIdMatcherSpec extends Specification { given: 'cm handle in the registry with alternate id /a/b' mockInventoryPersistence.getCmHandleDataNodeByAlternateId('/a/b') >> new DataNode() and: 'no other cm handle' - mockInventoryPersistence.getCmHandleDataNodeByAlternateId(_) >> { throw new DataNodeNotFoundException('', '') } + mockInventoryPersistence.getCmHandleDataNodeByAlternateId(_) >> { throw new CmHandleNotFoundException('') } } def 'Finding longest alternate id matches.'() { diff --git a/cps-ncmp-service/src/test/resources/dataOperationResponseEvent.json b/cps-ncmp-service/src/test/resources/dataOperationResponseEvent.json index 611d47d1a3..827250f5fd 100644 --- a/cps-ncmp-service/src/test/resources/dataOperationResponseEvent.json +++ b/cps-ncmp-service/src/test/resources/dataOperationResponseEvent.json @@ -1 +1 @@ -[{"operationId":"operational-14","ids":["unknown-cm-handle"],"resourceIdentifier":"some resource identifier","options":"some option","statusCode":"100","statusMessage":"cm handle id(s) not found"},{"operationId":"operational-14","ids":["non-ready-cm-handle"],"resourceIdentifier":"some resource identifier","options":"some option","statusCode":"101","statusMessage":"cm handle(s) not ready"},{"operationId":"running-12","ids":["non-ready-cm-handle"],"resourceIdentifier":"some resource identifier","options":"some option","statusCode":"101","statusMessage":"cm handle(s) not ready"}] \ No newline at end of file +[{"operationId":"operational-14","ids":["unknown-cm-handle"],"resourceIdentifier":"some resource identifier","options":"some option","statusCode":"100","statusMessage":"cm handle reference(s) not found"},{"operationId":"operational-14","ids":["non-ready-cm-handle"],"resourceIdentifier":"some resource identifier","options":"some option","statusCode":"101","statusMessage":"cm handle(s) not ready"},{"operationId":"running-12","ids":["non-ready-cm-handle"],"resourceIdentifier":"some resource identifier","options":"some option","statusCode":"101","statusMessage":"cm handle(s) not ready"}] \ No newline at end of file diff --git a/docs/api/swagger/ncmp/openapi-inventory.yaml b/docs/api/swagger/ncmp/openapi-inventory.yaml index d358719a4b..ab83ed2ae6 100644 --- a/docs/api/swagger/ncmp/openapi-inventory.yaml +++ b/docs/api/swagger/ncmp/openapi-inventory.yaml @@ -97,7 +97,7 @@ paths: example: my-dmi-plugin type: string - description: Boolean parameter to determine if returned value(s) will be cm - handle Ids or alternate Ids for a given query + handle ids or alternate ids for a given query in: query name: outputAlternateId required: false @@ -145,7 +145,7 @@ paths: operationId: searchCmHandleIds parameters: - description: Boolean parameter to determine if returned value(s) will be cm - handle Ids or alternate Ids for a given query + handle ids or alternate ids for a given query in: query name: outputAlternateId required: false @@ -202,7 +202,7 @@ components: type: string outputAlternateIdOptionInQuery: description: Boolean parameter to determine if returned value(s) will be cm - handle Ids or alternate Ids for a given query + handle ids or alternate ids for a given query in: query name: outputAlternateId required: false diff --git a/docs/api/swagger/ncmp/openapi.yaml b/docs/api/swagger/ncmp/openapi.yaml index aa84e432e9..e7256c0836 100644 --- a/docs/api/swagger/ncmp/openapi.yaml +++ b/docs/api/swagger/ncmp/openapi.yaml @@ -1130,10 +1130,10 @@ paths: /v1/ch/id-searches: post: description: Execute cm handle query search and return a list of cm handle references. - Any number of conditions can be applied. To be included in the result a cm-handle - must fulfill ALL the conditions. An empty collection will be returned in the - case that the cm handle does not match a condition. For more on cm handle - query search please refer to cm + Any number of conditions can be applied. To be included in the result a cm + handle must fulfill ALL the conditions. An empty collection will be returned + in the case that the cm handle does not match a condition. For more on cm + handle query search please refer to cm handle query search Read the Docs.
By supplying a CPS Path it is possible to query on any data related to the cm handle. For more on CPS Path please refer to CPS @@ -1142,7 +1142,7 @@ paths: operationId: searchCmHandleIds parameters: - description: Boolean parameter to determine if returned value(s) will be cm - handle Ids or alternate Ids for a given query + handle ids or alternate ids for a given query in: query name: outputAlternateId required: false @@ -1619,7 +1619,7 @@ components: type: string outputAlternateIdOptionInQuery: description: Boolean parameter to determine if returned value(s) will be cm - handle Ids or alternate Ids for a given query + handle ids or alternate ids for a given query in: query name: outputAlternateId required: false -- cgit 1.2.3-korg