First part of onap rename
[appc.git] / appc-config / appc-data-services / provider / src / test / java / org / onap / appc / data / services / db / TestConfigResourceNode.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * 
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  * ============LICENSE_END=========================================================
23  */
24
25 package org.onap.appc.data.services.db;
26
27 import java.util.HashMap;
28 import java.util.Map;
29 import static org.junit.Assert.assertFalse;
30 import org.junit.Ignore;
31 import org.junit.Test;
32 import org.onap.appc.data.services.AppcDataServiceConstant;
33 import org.onap.appc.data.services.node.ConfigResourceNode;
34 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
35 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
36
37 public class TestConfigResourceNode {
38
39     @Ignore("Test is taking 60 seconds")
40     @Test(expected = Exception.class)
41     public void testgetConfigFileReferenc() throws SvcLogicException {
42         SvcLogicContext ctx = new SvcLogicContext();
43         ctx.setAttribute("test", "test");
44         ConfigResourceNode dbService = new ConfigResourceNode();
45         Map<String, String> map = new HashMap<String, String>();
46         dbService.getConfigFileReference(map, ctx);
47     }
48
49     @Ignore("Test is taking 60 seconds")
50     @Test(expected = Exception.class)
51     public void testgetTemplate() throws SvcLogicException {
52         SvcLogicContext ctx = new SvcLogicContext();
53         ctx.setAttribute("test", "test");
54         ctx.setAttribute(AppcDataServiceConstant.INPUT_PARAM_FILE_CATEGORY, "test");
55         ctx.setAttribute(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "tmp.test");
56         ctx.setAttribute("template-name", "test.json");
57
58         ConfigResourceNode dbService = new ConfigResourceNode();
59         Map<String, String> map = new HashMap<String, String>();
60         dbService.getTemplate(map, ctx);
61
62     }
63
64     @Ignore("Test is taking 60 seconds")
65     @Test(expected = Exception.class)
66     public void testgetVnfcReference() throws SvcLogicException {
67         SvcLogicContext ctx = new SvcLogicContext();
68         ctx.setAttribute("test", "test");
69         ConfigResourceNode dbService = new ConfigResourceNode();
70         Map<String, String> map = new HashMap<String, String>();
71         map.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "tmp.test");
72         dbService.getVnfcReference(map, ctx);
73     }
74
75     @Ignore("Test is taking 60 seconds")
76     @Test(expected = Exception.class)
77     public void testgetSmmChainKeyFiles() throws SvcLogicException {
78         SvcLogicContext ctx = new SvcLogicContext();
79         ctx.setAttribute("test", "test");
80         ctx.setAttribute("site-location","test/location");
81         ConfigResourceNode dbService = new ConfigResourceNode();
82         Map<String, String> map = new HashMap<String, String>();
83         map.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "tmp.test");
84         dbService.getSmmChainKeyFiles(map, ctx);
85     }
86
87     @Ignore("Test is taking 60 seconds")
88     @Test(expected = Exception.class)
89     public void testgetDownloadConfigTemplateByVnf() throws SvcLogicException {
90         SvcLogicContext ctx = new SvcLogicContext();
91         ctx.setAttribute("test", "test");    
92         ConfigResourceNode dbService = new ConfigResourceNode();
93         Map<String, String> map = new HashMap<String, String>();
94         map.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "tmp.test");
95         dbService.getDownloadConfigTemplateByVnf(map, ctx);
96
97     }
98
99     @Ignore("Test is taking 60 seconds")
100     @Test(expected = Exception.class)
101     public void testgetCommonConfigInfo() throws SvcLogicException {
102         SvcLogicContext ctx = new SvcLogicContext();
103         ctx.setAttribute("test", "test");
104         ConfigResourceNode dbService = new ConfigResourceNode();
105         Map<String, String> map = new HashMap<String, String>();
106         dbService.getCommonConfigInfo(map, ctx);
107
108     }
109
110     @Ignore("Test is taking 60 seconds")
111     @Test(expected = Exception.class)
112     public void testupdateUploadConfigss() throws SvcLogicException {
113         SvcLogicContext ctx = new SvcLogicContext();
114         ctx.setAttribute("test", "test");
115         ConfigResourceNode dbService = new ConfigResourceNode();
116         Map<String, String> map = new HashMap<String, String>();
117         dbService.updateUploadConfig(map, ctx);
118
119     }
120
121     @Ignore("Test is taking 60 seconds")
122     @Test(expected = Exception.class)
123     public void testgetConfigFilesByVnfVmNCategory() throws SvcLogicException {
124         SvcLogicContext ctx = new SvcLogicContext();
125         ConfigResourceNode node = new ConfigResourceNode();
126         Map<String, String> inParams = new HashMap<String, String>();
127         inParams.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "response-prefix");
128         inParams.put(AppcDataServiceConstant.INPUT_PARAM_FILE_CATEGORY, "config_template");
129         inParams.put((String) AppcDataServiceConstant.INPUT_PARAM_VNF_ID, "test");
130         inParams.put((String) AppcDataServiceConstant.INPUT_PARAM_VM_NAME, "test");
131         node.getConfigFilesByVnfVmNCategory(inParams, ctx);
132     }
133
134     @Ignore("Test is taking 60 seconds")
135     @Test(expected = Exception.class)
136     public void testsaveConfigTransactionLog() throws SvcLogicException {
137         SvcLogicContext ctx = new SvcLogicContext();
138         ConfigResourceNode node = new ConfigResourceNode();
139         Map<String, String> inParams = new HashMap<String, String>();
140         inParams.put(AppcDataServiceConstant.INPUT_PARAM_MESSAGE, "testMessage");
141         inParams.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "response-prefix");
142         inParams.put(AppcDataServiceConstant.INPUT_PARAM_MESSAGE_TYPE, "testmessage");
143         ctx.setAttribute("request-id", "tets-id");
144         node.saveConfigTransactionLog(inParams, ctx);
145
146     }
147
148     @Ignore("Test is taking 60 seconds")
149     @Test(expected = Exception.class)
150     public void testsaveConfigBlock() throws SvcLogicException {
151         SvcLogicContext ctx = new SvcLogicContext();
152         ConfigResourceNode node = new ConfigResourceNode();
153         Map<String, String> inParams = new HashMap<String, String>();
154         inParams.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "tmp");
155         ctx.setAttribute("configuration", "test");
156         ctx.setAttribute("tmp.convertconfig.escapeData", "test");
157         ctx.setAttribute("tmp.merge.mergedData", "test");
158         node.saveConfigBlock(inParams, ctx);
159     }
160
161     @Test
162     public void testcheckIfCapabilityCheckNeeded ()  throws Exception {
163         ConfigResourceNode node = new ConfigResourceNode();
164         String findCapability="Start";
165         String capLevel="vnf";
166         boolean result=node.checkIfCapabilityCheckNeeded(capLevel,findCapability);
167         assertFalse(result);
168     }
169
170 }