Migrate query tests to integration-test module #6
[cps.git] / integration-test / src / test / groovy / org / onap / cps / integration / base / CpsIntegrationSpecBase.groovy
index 866fef4..b942a43 100644 (file)
@@ -40,6 +40,8 @@ import org.testcontainers.spock.Testcontainers
 import spock.lang.Shared
 import spock.lang.Specification
 
+import java.time.OffsetDateTime
+
 @SpringBootTest(classes = [TestConfig, CpsAdminServiceImpl, CpsValidatorImpl])
 @Testcontainers
 @EnableAutoConfiguration
@@ -68,9 +70,7 @@ class CpsIntegrationSpecBase extends Specification {
     CpsQueryService cpsQueryService
 
     def static GENERAL_TEST_DATASPACE = 'generalTestDataspace'
-    def static FUNCTIONAL_TEST_DATASPACE = 'functionalTestDataspace'
     def static BOOKSTORE_SCHEMA_SET = 'bookstoreSchemaSet'
-    def static BOOKSTORE_ANCHOR = 'bookstoreAnchor'
 
     def static initialized = false
 
@@ -107,4 +107,11 @@ class CpsIntegrationSpecBase extends Specification {
         }
         return true
     }
+
+    def addAnchorsWithData(numberOfAnchors, dataspaceName, schemaSetName, anchorNamePrefix, data) {
+        (1..numberOfAnchors).each {
+            cpsAdminService.createAnchor(dataspaceName, schemaSetName, anchorNamePrefix + it)
+            cpsDataService.saveData(dataspaceName, anchorNamePrefix + it, data, OffsetDateTime.now())
+        }
+    }
 }