Add collaboration feature
[sdc.git] / openecomp-be / backend / openecomp-sdc-application-config-manager / src / test / java / org / openecomp / sdc / applicationconfig / ApplicationConfigManagerTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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.openecomp.sdc.applicationconfig;
22
23 import org.openecomp.sdc.applicationconfig.impl.ApplicationConfigManagerImpl;
24
25 /**
26  * Created by Talio on 8/9/2016.
27  */
28 public class ApplicationConfigManagerTest {
29
30   public static final String TEST_NAMESPACE_1 = "test-app-namespace";
31   public static final String TEST_NAMESPACE_2 = "test-namespace";
32   public static final String TEST_KEY = "test-app-key";
33   public static final String TEST_VALUE = "test-app-value";
34   ApplicationConfigManager applicationConfigManager = new ApplicationConfigManagerImpl();
35
36   /*
37   @Test
38   public void testInsertIntoTable() {
39     try {
40       applicationConfigManager.insertIntoTable(TEST_NAMESPACE_1, TEST_KEY, TEST_VALUE);
41     } catch (CoreException exception) {
42       Assert.assertEquals(exception.getMessage(),
43           "Error occurred while loading questionnaire schema templates");
44     }
45   }
46
47
48   @Test(dependsOnMethods = "testInsertIntoTable")
49   public void testGetValueFromTable() {
50     ConfigurationData value = applicationConfigManager.getFromTable(TEST_NAMESPACE_1, TEST_KEY);
51
52     Assert.assertEquals(value.getValue(), TEST_VALUE);
53   }
54
55
56   @Test(dependsOnMethods = "testInsertIntoTable")
57   public void testGetValueFromTableNegative() {
58     try {
59       ConfigurationData value =
60           applicationConfigManager.getFromTable("not-existing-namespace", "not-existing-key");
61     } catch (CoreException ce) {
62       Assert.assertEquals(ce.getMessage(),
63           "Configuration for namespace not-existing-namespace and key not-existing-key was not found");
64     }
65
66   }
67
68   @Test
69   public void testGetList() {
70     applicationConfigManager.insertIntoTable(TEST_NAMESPACE_2, "key1", "val1");
71     applicationConfigManager.insertIntoTable(TEST_NAMESPACE_2, "key2", "val2");
72     applicationConfigManager.insertIntoTable(TEST_NAMESPACE_2, "key3", "val3");
73
74     Collection<ApplicationConfigEntity> ACElist =
75         applicationConfigManager.getListOfConfigurationByNamespace(TEST_NAMESPACE_2);
76
77     Assert.assertNotNull(ACElist);
78     Assert.assertEquals(ACElist.size(), 3);
79   }
80
81   */
82 }