Last inspect on all modules 18/142018/3 master
authorToineSiebelink <toine.siebelink@est.tech>
Tue, 9 Sep 2025 11:46:29 +0000 (12:46 +0100)
committerToineSiebelink <toine.siebelink@est.tech>
Wed, 10 Sep 2025 16:35:57 +0000 (17:35 +0100)
- 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 <toine.siebelink@est.tech>
41 files changed:
cps-events/src/main/resources/schemas/cps.dataupdated/cps-data-updated-event-schema-1.0.0.json
cps-ncmp-events/src/main/resources/schemas/ncmp/async-m2m/dmi-async-request-response-event-schema-v1.json
cps-ncmp-events/src/main/resources/schemas/ncmp/async-m2m/ncmp-async-request-response-event-schema-v1.json
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/models/CompositeState.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/init/InventoryModelLoader.java
cps-parent/pom.xml
cps-rest/docs/openapi/components.yml
cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java
cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java
cps-rest/src/main/java/org/onap/cps/rest/utils/ZipFileSizeValidator.java
cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy
cps-ri/src/main/java/org/onap/cps/ri/CpsAdminPersistenceServiceImpl.java
cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java
cps-ri/src/main/java/org/onap/cps/ri/CpsModulePersistenceServiceImpl.java
cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQueryImpl.java
cps-service/src/main/java/org/onap/cps/aop/CpsLoggingAspectService.java
cps-service/src/main/java/org/onap/cps/api/CpsDataService.java
cps-service/src/main/java/org/onap/cps/api/CpsQueryService.java
cps-service/src/main/java/org/onap/cps/api/exceptions/DataspaceInUseException.java
cps-service/src/main/java/org/onap/cps/events/CpsDataUpdateEventsProducer.java
cps-service/src/main/java/org/onap/cps/impl/CpsDataServiceImpl.java
cps-service/src/main/java/org/onap/cps/impl/CpsModuleServiceImpl.java
cps-service/src/main/java/org/onap/cps/impl/CpsQueryServiceImpl.java
cps-service/src/main/java/org/onap/cps/impl/YangTextSchemaSourceSetCache.java
cps-service/src/main/java/org/onap/cps/init/AbstractModelLoader.java
cps-service/src/main/java/org/onap/cps/init/CpsNotificationSubscriptionModelLoader.java
cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java
cps-service/src/main/java/org/onap/cps/spi/CpsDataPersistenceService.java
cps-service/src/main/java/org/onap/cps/utils/DateTimeUtility.java
cps-service/src/main/java/org/onap/cps/utils/RestConfStylePathToCpsPathUtil.java
cps-service/src/main/java/org/onap/cps/utils/YangParser.java
cps-service/src/main/java/org/onap/cps/utils/YangUtils.java
cps-service/src/main/java/org/onap/cps/yang/TimedYangTextSchemaSourceSetBuilder.java
cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java
cps-service/src/test/groovy/org/onap/cps/impl/CpsQueryServiceImplSpec.groovy
docs/api/swagger/cps/openapi.yaml
integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/DataspaceServiceIntegrationSpec.groovy
integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy
integration-test/src/test/groovy/org/onap/cps/integration/functional/ncmp/inventory/ModuleSyncWatchdogIntegrationSpec.groovy
test-tools/subtract-metrics-reports.py

index a3eaf63..b4171e6 100644 (file)
@@ -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": {
index 4db07be..5668acb 100644 (file)
@@ -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": {
index 32b7bec..cb10f75 100644 (file)
@@ -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": {
           "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": {
       }
     }
   }
