992d495369325d80463dca1c53b64df97891a33f
[so.git] / asdc-controller / src / test / java / org / onap / so / asdc / client / tests / ASDCConfigurationTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T 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.so.asdc.client.tests;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertFalse;
25 import static org.junit.Assert.assertNull;
26 import static org.junit.Assert.assertTrue;
27 import java.util.ArrayList;
28 import java.util.List;
29 import javax.transaction.Transactional;
30 import org.junit.Test;
31 import org.onap.so.asdc.BaseTest;
32 import org.onap.so.asdc.client.ASDCConfiguration;
33 import org.springframework.beans.factory.annotation.Autowired;
34
35 /**
36  * This class tests the ASDC Controller by using the ASDC Mock CLient
37  * 
38  *
39  */
40 @Transactional
41 public class ASDCConfigurationTest extends BaseTest {
42
43     @Autowired
44     private ASDCConfiguration config;
45
46     private List<String> msgBusAddressList = new ArrayList<String>();
47
48     private static final String MSO_PRE_IST = "msopreist";
49     private static final String MSO_ASDC_ID_LOCAL = "msoasdc-id-local";
50     private static final String PRE_IST = "Pre-IST";
51     private static final String ASDC_ADDRESS = "localhost:8443";
52
53     @Test
54     public void isUseHttpsWithDmaapTest() {
55         assertTrue(config.isUseHttpsWithDmaap());
56     }
57
58     @Test
59     public void isConsumeProduceStatusTopicTest() {
60         assertTrue(config.isConsumeProduceStatusTopic());
61     }
62
63     @Test
64     public void getUserTest() {
65         assertTrue(MSO_PRE_IST.equals(config.getUser()));
66     }
67
68     @Test
69     public void getConsumerGroupTest() {
70         assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerGroup()));
71     }
72
73     @Test
74     public void getConsumerIDTest() {
75         assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerID()));
76     }
77
78     @Test
79     public void getEnvironmentNameTest() {
80         assertTrue(PRE_IST.equals(config.getEnvironmentName()));
81     }
82
83     @Test
84     public void getAsdcAddress() {
85         assertTrue(ASDC_ADDRESS.equals(config.getAsdcAddress()));
86     }
87
88     @Test
89     public void getPasswordTest() {
90         assertTrue(MSO_PRE_IST.equals(config.getPassword()));
91     }
92
93     @Test
94     public void getPollingIntervalTest() {
95         assertTrue(config.getPollingInterval() == 30);
96     }
97
98     @Test
99     public void getPollingTimeoutTest() {
100         assertTrue(config.getPollingTimeout() == 30);
101     }
102
103     @Test
104     public void getRelevantArtifactTypesTest() {
105         assertTrue(config.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
106     }
107
108     @Test
109     public void getWatchDogTimeoutTest() {
110         assertTrue(config.getWatchDogTimeout() == 1);
111     }
112
113     @Test
114     public void activateServerTLSAuthTest() {
115         assertFalse(config.activateServerTLSAuth());
116     }
117
118     @Test
119     public void getKeyStorePasswordTest() {
120         assertNull(config.getKeyStorePassword());
121     }
122
123     @Test
124     public void getKeyStorePathTest() {
125         assertNull(config.getKeyStorePath());
126     }
127
128     @Test
129     public void isFilterInEmptyResourcesTest() {
130         assertTrue(config.isFilterInEmptyResources());
131     }
132
133     @Test
134     public void setGetAsdcControllerNameTest() {
135         String asdcControllerName = "testAsdcControllerName";
136         config.setAsdcControllerName(asdcControllerName);
137         String actualAsdcControllerName = config.getAsdcControllerName();
138         assertEquals(asdcControllerName, actualAsdcControllerName);
139     }
140
141     @Test
142     public void getMsgBusAddressTest() {
143         msgBusAddressList.add("localhost");
144         msgBusAddressList.add("localhost");
145
146         List<String> actualMsgBusAddress = config.getMsgBusAddress();
147         assertEquals(msgBusAddressList, actualMsgBusAddress);
148     }
149 }