1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
package org.openecomp.mso.bpmn.infrastructure;
import static org.junit.Assert.assertEquals;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetCustomer;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutServiceInstance;
import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Assert;
import org.junit.Test;
import org.openecomp.mso.bpmn.common.BPMNUtil;
import org.openecomp.mso.bpmn.common.WorkflowTest;
/**
* Unit test cases for DoCreateServiceInstance.bpmn
*/
public class DoCreateServiceInstanceTest extends WorkflowTest {
private static final String EOL = "\n";
private final CallbackSet callbacks = new CallbackSet();
private final String sdncAdapterCallback =
"<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
" <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
" <ack-final-indicator>Y</ack-final-indicator>" + EOL +
"</output>" + EOL;
public DoCreateServiceInstanceTest() throws IOException {
callbacks.put("assign", sdncAdapterCallback);
}
/**
* Sunny day VID scenario.
*
* @throws Exception
*/
//@Ignore // File not found - unable to run the test. Also, Stubs need updating..
@Test
@Deployment(resources = {
"subprocess/DoCreateServiceInstance.bpmn",
"subprocess/SDNCAdapterV1.bpmn",
"subprocess/GenericGetService.bpmn",
"subprocess/GenericPutService.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/DoCreateServiceInstanceRollback.bpmn",
"subprocess/FalloutHandler.bpmn" })
public void sunnyDay() throws Exception {
logStart();
//AAI
MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml");
MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", "");
MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", "GenericFlows/getServiceInstance.xml");
MockNodeQueryServiceInstanceByName("RAATest-si", "");
MockNodeQueryServiceInstanceById("RaaTest-si-id", "");
MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
//SDNC
mockSDNCAdapter(200);
//DB
mockUpdateRequestDB(200, "DBUpdateResponse.xml");
String businessKey = UUID.randomUUID().toString();
Map<String, Object> variables = new HashMap<String, Object>();
setupVariables(variables);
invokeSubProcess("DoCreateServiceInstance", businessKey, variables);
injectSDNCCallbacks(callbacks, "assign");
waitForProcessEnd(businessKey, 10000);
Assert.assertTrue(isProcessEnded(businessKey));
String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstance", "WorkflowException");
System.out.println("workflowException:\n" + workflowException);
assertEquals(null, workflowException);
logEnd();
}
// Success Scenario
private void setupVariables(Map<String, Object> variables) {
variables.put("mso-request-id", "RaaDSITest1");
variables.put("isDebugLogEnabled", "true");
variables.put("msoRequestId", "RaaDSITestRequestId-1");
variables.put("serviceInstanceId","RaaTest-si-id");
variables.put("serviceModelInfo", "{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"}");
variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
variables.put("globalSubscriberId", "MCBH-1610");
variables.put("subscriptionServiceType", "viprsvc");
variables.put("instanceName", "RAATest-1");
}
}
|