2 * Copyright © 2019 IBM.
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.
17 package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
19 import io.mockk.coEvery
21 import kotlinx.coroutines.delay
22 import kotlinx.coroutines.launch
23 import kotlinx.coroutines.runBlocking
24 import org.junit.runner.RunWith
25 import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
26 import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
27 import org.onap.ccsdk.cds.blueprintsprocessor.message.BluePrintMessageLibConfiguration
28 import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BluePrintMessageLibPropertyService
29 import org.springframework.beans.factory.annotation.Autowired
30 import org.springframework.test.context.ContextConfiguration
31 import org.springframework.test.context.TestPropertySource
32 import org.springframework.test.context.junit4.SpringRunner
33 import kotlin.test.Test
34 import kotlin.test.assertNotNull
36 @RunWith(SpringRunner::class)
37 @ContextConfiguration(
38 classes = [BluePrintMessageLibConfiguration::class,
39 BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
41 @TestPropertySource(locations = ["classpath:application-test.properties"])
42 class BluePrintProcessingKafkaConsumerTest {
45 lateinit var bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService
48 fun testExecutionInputMessageConsumer() {
51 bluePrintMessageLibPropertyService,
52 "failed to initialise bluePrintMessageLibPropertyService"
55 val executionServiceHandle = mockk<ExecutionServiceHandler>()
57 coEvery { executionServiceHandle.doProcess(any()) } returns mockk()
59 val bluePrintProcessingKafkaConsumer = BluePrintProcessingKafkaConsumer(
60 bluePrintMessageLibPropertyService,
61 executionServiceHandle
65 bluePrintProcessingKafkaConsumer.setupMessageListener()
68 bluePrintProcessingKafkaConsumer.shutdownMessageListener()