2 * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
\r
5 * ============LICENSE_START=======================================================
\r
7 * ================================================================================
\r
8 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
9 * ================================================================================
\r
10 * Licensed under the Apache License, Version 2.0 (the "License");
\r
11 * you may not use this file except in compliance with the License.
\r
12 * You may obtain a copy of the License at
\r
14 * http://www.apache.org/licenses/LICENSE-2.0
\r
16 * Unless required by applicable law or agreed to in writing, software
\r
17 * distributed under the License is distributed on an "AS IS" BASIS,
\r
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
19 * See the License for the specific language governing permissions and
\r
20 * limitations under the License.
\r
21 * ============LICENSE_END=========================================================
\r
24 package org.openecomp.mso.bpmn.common;
\r
26 import static org.junit.Assert.assertEquals;
\r
27 import static org.junit.Assert.assertNotNull;
\r
28 import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
\r
29 import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
\r
30 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
\r
31 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404;
\r
32 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500;
\r
33 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceSubscription;
\r
34 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
\r
35 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_404;
\r
36 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_500;
\r
37 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName;
\r
38 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404;
\r
39 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_500;
\r
41 import java.util.HashMap;
\r
42 import java.util.Map;
\r
44 import org.camunda.bpm.engine.test.Deployment;
\r
45 import org.junit.Test;
\r
46 import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
\r
50 * Unit Test for the GenericGetService Sub Flow
\r
52 public class GenericGetServiceTest extends WorkflowTest {
\r
56 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
57 public void testGenericGetService_success_serviceInstance() throws Exception{
\r
58 MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
\r
59 Map<String, String> variables = new HashMap<String, String>();
\r
60 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
\r
61 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
62 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
63 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
64 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
65 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
66 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
67 String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
\r
68 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
69 assertEquals("true", successIndicator);
\r
70 assertEquals("true", found);
\r
71 assertEquals("false", obtainUrl);
\r
72 assertEquals("false", byName);
\r
73 assertNotNull(response);
\r
74 assertEquals(null, workflowException);
\r
79 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
80 public void testGenericGetService_success_serviceSubscription() throws Exception{
\r
82 MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml");
\r
84 Map<String, String> variables = new HashMap<String, String>();
\r
85 setVariablesSubscription(variables, "", null , "1604-MVM-26", "SDN-ETHERNET-INTERNET");
\r
87 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
88 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
90 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
91 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
92 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
93 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
94 String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
\r
95 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
97 assertEquals("true", successIndicator);
\r
98 assertEquals("true", found);
\r
99 assertEquals("false", obtainUrl);
\r
100 assertEquals("false", byName);
\r
101 assertNotNull(response);
\r
102 assertEquals(null, workflowException);
\r
106 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
107 public void testGenericGetService_success_serviceInstance_byName() throws Exception{
\r
109 MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml");
\r
110 MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
\r
112 Map<String, String> variables = new HashMap<String, String>();
\r
113 setVariablesInstance(variables, null, "1604-MVM-26", null, null);
\r
115 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
116 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
118 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
119 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
120 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
121 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
122 String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
\r
123 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
124 String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
\r
126 assertEquals("true", successIndicator);
\r
127 assertEquals("true", found);
\r
128 assertEquals("true", obtainUrl);
\r
129 assertEquals("true", byName);
\r
130 assertNotNull(response);
\r
131 assertEquals("200", siUrlResponseCode);
\r
132 assertEquals(null, workflowException);
\r
136 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
137 public void testGenericGetService_success_serviceInstance_byId() throws Exception{
\r
139 MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
\r
140 MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
\r
142 Map<String, String> variables = new HashMap<String, String>();
\r
143 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
\r
145 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
146 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
148 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
149 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
150 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
151 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
152 String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
\r
153 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
154 String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
\r
156 assertEquals("true", successIndicator);
\r
157 assertEquals("true", found);
\r
158 assertEquals("true", obtainUrl);
\r
159 assertEquals("false", byName);
\r
160 assertNotNull(response);
\r
161 assertEquals("200", siUrlResponseCode);
\r
162 assertEquals(null, workflowException);
\r
166 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
167 public void testGenericGetService_success_serviceInstance_404Response() throws Exception{
\r
169 MockGetServiceInstance_404("SDN-ETHERNET-INTERNET", "123456789", "MIS%2F1604%2F0026%2FSW_INTERNET");
\r
171 Map<String, String> variables = new HashMap<String, String>();
\r
172 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
\r
174 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
175 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
177 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
178 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
179 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
180 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
181 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
183 assertEquals("true", successIndicator);
\r
184 assertEquals("false", found);
\r
185 assertEquals("false", obtainUrl);
\r
186 assertEquals("false", byName);
\r
187 assertEquals(null, workflowException);
\r
191 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
192 public void testGenericGetService_success_serviceSubscription404() throws Exception{
\r
193 MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", 404);
\r
195 Map<String, String> variables = new HashMap<String, String>();
\r
196 setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26");
\r
198 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
199 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
201 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
202 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
203 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
204 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
205 String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse");
\r
206 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
208 assertEquals("true", successIndicator);
\r
209 assertEquals("false", found);
\r
210 assertEquals("false", obtainUrl);
\r
211 assertEquals("false", byName);
\r
212 assertNotNull(response);
\r
213 assertEquals(null, workflowException);
\r
217 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
218 public void testGenericGetService_success_serviceInstanceByName404() throws Exception{
\r
220 MockNodeQueryServiceInstanceByName_404("1604-MVM-26");
\r
222 Map<String, String> variables = new HashMap<String, String>();
\r
223 setVariablesInstance(variables, "", "1604-MVM-26", null, null);
\r
225 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
226 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
228 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
229 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
230 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
231 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
232 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
233 String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
\r
235 assertEquals("true", successIndicator);
\r
236 assertEquals("false", found);
\r
237 assertEquals("true", obtainUrl);
\r
238 assertEquals("true", byName);
\r
239 assertEquals("404", siUrlResponseCode);
\r
240 assertEquals(null, workflowException);
\r
244 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
245 public void testGenericGetService_success_serviceInstanceById404() throws Exception{
\r
247 MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET");
\r
249 Map<String, String> variables = new HashMap<String, String>();
\r
250 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
\r
252 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
253 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
255 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
256 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
257 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
258 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
259 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
260 String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
\r
262 assertEquals("true", successIndicator);
\r
263 assertEquals("false", found);
\r
264 assertEquals("true", obtainUrl);
\r
265 assertEquals("false", byName);
\r
266 assertEquals("404", siUrlResponseCode);
\r
267 assertEquals(null, workflowException);
\r
271 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
272 public void testGenericGetService_success_serviceInstanceEmptyResponse() throws Exception{
\r
274 MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", " ");
\r
276 Map<String, String> variables = new HashMap<String, String>();
\r
277 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
\r
279 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
280 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
282 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
283 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
284 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
285 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
286 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
288 assertEquals("true", successIndicator);
\r
289 assertEquals("false", found);
\r
290 assertEquals("false", obtainUrl);
\r
291 assertEquals("false", byName);
\r
292 assertEquals(null, workflowException);
\r
296 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
297 public void testGenericGetService_success_serviceInstanceByNameEmpty() throws Exception{
\r
298 MockNodeQueryServiceInstanceByName("1604-MVM-26", "");
\r
300 Map<String, String> variables = new HashMap<String, String>();
\r
301 setVariablesInstance(variables, "", "1604-MVM-26", null, null);
\r
303 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
304 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
306 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
307 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
308 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
309 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
310 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
311 String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
\r
313 assertEquals("true", successIndicator);
\r
314 assertEquals("false", found);
\r
315 assertEquals("true", obtainUrl);
\r
316 assertEquals("true", byName);
\r
317 assertEquals("200", siUrlResponseCode);
\r
318 assertEquals(null, workflowException);
\r
322 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
323 public void testGenericGetService_success_serviceInstanceByIdEmpty() throws Exception{
\r
325 MockNodeQueryServiceInstanceById("MIS[%]2F1604[%]2F0026[%]2FSW_INTERNET", "");
\r
327 Map<String, String> variables = new HashMap<String, String>();
\r
328 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
\r
330 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
331 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
333 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
334 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
335 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
336 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
337 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
338 String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
\r
340 assertEquals("true", successIndicator);
\r
341 assertEquals("false", found);
\r
342 assertEquals("true", obtainUrl);
\r
343 assertEquals("false", byName);
\r
344 assertEquals("200", siUrlResponseCode);
\r
345 assertEquals(null, workflowException);
\r
350 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
351 public void testGenericGetService_error_serviceInstanceInvalidVariables() throws Exception{
\r
353 Map<String, String> variables = new HashMap<String, String>();
\r
354 setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null);
\r
356 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
357 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
359 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
360 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
361 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
362 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
363 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
365 String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.]";
\r
367 assertEquals("false", successIndicator);
\r
368 assertEquals("false", found);
\r
369 assertEquals("false", obtainUrl);
\r
370 assertEquals("false", byName);
\r
371 assertEquals(expectedWorkflowException, workflowException);
\r
375 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
376 public void testGenericGetService_success_serviceSubscriptionInvalidVariables() throws Exception{
\r
378 Map<String, String> variables = new HashMap<String, String>();
\r
379 setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null);
\r
381 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
382 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
384 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
385 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
386 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
387 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
388 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
390 String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.]";
\r
393 assertEquals("false", successIndicator);
\r
394 assertEquals("false", found);
\r
395 assertEquals("false", obtainUrl);
\r
396 assertEquals("false", byName);
\r
397 assertEquals(expectedWorkflowException, workflowException);
\r
401 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
402 public void testGenericGetService_error_serviceInstance_getSIBadResponse() throws Exception{
\r
404 MockGetServiceInstance_500("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
\r
406 Map<String, String> variables = new HashMap<String, String>();
\r
407 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789");
\r
409 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
410 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
412 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
413 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
414 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
415 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
416 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
418 String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]";
\r
420 assertEquals("false", successIndicator);
\r
421 assertEquals("false", found);
\r
422 assertEquals("false", obtainUrl);
\r
423 assertEquals("false", byName);
\r
424 assertEquals(expectedWorkflowException, workflowException);
\r
428 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
429 public void testGenericGetService_error_serviceInstance_getUrlByIdBadResponse() throws Exception{
\r
431 MockNodeQueryServiceInstanceById_500("MIS%2F1604%2F0026%2FSW_INTERNET");
\r
433 Map<String, String> variables = new HashMap<String, String>();
\r
434 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
\r
436 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
437 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
439 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
440 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
441 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
442 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
443 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
444 String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_genericQueryResponseCode");
\r
446 String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]";
\r
448 assertEquals("false", successIndicator);
\r
449 assertEquals("false", found);
\r
450 assertEquals("true", obtainUrl);
\r
451 assertEquals("false", byName);
\r
452 assertEquals("500", siUrlResponseCode);
\r
453 assertEquals(expectedWorkflowException, workflowException);
\r
457 @Deployment(resources = {"subprocess/GenericGetService.bpmn"})
\r
458 public void testGenericGetService_error_serviceInstance_getUrlByNameBadResponse() throws Exception{
\r
460 MockNodeQueryServiceInstanceByName_500("1604-MVM-26");
\r
462 Map<String, String> variables = new HashMap<String, String>();
\r
463 setVariablesInstance(variables, null, "1604-MVM-26", null, null);
\r
465 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables);
\r
466 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
468 String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator");
\r
469 String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator");
\r
470 String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException");
\r
471 String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainObjectsUrl");
\r
472 String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName");
\r
473 String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode");
\r
475 String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]";
\r
477 assertEquals("false", successIndicator);
\r
478 assertEquals("false", found);
\r
479 assertEquals("true", obtainUrl);
\r
480 assertEquals("true", byName);
\r
481 assertEquals("500", siUrlResponseCode);
\r
482 assertEquals(expectedWorkflowException, workflowException);
\r
486 private void setVariablesInstance(Map<String, String> variables, String siId, String siName, String globalCustId, String serviceType) {
\r
487 variables.put("isDebugLogEnabled", "true");
\r
488 variables.put("GENGS_serviceInstanceId", siId);
\r
489 variables.put("GENGS_serviceInstanceName", siName);
\r
490 variables.put("GENGS_globalCustomerId",globalCustId);
\r
491 variables.put("GENGS_serviceType", serviceType);
\r
492 variables.put("GENGS_type", "service-instance");
\r
495 private void setVariablesSubscription(Map<String, String> variables, String siId, String siName, String globalCustId, String serviceType) {
\r
496 variables.put("isDebugLogEnabled", "true");
\r
497 variables.put("GENGS_serviceInstanceId", siId);
\r
498 variables.put("GENGS_serviceInstanceName", siName);
\r
499 variables.put("GENGS_globalCustomerId",globalCustId);
\r
500 variables.put("GENGS_serviceType", serviceType);
\r
501 variables.put("GENGS_type", "service-subscription");
\r