2 * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
5 * ============LICENSE_START=======================================================
7 * ================================================================================
8 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
9 * ================================================================================
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 * ============LICENSE_END=========================================================
24 package org.onap.so.bpmn.common;
26 import static org.junit.Assert.assertEquals;
27 import static org.junit.Assert.assertNotNull;
28 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
29 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404;
30 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500;
31 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceSubscription;
32 import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
33 import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_404;
34 import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_500;
35 import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName;
36 import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404;
37 import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_500;
39 import java.util.HashMap;
41 import java.util.UUID;
43 import org.junit.Test;
44 import org.onap.so.BaseIntegrationTest;
48 * Unit Test for the GenericGetService Sub Flow
51 public class GenericGetServiceIT extends BaseIntegrationTest {
55 public void testGenericGetService_success_serviceInstance() throws Exception{
56 MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
57 Map<String, Object> variables = new HashMap<>();
58 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
59 String processId = invokeSubProcess( "GenericGetService", variables);
61 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
62 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
63 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
64 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
65 String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
66 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
67 assertEquals("true", successIndicator);
68 assertEquals("true", found);
69 assertEquals("false", obtainUrl);
70 assertEquals("false", byName);
71 assertNotNull(response);
72 assertEquals(null, workflowException);
78 public void testGenericGetService_success_serviceSubscription() throws Exception{
80 MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml");
82 Map<String, Object> variables = new HashMap<>();
83 setVariablesSubscription(variables, "", null , "1604-MVM-26", "SDN-ETHERNET-INTERNET");
85 String processId = invokeSubProcess( "GenericGetService", variables);
88 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
89 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
90 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
91 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
92 String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
93 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
95 assertEquals("true", successIndicator);
96 assertEquals("true", found);
97 assertEquals("false", obtainUrl);
98 assertEquals("false", byName);
99 assertNotNull(response);
100 assertEquals(null, workflowException);
105 public void testGenericGetService_success_serviceInstance_byName() throws Exception{
107 MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml");
108 MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
110 Map<String, Object> variables = new HashMap<>();
111 setVariablesInstance(variables, null, "1604-MVM-26", null, null);
113 String processId = invokeSubProcess( "GenericGetService", variables);
116 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
117 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
118 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
119 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
120 String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
121 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
122 String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
124 assertEquals("true", successIndicator);
125 assertEquals("true", found);
126 assertEquals("true", obtainUrl);
127 assertEquals("true", byName);
128 assertNotNull(response);
129 assertEquals("200", siUrlResponseCode);
130 assertEquals(null, workflowException);
135 public void testGenericGetService_success_serviceInstance_byId() throws Exception{
137 MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
138 MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
140 Map<String, Object> variables = new HashMap<>();
141 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
143 String processId = invokeSubProcess( "GenericGetService", variables);
146 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
147 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
148 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
149 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
150 String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
151 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
152 String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
154 assertEquals("true", successIndicator);
155 assertEquals("true", found);
156 assertEquals("true", obtainUrl);
157 assertEquals("false", byName);
158 assertNotNull(response);
159 assertEquals("200", siUrlResponseCode);
160 assertEquals(null, workflowException);
165 public void testGenericGetService_success_serviceInstance_404Response() throws Exception{
167 MockGetServiceInstance_404("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
169 Map<String, Object> variables = new HashMap<>();
170 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
172 String processId = invokeSubProcess( "GenericGetService", variables);
175 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
176 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
177 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
178 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
179 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
181 assertEquals("true", successIndicator);
182 assertEquals("false", found);
183 assertEquals("false", obtainUrl);
184 assertEquals("false", byName);
185 assertEquals(null, workflowException);
190 public void testGenericGetService_success_serviceSubscription404() throws Exception{
191 MockGetServiceSubscription("SDN-ETHERNET-INTERNET", "1604-MVM-26", 404);
193 Map<String, Object> variables = new HashMap<>();
194 setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26");
196 String processId = invokeSubProcess( "GenericGetService", variables);
199 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
200 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
201 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
202 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
203 String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
204 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
206 assertEquals("true", successIndicator);
207 assertEquals("false", found);
208 assertEquals("false", obtainUrl);
209 assertEquals("false", byName);
210 assertNotNull(response);
211 assertEquals(null, workflowException);
216 public void testGenericGetService_success_serviceInstanceByName404() throws Exception{
218 MockNodeQueryServiceInstanceByName_404("1604-MVM-26");
220 Map<String, Object> variables = new HashMap<>();
221 setVariablesInstance(variables, "", "1604-MVM-26", null, null);
223 String processId = invokeSubProcess( "GenericGetService", variables);
226 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
227 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
228 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
229 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
230 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
231 String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
233 assertEquals("true", successIndicator);
234 assertEquals("false", found);
235 assertEquals("true", obtainUrl);
236 assertEquals("true", byName);
237 assertEquals("404", siUrlResponseCode);
238 assertEquals(null, workflowException);
243 public void testGenericGetService_success_serviceInstanceById404() throws Exception{
245 MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET");
247 Map<String, Object> variables = new HashMap<>();
248 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
250 String processId = invokeSubProcess( "GenericGetService", variables);
253 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
254 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
255 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
256 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
257 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
258 String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
260 assertEquals("true", successIndicator);
261 assertEquals("false", found);
262 assertEquals("true", obtainUrl);
263 assertEquals("false", byName);
264 assertEquals("404", siUrlResponseCode);
265 assertEquals(null, workflowException);
270 public void testGenericGetService_success_serviceInstanceEmptyResponse() throws Exception{
272 MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
274 Map<String, Object> variables = new HashMap<>();
275 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
277 String processId = invokeSubProcess( "GenericGetService", variables);
280 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
281 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
282 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
283 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
284 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
286 assertEquals("true", successIndicator);
287 assertEquals("false", found);
288 assertEquals("false", obtainUrl);
289 assertEquals("false", byName);
290 assertEquals(null, workflowException);
295 public void testGenericGetService_success_serviceInstanceByNameEmpty() throws Exception{
296 MockNodeQueryServiceInstanceByName("1604-MVM-26", "");
298 Map<String, Object> variables = new HashMap<>();
299 setVariablesInstance(variables, "", "1604-MVM-26", null, null);
301 String processId = invokeSubProcess( "GenericGetService", variables);
304 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
305 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
306 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
307 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
308 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
309 String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
311 assertEquals("true", successIndicator);
312 assertEquals("false", found);
313 assertEquals("true", obtainUrl);
314 assertEquals("true", byName);
315 assertEquals("200", siUrlResponseCode);
316 assertEquals(null, workflowException);
321 public void testGenericGetService_success_serviceInstanceByIdEmpty() throws Exception{
323 MockNodeQueryServiceInstanceById("MIS[%]2F1604[%]2F0026[%]2FSW_INTERNET", "");
325 Map<String, Object> variables = new HashMap<>();
326 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
328 String processId = invokeSubProcess( "GenericGetService", variables);
331 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
332 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
333 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
334 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
335 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
336 String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
338 assertEquals("true", successIndicator);
339 assertEquals("false", found);
340 assertEquals("true", obtainUrl);
341 assertEquals("false", byName);
342 assertEquals("200", siUrlResponseCode);
343 assertEquals(null, workflowException);
349 public void testGenericGetService_error_serviceInstanceInvalidVariables() throws Exception{
351 Map<String, Object> variables = new HashMap<>();
352 setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null);
354 String processId = invokeSubProcess( "GenericGetService", variables);
357 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
358 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
359 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
360 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
361 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
363 String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.,workStep=*]";
365 assertEquals("false", successIndicator);
366 assertEquals("false", found);
367 assertEquals("false", obtainUrl);
368 assertEquals("false", byName);
369 assertEquals(expectedWorkflowException, workflowException);
374 public void testGenericGetService_success_serviceSubscriptionInvalidVariables() throws Exception{
376 Map<String, Object> variables = new HashMap<>();
377 setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null);
379 String processId = invokeSubProcess( "GenericGetService", variables);
382 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
383 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
384 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
385 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
386 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
388 String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.,workStep=*]";
391 assertEquals("false", successIndicator);
392 assertEquals("false", found);
393 assertEquals("false", obtainUrl);
394 assertEquals("false", byName);
395 assertEquals(expectedWorkflowException, workflowException);
400 public void testGenericGetService_error_serviceInstance_getSIBadResponse() throws Exception{
402 MockGetServiceInstance_500("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
404 Map<String, Object> variables = new HashMap<>();
405 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789");
407 String processId = invokeSubProcess( "GenericGetService", variables);
410 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
411 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
412 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
413 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
414 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
416 String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]";
418 assertEquals("false", successIndicator);
419 assertEquals("false", found);
420 assertEquals("false", obtainUrl);
421 assertEquals("false", byName);
422 assertEquals(expectedWorkflowException, workflowException);
427 public void testGenericGetService_error_serviceInstance_getUrlByIdBadResponse() throws Exception{
429 MockNodeQueryServiceInstanceById_500("MIS%2F1604%2F0026%2FSW_INTERNET");
431 Map<String, Object> variables = new HashMap<>();
432 setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
434 String processId = invokeSubProcess( "GenericGetService", variables);
437 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
438 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
439 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
440 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
441 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
442 String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
444 String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]";
446 assertEquals("false", successIndicator);
447 assertEquals("false", found);
448 assertEquals("true", obtainUrl);
449 assertEquals("false", byName);
450 assertEquals("500", siUrlResponseCode);
451 assertEquals(expectedWorkflowException, workflowException);
456 public void testGenericGetService_error_serviceInstance_getUrlByNameBadResponse() throws Exception{
458 MockNodeQueryServiceInstanceByName_500("1604-MVM-26");
460 Map<String, Object> variables = new HashMap<>();
461 setVariablesInstance(variables, null, "1604-MVM-26", null, null);
463 String processId = invokeSubProcess( "GenericGetService", variables);
466 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
467 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
468 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
469 String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
470 String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
471 String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
473 String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]";
475 assertEquals("false", successIndicator);
476 assertEquals("false", found);
477 assertEquals("true", obtainUrl);
478 assertEquals("true", byName);
479 assertEquals("500", siUrlResponseCode);
480 assertEquals(expectedWorkflowException, workflowException);
485 public void testGenericGetService_success_serviceInstance_byNameServicePresent() throws Exception{
487 MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml");
488 MockGetServiceInstance("AbcBank", "ABC-ST", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
490 Map<String, Object> variables = new HashMap<>();
491 setVariablesInstance(variables, null, "1604-MVM-26", "XyCorporation", null);
493 String processId = invokeSubProcess( "GenericGetService", variables);
496 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
497 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
498 String resourceLink = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_resourceLink",processId);
499 String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
500 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
501 String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
503 assertEquals("true", successIndicator);
504 assertEquals("true", found);
505 assertNotNull(resourceLink);
506 assertNotNull(response);
507 assertEquals("200", siUrlResponseCode);
508 assertEquals(null, workflowException);
513 public void testGenericGetService_success_serviceInstance_byNameServiceNotPresent() throws Exception{
515 MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml");
516 MockGetServiceInstance("CorporationNotPresent", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
518 Map<String, Object> variables = new HashMap<>();
519 setVariablesInstance(variables, null, "1604-MVM-26", "CorporationNotPresent", null);
521 String processId = invokeSubProcess( "GenericGetService", variables);
524 String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
525 String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
526 String resourceLink = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_resourceLink",processId);
527 String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
528 String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
529 String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
531 assertEquals("true", successIndicator);
532 assertEquals("false", found);
533 assertEquals(null, resourceLink);
534 assertEquals(" ", response);
535 assertEquals("200", siUrlResponseCode);
536 assertEquals(null, workflowException);
539 private void setVariablesInstance(Map<String, Object> variables, String siId, String siName, String globalCustId, String serviceType) {
540 variables.put("isDebugLogEnabled", "true");
541 variables.put("GENGS_serviceInstanceId", siId);
542 variables.put("GENGS_serviceInstanceName", siName);
543 variables.put("GENGS_globalCustomerId",globalCustId);
544 variables.put("GENGS_serviceType", serviceType);
545 variables.put("GENGS_type", "service-instance");
546 variables.put("mso-request-id", UUID.randomUUID().toString());
549 private void setVariablesSubscription(Map<String, Object> variables, String siId, String siName, String globalCustId, String serviceType) {
550 variables.put("isDebugLogEnabled", "true");
551 variables.put("GENGS_serviceInstanceId", siId);
552 variables.put("GENGS_serviceInstanceName", siName);
553 variables.put("GENGS_globalCustomerId",globalCustId);
554 variables.put("GENGS_serviceType", serviceType);
555 variables.put("GENGS_type", "service-subscription");
556 variables.put("mso-request-id", UUID.randomUUID().toString());