From 8e08dc797c89f6e85347c10cc7a2e877c126432a Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Fri, 10 Mar 2023 13:27:01 +0000 Subject: Make single deleteDataNode use plural deleteDataNodes - Make deleteDataNode and deleteListDataNode call deleteDataNodes - Add onlySupportListDeletion option to deleteDataNodes to support original deleteListDataNode behaviour - Allow delete root xpath in deleteDataNodes - Fix incorrect use of PathParsingException in deleteDataNode - Update performance tests timings Issue-ID: CPS-1523 Signed-off-by: danielhanrahan Change-Id: I92c3c3ce606a5ab2cb8e6779d1ee0f9853529982 --- ...CpsDataPersistenceServiceIntegrationSpec.groovy | 13 ++++++------ .../CpsDataPersistenceServiceDeletePerfTest.groovy | 24 +++++++++++----------- 2 files changed, 18 insertions(+), 19 deletions(-) (limited to 'cps-ri/src/test/groovy/org') diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceServiceIntegrationSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceServiceIntegrationSpec.groovy index 28916b1c4a..71253278e9 100755 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceServiceIntegrationSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceServiceIntegrationSpec.groovy @@ -25,7 +25,6 @@ package org.onap.cps.spi.impl import com.fasterxml.jackson.databind.ObjectMapper import com.google.common.collect.ImmutableSet -import org.onap.cps.cpspath.parser.PathParsingException import org.onap.cps.spi.CpsDataPersistenceService import org.onap.cps.spi.entities.FragmentEntity import org.onap.cps.spi.exceptions.AlreadyDefinedExceptionBatch @@ -253,8 +252,8 @@ class CpsDataPersistenceServiceIntegrationSpec extends CpsPersistenceSpecBase { when: 'trying to execute a query with a syntax (parsing) error' objectUnderTest.getDataNodes(DATASPACE_NAME, ANCHOR_FOR_DATA_NODES_WITH_LEAVES, 'invalid-cps-path/child' , OMIT_DESCENDANTS) then: 'exception is thrown' - def exceptionThrown = thrown(PathParsingException) - assert exceptionThrown.getMessage().contains('failed to parse at line 1 due to extraneous input \'invalid-cps-path\' expecting \'/\'') + def exceptionThrown = thrown(CpsPathException) + assert exceptionThrown.getDetails() == "failed to parse at line 1 due to extraneous input 'invalid-cps-path' expecting '/'" } @Sql([CLEAR_DATA, SET_DATA]) @@ -288,7 +287,7 @@ class CpsDataPersistenceServiceIntegrationSpec extends CpsPersistenceSpecBase { where: 'the following data is used' scenario | dataspaceName | anchorName | xpath || expectedException 'non existing xpath' | DATASPACE_NAME | ANCHOR_FOR_DATA_NODES_WITH_LEAVES | '/NO-XPATH' || DataNodeNotFoundException - 'invalid Xpath' | DATASPACE_NAME | ANCHOR_FOR_DATA_NODES_WITH_LEAVES | 'INVALID XPATH' || PathParsingException + 'invalid Xpath' | DATASPACE_NAME | ANCHOR_FOR_DATA_NODES_WITH_LEAVES | 'INVALID XPATH' || CpsPathException } @Sql([CLEAR_DATA, SET_DATA]) @@ -667,9 +666,9 @@ class CpsDataPersistenceServiceIntegrationSpec extends CpsPersistenceSpecBase { then: 'a #expectedException is thrown' thrown(expectedException) where: 'the following parameters were used' - scenario | datanodeXpath | expectedException - 'valid data node, non existent child node' | '/parent-203/child-non-existent' | DataNodeNotFoundException - 'invalid list element' | '/parent-206/child-206/grand-child-206@key="A"]' | PathParsingException + scenario | datanodeXpath | expectedException + 'valid data node, non existent child node' | '/parent-203/child-non-existent' | DataNodeNotFoundException + 'invalid list element' | '/parent-206/child-206/grand-child-206@key="A"]' | CpsPathException } @Sql([CLEAR_DATA, SET_DATA]) diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServiceDeletePerfTest.groovy b/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServiceDeletePerfTest.groovy index b6763db5f9..42698a65d6 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServiceDeletePerfTest.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/spi/performance/CpsDataPersistenceServiceDeletePerfTest.groovy @@ -50,8 +50,8 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase } stopWatch.stop() def deleteDurationInMillis = stopWatch.getTotalTimeMillis() - then: 'delete duration is under 400 milliseconds' - recordAndAssertPerformance('Delete 5 children', 400, deleteDurationInMillis) + then: 'delete duration is under 150 milliseconds' + recordAndAssertPerformance('Delete 5 children', 150, deleteDurationInMillis) } def 'Batch delete 100 children with grandchildren'() { @@ -77,8 +77,8 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase } stopWatch.stop() def deleteDurationInMillis = stopWatch.getTotalTimeMillis() - then: 'delete duration is under 400 milliseconds' - recordAndAssertPerformance('Delete 50 grandchildren', 400, deleteDurationInMillis) + then: 'delete duration is under 600 milliseconds' + recordAndAssertPerformance('Delete 50 grandchildren', 600, deleteDurationInMillis) } def 'Batch delete 500 grandchildren (that have no descendants)'() { @@ -118,8 +118,8 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase } stopWatch.stop() def deleteDurationInMillis = stopWatch.getTotalTimeMillis() - then: 'delete duration is under 2 seconds' - recordAndAssertPerformance('Delete 5 whole lists', 2_000, deleteDurationInMillis) + then: 'delete duration is under 130 milliseconds' + recordAndAssertPerformance('Delete 5 whole lists', 130, deleteDurationInMillis) } def 'Batch delete 100 whole lists'() { @@ -145,8 +145,8 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase } stopWatch.stop() def deleteDurationInMillis = stopWatch.getTotalTimeMillis() - then: 'delete duration is under 700 milliseconds' - recordAndAssertPerformance('Delete 10 lists elements', 700, deleteDurationInMillis) + then: 'delete duration is under 180 milliseconds' + recordAndAssertPerformance('Delete 10 lists elements', 180, deleteDurationInMillis) } def 'Batch delete 500 list elements'() { @@ -176,8 +176,8 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase objectUnderTest.deleteDataNode(PERF_DATASPACE, PERF_ANCHOR, PERF_TEST_PARENT) stopWatch.stop() def deleteDurationInMillis = stopWatch.getTotalTimeMillis() - then: 'delete duration is under 400 milliseconds' - recordAndAssertPerformance('Delete one large node', 400, deleteDurationInMillis) + then: 'delete duration is under 220 milliseconds' + recordAndAssertPerformance('Delete one large node', 220, deleteDurationInMillis) } @Sql([CLEAR_DATA, PERF_TEST_DATA]) @@ -190,8 +190,8 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase objectUnderTest.deleteDataNodes(PERF_DATASPACE, PERF_ANCHOR, [PERF_TEST_PARENT]) stopWatch.stop() def deleteDurationInMillis = stopWatch.getTotalTimeMillis() - then: 'delete duration is under 300 milliseconds' - recordAndAssertPerformance('Batch delete one large node', 300, deleteDurationInMillis) + then: 'delete duration is under 220 milliseconds' + recordAndAssertPerformance('Batch delete one large node', 220, deleteDurationInMillis) } @Sql([CLEAR_DATA, PERF_TEST_DATA]) -- cgit 1.2.3-korg