2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package org.openecomp.mso.bpmn.common;
\r
23 import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
\r
24 import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
\r
25 import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
\r
27 import java.util.HashMap;
\r
28 import java.util.Map;
\r
30 import org.camunda.bpm.engine.test.Deployment;
\r
31 import org.junit.Assert;
\r
32 import org.junit.Ignore;
\r
33 import org.junit.Test;
\r
34 import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
\r
37 * Unit test for CompleteMsoProcess.bpmn.
\r
39 public class CompleteMsoProcessTest extends WorkflowTest {
\r
41 private void executeFlow(String inputRequestFile) throws InterruptedException {
\r
42 mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
\r
44 //String changeFeatureActivateRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/ChangeFeatureActivateV1/" + inputRequestFile);
\r
45 Map<String, String> variables = new HashMap<>();
\r
46 variables.put("CompleteMsoProcessRequest",inputRequestFile);
\r
48 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CompleteMsoProcess", variables);
\r
49 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
\r
54 @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
\r
55 "subprocess/GenericNotificationService.bpmn"
\r
57 public void msoCompletionRequestWithNotificationurl_200() throws Exception {
\r
61 executeFlow(gMsoCompletionRequestWithNotificationurl());
\r
64 String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
\r
65 Assert.assertEquals("200", CMSO_ResponseCode);
\r
66 Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
\r
71 @Ignore // BROKEN TEST
\r
72 @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
\r
73 "subprocess/GenericNotificationService.bpmn"
\r
75 public void msoCompletionRequestWithNotificationurl_500() throws Exception {
\r
79 executeFlow(gMsoCompletionRequestWithNotificationurl());
\r
82 String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
\r
83 Assert.assertEquals("500", CMSO_ResponseCode);
\r
84 Assert.assertFalse((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
\r
89 @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
\r
90 "subprocess/GenericNotificationService.bpmn"
\r
92 public void msoCompletionRequestWithNoNotificationurl() throws Exception {
\r
96 executeFlow(gMsoCompletionRequestWithNoNotificationurl());
\r
99 String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
\r
100 Assert.assertEquals("200", CMSO_ResponseCode);
\r
101 Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
\r
106 @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
\r
107 "subprocess/GenericNotificationService.bpmn"
\r
109 public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception {
\r
113 executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId());
\r
116 String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
\r
117 Assert.assertEquals("200", CMSO_ResponseCode);
\r
118 Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
\r
123 @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn",
\r
124 "subprocess/GenericNotificationService.bpmn"
\r
126 public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception {
\r
130 executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId());
\r
133 String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode");
\r
134 Assert.assertEquals("200", CMSO_ResponseCode);
\r
135 Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
\r
139 public String gMsoCompletionRequestWithNotificationurl() {
\r
140 //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
\r
142 + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.openecomp.org.com/mso/workflow/schema/v1\">"
\r
143 + " <ns:request-information>"
\r
144 + " <ns:request-id>uCPE1020_STUW105_5002</ns:request-id>"
\r
145 + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
\r
146 + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
\r
147 + " <ns:source>OMX</ns:source>"
\r
148 + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
\r
149 + " <ns:order-number>10205000</ns:order-number>"
\r
150 + " <ns:order-version>1</ns:order-version>"
\r
151 + " </ns:request-information>"
\r
152 + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
\r
153 + "</sdncadapterworkflow:MsoCompletionRequest>";
\r
160 public String gMsoCompletionRequestWithNoNotificationurl() {
\r
161 //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
\r
163 + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
\r
164 + " <ns:request-information>"
\r
165 + " <ns:request-id>uCPE1020_STUW105_5002</ns:request-id>"
\r
166 + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
\r
167 + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
\r
168 + " <ns:source>OMX</ns:source>"
\r
169 + " <ns:notification-url></ns:notification-url>"
\r
170 + " <ns:order-number>10205000</ns:order-number>"
\r
171 + " <ns:order-version>1</ns:order-version>"
\r
172 + " </ns:request-information>"
\r
173 + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
\r
174 + "</sdncadapterworkflow:MsoCompletionRequest>";
\r
179 public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() {
\r
180 //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
\r
182 + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
\r
183 + " <ns:request-information>"
\r
184 + " <ns:request-id></ns:request-id>"
\r
185 + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
\r
186 + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
\r
187 + " <ns:source>OMX</ns:source>"
\r
188 + " <ns:notification-url></ns:notification-url>"
\r
189 + " <ns:order-number>10205000</ns:order-number>"
\r
190 + " <ns:order-version>1</ns:order-version>"
\r
191 + " </ns:request-information>"
\r
192 + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
\r
193 + "</sdncadapterworkflow:MsoCompletionRequest>";
\r
198 public String gMsoCompletionRequestWithNotificationurlNoRequestId() {
\r
199 //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
\r
201 + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
\r
202 + " <ns:request-information>"
\r
203 + " <ns:request-id></ns:request-id>"
\r
204 + " <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>"
\r
205 + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
\r
206 + " <ns:source>OMX</ns:source>"
\r
207 + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
\r
208 + " <ns:order-number>10205000</ns:order-number>"
\r
209 + " <ns:order-version>1</ns:order-version>"
\r
210 + " </ns:request-information>"
\r
211 + " <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>"
\r
212 + "</sdncadapterworkflow:MsoCompletionRequest>";
\r