diff options
author | danielhanrahan <daniel.hanrahan@est.tech> | 2023-06-30 12:14:07 +0100 |
---|---|---|
committer | danielhanrahan <daniel.hanrahan@est.tech> | 2023-07-11 11:48:28 +0100 |
commit | 9cfc03f3af00d0128a5b22e32cc5ba439de627b6 (patch) | |
tree | 591da6d42a571882219e6df207e5ad3cd1167566 /integration-test/src | |
parent | 0ed77bfc78fbb1f33fe6708234759dab2413e0f7 (diff) |
Combine alreadyDefinedException classes
Issue-ID: CPS-1774
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I52ff9074a9f8188e8635a811b0d2713a97cb4b10
Diffstat (limited to 'integration-test/src')
-rw-r--r-- | integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy | 20 |
1 files changed, 10 insertions, 10 deletions
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 5c9ced34e6..351f3106fb 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 @@ -24,7 +24,7 @@ package org.onap.cps.integration.functional import org.onap.cps.api.CpsDataService import org.onap.cps.integration.base.FunctionalSpecBase import org.onap.cps.spi.FetchDescendantsOption -import org.onap.cps.spi.exceptions.AlreadyDefinedExceptionBatch +import org.onap.cps.spi.exceptions.AlreadyDefinedException import org.onap.cps.spi.exceptions.AnchorNotFoundException import org.onap.cps.spi.exceptions.CpsAdminException import org.onap.cps.spi.exceptions.CpsPathException @@ -145,8 +145,8 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase { def json = '{"bookstore": {} }' objectUnderTest.saveData(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, json, now) then: 'an exception that (one cps paths is) already defined is thrown ' - def exceptionThrown = thrown(AlreadyDefinedExceptionBatch) - exceptionThrown.alreadyDefinedXpaths == [ '/bookstore' ] as Set + def exceptionThrown = thrown(AlreadyDefinedException) + exceptionThrown.alreadyDefinedObjectNames == ['/bookstore' ] as Set cleanup: restoreBookstoreDataAnchor(1) } @@ -202,8 +202,8 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase { when: 'attempt to save the list element' objectUnderTest.saveListElements(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1 , '/bookstore', json, now) then: 'an exception that (one cps paths is) already defined is thrown ' - def exceptionThrown = thrown(AlreadyDefinedExceptionBatch) - exceptionThrown.alreadyDefinedXpaths == [ '/bookstore/categories[@code=\'1\']' ] as Set + def exceptionThrown = thrown(AlreadyDefinedException) + exceptionThrown.alreadyDefinedObjectNames == ['/bookstore/categories[@code=\'1\']' ] as Set and: 'there is now one extra data nodes' assert originalCountBookstoreChildNodes + 1 == countDataNodesInBookstore() cleanup: @@ -246,8 +246,8 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase { when: 'the batches of new list element(s) are saved' objectUnderTest.saveListElementsBatch(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1 , '/bookstore', [jsonNewElement, jsonExistingElement], now) then: 'an already defined (batch) exception is thrown for the existing path' - def exceptionThrown = thrown(AlreadyDefinedExceptionBatch) - assert exceptionThrown.alreadyDefinedXpaths == [ '/bookstore/categories[@code=\'1\']' ] as Set + def exceptionThrown = thrown(AlreadyDefinedException) + assert exceptionThrown.alreadyDefinedObjectNames == ['/bookstore/categories[@code=\'1\']' ] as Set and: 'there is now one extra data node' assert originalCountBookstoreChildNodes + 1 == countDataNodesInBookstore() cleanup: @@ -269,7 +269,7 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase { where: 'the following data is used' scenario | parentXpath | json || expectedException 'parent does not exist' | '/bookstore/categories[@code="unknown"]' | '{"books": [ {"title":"new"} ] } ' || DataNodeNotFoundException - 'already existing child' | '/bookstore' | '{"categories": [ {"code":"1"} ] }' || AlreadyDefinedExceptionBatch + 'already existing child' | '/bookstore' | '{"categories": [ {"code":"1"} ] }' || AlreadyDefinedException } def 'Add multiple child data nodes with partial success.'() { @@ -278,8 +278,8 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase { when: 'attempt to add the elements' objectUnderTest.saveData(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore', json, now) then: 'an already defined (batch) exception is thrown for the existing path' - def thrown = thrown(AlreadyDefinedExceptionBatch) - assert thrown.alreadyDefinedXpaths == [ "/bookstore/categories[@code='1']" ] as Set + def thrown = thrown(AlreadyDefinedException) + assert thrown.alreadyDefinedObjectNames == [ "/bookstore/categories[@code='1']" ] as Set and: 'the new data node has been added i.e. can be retrieved' assert objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories[@code="new"]', DIRECT_CHILDREN_ONLY).size() == 1 } |