diff options
author | Dan Timoney <dtimoney@att.com> | 2019-03-29 12:55:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-03-29 12:55:06 +0000 |
commit | cf6a08425cc50b871cec9ae386e617388816b27d (patch) | |
tree | b28a25b623b143354364b4d778f01bdb4b0784c4 /ms/blueprintsprocessor/modules/commons/db-lib/src/test | |
parent | 837f8493fe6c7cd0569c43105b923e42549dcf7b (diff) | |
parent | c3811effed948926f8d94615df7530c99d490092 (diff) |
Merge "Improve blueprint save"
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 |