From 313133cf34008be43f6af432c1a11570f6c52d63 Mon Sep 17 00:00:00 2001 From: ToineSiebelink Date: Tue, 9 Sep 2025 12:46:29 +0100 Subject: [PATCH] Last inspect on all modules - Mainly focussed on spelling mistakes (e.g. schema set instead of schemaset) - Removed some unused code (overloaded but unused interface methods) - spelling issues resolve in many timed method (names) by adding full stops. I think this only affects Graphana dashboards etc and should be OK - Changed timeformat descriptions to say just "ISO standard format" - Fixed latest SonarQube warnings (removed test from MultiPartFileUtilSpec as the scenarios are correctly unit-tested in ZipFileSizeValidatorSpec) Issue-ID:CPS-2941 Change-Id: Ia654be16881b65b21522a554d6a70a3b38a6379e Signed-off-by: ToineSiebelink --- .../cps-data-updated-event-schema-1.0.0.json | 2 +- ...dmi-async-request-response-event-schema-v1.json | 2 +- ...cmp-async-request-response-event-schema-v1.json | 8 +++---- .../rest/controller/NetworkCmProxyController.java | 2 +- .../ncmp/api/inventory/models/CompositeState.java | 1 - .../onap/cps/ncmp/init/InventoryModelLoader.java | 1 - cps-parent/pom.xml | 4 ++-- cps-rest/docs/openapi/components.yml | 4 ++-- .../cps/rest/controller/AdminRestController.java | 12 +++++----- .../cps/rest/controller/DataRestController.java | 13 +++++------ .../onap/cps/rest/utils/ZipFileSizeValidator.java | 7 +++--- .../cps/rest/utils/MultipartFileUtilSpec.groovy | 26 ---------------------- .../cps/ri/CpsAdminPersistenceServiceImpl.java | 2 +- .../onap/cps/ri/CpsDataPersistenceServiceImpl.java | 23 +++---------------- .../cps/ri/CpsModulePersistenceServiceImpl.java | 8 +++---- .../FragmentRepositoryCpsPathQueryImpl.java | 1 + .../org/onap/cps/aop/CpsLoggingAspectService.java | 2 +- .../main/java/org/onap/cps/api/CpsDataService.java | 8 +++---- .../java/org/onap/cps/api/CpsQueryService.java | 15 +------------ .../api/exceptions/DataspaceInUseException.java | 2 +- .../cps/events/CpsDataUpdateEventsProducer.java | 2 +- .../java/org/onap/cps/impl/CpsDataServiceImpl.java | 6 ++--- .../org/onap/cps/impl/CpsModuleServiceImpl.java | 4 ++-- .../org/onap/cps/impl/CpsQueryServiceImpl.java | 11 ++------- .../cps/impl/YangTextSchemaSourceSetCache.java | 2 +- .../org/onap/cps/init/AbstractModelLoader.java | 6 ++--- .../CpsNotificationSubscriptionModelLoader.java | 6 ++--- .../onap/cps/spi/CpsAdminPersistenceService.java | 2 +- .../onap/cps/spi/CpsDataPersistenceService.java | 24 +++++--------------- .../java/org/onap/cps/utils/DateTimeUtility.java | 3 +-- .../cps/utils/RestConfStylePathToCpsPathUtil.java | 4 ++-- .../main/java/org/onap/cps/utils/YangParser.java | 10 ++++----- .../main/java/org/onap/cps/utils/YangUtils.java | 2 +- .../yang/TimedYangTextSchemaSourceSetBuilder.java | 2 +- .../cps/yang/YangTextSchemaSourceSetBuilder.java | 2 +- .../onap/cps/impl/CpsQueryServiceImplSpec.groovy | 2 +- docs/api/swagger/cps/openapi.yaml | 4 ++-- .../cps/DataspaceServiceIntegrationSpec.groovy | 4 ++-- .../cps/QueryServiceIntegrationSpec.groovy | 12 ---------- .../ModuleSyncWatchdogIntegrationSpec.groovy | 2 +- test-tools/subtract-metrics-reports.py | 12 +++++----- 41 files changed, 86 insertions(+), 179 deletions(-) diff --git a/cps-events/src/main/resources/schemas/cps.dataupdated/cps-data-updated-event-schema-1.0.0.json b/cps-events/src/main/resources/schemas/cps.dataupdated/cps-data-updated-event-schema-1.0.0.json index a3eaf63fa4..b4171e69a3 100644 --- a/cps-events/src/main/resources/schemas/cps.dataupdated/cps-data-updated-event-schema-1.0.0.json +++ b/cps-events/src/main/resources/schemas/cps.dataupdated/cps-data-updated-event-schema-1.0.0.json @@ -12,7 +12,7 @@ "type": "object", "properties": { "observedTimestamp": { - "description": "The timestamp when the data has been observed. The expected format is 'yyyy-MM-dd'T'HH:mm:ss.SSSZ'. Ex: '2024-02-12T09:35:46.143+0530' ", + "description": "The timestamp when the data has been observed in ISO format", "type": "string" }, "dataspaceName": { diff --git a/cps-ncmp-events/src/main/resources/schemas/ncmp/async-m2m/dmi-async-request-response-event-schema-v1.json b/cps-ncmp-events/src/main/resources/schemas/ncmp/async-m2m/dmi-async-request-response-event-schema-v1.json index 4db07bec95..5668acb193 100644 --- a/cps-ncmp-events/src/main/resources/schemas/ncmp/async-m2m/dmi-async-request-response-event-schema-v1.json +++ b/cps-ncmp-events/src/main/resources/schemas/ncmp/async-m2m/dmi-async-request-response-event-schema-v1.json @@ -17,7 +17,7 @@ "type": "string" }, "eventTime": { - "description": "The time of the event. The expected format is 'yyyy-MM-dd'T'HH:mm:ss.SSSZ'.", + "description": "The time of the event in ISO format.", "type": "string" }, "eventTarget": { diff --git a/cps-ncmp-events/src/main/resources/schemas/ncmp/async-m2m/ncmp-async-request-response-event-schema-v1.json b/cps-ncmp-events/src/main/resources/schemas/ncmp/async-m2m/ncmp-async-request-response-event-schema-v1.json index 32b7becd05..cb10f75882 100644 --- a/cps-ncmp-events/src/main/resources/schemas/ncmp/async-m2m/ncmp-async-request-response-event-schema-v1.json +++ b/cps-ncmp-events/src/main/resources/schemas/ncmp/async-m2m/ncmp-async-request-response-event-schema-v1.json @@ -17,7 +17,7 @@ "type": "string" }, "eventTime": { - "description": "The time of the event. The expected format is 'yyyy-MM-dd'T'HH:mm:ss.SSSZ'.", + "description": "The time of the event in ISO format.", "type": "string" }, "eventTarget": { @@ -66,7 +66,7 @@ "type": "string" }, "eventTime": { - "description": "The time of the event. The expected format is 'yyyy-MM-dd'T'HH:mm:ss.SSSZ'.", + "description": "The time of the event in ISO format.", "type": "string" }, "eventTarget": { @@ -139,7 +139,7 @@ "type": "string" }, "eventTime": { - "description": "The time of the event. The expected format is 'yyyy-MM-dd'T'HH:mm:ss.SSSZ'.", + "description": "The time of the event in ISO format.", "type": "string" }, "eventTarget": { @@ -195,4 +195,4 @@ } } } -} \ No newline at end of file +} diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java index 7977991476..2110e6f10b 100644 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java @@ -325,7 +325,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { } /** - * Get Cm Handle State by Cm Handle Id. + * Get Cm Handle State by Cm Handle id. * * @param cmHandleReference cm-handle or alternate identifier * @return cm handle state diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/CompositeState.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/CompositeState.java index bef06ade86..55d44afd32 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/CompositeState.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/CompositeState.java @@ -55,7 +55,6 @@ public class CompositeState { @JsonProperty("datastores") private DataStores dataStores; - /** * Composite State copy constructor. * diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/InventoryModelLoader.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/InventoryModelLoader.java index a9d4b7364a..fe8e10ae86 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/InventoryModelLoader.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/InventoryModelLoader.java @@ -106,7 +106,6 @@ public class InventoryModelLoader extends AbstractModelLoader { } private void performInventoryDataMigration() { - // TODO further implementation is pending //1. Load all the cm handles (in batch) //2. Copy the state and known properties log.info("Inventory module data migration is completed successfully."); diff --git a/cps-parent/pom.xml b/cps-parent/pom.xml index 31bb0b4557..b41d8b9faf 100644 --- a/cps-parent/pom.xml +++ b/cps-parent/pom.xml @@ -428,7 +428,7 @@ @@ -532,4 +532,4 @@ - \ No newline at end of file + diff --git a/cps-rest/docs/openapi/components.yml b/cps-rest/docs/openapi/components.yml index e151706dc0..93c25842d5 100644 --- a/cps-rest/docs/openapi/components.yml +++ b/cps-rest/docs/openapi/components.yml @@ -91,7 +91,7 @@ components: SchemaSetDetails: type: object - title: Schema set details by dataspace and schemasetName + title: Schema set details by dataspace and schema set name required: - "moduleReferences" properties: @@ -265,7 +265,7 @@ components: xpath: "/bookstore/categories/[@code=3]" target-data: code: 3, - name: "kidz" + name: "kids" - action: "remove" xpath: "/bookstore/categories/[@code=1]" source-data: diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java index f1215ba305..ca7d374949 100755 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java @@ -104,7 +104,7 @@ public class AdminRestController implements CpsAdminApi { * Create a {@link SchemaSet}. * * @param dataspaceName dataspace name - * @param schemaSetName schemaset name + * @param schemaSetName schema set name * @param multipartFile multipart file * @return a { {@code @Link} ResponseEntity } of created schemaset name & {@link HttpStatus} CREATED */ @@ -120,14 +120,14 @@ public class AdminRestController implements CpsAdminApi { * Create a {@link SchemaSet}. * * @param dataspaceName dataspace name - * @param schemaSetName schemaset name + * @param schemaSetName schema set name * @param multipartFile multipart file * @return a { {@code @Link} ResponseEntity } of created schema set * without any response body & {@link HttpStatus} CREATED */ @Override - @Timed(value = "cps.rest.admin.controller.schemaset.create", - description = "Time taken to create schemaset from controller") + @Timed(value = "cps.rest.admin.controller.schema.create", + description = "Time taken to create schema set from controller") public ResponseEntity createSchemaSetV2(final String dataspaceName, @NotNull @Valid final String schemaSetName, final MultipartFile multipartFile) { @@ -140,7 +140,7 @@ public class AdminRestController implements CpsAdminApi { * * @param apiVersion api version * @param dataspaceName dataspace name - * @param schemaSetName schemaset name + * @param schemaSetName schema set name * @return a { {@code @Link} ResponseEntity } of { {@code @Link} SchemaSetDetails } & {@link HttpStatus} OK */ @Override @@ -167,7 +167,7 @@ public class AdminRestController implements CpsAdminApi { } /** - * Delete a {@link SchemaSet} based on given dataspace name & schemaset name. + * Delete a {@link SchemaSet} based on given dataspace name & schema set name. * * @param apiVersion api version * @param dataspaceName dataspace name diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java index 103ed695fd..9ba46918c2 100755 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java @@ -50,8 +50,8 @@ import org.springframework.web.bind.annotation.RestController; public class DataRestController implements CpsDataApi { private static final String ROOT_XPATH = "/"; - private static final String ISO_TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; - private static final DateTimeFormatter ISO_TIMESTAMP_FORMATTER = DateTimeFormatter.ofPattern(ISO_TIMESTAMP_FORMAT); + private static final DateTimeFormatter ISO_TIMESTAMP_FORMATTER = + DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); private final CpsFacade cpsFacade; private final CpsDataService cpsDataService; @@ -215,13 +215,12 @@ public class DataRestController implements CpsDataApi { return ROOT_XPATH.equals(xpath); } - private static OffsetDateTime toOffsetDateTime(final String datetTimestamp) { + private static OffsetDateTime toOffsetDateTime(final String dateTimestamp) { try { - return StringUtils.isEmpty(datetTimestamp) - ? null : OffsetDateTime.parse(datetTimestamp, ISO_TIMESTAMP_FORMATTER); + return StringUtils.isEmpty(dateTimestamp) + ? null : OffsetDateTime.parse(dateTimestamp, ISO_TIMESTAMP_FORMATTER); } catch (final Exception exception) { - throw new ValidationException( - String.format("observed-timestamp must be in '%s' format", ISO_TIMESTAMP_FORMAT)); + throw new ValidationException("observed-timestamp must be in ISO format"); } } } diff --git a/cps-rest/src/main/java/org/onap/cps/rest/utils/ZipFileSizeValidator.java b/cps-rest/src/main/java/org/onap/cps/rest/utils/ZipFileSizeValidator.java index 316b4d4764..d75f314f7a 100644 --- a/cps-rest/src/main/java/org/onap/cps/rest/utils/ZipFileSizeValidator.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/utils/ZipFileSizeValidator.java @@ -28,10 +28,9 @@ import org.onap.cps.api.exceptions.ModelValidationException; @Getter public class ZipFileSizeValidator { - private static final int THRESHOLD_ENTRIES = 10000; - @SuppressWarnings("FieldCanBeLocal") - private static int THRESHOLD_SIZE = 100000000; - private static final double THRESHOLD_RATIO = 40; + private static final int THRESHOLD_ENTRIES = 10_000; + private static final int THRESHOLD_RATIO = 40; + private static final int THRESHOLD_SIZE = 100_000_000; private static final String INVALID_ZIP = "Invalid ZIP archive content."; private int totalUncompressedSizeOfYangFilesInArchive = 0; diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy index 97c0ff1e31..e3638f2a02 100644 --- a/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy +++ b/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy @@ -50,32 +50,6 @@ class MultipartFileUtilSpec extends Specification { assert result["component.yang"] == "fake component content 1\n" } - def 'Yang file limits in zip archive: #scenario for the bug reported in CPS-1477'() { - given: 'a yang file size (uncompressed) limit of #threshold bytes' - ZipFileSizeValidator.THRESHOLD_SIZE = threshold - and: 'an archive with a yang file of 1083 bytes' - def multipartFile = multipartZipFileFromResource('/yang-files-set-total-1083-bytes.zip') - when: 'attempt to extract yang files' - def thrownException = null - try { - MultipartFileUtil.extractYangResourcesMap(multipartFile) - } catch (Exception e) { - thrownException = e - } - then: 'ModelValidationException indicating size limit is only thrown when threshold exceeded' - if (thresholdExceeded) { - assert thrownException instanceof ModelValidationException - assert thrownException.details.contains('limit of ' + threshold + ' bytes') - } else { - assert thrownException == null - } - where: - scenario | threshold || thresholdExceeded - 'exceed limit' | 1082 || true - 'equals to limit' | 1083 || false - 'within limit' | 1084 || false - } - def 'Extract resources from zip archive having #caseDescriptor.'() { when: 'attempt to extract resources from zip file is performed' MultipartFileUtil.extractYangResourcesMap(multipartFile) diff --git a/cps-ri/src/main/java/org/onap/cps/ri/CpsAdminPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsAdminPersistenceServiceImpl.java index 588a639ab8..27dd48d38c 100755 --- a/cps-ri/src/main/java/org/onap/cps/ri/CpsAdminPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsAdminPersistenceServiceImpl.java @@ -71,7 +71,7 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic final int numberOfAssociatedSchemaSets = schemaSetRepository.countByDataspace(dataspaceEntity); if (numberOfAssociatedSchemaSets != 0) { throw new DataspaceInUseException(dataspaceName, - String.format("Dataspace contains %d schemaset(s)", numberOfAssociatedSchemaSets)); + String.format("Dataspace contains %d schema set(s)", numberOfAssociatedSchemaSets)); } dataspaceRepository.delete(dataspaceEntity); } diff --git a/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java index 72a70362ff..a1a2614c63 100644 --- a/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java @@ -244,13 +244,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService @Override @Timed(value = "cps.data.persistence.service.datanode.query", - description = "Time taken to query data nodes") - public List queryDataNodes(final String dataspaceName, final String anchorName, final String cpsPath, - final FetchDescendantsOption fetchDescendantsOption) { - return queryDataNodes(dataspaceName, anchorName, cpsPath, fetchDescendantsOption, NO_LIMIT); - } - - @Override + description = "Time taken to query data nodes") public List queryDataNodes(final String dataspaceName, final String anchorName, final String cpsPath, @@ -265,7 +259,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService @Override public Set queryDataLeaf(final String dataspaceName, final String anchorName, final String cpsPath, - final int queryResultLimit, final Class targetClass) { + final Class targetClass) { final CpsPathQuery cpsPathQuery = getCpsPathQuery(cpsPath); if (!cpsPathQuery.hasAttributeAxis()) { throw new IllegalArgumentException( @@ -273,7 +267,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService } final AnchorEntity anchorEntity = getAnchorEntity(dataspaceName, anchorName); return fragmentRepository.findAttributeValuesByAnchorAndCpsPath(anchorEntity, cpsPathQuery, - queryResultLimit, targetClass); + NO_LIMIT, targetClass); } @Override @@ -716,15 +710,4 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService } } - private static void logMissingXPaths(final Collection xpaths, - final Collection existingFragmentEntities) { - final Set existingXPaths = - existingFragmentEntities.stream().map(FragmentEntity::getXpath).collect(Collectors.toSet()); - final Set missingXPaths = - xpaths.stream().filter(xpath -> !existingXPaths.contains(xpath)).collect(Collectors.toSet()); - if (!missingXPaths.isEmpty()) { - log.warn("Cannot update data nodes: Target XPaths {} not found in DB.", missingXPaths); - } - } - } diff --git a/cps-ri/src/main/java/org/onap/cps/ri/CpsModulePersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsModulePersistenceServiceImpl.java index 5e6faba3af..a2e4aa201b 100755 --- a/cps-ri/src/main/java/org/onap/cps/ri/CpsModulePersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsModulePersistenceServiceImpl.java @@ -147,8 +147,8 @@ public class CpsModulePersistenceServiceImpl implements CpsModulePersistenceServ @Override @Transactional - @Timed(value = "cps.module.persistence.schemaset.create", - description = "Time taken to store a schemaset (list of module references)") + @Timed(value = "cps.module.persistence.schema.create", + description = "Time taken to store a schema set (list of module references)") public void createSchemaSet(final String dataspaceName, final String schemaSetName, final Map yangResourceContentPerName) { final Set yangResourceEntities = synchronizeYangResources(yangResourceContentPerName); @@ -157,8 +157,8 @@ public class CpsModulePersistenceServiceImpl implements CpsModulePersistenceServ @Override @Transactional - @Timed(value = "cps.module.persistence.schemaset.createFromNewAndExistingModules", - description = "Time taken to store a schemaset (from new and existing)") + @Timed(value = "cps.module.persistence.schema.createFromNewAndExistingModules", + description = "Time taken to store a schema set (from new and existing)") public void createSchemaSetFromNewAndExistingModules(final String dataspaceName, final String schemaSetName, final Map newYangResourceContentPerName, final Collection allModuleReferences) { diff --git a/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQueryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQueryImpl.java index 4b30dcd877..0d6b18b871 100644 --- a/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQueryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQueryImpl.java @@ -87,6 +87,7 @@ public class FragmentRepositoryCpsPathQueryImpl implements FragmentRepositoryCps return fragmentEntities; } + @SuppressWarnings("unchecked") @Override @Transactional public List findAnchorIdsForPagination(final DataspaceEntity dataspaceEntity, diff --git a/cps-service/src/main/java/org/onap/cps/aop/CpsLoggingAspectService.java b/cps-service/src/main/java/org/onap/cps/aop/CpsLoggingAspectService.java index 6956d85181..86563d6eab 100644 --- a/cps-service/src/main/java/org/onap/cps/aop/CpsLoggingAspectService.java +++ b/cps-service/src/main/java/org/onap/cps/aop/CpsLoggingAspectService.java @@ -45,7 +45,7 @@ public class CpsLoggingAspectService { /** * Intercept methods to measure and log execution details when debug level logging enabled. * - * @param proceedingJoinPoint exposes the proceed(..) method in order to support around advice. + * @param proceedingJoinPoint exposes the proceeding method in order to support around advice. * @return empty in case of void otherwise an object of return type */ @Around(ALL_CPS_METHODS) diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java b/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java index d86fb9211c..a0b79462e9 100644 --- a/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java +++ b/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java @@ -99,7 +99,7 @@ public interface CpsDataService { OffsetDateTime observedTimestamp, ContentType contentType); /** - * Retrieves all the datanodes by XPath for given dataspace and anchor. + * Retrieves all the data nodes by XPath for given dataspace and anchor. * * @param dataspaceName dataspace name * @param anchorName anchor name @@ -112,7 +112,7 @@ public interface CpsDataService { FetchDescendantsOption fetchDescendantsOption); /** - * Retrieves all the datanodes for multiple XPaths for given dataspace and anchor. + * Retrieves all the data nodes for multiple XPaths for given dataspace and anchor. * * @param dataspaceName dataspace name * @param anchorName anchor name @@ -183,10 +183,10 @@ public interface CpsDataService { * Replaces list content by removing all existing elements and inserting the given new elements as data nodes * under given parent, anchor and dataspace. * - * @param dataspaceName dataspace-name + * @param dataspaceName dataspace name * @param anchorName anchor name * @param parentNodeXpath parent node xpath - * @param dataNodes datanodes representing the updated data + * @param dataNodes data nodes representing the updated data * @param observedTimestamp observedTimestamp */ void replaceListContent(String dataspaceName, String anchorName, String parentNodeXpath, diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsQueryService.java b/cps-service/src/main/java/org/onap/cps/api/CpsQueryService.java index d6c1f7fc60..4b52d1cd99 100644 --- a/cps-service/src/main/java/org/onap/cps/api/CpsQueryService.java +++ b/cps-service/src/main/java/org/onap/cps/api/CpsQueryService.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020-2025 Nordix Foundation + * Copyright (C) 2020-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2022-2023 TechMahindra Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -73,19 +73,6 @@ public interface CpsQueryService { */ Set queryDataLeaf(String dataspaceName, String anchorName, String cpsPath, Class targetClass); - /** - * Get data leaf for the given dataspace and anchor by cps path. - * - * @param dataspaceName dataspace name - * @param anchorName anchor name - * @param cpsPath cps path - * @param queryResultLimit the maximum number of data nodes to return; if less than 1, returns all matching nodes - * @param targetClass class of the expected data type - * @return a collection of data objects of expected type - */ - Set queryDataLeaf(String dataspaceName, String anchorName, String cpsPath, int queryResultLimit, - Class targetClass); - /** * Get data nodes for the given dataspace across all anchors by cps path. * diff --git a/cps-service/src/main/java/org/onap/cps/api/exceptions/DataspaceInUseException.java b/cps-service/src/main/java/org/onap/cps/api/exceptions/DataspaceInUseException.java index 0508c85b0d..949f616002 100644 --- a/cps-service/src/main/java/org/onap/cps/api/exceptions/DataspaceInUseException.java +++ b/cps-service/src/main/java/org/onap/cps/api/exceptions/DataspaceInUseException.java @@ -23,7 +23,7 @@ import java.io.Serial; /** * Runtime exception. - * Thrown when given dataspace name is rejected to be deleted because it has anchor or schemasets associated. + * Thrown when given dataspace name is rejected to be deleted because it has anchor or schema sets associated. */ @SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions public class DataspaceInUseException extends DataInUseException { diff --git a/cps-service/src/main/java/org/onap/cps/events/CpsDataUpdateEventsProducer.java b/cps-service/src/main/java/org/onap/cps/events/CpsDataUpdateEventsProducer.java index 6d82245998..c59c0e6b19 100644 --- a/cps-service/src/main/java/org/onap/cps/events/CpsDataUpdateEventsProducer.java +++ b/cps-service/src/main/java/org/onap/cps/events/CpsDataUpdateEventsProducer.java @@ -63,7 +63,7 @@ public class CpsDataUpdateEventsProducer { * @param operation operation performed on the data * @param observedTimestamp timestamp when data was updated. */ - @Timed(value = "cps.dataupdate.events.send", description = "Time taken to send Data Update event") + @Timed(value = "cps.data.update.events.send", description = "Time taken to send Data Update event") public void sendCpsDataUpdateEvent(final Anchor anchor, final String xpath, final Operation operation, final OffsetDateTime observedTimestamp) { if (notificationsEnabled && cpsChangeEventNotificationsEnabled && isNotificationEnabledForAnchor(anchor)) { diff --git a/cps-service/src/main/java/org/onap/cps/impl/CpsDataServiceImpl.java b/cps-service/src/main/java/org/onap/cps/impl/CpsDataServiceImpl.java index def9429595..f680c62a46 100644 --- a/cps-service/src/main/java/org/onap/cps/impl/CpsDataServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/impl/CpsDataServiceImpl.java @@ -257,7 +257,7 @@ public class CpsDataServiceImpl implements CpsDataService { } @Override - @Timed(value = "cps.data.service.datanode.batch.delete", description = "Time taken to delete a batch of datanodes") + @Timed(value = "cps.data.service.datanode.batch.delete", description = "Time taken to delete a batch of data nodes") public void deleteDataNodes(final String dataspaceName, final String anchorName, final Collection dataNodeXpaths, final OffsetDateTime observedTimestamp) { cpsValidator.validateNameCharacters(dataspaceName, anchorName); @@ -270,7 +270,7 @@ public class CpsDataServiceImpl implements CpsDataService { @Override @Timed(value = "cps.data.service.datanode.delete.anchor", - description = "Time taken to delete all datanodes for an anchor") + description = "Time taken to delete all data nodes for an anchor") public void deleteDataNodes(final String dataspaceName, final String anchorName, final OffsetDateTime observedTimestamp) { cpsValidator.validateNameCharacters(dataspaceName, anchorName); @@ -281,7 +281,7 @@ public class CpsDataServiceImpl implements CpsDataService { @Override @Timed(value = "cps.data.service.datanode.delete.anchor.batch", - description = "Time taken to delete all datanodes for multiple anchors") + description = "Time taken to delete all data nodes for multiple anchors") public void deleteDataNodes(final String dataspaceName, final Collection anchorNames, final OffsetDateTime observedTimestamp) { cpsValidator.validateNameCharacters(dataspaceName); diff --git a/cps-service/src/main/java/org/onap/cps/impl/CpsModuleServiceImpl.java b/cps-service/src/main/java/org/onap/cps/impl/CpsModuleServiceImpl.java index cf3e6bbf9c..1fcf9a9670 100644 --- a/cps-service/src/main/java/org/onap/cps/impl/CpsModuleServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/impl/CpsModuleServiceImpl.java @@ -56,8 +56,8 @@ public class CpsModuleServiceImpl implements CpsModuleService { private final YangParser yangParser; @Override - @Timed(value = "cps.module.service.schemaset.create", - description = "Time taken to create (and store) a schemaset") + @Timed(value = "cps.module.service.schema.create", + description = "Time taken to create (and store) a schema set") public void createSchemaSet(final String dataspaceName, final String schemaSetName, final Map yangResourceContentPerName) { cpsValidator.validateNameCharacters(dataspaceName); diff --git a/cps-service/src/main/java/org/onap/cps/impl/CpsQueryServiceImpl.java b/cps-service/src/main/java/org/onap/cps/impl/CpsQueryServiceImpl.java index d61caf2d27..be004fa576 100644 --- a/cps-service/src/main/java/org/onap/cps/impl/CpsQueryServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/impl/CpsQueryServiceImpl.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021-2025 Nordix Foundation + * Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2022-2023 TechMahindra Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -67,15 +67,8 @@ public class CpsQueryServiceImpl implements CpsQueryService { @Override public Set queryDataLeaf(final String dataspaceName, final String anchorName, final String cpsPath, final Class targetClass) { - return queryDataLeaf(dataspaceName, anchorName, cpsPath, NO_LIMIT, targetClass); - } - - @Override - public Set queryDataLeaf(final String dataspaceName, final String anchorName, final String cpsPath, - final int queryResultLimit, final Class targetClass) { cpsValidator.validateNameCharacters(dataspaceName, anchorName); - return cpsDataPersistenceService.queryDataLeaf(dataspaceName, anchorName, cpsPath, - queryResultLimit, targetClass); + return cpsDataPersistenceService.queryDataLeaf(dataspaceName, anchorName, cpsPath, targetClass); } @Override diff --git a/cps-service/src/main/java/org/onap/cps/impl/YangTextSchemaSourceSetCache.java b/cps-service/src/main/java/org/onap/cps/impl/YangTextSchemaSourceSetCache.java index 0a35813771..bacdd03626 100644 --- a/cps-service/src/main/java/org/onap/cps/impl/YangTextSchemaSourceSetCache.java +++ b/cps-service/src/main/java/org/onap/cps/impl/YangTextSchemaSourceSetCache.java @@ -48,7 +48,7 @@ public class YangTextSchemaSourceSetCache { private final CpsModulePersistenceService cpsModulePersistenceService; private final CpsValidator cpsValidator; - private final AtomicInteger yangSchemaCacheCounter = Metrics.gauge("cps.yangschema.cache.gauge", + private final AtomicInteger yangSchemaCacheCounter = Metrics.gauge("cps.yang.schema.cache.gauge", new AtomicInteger(0)); /** diff --git a/cps-service/src/main/java/org/onap/cps/init/AbstractModelLoader.java b/cps-service/src/main/java/org/onap/cps/init/AbstractModelLoader.java index a3ba018af6..7bd3aaf1a6 100644 --- a/cps-service/src/main/java/org/onap/cps/init/AbstractModelLoader.java +++ b/cps-service/src/main/java/org/onap/cps/init/AbstractModelLoader.java @@ -77,7 +77,7 @@ public abstract class AbstractModelLoader implements ModelLoader { /** * Create initial schema set. * @param dataspaceName dataspace name - * @param schemaSetName schemaset name + * @param schemaSetName schema set name * @param resourceNames resource names */ public void createSchemaSet(final String dataspaceName, final String schemaSetName, final String... resourceNames) { @@ -112,7 +112,7 @@ public abstract class AbstractModelLoader implements ModelLoader { /** * Create initial anchor. * @param dataspaceName dataspace name - * @param schemaSetName schemaset name + * @param schemaSetName schemas et name * @param anchorName anchor name */ public void createAnchor(final String dataspaceName, final String schemaSetName, final String anchorName) { @@ -181,7 +181,7 @@ public abstract class AbstractModelLoader implements ModelLoader { * Update anchor schema set. * @param dataspaceName dataspace name * @param anchorName anchor name - * @param schemaSetName schemaset name + * @param schemaSetName schema set name */ public void updateAnchorSchemaSet(final String dataspaceName, final String anchorName, final String schemaSetName) { try { diff --git a/cps-service/src/main/java/org/onap/cps/init/CpsNotificationSubscriptionModelLoader.java b/cps-service/src/main/java/org/onap/cps/init/CpsNotificationSubscriptionModelLoader.java index ee267612c2..415dcce8fa 100644 --- a/cps-service/src/main/java/org/onap/cps/init/CpsNotificationSubscriptionModelLoader.java +++ b/cps-service/src/main/java/org/onap/cps/init/CpsNotificationSubscriptionModelLoader.java @@ -33,7 +33,7 @@ import org.springframework.stereotype.Service; public class CpsNotificationSubscriptionModelLoader extends AbstractModelLoader { private static final String MODEL_FILENAME = "cps-notification-subscriptions@2024-07-03.yang"; - private static final String SCHEMASET_NAME = "cps-notification-subscriptions"; + private static final String SCHEMA_SET_NAME = "cps-notification-subscriptions"; private static final String ANCHOR_NAME = "cps-notification-subscriptions"; private static final String CPS_DATASPACE_NAME = "CPS-Admin"; private static final String REGISTRY_DATANODE_NAME = "dataspaces"; @@ -54,8 +54,8 @@ public class CpsNotificationSubscriptionModelLoader extends AbstractModelLoader private void onboardSubscriptionModels() { createDataspace(CPS_DATASPACE_NAME); - createSchemaSet(CPS_DATASPACE_NAME, SCHEMASET_NAME, MODEL_FILENAME); - createAnchor(CPS_DATASPACE_NAME, SCHEMASET_NAME, ANCHOR_NAME); + createSchemaSet(CPS_DATASPACE_NAME, SCHEMA_SET_NAME, MODEL_FILENAME); + createAnchor(CPS_DATASPACE_NAME, SCHEMA_SET_NAME, ANCHOR_NAME); createTopLevelDataNode(CPS_DATASPACE_NAME, ANCHOR_NAME, REGISTRY_DATANODE_NAME); } diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java index 5b9bbdcd75..62b26622de 100755 --- a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java +++ b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java @@ -118,7 +118,7 @@ public interface CpsAdminPersistenceService { /** * Query anchor names for the given module names in the provided dataspace. - * If dataspace or one of the given module names does not exists, return with an empty collection. + * If dataspace or one of the given module names does not exist, return with an empty collection. * * @param dataspaceName dataspace name * @param moduleNames a collection of module names diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java index 0e3d864901..7deb09a01c 100644 --- a/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java +++ b/cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java @@ -40,7 +40,7 @@ import org.onap.cps.api.parameters.PaginationOption; public interface CpsDataPersistenceService { /** - * Store multiple datanodes at once. + * Store multiple data nodes at once. * @param dataspaceName dataspace name * @param anchorName anchor name * @param dataNodes data nodes @@ -70,7 +70,7 @@ public interface CpsDataPersistenceService { Collection listElementsCollection); /** - * Retrieves multiple datanodes for a single XPath for given dataspace and anchor. + * Retrieves multiple data nodes for a single XPath for given dataspace and anchor. * Multiple data nodes are returned when xPath is set to root '/', otherwise single data node * is returned when a specific xpath is used (Example: /bookstore). * @@ -85,7 +85,7 @@ public interface CpsDataPersistenceService { FetchDescendantsOption fetchDescendantsOption); /** - * Retrieves multiple datanodes for multiple XPaths, given a dataspace and anchor. + * Retrieves multiple data nodes for multiple XPaths, given a dataspace and anchor. * * @param dataspaceName dataspace name * @param anchorName anchor name @@ -176,18 +176,6 @@ public interface CpsDataPersistenceService { */ void deleteListDataNode(String dataspaceName, String anchorName, String targetXpath); - /** - * Get a datanode by cps path. - * - * @param dataspaceName dataspace name - * @param anchorName anchor name - * @param cpsPath cps path - * @param fetchDescendantsOption defines whether the descendants of the node(s) found by the query should be - * included in the output - * @return the data nodes found i.e. 0 or more data nodes - */ - List queryDataNodes(String dataspaceName, String anchorName, - String cpsPath, FetchDescendantsOption fetchDescendantsOption); /** * Get a datanode by cps path. @@ -212,12 +200,10 @@ public interface CpsDataPersistenceService { * @param dataspaceName dataspace name * @param anchorName anchor name * @param cpsPath cps path - * @param queryResultLimit limits the number of returned entities (if less than 1 returns all) * @param targetClass class of the expected data type * @return a collection of data objects of expected type */ - Set queryDataLeaf(String dataspaceName, String anchorName, String cpsPath, int queryResultLimit, - Class targetClass); + Set queryDataLeaf(String dataspaceName, String anchorName, String cpsPath, Class targetClass); /** * Get a datanode by dataspace name and cps path across all anchors. @@ -260,7 +246,7 @@ public interface CpsDataPersistenceService { /** * Query total anchors for dataspace name and cps path. - * @param dataspaceName datasoace name + * @param dataspaceName dataspace name * @param cpsPath cps path * @return total anchors for dataspace name and cps path */ diff --git a/cps-service/src/main/java/org/onap/cps/utils/DateTimeUtility.java b/cps-service/src/main/java/org/onap/cps/utils/DateTimeUtility.java index c2310707ab..4f0ad59d3e 100644 --- a/cps-service/src/main/java/org/onap/cps/utils/DateTimeUtility.java +++ b/cps-service/src/main/java/org/onap/cps/utils/DateTimeUtility.java @@ -26,8 +26,7 @@ import java.time.format.DateTimeFormatter; public interface DateTimeUtility { - String ISO_TIMESTAMP_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; - DateTimeFormatter ISO_TIMESTAMP_FORMATTER = DateTimeFormatter.ofPattern(ISO_TIMESTAMP_PATTERN); + DateTimeFormatter ISO_TIMESTAMP_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); static String toString(OffsetDateTime offsetDateTime) { return offsetDateTime != null ? ISO_TIMESTAMP_FORMATTER.format(offsetDateTime) : null; diff --git a/cps-service/src/main/java/org/onap/cps/utils/RestConfStylePathToCpsPathUtil.java b/cps-service/src/main/java/org/onap/cps/utils/RestConfStylePathToCpsPathUtil.java index 7b575c3894..0b68231435 100644 --- a/cps-service/src/main/java/org/onap/cps/utils/RestConfStylePathToCpsPathUtil.java +++ b/cps-service/src/main/java/org/onap/cps/utils/RestConfStylePathToCpsPathUtil.java @@ -36,9 +36,9 @@ public final class RestConfStylePathToCpsPathUtil { private static final String NO_KEY_VALUE_IN_PATH_SEGMENT = null; /** - * Convert RESTCONF style path to CpsPath. + * Convert RestConf style path to CpsPath. * - * @param restConfStylePath restconf style path + * @param restConfStylePath restConf style path * @param schemaContext schema context * @return CpsPath */ diff --git a/cps-service/src/main/java/org/onap/cps/utils/YangParser.java b/cps-service/src/main/java/org/onap/cps/utils/YangParser.java index 755c61985c..dc3d0c0f38 100644 --- a/cps-service/src/main/java/org/onap/cps/utils/YangParser.java +++ b/cps-service/src/main/java/org/onap/cps/utils/YangParser.java @@ -55,7 +55,7 @@ public class YangParser { * @param anchor the anchor for the node data * @return the NormalizedNode object */ - @Timed(value = "cps.utils.yangparser.nodedata.with.parent.parse", + @Timed(value = "cps.utils.yang.parser.node.data.with.parent.parse", description = "Time taken to parse node data with a parent") public ContainerNode parseData(final ContentType contentType, final String nodeData, final Anchor anchor, final String parentNodeXpath) { @@ -76,7 +76,7 @@ public class YangParser { * @param yangResourceContentPerName yang resource content per name * @return the NormalizedNode object */ - @Timed(value = "cps.utils.yangparser.nodedata.with.parent.with.yangResourceMap.parse", + @Timed(value = "cps.utils.yang.parser.node.data.with.parent.with.yangResourceMap.parse", description = "Time taken to parse node data with a parent") public ContainerNode parseData(final ContentType contentType, final String nodeData, final Map yangResourceContentPerName, final String parentNodeXpath) { @@ -107,10 +107,10 @@ public class YangParser { } /** - * Get Cps path from Restconf path. + * Get Cps path from RestConf path. * * @param anchor anchor - * @param restConfStylePath restconf path + * @param restConfStylePath restConf path * @return CpsPath */ public String getCpsPathFromRestConfStylePath(final Anchor anchor, final String restConfStylePath) { @@ -122,7 +122,7 @@ public class YangParser { * Get the collection of concatenated module-name:root-node of the provided anchor. * * @param anchor Anchor - * @return Concatentated module and root node + * @return Concatenated module and root node */ public Set getRootNodeReferences(final Anchor anchor) { final SchemaContext schemaContext = getSchemaContext(anchor); diff --git a/cps-service/src/main/java/org/onap/cps/utils/YangUtils.java b/cps-service/src/main/java/org/onap/cps/utils/YangUtils.java index 96841bf5c8..d99d6bc884 100644 --- a/cps-service/src/main/java/org/onap/cps/utils/YangUtils.java +++ b/cps-service/src/main/java/org/onap/cps/utils/YangUtils.java @@ -35,7 +35,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; public class YangUtils { /** - * Create an xpath form a Yang Tools NodeIdentifier (i.e. PathArgument). + * Create a xpath form a Yang Tools NodeIdentifier (i.e. PathArgument). * * @param nodeIdentifier the NodeIdentifier * @return a xpath diff --git a/cps-service/src/main/java/org/onap/cps/yang/TimedYangTextSchemaSourceSetBuilder.java b/cps-service/src/main/java/org/onap/cps/yang/TimedYangTextSchemaSourceSetBuilder.java index 9b2ac944dc..d2dbdaacaf 100644 --- a/cps-service/src/main/java/org/onap/cps/yang/TimedYangTextSchemaSourceSetBuilder.java +++ b/cps-service/src/main/java/org/onap/cps/yang/TimedYangTextSchemaSourceSetBuilder.java @@ -27,7 +27,7 @@ import org.springframework.stereotype.Service; @Service public class TimedYangTextSchemaSourceSetBuilder { - @Timed(value = "cps.yangtextschemasourceset.build", + @Timed(value = "cps.yang.text.schema.source.set.build", description = "Time taken to build a yang text schema source set") public YangTextSchemaSourceSet getYangTextSchemaSourceSet( final Map yangResourceContentPerName) { diff --git a/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java b/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java index a98e01d09a..1cbfe90df8 100644 --- a/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java +++ b/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java @@ -89,7 +89,7 @@ public final class YangTextSchemaSourceSetBuilder { * @return the YangTextSchemaSourceSet */ - @Timed(value = "cps.yang.schemasourceset.build", description = "Time taken to build a ODL yang Model") + @Timed(value = "cps.yang.schema.source.set.build", description = "Time taken to build a ODL yang Model") public static YangTextSchemaSourceSet of(final Map yangResourceNameToContent) { return new YangTextSchemaSourceSetBuilder().putAll(yangResourceNameToContent).build(); } diff --git a/cps-service/src/test/groovy/org/onap/cps/impl/CpsQueryServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/impl/CpsQueryServiceImplSpec.groovy index d581727e40..e454189dd5 100644 --- a/cps-service/src/test/groovy/org/onap/cps/impl/CpsQueryServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/impl/CpsQueryServiceImplSpec.groovy @@ -92,6 +92,6 @@ class CpsQueryServiceImplSpec extends Specification { when: 'a query for a specific leaf is executed' objectUnderTest.queryDataLeaf('some-dataspace', 'some-anchor', '/cps-path/@id', Object.class) then: 'the persistence service is called once with the correct parameters' - 1 * mockCpsDataPersistenceService.queryDataLeaf('some-dataspace', 'some-anchor', '/cps-path/@id', 0, Object.class) + 1 * mockCpsDataPersistenceService.queryDataLeaf('some-dataspace', 'some-anchor', '/cps-path/@id', Object.class) } } diff --git a/docs/api/swagger/cps/openapi.yaml b/docs/api/swagger/cps/openapi.yaml index 73ae1682ae..a9e8b439e7 100644 --- a/docs/api/swagger/cps/openapi.yaml +++ b/docs/api/swagger/cps/openapi.yaml @@ -3028,7 +3028,7 @@ components: xpath: "/bookstore/categories/[@code=3]" target-data: code: "3," - name: kidz + name: kids - action: remove xpath: "/bookstore/categories/[@code=1]" source-data: @@ -3415,7 +3415,7 @@ components: type: string required: - moduleReferences - title: Schema set details by dataspace and schemasetName + title: Schema set details by dataspace and schema set name type: object ModuleReferences: example: diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/DataspaceServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/DataspaceServiceIntegrationSpec.groovy index 47a332adc9..ba456ea904 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/DataspaceServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/DataspaceServiceIntegrationSpec.groovy @@ -78,9 +78,9 @@ class DataspaceServiceIntegrationSpec extends FunctionalSpecBase { cpsModuleService.createSchemaSet('targetDataspace','someSchemaSet',[:]) when: 'attempt to delete dataspace' objectUnderTest.deleteDataspace('targetDataspace') - then: 'an in-use exception is thrown mentioning schemasets' + then: 'an in-use exception is thrown mentioning schema sets' def thrownException = thrown(DataspaceInUseException) - assert thrownException.details.contains('contains 1 schemaset(s)') + assert thrownException.details.contains('contains 1 schema set(s)') cleanup: cpsModuleService.deleteSchemaSetsWithCascade('targetDataspace',['someSchemaSet']) objectUnderTest.deleteDataspace('targetDataspace') diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy index 212686e917..4834052229 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy @@ -481,16 +481,4 @@ class QueryServiceIntegrationSpec extends FunctionalSpecBase { -1 || 5 } - def 'Query data leaf with a limit of #limit.' () { - when: 'a query for data leaf is executed with a result limit' - def result = objectUnderTest.queryDataLeaf(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories/@name', limit, String) - then: 'the expected number of leaf values is returned' - assert result.size() == expectedNumberOfResults - where: 'the following parameters are used' - limit || expectedNumberOfResults - 1 || 1 - 2 || 2 - 0 || 5 - -1 || 5 - } } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/inventory/ModuleSyncWatchdogIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/inventory/ModuleSyncWatchdogIntegrationSpec.groovy index 5c949af5ed..b73aa73c1b 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/inventory/ModuleSyncWatchdogIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/inventory/ModuleSyncWatchdogIntegrationSpec.groovy @@ -101,7 +101,7 @@ class ModuleSyncWatchdogIntegrationSpec extends CpsIntegrationSpecBase { }) and: 'log the relevant instrumentation' def dmiModuleRetrievalTimer = meterRegistry.get('cps.ncmp.inventory.module.references.from.dmi').timer() - def dbSchemaSetStorageTimer = meterRegistry.get('cps.module.persistence.schemaset.createFromNewAndExistingModules').timer() + def dbSchemaSetStorageTimer = meterRegistry.get('cps.module.persistence.schema.createFromNewAndExistingModules').timer() def dbStateUpdateTimer = meterRegistry.get('cps.ncmp.cmhandle.state.update.batch').timer() logInstrumentation(dmiModuleRetrievalTimer, 'get modules from DMI ') logInstrumentation(dbSchemaSetStorageTimer, 'store schema sets ') diff --git a/test-tools/subtract-metrics-reports.py b/test-tools/subtract-metrics-reports.py index 8f6fab3847..073c6210f4 100755 --- a/test-tools/subtract-metrics-reports.py +++ b/test-tools/subtract-metrics-reports.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright 2023 Nordix Foundation. +# Copyright 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. @@ -21,9 +21,9 @@ import csv def load_metrics_table(filename): with open(filename) as tsvFile: - csvreader = csv.DictReader(tsvFile, dialect="excel-tab") + csvReader = csv.DictReader(tsvFile, dialect="excel-tab") table = {} - for source_row in csvreader: + for source_row in csvReader: method, count, sum_time = source_row['Method'], source_row['Count'], source_row['Sum'] table[method] = { 'Count': int(float(count)), 'Sum': float(sum_time) } return table @@ -31,11 +31,11 @@ def load_metrics_table(filename): def save_metrics_table(table, filename): with open(filename, 'w', newline='') as outfile: - csvwriter = csv.writer(outfile, dialect="excel-tab") - csvwriter.writerow(["Method", "Count", "Sum"]) + csvWriter = csv.Writer(outfile, dialect="excel-tab") + csvWriter.writerow(["Method", "Count", "Sum"]) for method in table: count, sum_time = table[method]['Count'], table[method]['Sum'] - csvwriter.writerow([method, count, sum_time]) + csvWriter.writerow([method, count, sum_time]) def subtract_metrics_tables(table, table_to_subtract): -- 2.16.6