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