12e393a17f10943d530d2b8a5f5699e7b9d3034f
[dcaegen2/services.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * BBS-RELOCATION-CPE-AUTHENTICATION-HANDLER
4  * ================================================================================
5  * Copyright (C) 2019 NOKIA Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.bbs.event.processor.config;
22
23 import static org.junit.jupiter.api.Assertions.assertAll;
24 import static org.junit.jupiter.api.Assertions.assertEquals;
25
26 import org.junit.jupiter.api.Test;
27 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.boot.context.properties.EnableConfigurationProperties;
29 import org.springframework.boot.test.context.SpringBootTest;
30 import org.springframework.test.context.TestPropertySource;
31
32 @SpringBootTest(classes = {GenericProperties.class,
33         GenericProperties.ReRegistrationGenericProperties.class,
34         GenericProperties.CpeAuthenticationGenericProperties.class})
35 @EnableConfigurationProperties
36 @TestPropertySource(properties = {
37         "configs.application.pipelinesPollingIntervalSec=30",
38         "configs.application.pipelinesTimeoutSec=15",
39         "configs.application.re-registration.policyScope=reRegPolicyScope",
40         "configs.application.re-registration.clControlName=reRegControlName",
41         "configs.application.cpe-authentication.policyScope=cpeAuthPolicyScope",
42         "configs.application.cpe-authentication.clControlName=cpeAuthControlName"})
43 class GenericPropertiesTest {
44
45     private GenericProperties genericProperties;
46
47     @Autowired
48     public GenericPropertiesTest(GenericProperties genericProperties) {
49         this.genericProperties = genericProperties;
50     }
51
52     @Test
53     void genericProperties_SuccessFullyLoaded() {
54         assertAll("Generic Application Properties",
55             () -> assertEquals(30, genericProperties.getPipelinesPollingIntervalSec()),
56             () -> assertEquals(15, genericProperties.getPipelinesTimeoutSec()),
57             () -> assertEquals("reRegPolicyScope", genericProperties.getReRegistration().getPolicyScope()),
58             () -> assertEquals("cpeAuthPolicyScope",
59                     genericProperties.getCpeAuthentication().getPolicyScope()),
60             () -> assertEquals("reRegControlName", genericProperties.getReRegistration().getClControlName()),
61             () -> assertEquals("cpeAuthControlName",
62                     genericProperties.getCpeAuthentication().getClControlName())
63         );
64     }
65 }