diff options
Diffstat (limited to 'integration-test')
12 files changed, 159 insertions, 105 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy index 40fe03018..6dec3dbf9 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy @@ -20,10 +20,11 @@ package org.onap.cps.integration.base +import org.onap.cps.api.CpsAnchorService +import org.onap.cps.api.CpsDataService +import org.onap.cps.api.CpsDataspaceService +import org.onap.cps.api.CpsModuleService import org.onap.cps.api.CpsQueryService -import org.onap.cps.api.impl.CpsAdminServiceImpl -import org.onap.cps.api.impl.CpsDataServiceImpl -import org.onap.cps.api.impl.CpsModuleServiceImpl import org.onap.cps.integration.DatabaseTestContainer import org.onap.cps.spi.config.CpsSessionFactory import org.onap.cps.spi.exceptions.DataspaceNotFoundException @@ -44,7 +45,7 @@ import spock.lang.Specification import java.time.OffsetDateTime -@SpringBootTest(classes = [TestConfig, CpsAdminServiceImpl, CpsValidatorImpl, SessionManager, CpsSessionFactory]) +@SpringBootTest(classes = [TestConfig, CpsValidatorImpl, SessionManager, CpsSessionFactory]) @Testcontainers @EnableAutoConfiguration @EnableJpaRepositories(basePackageClasses = [DataspaceRepository]) @@ -57,15 +58,19 @@ class CpsIntegrationSpecBase extends Specification { @Autowired @Lazy - CpsAdminServiceImpl cpsAdminService + CpsDataspaceService cpsDataspaceService @Autowired @Lazy - CpsDataServiceImpl cpsDataService + CpsAnchorService cpsAnchorService @Autowired @Lazy - CpsModuleServiceImpl cpsModuleService + CpsDataService cpsDataService + + @Autowired + @Lazy + CpsModuleService cpsModuleService @Autowired @Lazy @@ -83,7 +88,7 @@ class CpsIntegrationSpecBase extends Specification { def setup() { if (!initialized) { - cpsAdminService.createDataspace(GENERAL_TEST_DATASPACE) + cpsDataspaceService.createDataspace(GENERAL_TEST_DATASPACE) def bookstoreModelFileContent = readResourceDataFile('bookstore/bookstore.yang') cpsModuleService.createSchemaSet(GENERAL_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, [bookstore : bookstoreModelFileContent]) initialized = true; @@ -108,7 +113,7 @@ class CpsIntegrationSpecBase extends Specification { def dataspaceExists(dataspaceName) { try { - cpsAdminService.getDataspace(dataspaceName) + cpsDataspaceService.getDataspace(dataspaceName) } catch (DataspaceNotFoundException dataspaceNotFoundException) { return false } @@ -117,7 +122,7 @@ class CpsIntegrationSpecBase extends Specification { def addAnchorsWithData(numberOfAnchors, dataspaceName, schemaSetName, anchorNamePrefix, data) { (1..numberOfAnchors).each { - cpsAdminService.createAnchor(dataspaceName, schemaSetName, anchorNamePrefix + it) + cpsAnchorService.createAnchor(dataspaceName, schemaSetName, anchorNamePrefix + it) cpsDataService.saveData(dataspaceName, anchorNamePrefix + it, data.replace("Easons", "Easons-"+it.toString()), OffsetDateTime.now()) } } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/base/FunctionalSpecBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/base/FunctionalSpecBase.groovy index 14612d6c1..b10194560 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/base/FunctionalSpecBase.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/base/FunctionalSpecBase.groovy @@ -50,9 +50,9 @@ class FunctionalSpecBase extends CpsIntegrationSpecBase { } def setupBookstoreInfraStructure() { - cpsAdminService.createDataspace(FUNCTIONAL_TEST_DATASPACE_1) - cpsAdminService.createDataspace(FUNCTIONAL_TEST_DATASPACE_2) - cpsAdminService.createDataspace(FUNCTIONAL_TEST_DATASPACE_3) + cpsDataspaceService.createDataspace(FUNCTIONAL_TEST_DATASPACE_1) + cpsDataspaceService.createDataspace(FUNCTIONAL_TEST_DATASPACE_2) + cpsDataspaceService.createDataspace(FUNCTIONAL_TEST_DATASPACE_3) def bookstoreYangModelAsString = readResourceDataFile('bookstore/bookstore.yang') cpsModuleService.createSchemaSet(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_SCHEMA_SET, [bookstore: bookstoreYangModelAsString]) cpsModuleService.createSchemaSet(FUNCTIONAL_TEST_DATASPACE_2, BOOKSTORE_SCHEMA_SET, [bookstore: bookstoreYangModelAsString]) @@ -73,8 +73,8 @@ class FunctionalSpecBase extends CpsIntegrationSpecBase { def restoreBookstoreDataAnchor(anchorNumber) { def anchorName = 'bookstoreAnchor' + anchorNumber - cpsAdminService.deleteAnchor(FUNCTIONAL_TEST_DATASPACE_1, anchorName) - cpsAdminService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_SCHEMA_SET, anchorName) + cpsAnchorService.deleteAnchor(FUNCTIONAL_TEST_DATASPACE_1, anchorName) + cpsAnchorService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_SCHEMA_SET, anchorName) cpsDataService.saveData(FUNCTIONAL_TEST_DATASPACE_1, anchorName, bookstoreJsonData.replace("Easons", "Easons-"+anchorNumber.toString()), OffsetDateTime.now()) } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAnchorServiceIntegrationSpec.groovy index f8eca6199..99dab8426 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAdminServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsAnchorServiceIntegrationSpec.groovy @@ -20,76 +20,19 @@ package org.onap.cps.integration.functional -import org.onap.cps.api.CpsAdminService +import org.onap.cps.api.CpsAnchorService import org.onap.cps.integration.base.CpsIntegrationSpecBase import org.onap.cps.spi.FetchDescendantsOption import org.onap.cps.spi.exceptions.AlreadyDefinedException import org.onap.cps.spi.exceptions.AnchorNotFoundException -import org.onap.cps.spi.exceptions.DataspaceInUseException -import org.onap.cps.spi.exceptions.DataspaceNotFoundException -import java.time.OffsetDateTime - -class CpsAdminServiceIntegrationSpec extends CpsIntegrationSpecBase { - - CpsAdminService objectUnderTest - def setup() { objectUnderTest = cpsAdminService } - - def 'Dataspace CRUD operations.'() { - when: 'a dataspace is created' - objectUnderTest.createDataspace('newDataspace') - then: 'the dataspace can be read' - assert objectUnderTest.getDataspace('newDataspace').name == 'newDataspace' - and: 'it can be deleted' - objectUnderTest.deleteDataspace('newDataspace') - then: 'the dataspace no longer exists i.e. an exception is thrown if an attempt is made to retrieve it' - def thrown = null - try { - objectUnderTest.getDataspace('newDataspace') - } catch(Exception exception) { - thrown = exception - } - assert thrown instanceof DataspaceNotFoundException - } +import java.time.OffsetDateTime - def 'Delete dataspace with error; #scenario.'() { - setup: 'add some anchors if needed' - numberOfAnchors.times { - objectUnderTest.createAnchor(GENERAL_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, 'anchor' + it) - } - when: 'attempt to delete dataspace' - objectUnderTest.deleteDataspace(dataspaceName) - then: 'the correct exception is thrown with the relevant details' - def thrownException = thrown(expectedException) - thrownException.details.contains(expectedMessageDetails) - cleanup: - numberOfAnchors.times { - objectUnderTest.deleteAnchor(GENERAL_TEST_DATASPACE, 'anchor' + it) - } - where: 'the following data is used' - scenario | dataspaceName | numberOfAnchors || expectedException | expectedMessageDetails - 'dataspace name does not exist' | 'unknown' | 0 || DataspaceNotFoundException | 'unknown does not exist' - 'dataspace contains schemasets' | GENERAL_TEST_DATASPACE | 0 || DataspaceInUseException | 'contains 1 schemaset(s)' - 'dataspace contains anchors' | GENERAL_TEST_DATASPACE | 2 || DataspaceInUseException | 'contains 2 anchor(s)' - } +class CpsAnchorServiceIntegrationSpec extends CpsIntegrationSpecBase { - def 'Retrieve all dataspaces (depends on total test suite).'() { - given: 'two addtional dataspaces are created' - objectUnderTest.createDataspace('dataspace1') - objectUnderTest.createDataspace('dataspace2') - when: 'all datespaces are retreived' - def result = objectUnderTest.getAllDataspaces() - then: 'there are at least 3 dataspaces (2 new ones plus the general test dataspace)' - result.size() >= 3 - assert result.name.containsAll([GENERAL_TEST_DATASPACE, 'dataspace1', 'dataspace2']) - } + CpsAnchorService objectUnderTest - def 'Duplicate dataspaces.'() { - when: 'attempting to create a dataspace with the same name as an existing one' - objectUnderTest.createDataspace(GENERAL_TEST_DATASPACE) - then: 'an exception is thrown indicating the dataspace already exists' - thrown(AlreadyDefinedException) - } + def setup() { objectUnderTest = cpsAnchorService } def 'Anchor CRUD operations.'() { when: 'an anchor is created' @@ -148,9 +91,9 @@ class CpsAdminServiceIntegrationSpec extends CpsIntegrationSpecBase { then: 'an empty result is returned (no error)' assert result == [] where: - scenario | dataspaceName - 'non existing database' | 'nonExistingDataspace' - 'just unknown module(s)' | GENERAL_TEST_DATASPACE + scenario | dataspaceName + 'non existing database' | 'nonExistingDataspace' + 'just unknown module(s)' | GENERAL_TEST_DATASPACE } def 'Update anchor schema set.'() { diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy index 017ede7de..b107a87e8 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy @@ -34,8 +34,6 @@ import org.onap.cps.spi.exceptions.DataValidationException import org.onap.cps.spi.exceptions.DataspaceNotFoundException import org.onap.cps.spi.model.DeltaReport -import java.time.OffsetDateTime - import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS @@ -174,7 +172,7 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase { def 'Attempt to create a top level data node using root.'() { given: 'a new anchor' - cpsAdminService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_SCHEMA_SET, 'newAnchor1'); + cpsAnchorService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_SCHEMA_SET, 'newAnchor1'); when: 'attempt to save new top level datanode' def json = '{"bookstore": {"bookstore-name": "New Store"} }' objectUnderTest.saveData(FUNCTIONAL_TEST_DATASPACE_1, 'newAnchor1' , '/', json, now) diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataspaceServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataspaceServiceIntegrationSpec.groovy new file mode 100644 index 000000000..739e80224 --- /dev/null +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataspaceServiceIntegrationSpec.groovy @@ -0,0 +1,107 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2023 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.integration.functional + +import org.onap.cps.api.CpsDataspaceService +import org.onap.cps.integration.base.CpsIntegrationSpecBase +import org.onap.cps.spi.exceptions.AlreadyDefinedException +import org.onap.cps.spi.exceptions.DataspaceInUseException +import org.onap.cps.spi.exceptions.DataspaceNotFoundException + +class CpsDataspaceServiceIntegrationSpec extends CpsIntegrationSpecBase { + + CpsDataspaceService objectUnderTest + + def setup() { objectUnderTest = cpsDataspaceService } + + def 'Dataspace CRUD operations.'() { + when: 'a dataspace is created' + objectUnderTest.createDataspace('newDataspace') + then: 'the dataspace can be read' + assert objectUnderTest.getDataspace('newDataspace').name == 'newDataspace' + and: 'it can be deleted' + objectUnderTest.deleteDataspace('newDataspace') + then: 'the dataspace no longer exists i.e. an exception is thrown if an attempt is made to retrieve it' + def thrown = null + try { + objectUnderTest.getDataspace('newDataspace') + } catch(Exception exception) { + thrown = exception + } + assert thrown instanceof DataspaceNotFoundException + } + + def 'Attempt to delete a non-existing dataspace'() { + when: 'attempt to delete a non-existing dataspace' + objectUnderTest.deleteDataspace('non-existing-name') + then: 'a not found exception is thrown with the relevant dataspace name' + def thrownException = thrown(DataspaceNotFoundException) + assert thrownException.details.contains('non-existing-name does not exist') + } + + def 'Attempt Delete dataspace with a schema set and anchor'() { + setup: 'a dataspace with a schema set and anchor' + objectUnderTest.createDataspace('targetDataspace') + cpsModuleService.createSchemaSet('targetDataspace','someSchemaSet',[:]) + cpsAnchorService.createAnchor('targetDataspace', 'someSchemaSet', 'some_anchor') + when: 'attempt to delete dataspace' + objectUnderTest.deleteDataspace('targetDataspace') + then: 'an in-use exception is thrown mentioning anchors' + def thrownException = thrown(DataspaceInUseException) + assert thrownException.details.contains('contains 1 anchor(s)') + cleanup: + cpsModuleService.deleteSchemaSetsWithCascade('targetDataspace',['someSchemaSet']) + objectUnderTest.deleteDataspace('targetDataspace') + } + + def 'Attempt to delete dataspace with just a schema set'() { + setup: 'a dataspace with a schema set' + objectUnderTest.createDataspace('targetDataspace') + cpsModuleService.createSchemaSet('targetDataspace','someSchemaSet',[:]) + when: 'attempt to delete dataspace' + objectUnderTest.deleteDataspace('targetDataspace') + then: 'an in-use exception is thrown mentioning schemasets' + def thrownException = thrown(DataspaceInUseException) + assert thrownException.details.contains('contains 1 schemaset(s)') + cleanup: + cpsModuleService.deleteSchemaSetsWithCascade('targetDataspace',['someSchemaSet']) + objectUnderTest.deleteDataspace('targetDataspace') + } + + def 'Retrieve all dataspaces (depends on total test suite).'() { + given: 'two addtional dataspaces are created' + objectUnderTest.createDataspace('dataspace1') + objectUnderTest.createDataspace('dataspace2') + when: 'all datespaces are retreived' + def result = objectUnderTest.getAllDataspaces() + then: 'there are at least 3 dataspaces (2 new ones plus the general test dataspace)' + result.size() >= 3 + assert result.name.containsAll([GENERAL_TEST_DATASPACE, 'dataspace1', 'dataspace2']) + } + + def 'Duplicate dataspaces.'() { + when: 'attempting to create a dataspace with the same name as an existing one' + objectUnderTest.createDataspace(GENERAL_TEST_DATASPACE) + then: 'an exception is thrown indicating the dataspace already exists' + thrown(AlreadyDefinedException) + } + +} diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsModuleServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsModuleServiceIntegrationSpec.groovy index 2e1b082c0..cf0e0b594 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsModuleServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsModuleServiceIntegrationSpec.groovy @@ -20,6 +20,7 @@ package org.onap.cps.integration.functional +import org.onap.cps.api.CpsModuleService import org.onap.cps.api.impl.CpsModuleServiceImpl import org.onap.cps.integration.base.FunctionalSpecBase import org.onap.cps.spi.CascadeDeleteAllowed @@ -33,7 +34,7 @@ import org.onap.cps.spi.model.ModuleReference class CpsModuleServiceIntegrationSpec extends FunctionalSpecBase { - CpsModuleServiceImpl objectUnderTest + CpsModuleService objectUnderTest private static def originalNumberOfModuleReferences = 1 private static def existingModuleReference = new ModuleReference('stores','2020-09-15') @@ -97,7 +98,7 @@ class CpsModuleServiceIntegrationSpec extends FunctionalSpecBase { def schemaSetName = "NewSchemaWith${numberOfNewModules}Modules" objectUnderTest.createSchemaSetFromModules(FUNCTIONAL_TEST_DATASPACE_1, schemaSetName, newYangResourcesNameToContentMap, moduleReferences) and: 'associated with a new anchor' - cpsAdminService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, schemaSetName, 'newAnchor') + cpsAnchorService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, schemaSetName, 'newAnchor') then: 'the new anchor has the correct number of modules' def yangResourceModuleReferences = objectUnderTest.getYangResourcesModuleReferences(FUNCTIONAL_TEST_DATASPACE_1, 'newAnchor') assert expectedNumberOfModulesForAnchor == yangResourceModuleReferences.size() @@ -204,7 +205,7 @@ class CpsModuleServiceIntegrationSpec extends FunctionalSpecBase { objectUnderTest.createSchemaSet(FUNCTIONAL_TEST_DATASPACE_1, 'newSchemaSet', newYangResourcesNameToContentMap) and: 'optionally create anchor for the schema set' if (associateWithAnchor) { - cpsAdminService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, 'newSchemaSet', 'newAnchor') + cpsAnchorService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, 'newSchemaSet', 'newAnchor') } when: 'attempt to delete the schema set' try { @@ -270,7 +271,7 @@ class CpsModuleServiceIntegrationSpec extends FunctionalSpecBase { given: 'an anchor and schema set with 2 modules (to be upgraded)' populateNewYangResourcesNameToContentMapAndAllModuleReferences('original', 2) objectUnderTest.createSchemaSetFromModules(FUNCTIONAL_TEST_DATASPACE_1, 'targetSchema', newYangResourcesNameToContentMap, []) - cpsAdminService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, 'targetSchema', 'targetAnchor') + cpsAnchorService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, 'targetSchema', 'targetAnchor') def yangResourceModuleReferencesBeforeUpgrade = objectUnderTest.getYangResourcesModuleReferences(FUNCTIONAL_TEST_DATASPACE_1, 'targetAnchor') assert yangResourceModuleReferencesBeforeUpgrade.size() == 2 assert yangResourceModuleReferencesBeforeUpgrade.containsAll([new ModuleReference('original_0','2000-01-01'),new ModuleReference('original_1','2001-01-01')]) @@ -291,18 +292,18 @@ class CpsModuleServiceIntegrationSpec extends FunctionalSpecBase { cleanup: objectUnderTest.deleteSchemaSetsWithCascade(FUNCTIONAL_TEST_DATASPACE_1, ['targetSchema']) } - + def 'Upgrade existing schema set from another anchor (used in NCMP for matching module set tag)'() { given: 'an anchor and schema set with 1 module (target)' populateNewYangResourcesNameToContentMapAndAllModuleReferences('target', 1) objectUnderTest.createSchemaSetFromModules(FUNCTIONAL_TEST_DATASPACE_1, 'targetSchema', newYangResourcesNameToContentMap, []) - cpsAdminService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, 'targetSchema', 'targetAnchor') + cpsAnchorService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, 'targetSchema', 'targetAnchor') def moduleReferencesBeforeUpgrade = objectUnderTest.getYangResourcesModuleReferences(FUNCTIONAL_TEST_DATASPACE_1, 'targetAnchor') assert moduleReferencesBeforeUpgrade.size() == 1 and: 'another anchor and schema set with 2 other modules (source for upgrade)' populateNewYangResourcesNameToContentMapAndAllModuleReferences('source', 2) objectUnderTest.createSchemaSetFromModules(FUNCTIONAL_TEST_DATASPACE_1, 'sourceSchema', newYangResourcesNameToContentMap, []) - cpsAdminService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, 'sourceSchema', 'sourceAnchor') + cpsAnchorService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, 'sourceSchema', 'sourceAnchor') assert objectUnderTest.getYangResourcesModuleReferences(FUNCTIONAL_TEST_DATASPACE_1, 'sourceAnchor').size() == 2 when: 'the target schema is upgraded using the module references from the source anchor' def moduleReferencesFromSourceAnchor = objectUnderTest.getYangResourcesModuleReferences(FUNCTIONAL_TEST_DATASPACE_1, 'sourceAnchor') diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/CpsPerfTestBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/CpsPerfTestBase.groovy index d8012ec6d..816aeff71 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/CpsPerfTestBase.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/CpsPerfTestBase.groovy @@ -43,7 +43,7 @@ class CpsPerfTestBase extends PerfTestBase { } def setupPerformanceInfraStructure() { - cpsAdminService.createDataspace(CPS_PERFORMANCE_TEST_DATASPACE) + cpsDataspaceService.createDataspace(CPS_PERFORMANCE_TEST_DATASPACE) def modelAsString = readResourceDataFile('bookstore/bookstore.yang') cpsModuleService.createSchemaSet(CPS_PERFORMANCE_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, [bookstore: modelAsString]) } diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy index 12b04be2e..0557d5bb7 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy @@ -59,14 +59,14 @@ class NcmpPerfTestBase extends PerfTestBase { } def setupPerformanceInfraStructure() { - cpsAdminService.createDataspace(NCMP_PERFORMANCE_TEST_DATASPACE) + cpsDataspaceService.createDataspace(NCMP_PERFORMANCE_TEST_DATASPACE) createRegistrySchemaSet() createCmDataSubscriptionsSchemaSet() addCmSubscriptionData() } def createInitialData() { - cpsAdminService.createAnchor(NCMP_PERFORMANCE_TEST_DATASPACE, REGISTRY_SCHEMA_SET, REGISTRY_ANCHOR) + cpsDataspaceService.createAnchor(NCMP_PERFORMANCE_TEST_DATASPACE, REGISTRY_SCHEMA_SET, REGISTRY_ANCHOR) def data = readResourceDataFile('ncmp-registry/1000-cmhandles.json') cpsDataService.saveData(NCMP_PERFORMANCE_TEST_DATASPACE, REGISTRY_ANCHOR, data, OffsetDateTime.now()) } @@ -82,7 +82,7 @@ class NcmpPerfTestBase extends PerfTestBase { } def addCmSubscriptionData() { - cpsAdminService.createAnchor(NCMP_PERFORMANCE_TEST_DATASPACE, CM_DATA_SUBSCRIPTIONS_SCHEMA_SET, CM_DATA_SUBSCRIPTIONS_ANCHOR) + cpsDataspaceService.createAnchor(NCMP_PERFORMANCE_TEST_DATASPACE, CM_DATA_SUBSCRIPTIONS_SCHEMA_SET, CM_DATA_SUBSCRIPTIONS_ANCHOR) cpsDataService.saveData(NCMP_PERFORMANCE_TEST_DATASPACE, CM_DATA_SUBSCRIPTIONS_ANCHOR, datastore1cmHandlePlaceHolder, now) def subscribers = createLeafList('subscribers',numberOfCmDataSubscribers, subscriberIdPrefix) def filters = '"filters":' + createJsonArray('filter',numberOfFiltersPerCmHandle,'xpath',xpathPrefix,subscribers) diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy index ce66cb08a..4d4d6125c 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataServiceLimitsPerfTest.groovy @@ -35,7 +35,7 @@ class CpsDataServiceLimitsPerfTest extends CpsPerfTestBase { def 'Create 33,000 books (note further tests depend on this running first).'() { given: 'an anchor containing a bookstore with one category' - cpsAdminService.createAnchor(CPS_PERFORMANCE_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, 'limitsAnchor') + cpsAnchorService.createAnchor(CPS_PERFORMANCE_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, 'limitsAnchor') def parentNodeData = '{"bookstore": { "categories": [{ "code": 1, "name": "Test", "books" : [] }] }}' cpsDataService.saveData(CPS_PERFORMANCE_TEST_DATASPACE, 'limitsAnchor', parentNodeData, OffsetDateTime.now()) when: '33,000 books are added' @@ -84,7 +84,7 @@ class CpsDataServiceLimitsPerfTest extends CpsPerfTestBase { when: resourceMeter.start() cpsDataService.deleteDataNodes(CPS_PERFORMANCE_TEST_DATASPACE, 'limitsAnchor', OffsetDateTime.now()) - cpsAdminService.deleteAnchor(CPS_PERFORMANCE_TEST_DATASPACE, 'limitsAnchor') + cpsAnchorService.deleteAnchor(CPS_PERFORMANCE_TEST_DATASPACE, 'limitsAnchor') resourceMeter.stop() def durationInSeconds = resourceMeter.getTotalTimeInSeconds() then: 'test data is deleted in 1 second' diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsAdminServiceLimitsPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataspaceServiceLimitsPerfTest.groovy index 9ea7a7b53..e1235272f 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsAdminServiceLimitsPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/CpsDataspaceServiceLimitsPerfTest.groovy @@ -20,14 +20,14 @@ package org.onap.cps.integration.performance.cps -import org.onap.cps.api.CpsAdminService +import org.onap.cps.api.CpsAnchorService import org.onap.cps.integration.performance.base.CpsPerfTestBase -class CpsAdminServiceLimitsPerfTest extends CpsPerfTestBase { +class CpsDataspaceServiceLimitsPerfTest extends CpsPerfTestBase { - CpsAdminService objectUnderTest + CpsAnchorService objectUnderTest - def setup() { objectUnderTest = cpsAdminService } + def setup() { objectUnderTest = cpsAnchorService } def 'Get anchors from multiple schema set names limit exceeded: 32,766 (~ 2^15) schema set names.'() { given: 'more than 32,766 schema set names' diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/DeletePerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/DeletePerfTest.groovy index 818c300a5..e7bfabefb 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/DeletePerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/DeletePerfTest.groovy @@ -182,7 +182,7 @@ class DeletePerfTest extends CpsPerfTestBase { def anchorNames = (1..10).collect {'delete' + it} when: 'data nodes are deleted' resourceMeter.start() - cpsAdminService.deleteAnchors(CPS_PERFORMANCE_TEST_DATASPACE, anchorNames) + cpsAnchorService.deleteAnchors(CPS_PERFORMANCE_TEST_DATASPACE, anchorNames) resourceMeter.stop() def deleteDurationInSeconds = resourceMeter.getTotalTimeInSeconds() then: 'delete duration is within expected time and memory used is within limit' diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy index 0c7107a56..2d38a0dfb 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/cps/WritePerfTest.groovy @@ -27,7 +27,7 @@ class WritePerfTest extends CpsPerfTestBase { def 'Writing openroadm data has linear time.'() { given: 'an empty anchor exists for openroadm' - cpsAdminService.createAnchor(CPS_PERFORMANCE_TEST_DATASPACE, LARGE_SCHEMA_SET, 'writeAnchor') + cpsAnchorService.createAnchor(CPS_PERFORMANCE_TEST_DATASPACE, LARGE_SCHEMA_SET, 'writeAnchor') and: 'a list of device nodes to add' def jsonData = generateOpenRoadData(totalNodes) when: 'device nodes are added' @@ -39,7 +39,7 @@ class WritePerfTest extends CpsPerfTestBase { recordAndAssertResourceUsage("Writing ${totalNodes} devices", expectedDuration, durationInSeconds, memoryLimit, resourceMeter.getTotalMemoryUsageInMB()) cleanup: cpsDataService.deleteDataNodes(CPS_PERFORMANCE_TEST_DATASPACE, 'writeAnchor', OffsetDateTime.now()) - cpsAdminService.deleteAnchor(CPS_PERFORMANCE_TEST_DATASPACE, 'writeAnchor') + cpsAnchorService.deleteAnchor(CPS_PERFORMANCE_TEST_DATASPACE, 'writeAnchor') where: totalNodes || expectedDuration | memoryLimit 50 || 4 | 100 @@ -50,7 +50,7 @@ class WritePerfTest extends CpsPerfTestBase { def 'Writing bookstore data has exponential time.'() { given: 'an anchor containing a bookstore with a single category' - cpsAdminService.createAnchor(CPS_PERFORMANCE_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, 'writeAnchor') + cpsAnchorService.createAnchor(CPS_PERFORMANCE_TEST_DATASPACE, BOOKSTORE_SCHEMA_SET, 'writeAnchor') def parentNodeData = '{"bookstore": { "categories": [{ "code": 1, "name": "Test", "books" : [] }] }}' cpsDataService.saveData(CPS_PERFORMANCE_TEST_DATASPACE, 'writeAnchor', parentNodeData, OffsetDateTime.now()) and: 'a list of books to add' @@ -64,7 +64,7 @@ class WritePerfTest extends CpsPerfTestBase { recordAndAssertResourceUsage("Writing ${totalBooks} books", expectedDuration, durationInSeconds, memoryLimit, resourceMeter.getTotalMemoryUsageInMB()) cleanup: cpsDataService.deleteDataNodes(CPS_PERFORMANCE_TEST_DATASPACE, 'writeAnchor', OffsetDateTime.now()) - cpsAdminService.deleteAnchor(CPS_PERFORMANCE_TEST_DATASPACE, 'writeAnchor') + cpsAnchorService.deleteAnchor(CPS_PERFORMANCE_TEST_DATASPACE, 'writeAnchor') where: totalBooks || expectedDuration | memoryLimit 800 || 1 | 50 |