DMI Data AVC to use kafka headers
[cps.git] / cps-ri / src / test / groovy / org / onap / cps / spi / performance / CpsDataPersistenceServiceDeletePerfTest.groovy
index 706b35e..4280881 100644 (file)
@@ -24,15 +24,12 @@ import org.onap.cps.spi.CpsDataPersistenceService
 import org.onap.cps.spi.impl.CpsPersistencePerfSpecBase
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.test.context.jdbc.Sql
-import org.springframework.util.StopWatch
 
 class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase {
 
     @Autowired
     CpsDataPersistenceService objectUnderTest
 
-    def stopWatch = new StopWatch()
-
     @Sql([CLEAR_DATA, PERF_TEST_DATA])
     def 'Create a node with many descendants (please note, subsequent tests depend on this running first).'() {
         when: 'a node with a large number of descendants is created'
@@ -44,22 +41,22 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase
             recordAndAssertPerformance('Setup', 10_000, setupDurationInMillis)
     }
 
-    def 'Delete 5 children with grandchildren'() {
+    def 'Delete 10 children with grandchildren'() {
         when: 'child nodes are deleted'
             stopWatch.start()
-            (1..5).each {
+            (1..10).each {
                 def childPath = "${PERF_TEST_PARENT}/perf-test-child-${it}".toString()
                 objectUnderTest.deleteDataNode(PERF_DATASPACE, PERF_ANCHOR, childPath)
             }
             stopWatch.stop()
             def deleteDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'delete duration is under 350 milliseconds'
-            recordAndAssertPerformance('Delete 5 children', 350, deleteDurationInMillis)
+        then: 'delete duration is under 300 milliseconds'
+            recordAndAssertPerformance('Delete 10 children', 300, deleteDurationInMillis)
     }
 
     def 'Batch delete 100 children with grandchildren'() {
         given: 'a list of xpaths to delete'
-            def xpathsToDelete = (6..105).collect {
+            def xpathsToDelete = (11..110).collect {
                 "${PERF_TEST_PARENT}/perf-test-child-${it}".toString()
             }
         when: 'child nodes are deleted'
@@ -67,21 +64,21 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase
             objectUnderTest.deleteDataNodes(PERF_DATASPACE, PERF_ANCHOR, xpathsToDelete)
             stopWatch.stop()
             def deleteDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'delete duration is under 350 milliseconds'
-            recordAndAssertPerformance('Batch delete 100 children', 350, deleteDurationInMillis)
+        then: 'delete duration is under 300 milliseconds'
+            recordAndAssertPerformance('Batch delete 100 children', 300, deleteDurationInMillis)
     }
 
     def 'Delete 50 grandchildren (that have no descendants)'() {
         when: 'target nodes are deleted'
             stopWatch.start()
             (1..50).each {
-                def grandchildPath = "${PERF_TEST_PARENT}/perf-test-child-106/perf-test-grand-child-${it}".toString()
+                def grandchildPath = "${PERF_TEST_PARENT}/perf-test-child-111/perf-test-grand-child-${it}".toString()
                 objectUnderTest.deleteDataNode(PERF_DATASPACE, PERF_ANCHOR, grandchildPath)
             }
             stopWatch.stop()
             def deleteDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'delete duration is under 350 milliseconds'
-            recordAndAssertPerformance('Delete 50 grandchildren', 350, deleteDurationInMillis)
+        then: 'delete duration is under 700 milliseconds'
+            recordAndAssertPerformance('Delete 50 grandchildren', 700, deleteDurationInMillis)
     }
 
     def 'Batch delete 500 grandchildren (that have no descendants)'() {
@@ -89,7 +86,7 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase
             def xpathsToDelete = []
             for (int childIndex = 0; childIndex < 10; childIndex++) {
                 xpathsToDelete.addAll((1..50).collect {
-                    "${PERF_TEST_PARENT}/perf-test-child-${107+childIndex}/perf-test-grand-child-${it}".toString()
+                    "${PERF_TEST_PARENT}/perf-test-child-${112+childIndex}/perf-test-grand-child-${it}".toString()
                 })
             }
         when: 'target nodes are deleted'
@@ -97,8 +94,8 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase
             objectUnderTest.deleteDataNodes(PERF_DATASPACE, PERF_ANCHOR, xpathsToDelete)
             stopWatch.stop()
             def deleteDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'delete duration is under 350 milliseconds'
-            recordAndAssertPerformance('Batch delete 500 grandchildren', 350, deleteDurationInMillis)
+        then: 'delete duration is under 100 milliseconds'
+            recordAndAssertPerformance('Batch delete 500 grandchildren', 100, deleteDurationInMillis)
     }
 
     @Sql([CLEAR_DATA, PERF_TEST_DATA])
@@ -108,26 +105,26 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase
             createLineage(objectUnderTest, 150, 50, true)
             stopWatch.stop()
             def setupDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'setup duration is under 10 seconds'
-            recordAndAssertPerformance('Setup lists', 10_000, setupDurationInMillis)
+        then: 'setup duration is under 6 seconds'
+            recordAndAssertPerformance('Setup lists', 6_000, setupDurationInMillis)
     }
 
-    def 'Delete 5 whole lists'() {
+    def 'Delete 10 whole lists'() {
         when: 'lists are deleted'
             stopWatch.start()
-            (1..5).each {
+            (1..10).each {
                 def childPath = "${PERF_TEST_PARENT}/perf-test-list-${it}".toString()
                 objectUnderTest.deleteListDataNode(PERF_DATASPACE, PERF_ANCHOR, childPath)
             }
             stopWatch.stop()
             def deleteDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'delete duration is under 1500 milliseconds'
-            recordAndAssertPerformance('Delete 5 whole lists', 1500, deleteDurationInMillis)
+        then: 'delete duration is under 300 milliseconds'
+            recordAndAssertPerformance('Delete 10 whole lists', 300, deleteDurationInMillis)
     }
 
     def 'Batch delete 100 whole lists'() {
         given: 'a list of xpaths to delete'
-            def xpathsToDelete = (6..105).collect {
+            def xpathsToDelete = (11..110).collect {
                 "${PERF_TEST_PARENT}/perf-test-list-${it}".toString()
             }
         when: 'lists are deleted'
@@ -135,21 +132,21 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase
             objectUnderTest.deleteDataNodes(PERF_DATASPACE, PERF_ANCHOR, xpathsToDelete)
             stopWatch.stop()
             def deleteDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'delete duration is under 350 milliseconds'
-            recordAndAssertPerformance('Batch delete 100 whole lists', 350, deleteDurationInMillis)
+        then: 'delete duration is under 600 milliseconds'
+            recordAndAssertPerformance('Batch delete 100 whole lists', 600, deleteDurationInMillis)
     }
 
     def 'Delete 10 list elements'() {
         when: 'list elements are deleted'
             stopWatch.start()
             (1..10).each {
-                def grandchildPath = "${PERF_TEST_PARENT}/perf-test-list-106[@key='${it}']".toString()
+                def grandchildPath = "${PERF_TEST_PARENT}/perf-test-list-111[@key='${it}']".toString()
                 objectUnderTest.deleteListDataNode(PERF_DATASPACE, PERF_ANCHOR, grandchildPath)
             }
             stopWatch.stop()
             def deleteDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'delete duration is under 750 milliseconds'
-            recordAndAssertPerformance('Delete 10 lists elements', 750, deleteDurationInMillis)
+        then: 'delete duration is under 200 milliseconds'
+            recordAndAssertPerformance('Delete 10 lists elements', 200, deleteDurationInMillis)
     }
 
     def 'Batch delete 500 list elements'() {
@@ -157,7 +154,7 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase
             def xpathsToDelete = []
             for (int childIndex = 0; childIndex < 10; childIndex++) {
                 xpathsToDelete.addAll((1..50).collect {
-                    "${PERF_TEST_PARENT}/perf-test-list-${107+childIndex}[@key='${it}']".toString()
+                    "${PERF_TEST_PARENT}/perf-test-list-${112+childIndex}[@key='${it}']".toString()
                 })
             }
         when: 'list elements are deleted'
@@ -165,8 +162,8 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase
             objectUnderTest.deleteDataNodes(PERF_DATASPACE, PERF_ANCHOR, xpathsToDelete)
             stopWatch.stop()
             def deleteDurationInMillis = stopWatch.getTotalTimeMillis()
-        then: 'delete duration is under 350 milliseconds'
-            recordAndAssertPerformance('Batch delete 500 lists elements', 350, deleteDurationInMillis)
+        then: 'delete duration is under 100 milliseconds'
+            recordAndAssertPerformance('Batch delete 500 lists elements', 100, deleteDurationInMillis)
     }
 
     @Sql([CLEAR_DATA, PERF_TEST_DATA])
@@ -236,7 +233,7 @@ class CpsDataPersistenceServiceDeletePerfTest extends CpsPersistencePerfSpecBase
             stopWatch.stop()
             def deleteDurationInMillis = stopWatch.getTotalTimeMillis()
         then: 'delete duration is under 300 milliseconds'
-            recordAndAssertPerformance('Delete data nodes for anchor', 300, deleteDurationInMillis)
+            recordAndAssertPerformance('Delete data nodes for anchors', 300, deleteDurationInMillis)
     }
 
 }