-}
\ No newline at end of file
+}
index 7977991..2110e6f 100644 (file)
@@ -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
index bef06ad..55d44af 100644 (file)
@@ -55,7 +55,6 @@ public class CompositeState {
     @JsonProperty("datastores")
     private DataStores dataStores;
 
-
     /**
      * Composite State copy constructor.
      *
index a9d4b73..fe8e10a 100644 (file)
@@ -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.");
index 31bb0b4..b41d8b9 100644 (file)
                     </excludes>
                     <environmentVariables>
                         <!--
-                            disable privileged container usage to cleanup the test containers;
+                            disable privileged container usage to clean up the test containers;
                             these will be removed automatically on jvm termination;
                             see https://www.testcontainers.org/features/configuration/#disabling-ryuk
                          -->
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
index e151706..93c2584 100644 (file)
@@ -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:
index f1215ba..ca7d374 100755 (executable)
@@ -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<Void> 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
index 103ed69..9ba4691 100755 (executable)
@@ -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");
         }
     }
 }
index 316b4d4..d75f314 100644 (file)
@@ -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;
index 97c0ff1..e3638f2 100644 (file)
@@ -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)
index 588a639..27dd48d 100755 (executable)
@@ -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);
     }
index 72a7036..a1a2614 100644 (file)
@@ -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<DataNode> 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<DataNode> queryDataNodes(final String dataspaceName,
                                          final String anchorName,
                                          final String cpsPath,
@@ -265,7 +259,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
 
     @Override
     public <T> Set<T> queryDataLeaf(final String dataspaceName, final String anchorName, final String cpsPath,
-                                    final int queryResultLimit, final Class<T> targetClass) {
+                                    final Class<T> 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<String> xpaths,
-                                         final Collection<FragmentEntity> existingFragmentEntities) {
-        final Set<String> existingXPaths =
-                existingFragmentEntities.stream().map(FragmentEntity::getXpath).collect(Collectors.toSet());
-        final Set<String> 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);
-        }
-    }
-
 }
index 5e6faba..a2e4aa2 100755 (executable)
@@ -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<String, String> yangResourceContentPerName) {
         final Set<YangResourceEntity> 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<String, String> newYangResourceContentPerName,
                                                          final Collection<ModuleReference> allModuleReferences) {
index 4b30dcd..0d6b18b 100644 (file)
@@ -87,6 +87,7 @@ public class FragmentRepositoryCpsPathQueryImpl implements FragmentRepositoryCps
         return fragmentEntities;
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     @Transactional
     public List<Long> findAnchorIdsForPagination(final DataspaceEntity dataspaceEntity,
index 6956d85..86563d6 100644 (file)
@@ -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)
index d86fb92..a0b7946 100644 (file)
@@ -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,
index d6c1f7f..4b52d1c 100644 (file)
@@ -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 {
      */
     <T> Set<T> queryDataLeaf(String dataspaceName, String anchorName, String cpsPath, Class<T> 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
-     */
-    <T> Set<T> queryDataLeaf(String dataspaceName, String anchorName, String cpsPath, int queryResultLimit,
-                             Class<T> targetClass);
-
     /**
      * Get data nodes for the given dataspace across all anchors by cps path.
      *
index 0508c85..949f616 100644 (file)
@@ -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 {
index 6d82245..c59c0e6 100644 (file)
@@ -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)) {
index def9429..f680c62 100644 (file)
@@ -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<String> 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<String> anchorNames,
                                 final OffsetDateTime observedTimestamp) {
         cpsValidator.validateNameCharacters(dataspaceName);
index cf3e6bb..1fcf9a9 100644 (file)
@@ -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<String, String> yangResourceContentPerName) {
         cpsValidator.validateNameCharacters(dataspaceName);
index d61caf2..be004fa 100644 (file)
@@ -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 <T> Set<T> queryDataLeaf(final String dataspaceName, final String anchorName, final String cpsPath,
                                     final Class<T> targetClass) {
-        return queryDataLeaf(dataspaceName, anchorName, cpsPath, NO_LIMIT, targetClass);
-    }
-
-    @Override
-    public <T> Set<T> queryDataLeaf(final String dataspaceName, final String anchorName, final String cpsPath,
-                                    final int queryResultLimit, final Class<T> targetClass) {
         cpsValidator.validateNameCharacters(dataspaceName, anchorName);
-        return cpsDataPersistenceService.queryDataLeaf(dataspaceName, anchorName, cpsPath,
-                queryResultLimit, targetClass);
+        return cpsDataPersistenceService.queryDataLeaf(dataspaceName, anchorName, cpsPath, targetClass);
     }
 
     @Override
index 0a35813..bacdd03 100644 (file)
@@ -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));
 
     /**
index a3ba018..7bd3aaf 100644 (file)
@@ -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 {
index ee26761..415dcce 100644 (file)
@@ -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);
     }
 
index 5b9bbdc..62b2662 100755 (executable)
@@ -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
index 0e3d864..7deb09a 100644 (file)
@@ -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<DataNode> 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<DataNode> 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
      */
-    <T> Set<T> queryDataLeaf(String dataspaceName, String anchorName, String cpsPath, int queryResultLimit,
-                             Class<T> targetClass);
+    <T> Set<T> queryDataLeaf(String dataspaceName, String anchorName, String cpsPath, Class<T> 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
      */
index c231070..4f0ad59 100644 (file)
@@ -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;
index 7b575c3..0b68231 100644 (file)
@@ -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
      */
index 755c619..dc3d0c0 100644 (file)
@@ -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<String, String> 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<String> getRootNodeReferences(final Anchor anchor) {
         final SchemaContext schemaContext = getSchemaContext(anchor);
index 96841bf..d99d6bc 100644 (file)
@@ -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
index 9b2ac94..d2dbdaa 100644 (file)
@@ -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<String, String> yangResourceContentPerName) {
index a98e01d..1cbfe90 100644 (file)
@@ -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<String, String> yangResourceNameToContent) {
         return new YangTextSchemaSourceSetBuilder().putAll(yangResourceNameToContent).build();
     }
index d581727..e454189 100644 (file)
@@ -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)
     }
 }
index 73ae168..a9e8b43 100644 (file)
@@ -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:
index 47a332a..ba456ea 100644 (file)
@@ -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')
index 212686e..4834052 100644 (file)
@@ -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
-    }
 }
index 5c949af..b73aa73 100644 (file)
@@ -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      ')
index 8f6fab3..073c621 100755 (executable)
@@ -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):