bc07c5207ebc385917c97624e391b3f03105b549
[ccsdk/cds.git] / ms / sdclistener / application / src / test / java / org / onap / ccsdk / cds / sdclistener / SdcListenerConfigurationTest.java
1 /*
2  * Copyright © 2019 Bell Canada
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.sdclistener;
18
19 import org.junit.Test;
20 import org.junit.runner.RunWith;
21 import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.boot.context.properties.EnableConfigurationProperties;
23 import org.springframework.boot.test.context.SpringBootTest;
24 import org.springframework.test.context.junit4.SpringRunner;
25
26 import static org.junit.Assert.assertEquals;
27
28 @RunWith(SpringRunner.class)
29 @EnableConfigurationProperties(SdcListenerConfiguration.class)
30 @SpringBootTest(classes = {SdcListenerConfigurationTest.class})
31 public class SdcListenerConfigurationTest {
32
33     @Autowired
34     private SdcListenerConfiguration listenerConfiguration;
35
36     @Test
37     public void testCdsSdcListenerConfiguration() {
38         assertEquals(listenerConfiguration.getAsdcAddress(), "localhost:8443");
39         assertEquals(listenerConfiguration.getMsgBusAddress().stream().findFirst().get(), "localhost");
40         assertEquals(listenerConfiguration.getUser(), "cds");
41         assertEquals(listenerConfiguration.getPassword(), "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U");
42         assertEquals(listenerConfiguration.getPollingInterval(), 15);
43         assertEquals(listenerConfiguration.getPollingTimeout(), 60);
44         assertEquals(listenerConfiguration.getRelevantArtifactTypes().stream().findFirst().get(), "TOSCA_CSAR");
45         assertEquals(listenerConfiguration.getConsumerGroup(), "cds-id-local");
46         assertEquals(listenerConfiguration.getEnvironmentName(), "AUTO");
47         assertEquals(listenerConfiguration.getConsumerID(), "cds-id-local");
48         assertEquals(listenerConfiguration.activateServerTLSAuth(), false);
49         assertEquals(listenerConfiguration.isUseHttpsWithSDC(), true);
50         assertEquals(listenerConfiguration.isUseHttpsWithDmaap(), false);
51     }
52
53 }