Performance tests for getDataNodes and queryDataNodes
[cps.git] / cps-ri / src / test / groovy / org / onap / cps / spi / performance / CpsDataPersistenceServicePerfTest.groovy
index 7f1fb20..2628e96 100644 (file)
@@ -47,7 +47,6 @@ class CpsDataPersistenceServicePerfTest extends CpsPersistencePerfSpecBase {
 
     static def NUMBER_OF_CHILDREN = 200
     static def NUMBER_OF_GRAND_CHILDREN = 50
-    static def TOTAL_NUMBER_OF_NODES = 1 + NUMBER_OF_CHILDREN + (NUMBER_OF_CHILDREN * NUMBER_OF_GRAND_CHILDREN)  //  Parent + Children +  Grand-children
 
     @Sql([CLEAR_DATA, PERF_TEST_DATA])
     def 'Create a node with many descendants (please note, subsequent tests depend on this running first).'() {
@@ -60,63 +59,6 @@ class CpsDataPersistenceServicePerfTest extends CpsPersistencePerfSpecBase {
             recordAndAssertPerformance('Setup', 10000, setupDurationInMillis)
     }
 
-    def 'Get data node with many descendants by xpath #scenario'() {
-        when: 'get parent is executed with all descendants'
-            stopWatch.start()
-            def result = objectUnderTest.getDataNodes(PERF_DATASPACE, PERF_ANCHOR, xpath, INCLUDE_ALL_DESCENDANTS)
-            stopWatch.stop()
-            def readDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'read duration is under #allowedDuration milliseconds'
-            recordAndAssertPerformance("Get ${scenario}", allowedDuration, readDurationInMillis)
-        and: 'data node is returned with all the descendants populated'
-            assert countDataNodes(result[0]) == TOTAL_NUMBER_OF_NODES
-        where: 'the following xPaths are used'
-            scenario | xpath            || allowedDuration
-            'parent' | PERF_TEST_PARENT || 500
-            'root'   | '/'              || 500
-    }
-
-    def 'Query parent data node with many descendants by cps-path'() {
-        when: 'query is executed with all descendants'
-            stopWatch.start()
-            def result = objectUnderTest.queryDataNodes(PERF_DATASPACE, PERF_ANCHOR, '//perf-parent-1' , INCLUDE_ALL_DESCENDANTS)
-            stopWatch.stop()
-            def readDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'read duration is under 350 milliseconds'
-            recordAndAssertPerformance('Query with many descendants', 350, readDurationInMillis)
-        and: 'data node is returned with all the descendants populated'
-            assert countDataNodes(result) == TOTAL_NUMBER_OF_NODES
-    }
-
-    def 'Performance of finding multiple xpaths'() {
-        when: 'we query for all grandchildren (except 1 for fun) with the new native method'
-            xpathsToAllGrandChildren.remove(0)
-            stopWatch.start()
-            def result = objectUnderTest.getDataNodesForMultipleXpaths(PERF_DATASPACE, PERF_ANCHOR, xpathsToAllGrandChildren, INCLUDE_ALL_DESCENDANTS)
-            stopWatch.stop()
-            def readDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'the returned number of entities equal to the number of children * number of grandchildren'
-            assert result.size() == xpathsToAllGrandChildren.size()
-        and: 'it took less then 1000ms'
-            recordAndAssertPerformance('Find multiple xpaths', 1000, readDurationInMillis)
-    }
-
-    def 'Query many descendants by cps-path with #scenario'() {
-        when: 'query is executed with all descendants'
-            stopWatch.start()
-            def result = objectUnderTest.queryDataNodes(PERF_DATASPACE, PERF_ANCHOR,  '//perf-test-grand-child-1', descendantsOption)
-            stopWatch.stop()
-            def readDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'read duration is under #allowedDuration milliseconds'
-            recordAndAssertPerformance("Query many descendants by cpspath (${scenario})", allowedDuration, readDurationInMillis)
-        and: 'data node is returned with all the descendants populated'
-            assert result.size() == NUMBER_OF_CHILDREN
-        where: 'the following options are used'
-            scenario                                        | descendantsOption        || allowedDuration
-            'omit descendants                             ' | OMIT_DESCENDANTS         || 150
-            'include descendants (although there are none)' | INCLUDE_ALL_DESCENDANTS  || 150
-    }
-
     def 'Update data nodes with descendants'() {
         given: 'a list of xpaths to data nodes with descendants (xpath for each child)'
             def xpaths = (1..20).collect {