2 * ============LICENSE_START=======================================================
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.onap.appc.data.services.db;
27 import com.fasterxml.jackson.databind.JsonNode;
28 import com.fasterxml.jackson.databind.ObjectMapper;
29 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
30 import java.util.HashMap;
32 import static org.junit.Assert.assertEquals;
33 import static org.junit.Assert.assertFalse;
34 import org.junit.Ignore;
35 import org.junit.Test;
36 import org.onap.appc.data.services.AppcDataServiceConstant;
37 import org.onap.appc.data.services.node.ConfigResourceNode;
38 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
39 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
41 @Deprecated // class must be rewritten
42 public class TestConfigResourceNode {
44 @Deprecated // timeout due NPE
45 @Ignore("Test is taking 60 seconds")
46 @Test(expected = Exception.class)
47 public void testgetConfigFileReferenc() throws SvcLogicException {
48 SvcLogicContext ctx = new SvcLogicContext();
49 ctx.setAttribute("test", "test");
50 ConfigResourceNode dbService = new ConfigResourceNode(DGGeneralDBService.initialise());
51 Map<String, String> map = new HashMap<>();
52 dbService.getConfigFileReference(map, ctx);
55 @Deprecated // timeout due NPE
56 @Ignore("Test is taking 60 seconds")
57 @Test(expected = Exception.class)
58 public void testgetTemplate() throws SvcLogicException {
59 SvcLogicContext ctx = new SvcLogicContext();
60 ctx.setAttribute("test", "test");
61 ctx.setAttribute(AppcDataServiceConstant.INPUT_PARAM_FILE_CATEGORY, "test");
62 ctx.setAttribute(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "tmp.test");
63 ctx.setAttribute("template-name", "test.json");
65 ConfigResourceNode dbService = new ConfigResourceNode(DGGeneralDBService.initialise());
66 Map<String, String> map = new HashMap<>();
67 dbService.getTemplate(map, ctx);
71 @Deprecated // timeout due NPE
72 @Ignore("Test is taking 60 seconds")
73 @Test(expected = Exception.class)
74 public void testgetVnfcReference() throws SvcLogicException {
75 SvcLogicContext ctx = new SvcLogicContext();
76 ctx.setAttribute("test", "test");
77 ConfigResourceNode dbService = new ConfigResourceNode(DGGeneralDBService.initialise());
78 Map<String, String> map = new HashMap<>();
79 map.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "tmp.test");
80 dbService.getVnfcReference(map, ctx);
83 @Deprecated // timeout due NPE
84 @Ignore("Test is taking 60 seconds")
85 @Test(expected = Exception.class)
86 public void testgetSmmChainKeyFiles() throws SvcLogicException {
87 SvcLogicContext ctx = new SvcLogicContext();
88 ctx.setAttribute("test", "test");
89 ctx.setAttribute("site-location","test/location");
90 ConfigResourceNode dbService = new ConfigResourceNode(DGGeneralDBService.initialise());
91 Map<String, String> map = new HashMap<>();
92 map.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "tmp.test");
93 dbService.getSmmChainKeyFiles(map, ctx);
96 @Deprecated // timeout due NPE
97 @Ignore("Test is taking 60 seconds")
98 @Test(expected = Exception.class)
99 public void testgetDownloadConfigTemplateByVnf() throws SvcLogicException {
100 SvcLogicContext ctx = new SvcLogicContext();
101 ctx.setAttribute("test", "test");
102 ConfigResourceNode dbService = new ConfigResourceNode(DGGeneralDBService.initialise());
103 Map<String, String> map = new HashMap<>();
104 map.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "tmp.test");
105 dbService.getDownloadConfigTemplateByVnf(map, ctx);
109 @Deprecated // timeout due NPE
110 @Ignore("Test is taking 60 seconds")
111 @Test(expected = Exception.class)
112 public void testgetCommonConfigInfo() throws SvcLogicException {
113 SvcLogicContext ctx = new SvcLogicContext();
114 ctx.setAttribute("test", "test");
115 ConfigResourceNode dbService = new ConfigResourceNode(DGGeneralDBService.initialise());
116 Map<String, String> map = new HashMap<>();
117 dbService.getCommonConfigInfo(map, ctx);
121 @Deprecated // timeout due NPE
122 @Ignore("Test is taking 60 seconds")
123 @Test(expected = Exception.class)
124 public void testupdateUploadConfigss() throws SvcLogicException {
125 SvcLogicContext ctx = new SvcLogicContext();
126 ctx.setAttribute("test", "test");
127 ConfigResourceNode dbService = new ConfigResourceNode(DGGeneralDBService.initialise());
128 Map<String, String> map = new HashMap<>();
129 dbService.updateUploadConfig(map, ctx);
133 @Deprecated // timeout due NPE
134 @Ignore("Test is taking 60 seconds")
135 @Test(expected = Exception.class)
136 public void testgetConfigFilesByVnfVmNCategory() throws SvcLogicException {
137 SvcLogicContext ctx = new SvcLogicContext();
138 ConfigResourceNode node = new ConfigResourceNode(DGGeneralDBService.initialise());
139 Map<String, String> inParams = new HashMap<>();
140 inParams.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "response-prefix");
141 inParams.put(AppcDataServiceConstant.INPUT_PARAM_FILE_CATEGORY, "config_template");
142 inParams.put((String) AppcDataServiceConstant.INPUT_PARAM_VNF_ID, "test");
143 inParams.put((String) AppcDataServiceConstant.INPUT_PARAM_VM_NAME, "test");
144 node.getConfigFilesByVnfVmNCategory(inParams, ctx);
147 @Deprecated // timeout due NPE
148 @Ignore("Test is taking 60 seconds")
149 @Test(expected = Exception.class)
150 public void testsaveConfigTransactionLog() throws SvcLogicException {
151 SvcLogicContext ctx = new SvcLogicContext();
152 ConfigResourceNode node = new ConfigResourceNode(DGGeneralDBService.initialise());
153 Map<String, String> inParams = new HashMap<>();
154 inParams.put(AppcDataServiceConstant.INPUT_PARAM_MESSAGE, "testMessage");
155 inParams.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "response-prefix");
156 inParams.put(AppcDataServiceConstant.INPUT_PARAM_MESSAGE_TYPE, "testmessage");
157 ctx.setAttribute("request-id", "tets-id");
158 node.saveConfigTransactionLog(inParams, ctx);
162 @Deprecated // timeout due NPE
163 @Ignore("Test is taking 60 seconds")
164 @Test(expected = Exception.class)
165 public void testsaveConfigBlock() throws SvcLogicException {
166 SvcLogicContext ctx = new SvcLogicContext();
167 ConfigResourceNode node = new ConfigResourceNode(DGGeneralDBService.initialise());
168 Map<String, String> inParams = new HashMap<>();
169 inParams.put(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX, "tmp");
170 ctx.setAttribute("configuration", "test");
171 ctx.setAttribute("tmp.convertconfig.escapeData", "test");
172 ctx.setAttribute("tmp.merge.mergedData", "test");
173 node.saveConfigBlock(inParams, ctx);