b1d629da71812c9750438c2ebf61413cdbb742d2
[ccsdk/cds.git] /
1 /*
2  * Copyright © 2019-2020 Orange.
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.ccsdk.cds.blueprintsprocessor.healthapi
18
19
20 import org.junit.Test
21 import org.junit.runner.RunWith
22 import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
23 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor
24 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
25 import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
26 import org.springframework.beans.factory.annotation.Autowired
27 import org.springframework.boot.autoconfigure.security.SecurityProperties
28 import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
29 import org.springframework.context.annotation.ComponentScan
30 import org.springframework.test.context.ContextConfiguration
31 import org.springframework.test.context.TestPropertySource
32 import org.springframework.test.context.junit4.SpringRunner
33 import org.springframework.test.web.reactive.server.WebTestClient
34
35 /**
36  *Unit tests for making sure that two endpoints is up and running
37  *
38  * @author Shaaban Ebrahim
39  * @version 1.0
40  */
41 @RunWith(SpringRunner::class)
42 @WebFluxTest
43 @ContextConfiguration(classes = [BluePrintRuntimeService::class, BluePrintCoreConfiguration::class,
44     BluePrintCatalogService::class, SecurityProperties::class, ComponentScriptExecutor::class])
45 @ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
46 @TestPropertySource(locations = ["classpath:application-test.properties"])
47 class HealthCheckApplicationTests {
48
49     @Autowired
50     lateinit var webTestClient: WebTestClient
51
52     @Test
53     fun testHealthApiUp() {
54         webTestClient.get().uri("/api/v1/combinedHealth")
55                 .exchange()
56                 .expectStatus().is2xxSuccessful
57
58     }
59
60     @Test
61     fun testMetricsApiUp() {
62         webTestClient.get().uri("/api/v1/combinedMetrics")
63                 .exchange()
64                 .expectStatus().is2xxSuccessful
65     }
66
67
68 }