aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
blob: 992d495369325d80463dca1c53b64df97891a33f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*-
 * ============LICENSE_START=======================================================
 * ONAP - SO
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.onap.so.asdc.client.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import javax.transaction.Transactional;
import org.junit.Test;
import org.onap.so.asdc.BaseTest;
import org.onap.so.asdc.client.ASDCConfiguration;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * This class tests the ASDC Controller by using the ASDC Mock CLient
 * 
 *
 */
@Transactional
public class ASDCConfigurationTest extends BaseTest {

    @Autowired
    private ASDCConfiguration config;

    private List<String> msgBusAddressList = new ArrayList<String>();

    private static final String MSO_PRE_IST = "msopreist";
    private static final String MSO_ASDC_ID_LOCAL = "msoasdc-id-local";
    private static final String PRE_IST = "Pre-IST";
    private static final String ASDC_ADDRESS = "localhost:8443";

    @Test
    public void isUseHttpsWithDmaapTest() {
        assertTrue(config.isUseHttpsWithDmaap());
    }

    @Test
    public void isConsumeProduceStatusTopicTest() {
        assertTrue(config.isConsumeProduceStatusTopic());
    }

    @Test
    public void getUserTest() {
        assertTrue(MSO_PRE_IST.equals(config.getUser()));
    }

    @Test
    public void getConsumerGroupTest() {
        assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerGroup()));
    }

    @Test
    public void getConsumerIDTest() {
        assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerID()));
    }

    @Test
    public void getEnvironmentNameTest() {
        assertTrue(PRE_IST.equals(config.getEnvironmentName()));
    }

    @Test
    public void getAsdcAddress() {
        assertTrue(ASDC_ADDRESS.equals(config.getAsdcAddress()));
    }

    @Test
    public void getPasswordTest() {
        assertTrue(MSO_PRE_IST.equals(config.getPassword()));
    }

    @Test
    public void getPollingIntervalTest() {
        assertTrue(config.getPollingInterval() == 30);
    }

    @Test
    public void getPollingTimeoutTest() {
        assertTrue(config.getPollingTimeout() == 30);
    }

    @Test
    public void getRelevantArtifactTypesTest() {
        assertTrue(config.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
    }

    @Test
    public void getWatchDogTimeoutTest() {
        assertTrue(config.getWatchDogTimeout() == 1);
    }

    @Test
    public void activateServerTLSAuthTest() {
        assertFalse(config.activateServerTLSAuth());
    }

    @Test
    public void getKeyStorePasswordTest() {
        assertNull(config.getKeyStorePassword());
    }

    @Test
    public void getKeyStorePathTest() {
        assertNull(config.getKeyStorePath());
    }

    @Test
    public void isFilterInEmptyResourcesTest() {
        assertTrue(config.isFilterInEmptyResources());
    }

    @Test
    public void setGetAsdcControllerNameTest() {
        String asdcControllerName = "testAsdcControllerName";
        config.setAsdcControllerName(asdcControllerName);
        String actualAsdcControllerName = config.getAsdcControllerName();
        assertEquals(asdcControllerName, actualAsdcControllerName);
    }

    @Test
    public void getMsgBusAddressTest() {
        msgBusAddressList.add("localhost");
        msgBusAddressList.add("localhost");

        List<String> actualMsgBusAddress = config.getMsgBusAddress();
        assertEquals(msgBusAddressList, actualMsgBusAddress);
    }
}