2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.common;
23 import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
24 import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
26 import java.util.HashMap;
28 import java.util.UUID;
30 import org.junit.Assert;
31 import org.junit.Test;
32 import org.onap.so.BaseIntegrationTest;
35 * Unit test for CompleteMsoProcess.bpmn.
38 public class CompleteMsoProcessIT extends BaseIntegrationTest {
40 private void executeFlow(String inputRequestFile) throws InterruptedException {
41 mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
42 Map<String, Object> variables = new HashMap<>();
43 variables.put("CompleteMsoProcessRequest",inputRequestFile);
44 variables.put("mso-request-id", UUID.randomUUID().toString());
45 String processId = invokeSubProcess( "CompleteMsoProcess", variables);
46 waitForWorkflowToFinish(processEngine,processId);
51 public void msoCompletionRequestWithNotificationUrl_200() throws Exception {
55 executeFlow(gMsoCompletionRequestWithNotificationurl());
58 String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
59 Assert.assertEquals("200", CMSO_ResponseCode);
60 Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
65 public void msoCompletionRequestWithNoNotificationurl() throws Exception {
69 executeFlow(gMsoCompletionRequestWithNoNotificationurl());
72 String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
73 Assert.assertEquals("200", CMSO_ResponseCode);
74 Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
79 public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception {
83 executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId());
86 String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
87 Assert.assertEquals("200", CMSO_ResponseCode);
88 Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
93 public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception {
97 executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId());
100 String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
101 Assert.assertEquals("200", CMSO_ResponseCode);
102 Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
106 public String gMsoCompletionRequestWithNotificationurl() {
108 + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.openecomp.org.com/mso/workflow/schema/v1\">"
109 + " <ns:request-information>"
110 + " <ns:request-id>STUW105_5002</ns:request-id>"
111 + " <ns:request-action>RequestAction</ns:request-action>"
112 + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
113 + " <ns:source>SOURCE</ns:source>"
114 + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
115 + " <ns:order-number>10205000</ns:order-number>"
116 + " <ns:order-version>1</ns:order-version>"
117 + " </ns:request-information>"
118 + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
119 + "</sdncadapterworkflow:MsoCompletionRequest>";
126 public String gMsoCompletionRequestWithNoNotificationurl() {
127 //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
129 + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
130 + " <ns:request-information>"
131 + " <ns:request-id>STUW105_5002</ns:request-id>"
132 + " <ns:request-action>RequestAction</ns:request-action>"
133 + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
134 + " <ns:source>SOURCE</ns:source>"
135 + " <ns:notification-url></ns:notification-url>"
136 + " <ns:order-number>10205000</ns:order-number>"
137 + " <ns:order-version>1</ns:order-version>"
138 + " </ns:request-information>"
139 + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
140 + "</sdncadapterworkflow:MsoCompletionRequest>";
145 public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() {
146 //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
148 + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
149 + " <ns:request-information>"
150 + " <ns:request-id></ns:request-id>"
151 + " <ns:request-action>RequestAction</ns:request-action>"
152 + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
153 + " <ns:source>SOURCE</ns:source>"
154 + " <ns:notification-url></ns:notification-url>"
155 + " <ns:order-number>10205000</ns:order-number>"
156 + " <ns:order-version>1</ns:order-version>"
157 + " </ns:request-information>"
158 + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
159 + "</sdncadapterworkflow:MsoCompletionRequest>";
164 public String gMsoCompletionRequestWithNotificationurlNoRequestId() {
165 //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
167 + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
168 + " <ns:request-information>"
169 + " <ns:request-id></ns:request-id>"
170 + " <ns:request-action>RequestAction</ns:request-action>"
171 + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
172 + " <ns:source>SOURCE</ns:source>"
173 + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
174 + " <ns:order-number>10205000</ns:order-number>"
175 + " <ns:order-version>1</ns:order-version>"
176 + " </ns:request-information>"
177 + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
178 + "</sdncadapterworkflow:MsoCompletionRequest>";