fixing warnings from checkstyle in common-app-api
[sdc.git] / common-app-api / src / test / java / org / openecomp / sdc / be / config / ConfigurationManagerTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP SDC
4  * ================================================================================
5  * Copyright (C) 2019 Samsung. 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  */
22
23 package org.openecomp.sdc.be.config;
24
25 import static org.junit.Assert.assertEquals;
26
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.openecomp.sdc.common.api.ConfigurationSource;
30 import org.openecomp.sdc.common.config.EcompErrorConfiguration;
31 import org.openecomp.sdc.common.impl.ExternalConfiguration;
32 import org.openecomp.sdc.common.impl.FSConfigurationSource;
33
34 public class ConfigurationManagerTest {
35
36     private ConfigurationManager configurationManager;
37
38     @Before
39     public void setConfigurationSource() {
40         String appConfigDir = "src/test/resources/config/common";
41         ConfigurationSource configurationSource =
42                 new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
43         configurationManager = new ConfigurationManager(configurationSource);
44     }
45
46     @Test
47     public void testGetConfiguration() {
48         assertEquals(configurationManager.getConfiguration(),
49                 ConfigurationManager.getConfigurationManager().getConfigurations()
50                         .get(Configuration.class.getSimpleName()));
51     }
52
53     @Test
54     public void testGetErrorConfiguration() {
55         assertEquals(configurationManager.getErrorConfiguration(),
56                 ConfigurationManager.getConfigurationManager().getConfigurations()
57                         .get(ErrorConfiguration.class.getSimpleName()));
58     }
59
60     @Test
61     public void testGetEcompErrorConfiguration() {
62         assertEquals(configurationManager.getEcompErrorConfiguration(),
63                 ConfigurationManager.getConfigurationManager().getConfigurations()
64                         .get(EcompErrorConfiguration.class.getSimpleName()));
65     }
66
67     @Test
68     public void testGetDistributionEngineConfiguration() {
69         assertEquals(configurationManager.getDistributionEngineConfiguration(),
70                 ConfigurationManager.getConfigurationManager().getConfigurations()
71                         .get(DistributionEngineConfiguration.class.getSimpleName()));
72     }
73
74 }