Configuration file runtime reload
[sdc.git] / common-app-api / src / test / java / org / openecomp / sdc / fe / config / WorkspaceConfigurationTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 Nokia. 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.openecomp.sdc.fe.config;
22
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.junit.runner.RunWith;
26 import org.mockito.Mock;
27 import org.mockito.junit.MockitoJUnitRunner;
28 import org.openecomp.sdc.common.api.ConfigurationSource;
29 import org.openecomp.sdc.common.impl.ExternalConfiguration;
30 import org.openecomp.sdc.common.impl.FSConfigurationSource;
31
32 import static org.junit.Assert.assertEquals;
33 import static org.junit.Assert.assertTrue;
34
35 @RunWith(MockitoJUnitRunner.class)
36 public class WorkspaceConfigurationTest {
37     private WorkspaceConfiguration workspaceConfiguration = new WorkspaceConfiguration();
38
39     @Mock
40     private ConfigurationManager configurationManager;
41
42     @Before
43     public void setUp() {
44         String appConfigDir = "src/test/resources/config/fe";
45         ConfigurationSource configurationSource =
46                 new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
47         configurationManager = new ConfigurationManager(configurationSource);
48     }
49
50     @Test
51     public void validateInstanceGetsProperTestManager() {
52         workspaceConfiguration = configurationManager.getWorkspaceConfiguration();
53         assertEquals(7,workspaceConfiguration.getWorkspaceMenuConfiguration().size());
54         assertTrue(workspaceConfiguration.getWorkspaceMenuConfiguration().containsKey("VFC"));
55     }
56 }