15e6ca946025d172fbc14cdf326a0fca23f1688e
[ccsdk/cds.git] /
1 /*
2  * Copyright © 2017-2018 AT&T Intellectual Property.
3  * Modifications Copyright © 2019 Bell Canada.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
19
20 import org.junit.Ignore
21 import org.junit.Test
22 import org.junit.runner.RunWith
23 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
24 import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
25 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
26 import org.springframework.beans.factory.annotation.Autowired
27 import org.springframework.boot.autoconfigure.EnableAutoConfiguration
28 import org.springframework.context.annotation.ComponentScan
29 import org.springframework.test.annotation.DirtiesContext
30 import org.springframework.test.context.TestPropertySource
31 import org.springframework.test.context.junit4.SpringRunner
32 import java.nio.file.Paths
33 import kotlin.test.assertTrue
34
35 @Ignore
36 @RunWith(SpringRunner::class)
37 @DirtiesContext
38 @EnableAutoConfiguration
39 @ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
40 @TestPropertySource(locations = ["classpath:application-test.properties"])
41 class ExecutionServiceHandlerTest {
42
43     @Autowired
44     lateinit var executionServiceHandler: ExecutionServiceHandler
45
46     @Autowired
47     lateinit var blueprintCatalog: BluePrintCatalogService
48
49     @Test
50     fun testProcess() {
51         val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
52         assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
53
54         blueprintCatalog.saveToDatabase(file)
55
56         val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/default-input.json", ExecutionServiceInput::class.java)!!
57
58         executionServiceHandler.process(executionServiceInput)
59     }
60
61 }