diff options
author | Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com> | 2019-03-25 17:01:08 -0400 |
---|---|---|
committer | Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com> | 2019-03-27 13:23:06 -0400 |
commit | c3811effed948926f8d94615df7530c99d490092 (patch) | |
tree | dff68af7c67bc9db332fa43b7a882d1a1b05b4db /ms/blueprintsprocessor/modules/commons/db-lib/src/test | |
parent | 10164a7ab851859bfd548e32b4fe3c0610f3d614 (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')
2 files changed, 25 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 diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties index 3ac7ec38b..9dda71eb2 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties @@ -25,3 +25,4 @@ blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect # Controller Blueprints Core Configuration blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive +blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work |