summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/commons/db-lib/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/db-lib/src/test')
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt52
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties5
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zipbin0 -> 9189 bytes
3 files changed, 54 insertions, 3 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
new file mode 100644
index 000000000..4c953163a
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.ccsdk.apps.blueprintsprocessor.db
+
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
+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.assertTrue
+
+@RunWith(SpringRunner::class)
+@EnableAutoConfiguration
+@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
+class BlueprintProcessorCatalogServiceImplTest {
+
+ @Autowired
+ lateinit var blueprintCatalog: BluePrintCatalogService
+
+ @Test
+ fun `test catalog service`() {
+ val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
+ assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
+
+ blueprintCatalog.saveToDatabase(file)
+
+ blueprintCatalog.getFromDatabase("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 6f10626e0..3ac7ec38b 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
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE
+blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
blueprintsprocessor.db.primary.username=sa
blueprintsprocessor.db.primary.password=
blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
@@ -22,7 +22,6 @@ blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
blueprintsprocessor.db.primary.hibernateDDLAuto=update
blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
-
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
-blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive \ No newline at end of file
+blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip
new file mode 100644
index 000000000..a62d4bfbb
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip
Binary files differ