summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-25 17:01:08 -0400
committerMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-27 13:23:06 -0400
commitc3811effed948926f8d94615df7530c99d490092 (patch)
treedff68af7c67bc9db332fa43b7a882d1a1b05b4db /ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org
parent10164a7ab851859bfd548e32b4fe3c0610f3d614 (diff)
Improve blueprint save
Change-Id: Ibac2ef9cd7e217db809a6a695ea0ee39a6bd2e21 Issue-ID: CCSDK-1137 Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org')
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt32
1 files changed, 24 insertions, 8 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
index a9a2ae73e..2fda15906 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
@@ -15,16 +15,19 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.db
+import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.annotation.ComponentScan
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
-import java.io.File
-import java.nio.file.Paths
+import kotlin.test.AfterTest
+import kotlin.test.BeforeTest
import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@@ -36,17 +39,30 @@ class BlueprintProcessorCatalogServiceImplTest {
@Autowired
lateinit var blueprintCatalog: BluePrintCatalogService
+ @BeforeTest
+ fun setup() {
+ deleteDir("target", "blueprints")
+ }
+
+ @AfterTest
+ fun cleanDir() {
+ deleteDir("target", "blueprints")
+ }
+
@Test
fun `test catalog service`() {
- val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
- assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
+ runBlocking {
+ //FIXME("Create ZIP from test blueprints")
+
+ val file = normalizedFile("./src/test/resources/test-cba.zip")
+ assertTrue(file.exists(), "couldn't get file ${file.absolutePath}")
- blueprintCatalog.saveToDatabase(file)
+ blueprintCatalog.saveToDatabase("1234", file)
- blueprintCatalog.getFromDatabase("baseconfiguration", "1.0.0")
+ blueprintCatalog.getFromDatabase("baseconfiguration", "1.0.0")
- blueprintCatalog.deleteFromDatabase("baseconfiguration", "1.0.0")
+ blueprintCatalog.deleteFromDatabase("baseconfiguration", "1.0.0")
- File("./src/test/resources/baseconfiguration").deleteRecursively()
+ }
}
} \ No newline at end of file