2 * Copyright (C) 2019 Bell Canada.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.ccsdk.cds.blueprintsprocessor.db
18 import kotlinx.coroutines.runBlocking
20 import org.junit.runner.RunWith
21 import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
22 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
23 import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
24 import org.springframework.beans.factory.annotation.Autowired
25 import org.springframework.boot.autoconfigure.EnableAutoConfiguration
26 import org.springframework.context.annotation.ComponentScan
27 import org.springframework.test.context.TestPropertySource
28 import org.springframework.test.context.junit4.SpringRunner
29 import kotlin.test.AfterTest
30 import kotlin.test.BeforeTest
31 import kotlin.test.assertTrue
33 @RunWith(SpringRunner::class)
34 @EnableAutoConfiguration
35 @ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
36 @TestPropertySource(locations = ["classpath:application-test.properties"])
37 class BlueprintProcessorCatalogServiceImplTest {
40 lateinit var blueprintCatalog: BluePrintCatalogService
44 deleteDir("target", "blueprints")
49 deleteDir("target", "blueprints")
53 fun `test catalog service`() {
55 //FIXME("Create ZIP from test blueprints")
57 val file = normalizedFile("./src/test/resources/test-cba.zip")
58 assertTrue(file.exists(), "couldn't get file ${file.absolutePath}")
60 blueprintCatalog.saveToDatabase("1234", file)
62 blueprintCatalog.getFromDatabase("baseconfiguration", "1.0.0")
64 blueprintCatalog.deleteFromDatabase("baseconfiguration", "1.0.0")