diff options
author | Daniel Hanrahan <daniel.hanrahan@est.tech> | 2024-07-01 13:52:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2024-07-01 13:52:29 +0000 |
commit | 6dff92fe827320df9a84ed06b0e287c4a9be8596 (patch) | |
tree | 6d04d7844804bc505b12ce96570b411496dbedc2 | |
parent | 98d9ac273754a8637bb5e08b1ec7c0b98c645e9e (diff) | |
parent | 7915e994ac4eb403461b3a93165a2e3c72871ab6 (diff) |
Merge "Fix incorrect use of getAnchors(dataspace, schemasets)"
10 files changed, 132 insertions, 73 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java index 56a046496e..13710dbec0 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java @@ -107,6 +107,12 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic } @Override + public Anchor getAnchor(final String dataspaceName, final String anchorName) { + final AnchorEntity anchorEntity = getAnchorEntity(dataspaceName, anchorName); + return toAnchor(anchorEntity); + } + + @Override public Collection<Anchor> getAnchors(final String dataspaceName) { final var dataspaceEntity = dataspaceRepository.getByName(dataspaceName); final Collection<AnchorEntity> anchorEntities = anchorRepository.findAllByDataspace(dataspaceEntity); @@ -114,7 +120,14 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic } @Override - public Collection<Anchor> getAnchors(final String dataspaceName, final String schemaSetName) { + public Collection<Anchor> getAnchors(final String dataspaceName, final Collection<String> anchorNames) { + final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName); + return anchorRepository.findAllByDataspaceAndNameIn(dataspaceEntity, anchorNames) + .stream().map(CpsAdminPersistenceServiceImpl::toAnchor).collect(Collectors.toSet()); + } + + @Override + public Collection<Anchor> getAnchorsBySchemaSetName(final String dataspaceName, final String schemaSetName) { final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName); final SchemaSetEntity schemaSetEntity = schemaSetRepository.getByDataspaceAndName( dataspaceEntity, schemaSetName); @@ -124,7 +137,8 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic } @Override - public Collection<Anchor> getAnchors(final String dataspaceName, final Collection<String> schemaSetNames) { + public Collection<Anchor> getAnchorsBySchemaSetNames(final String dataspaceName, + final Collection<String> schemaSetNames) { final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName); return anchorRepository.findAllByDataspaceAndSchemaSetNameIn(dataspaceEntity, schemaSetNames) .stream().map(CpsAdminPersistenceServiceImpl::toAnchor).collect(Collectors.toSet()); @@ -137,11 +151,6 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic inputModuleNames.size()); } - @Override - public Anchor getAnchor(final String dataspaceName, final String anchorName) { - return toAnchor(getAnchorEntity(dataspaceName, anchorName)); - } - @Transactional @Override public void deleteAnchor(final String dataspaceName, final String anchorName) { diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsAnchorService.java b/cps-service/src/main/java/org/onap/cps/api/CpsAnchorService.java index a247150c15..fcb969ba30 100644 --- a/cps-service/src/main/java/org/onap/cps/api/CpsAnchorService.java +++ b/cps-service/src/main/java/org/onap/cps/api/CpsAnchorService.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2023 Nordix Foundation + * Copyright (C) 2023-2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,15 @@ public interface CpsAnchorService { void createAnchor(String dataspaceName, String schemaSetName, String anchorName); /** + * Get an anchor in the given dataspace using the anchor name. + * + * @param dataspaceName dataspace name + * @param anchorName anchor name + * @return an anchor + */ + Anchor getAnchor(String dataspaceName, String anchorName); + + /** * Read all anchors in the given dataspace. * * @param dataspaceName dataspace name @@ -45,13 +54,22 @@ public interface CpsAnchorService { Collection<Anchor> getAnchors(String dataspaceName); /** + * Read all anchors in the given dataspace with the anchor names. + * + * @param dataspaceName dataspace name + * @param anchorNames anchor names + * @return a collection of anchors + */ + Collection<Anchor> getAnchors(String dataspaceName, Collection<String> anchorNames); + + /** * Read all anchors associated with the given schema-set in the given dataspace. * * @param dataspaceName dataspace name * @param schemaSetName schema-set name * @return a collection of anchors */ - Collection<Anchor> getAnchors(String dataspaceName, String schemaSetName); + Collection<Anchor> getAnchorsBySchemaSetName(String dataspaceName, String schemaSetName); /** * Read all anchors associated with the given schema-sets in the given dataspace. @@ -60,16 +78,7 @@ public interface CpsAnchorService { * @param schemaSetNames schema-set names * @return a collection of anchors */ - Collection<Anchor> getAnchors(String dataspaceName, Collection<String> schemaSetNames); - - /** - * Get an anchor in the given dataspace using the anchor name. - * - * @param dataspaceName dataspace name - * @param anchorName anchor name - * @return an anchor - */ - Anchor getAnchor(String dataspaceName, String anchorName); + Collection<Anchor> getAnchorsBySchemaSetNames(String dataspaceName, Collection<String> schemaSetNames); /** * Delete anchor by name in given dataspace. diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java index aa9c45d09a..c31e51b174 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2023 Nordix Foundation + * Copyright (C) 2023-2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,28 +44,36 @@ public class CpsAnchorServiceImpl implements CpsAnchorService { } @Override + public Anchor getAnchor(final String dataspaceName, final String anchorName) { + cpsValidator.validateNameCharacters(dataspaceName, anchorName); + return cpsAdminPersistenceService.getAnchor(dataspaceName, anchorName); + } + + @Override public Collection<Anchor> getAnchors(final String dataspaceName) { cpsValidator.validateNameCharacters(dataspaceName); return cpsAdminPersistenceService.getAnchors(dataspaceName); } @Override - public Collection<Anchor> getAnchors(final String dataspaceName, final String schemaSetName) { - cpsValidator.validateNameCharacters(dataspaceName, schemaSetName); - return cpsAdminPersistenceService.getAnchors(dataspaceName, schemaSetName); + public Collection<Anchor> getAnchors(final String dataspaceName, final Collection<String> anchorNames) { + cpsValidator.validateNameCharacters(dataspaceName); + cpsValidator.validateNameCharacters(anchorNames); + return cpsAdminPersistenceService.getAnchors(dataspaceName, anchorNames); } @Override - public Collection<Anchor> getAnchors(final String dataspaceName, final Collection<String> schemaSetNames) { - cpsValidator.validateNameCharacters(dataspaceName); - cpsValidator.validateNameCharacters(schemaSetNames); - return cpsAdminPersistenceService.getAnchors(dataspaceName, schemaSetNames); + public Collection<Anchor> getAnchorsBySchemaSetName(final String dataspaceName, final String schemaSetName) { + cpsValidator.validateNameCharacters(dataspaceName, schemaSetName); + return cpsAdminPersistenceService.getAnchorsBySchemaSetName(dataspaceName, schemaSetName); } @Override - public Anchor getAnchor(final String dataspaceName, final String anchorName) { - cpsValidator.validateNameCharacters(dataspaceName, anchorName); - return cpsAdminPersistenceService.getAnchor(dataspaceName, anchorName); + public Collection<Anchor> getAnchorsBySchemaSetNames(final String dataspaceName, + final Collection<String> schemaSetNames) { + cpsValidator.validateNameCharacters(dataspaceName); + cpsValidator.validateNameCharacters(schemaSetNames); + return cpsAdminPersistenceService.getAnchorsBySchemaSetNames(dataspaceName, schemaSetNames); } @Override diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java index 14b949e5ae..e6ad9a8bb8 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java @@ -97,7 +97,7 @@ public class CpsModuleServiceImpl implements CpsModuleService { public void deleteSchemaSet(final String dataspaceName, final String schemaSetName, final CascadeDeleteAllowed cascadeDeleteAllowed) { cpsValidator.validateNameCharacters(dataspaceName, schemaSetName); - final Collection<Anchor> anchors = cpsAnchorService.getAnchors(dataspaceName, schemaSetName); + final Collection<Anchor> anchors = cpsAnchorService.getAnchorsBySchemaSetName(dataspaceName, schemaSetName); if (!anchors.isEmpty() && isCascadeDeleteProhibited(cascadeDeleteAllowed)) { throw new SchemaSetInUseException(dataspaceName, schemaSetName); } @@ -114,8 +114,9 @@ public class CpsModuleServiceImpl implements CpsModuleService { public void deleteSchemaSetsWithCascade(final String dataspaceName, final Collection<String> schemaSetNames) { cpsValidator.validateNameCharacters(dataspaceName); cpsValidator.validateNameCharacters(schemaSetNames); - final Collection<String> anchorNames = cpsAnchorService.getAnchors(dataspaceName, schemaSetNames) - .stream().map(Anchor::getName).collect(Collectors.toSet()); + final Collection<String> anchorNames = + cpsAnchorService.getAnchorsBySchemaSetNames(dataspaceName, schemaSetNames) + .stream().map(Anchor::getName).collect(Collectors.toSet()); cpsAnchorService.deleteAnchors(dataspaceName, anchorNames); cpsModulePersistenceService.deleteSchemaSets(dataspaceName, schemaSetNames); cpsModulePersistenceService.deleteUnusedYangResourceModules(); 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 2b21619cb7..25830a55de 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 @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020-2022 Nordix Foundation. + * Copyright (C) 2020-2024 Nordix Foundation. * Modifications Copyright (C) 2020-2022 Bell Canada. * Modifications Copyright (C) 2021 Pantheon.tech * Modifications Copyright (C) 2022 TechMahindra Ltd. @@ -73,30 +73,48 @@ public interface CpsAdminPersistenceService { void createAnchor(String dataspaceName, String schemaSetName, String anchorName); /** - * Read all anchors associated with the given schema-set in the given dataspace. + * Get an anchor in the given dataspace using the anchor name. + * + * @param dataspaceName dataspace name + * @param anchorName anchor name + * @return an anchor + */ + Anchor getAnchor(String dataspaceName, String anchorName); + + /** + * Read all anchors in the given a dataspace. * * @param dataspaceName dataspace name - * @param schemaSetName schema-set name * @return a collection of anchors */ - Collection<Anchor> getAnchors(String dataspaceName, String schemaSetName); + Collection<Anchor> getAnchors(String dataspaceName); /** - * Read all anchors associated with multiple schema-sets in the given dataspace. + * Read all anchors in the given dataspace with the anchor names. * - * @param dataspaceName dataspace name - * @param schemaSetNames schema-set names + * @param dataspaceName dataspace name + * @param anchorNames anchor names * @return a collection of anchors */ - Collection<Anchor> getAnchors(String dataspaceName, Collection<String> schemaSetNames); + Collection<Anchor> getAnchors(String dataspaceName, Collection<String> anchorNames); /** - * Read all anchors in the given a dataspace. + * Read all anchors associated with the given schema-set in the given dataspace. * * @param dataspaceName dataspace name + * @param schemaSetName schema-set name * @return a collection of anchors */ - Collection<Anchor> getAnchors(String dataspaceName); + Collection<Anchor> getAnchorsBySchemaSetName(String dataspaceName, String schemaSetName); + + /** + * Read all anchors associated with multiple schema-sets in the given dataspace. + * + * @param dataspaceName dataspace name + * @param schemaSetNames schema-set names + * @return a collection of anchors + */ + Collection<Anchor> getAnchorsBySchemaSetNames(String dataspaceName, Collection<String> schemaSetNames); /** * Query anchor names for the given module names in the provided dataspace. @@ -110,15 +128,6 @@ public interface CpsAdminPersistenceService { Collection<String> queryAnchorNames(String dataspaceName, Collection<String> moduleNames); /** - * Get an anchor in the given dataspace using the anchor name. - * - * @param dataspaceName dataspace name - * @param anchorName anchor name - * @return an anchor - */ - Anchor getAnchor(String dataspaceName, String anchorName); - - /** * Delete anchor by name in given dataspace. * * @param dataspaceName dataspace name diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy index c7865386bc..e58a5024b5 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2023 Nordix Foundation + * Copyright (C) 2023-2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,9 +59,9 @@ class CpsAnchorServiceImplSpec extends Specification { def 'Retrieve all anchors for schema-set.'() { given: 'that anchor is associated with the dataspace and schemaset' def anchors = [new Anchor()] - mockCpsAdminPersistenceService.getAnchors('someDataspace', 'someSchemaSet') >> anchors + mockCpsAdminPersistenceService.getAnchorsBySchemaSetName('someDataspace', 'someSchemaSet') >> anchors when: 'get anchors is called for a dataspace name and schema set name' - def result = objectUnderTest.getAnchors('someDataspace', 'someSchemaSet') + def result = objectUnderTest.getAnchorsBySchemaSetName('someDataspace', 'someSchemaSet') then: 'the collection provided by persistence service is returned as result' result == anchors and: 'the CpsValidator is called on the dataspaceName, schemaSetName' @@ -71,9 +71,9 @@ class CpsAnchorServiceImplSpec extends Specification { def 'Retrieve all anchors for multiple schema-sets.'() { given: 'that anchor is associated with the dataspace and schemasets' def anchors = [new Anchor(), new Anchor()] - mockCpsAdminPersistenceService.getAnchors('someDataspace', _ as Collection<String>) >> anchors + mockCpsAdminPersistenceService.getAnchorsBySchemaSetNames('someDataspace', _ as Collection<String>) >> anchors when: 'get anchors is called for a dataspace name and schema set names' - def result = objectUnderTest.getAnchors('someDataspace', ['schemaSet1', 'schemaSet2']) + def result = objectUnderTest.getAnchorsBySchemaSetNames('someDataspace', ['schemaSet1', 'schemaSet2']) then: 'the collection provided by persistence service is returned as result' result == anchors and: 'the CpsValidator is called on the dataspace name and schema-set names' @@ -93,6 +93,21 @@ class CpsAnchorServiceImplSpec extends Specification { 1 * mockCpsValidator.validateNameCharacters('someDataspace', 'someAnchor') } + def 'Retrieve multiple anchors for dataspace and provided anchor names.'() { + given: 'multiple anchors names to get' + def anchorNames = ['anchor1', 'anchor2'] + and: 'that anchors are associated with the dataspace and anchor names' + def anchors = [new Anchor(), new Anchor()] + mockCpsAdminPersistenceService.getAnchors('someDataspace', anchorNames) >> anchors + when: 'get anchors is called for a dataspace name and anchor names' + def result = objectUnderTest.getAnchors('someDataspace', anchorNames) + then: 'the collection provided by persistence service is returned as result' + result == anchors + and: 'the CpsValidator is called on the dataspace name and anchor names' + 1 * mockCpsValidator.validateNameCharacters('someDataspace') + 1 * mockCpsValidator.validateNameCharacters(anchorNames) + } + def 'Delete anchor.'() { when: 'delete anchor is invoked' objectUnderTest.deleteAnchor('someDataspace','someAnchor') @@ -105,15 +120,17 @@ class CpsAnchorServiceImplSpec extends Specification { } def 'Delete multiple anchors.'() { + given: 'multiple anchors to delete' + def anchorNames = ['anchor1', 'anchor2'] when: 'delete anchors is invoked' - objectUnderTest.deleteAnchors('someDataspace', ['anchor1', 'anchor2']) + objectUnderTest.deleteAnchors('someDataspace', anchorNames) then: 'delete data nodes is invoked on the data service with expected parameters' - 1 * mockCpsDataPersistenceService.deleteDataNodes('someDataspace', _ as Collection<String>) + 1 * mockCpsDataPersistenceService.deleteDataNodes('someDataspace', anchorNames) and: 'the persistence service method is invoked with same parameters to delete anchor' - 1 * mockCpsAdminPersistenceService.deleteAnchors('someDataspace',_ as Collection<String>) + 1 * mockCpsAdminPersistenceService.deleteAnchors('someDataspace', anchorNames) and: 'the CpsValidator is called on the dataspace name and anchor names' 1 * mockCpsValidator.validateNameCharacters('someDataspace') - 1 * mockCpsValidator.validateNameCharacters(_) + 1 * mockCpsValidator.validateNameCharacters(anchorNames) } def 'Query all anchor identifiers for a dataspace and module names.'() { diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy index edf25715b3..4e5807ec84 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy @@ -55,6 +55,8 @@ import spock.lang.Shared import spock.lang.Specification import java.time.OffsetDateTime +import static org.onap.cps.events.model.Data.Operation.DELETE + class CpsDataServiceImplSpec extends Specification { def mockCpsDataPersistenceService = Mock(CpsDataPersistenceService) def mockCpsAnchorService = Mock(CpsAnchorService) @@ -489,15 +491,19 @@ class CpsDataServiceImplSpec extends Specification { def 'Delete all data nodes for given dataspace and multiple anchors.'() { given: 'schema set for given anchors and dataspace references test tree model' setupSchemaSetMocks('test-tree.yang') - mockCpsAnchorService.getAnchors(dataspaceName, ['anchor1', 'anchor2']) >> - [new Anchor(name: 'anchor1', dataspaceName: dataspaceName), - new Anchor(name: 'anchor2', dataspaceName: dataspaceName)] + def anchor1 = new Anchor(name: 'anchor1', dataspaceName: dataspaceName) + def anchor2 = new Anchor(name: 'anchor2', dataspaceName: dataspaceName) + mockCpsAnchorService.getAnchors(dataspaceName, ['anchor1', 'anchor2']) >> [anchor1, anchor2] when: 'delete data node method is invoked with correct parameters' objectUnderTest.deleteDataNodes(dataspaceName, ['anchor1', 'anchor2'], observedTimestamp) then: 'the CpsValidator is called on the dataspace name and the anchor names' - 2 * mockCpsValidator.validateNameCharacters(_) + 1 * mockCpsValidator.validateNameCharacters(dataspaceName) + 1 * mockCpsValidator.validateNameCharacters(['anchor1', 'anchor2']) and: 'the persistence service method is invoked with the correct parameters' 1 * mockCpsDataPersistenceService.deleteDataNodes(dataspaceName, _ as Collection<String>) + and: 'a data update event is sent for each anchor' + 1 * mockDataUpdateEventsService.publishCpsDataUpdateEvent(anchor1, '/', DELETE, observedTimestamp) + 1 * mockDataUpdateEventsService.publishCpsDataUpdateEvent(anchor2, '/', DELETE, observedTimestamp) } def 'Start session.'() { diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy index 0bad0de6ac..ad8c54bf27 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy @@ -134,7 +134,7 @@ class CpsModuleServiceImplSpec extends Specification { def 'Delete schema-set when cascade is allowed.'() { given: '#numberOfAnchors anchors are associated with schemaset' def associatedAnchors = createAnchors(numberOfAnchors) - mockCpsAnchorService.getAnchors('my-dataspace', 'my-schemaset') >> associatedAnchors + mockCpsAnchorService.getAnchorsBySchemaSetName('my-dataspace', 'my-schemaset') >> associatedAnchors when: 'schema set deletion is requested with cascade allowed' objectUnderTest.deleteSchemaSet('my-dataspace', 'my-schemaset', CASCADE_DELETE_ALLOWED) then: 'anchor deletion is called #numberOfAnchors times' @@ -153,7 +153,7 @@ class CpsModuleServiceImplSpec extends Specification { def 'Delete schema-set when cascade is prohibited.'() { given: 'no anchors are associated with schemaset' - mockCpsAnchorService.getAnchors('my-dataspace', 'my-schemaset') >> Collections.emptyList() + mockCpsAnchorService.getAnchorsBySchemaSetName('my-dataspace', 'my-schemaset') >> Collections.emptyList() when: 'schema set deletion is requested with cascade allowed' objectUnderTest.deleteSchemaSet('my-dataspace', 'my-schemaset', CASCADE_DELETE_PROHIBITED) then: 'no anchors are deleted' @@ -170,7 +170,7 @@ class CpsModuleServiceImplSpec extends Specification { def 'Delete schema-set when cascade is prohibited and schema-set has anchors.'() { given: '2 anchors are associated with schemaset' - mockCpsAnchorService.getAnchors('my-dataspace', 'my-schemaset') >> createAnchors(2) + mockCpsAnchorService.getAnchorsBySchemaSetName('my-dataspace', 'my-schemaset') >> createAnchors(2) when: 'schema set deletion is requested with cascade allowed' objectUnderTest.deleteSchemaSet('my-dataspace', 'my-schemaset', CASCADE_DELETE_PROHIBITED) then: 'Schema-Set in Use exception is thrown' @@ -179,7 +179,7 @@ class CpsModuleServiceImplSpec extends Specification { def 'Delete multiple schema-sets when cascade is allowed.'() { given: '#numberOfAnchors anchors are associated with each schemaset' - mockCpsAnchorService.getAnchors('my-dataspace', ['my-schemaset1', 'my-schemaset2']) >> createAnchors(numberOfAnchors * 2) + mockCpsAnchorService.getAnchorsBySchemaSetNames('my-dataspace', ['my-schemaset1', 'my-schemaset2']) >> createAnchors(numberOfAnchors * 2) when: 'schema set deletion is requested with cascade allowed' objectUnderTest.deleteSchemaSetsWithCascade('my-dataspace', ['my-schemaset1', 'my-schemaset2']) then: 'anchor deletion is called #numberOfAnchors times' diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAnchorServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAnchorServiceIntegrationSpec.groovy index 3013e6ff94..26857799a1 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAnchorServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAnchorServiceIntegrationSpec.groovy @@ -63,9 +63,9 @@ class CpsAnchorServiceIntegrationSpec extends CpsIntegrationSpecBase { then: 'there are 3 anchors in the general test database' assert objectUnderTest.getAnchors(GENERAL_TEST_DATASPACE).size() == 3 and: 'there are 2 anchors associated with bookstore schema set' - assert objectUnderTest.getAnchors(GENERAL_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET).size() == 2 + assert objectUnderTest.getAnchorsBySchemaSetName(GENERAL_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET).size() == 2 and: 'there is 1 anchor associated with other schema set' - assert objectUnderTest.getAnchors(GENERAL_TEST_DATASPACE, 'otherSchemaSet').size() == 1 + assert objectUnderTest.getAnchorsBySchemaSetName(GENERAL_TEST_DATASPACE, 'otherSchemaSet').size() == 1 } def 'Querying anchor(name)s (depends on previous test!).'() { diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataspaceServiceLimitsPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataspaceServiceLimitsPerfTest.groovy index e1235272fe..ab8ffe7c76 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataspaceServiceLimitsPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataspaceServiceLimitsPerfTest.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2023 Nordix Foundation + * Copyright (C) 2023-2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ class CpsDataspaceServiceLimitsPerfTest extends CpsPerfTestBase { given: 'more than 32,766 schema set names' def schemaSetNames = (0..40_000).collect { "size-of-this-name-does-not-matter-for-limit-" + it } when: 'single get is executed to get all the anchors' - objectUnderTest.getAnchors(CPS_PERFORMANCE_TEST_DATASPACE, schemaSetNames) + objectUnderTest.getAnchorsBySchemaSetNames(CPS_PERFORMANCE_TEST_DATASPACE, schemaSetNames) then: 'a database exception is not thrown' noExceptionThrown() } |