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