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.openecomp.mso.bpmn.infrastructure;
23 import java.io.IOException;
24 import java.util.HashMap;
26 import java.util.UUID;
28 import org.camunda.bpm.engine.test.Deployment;
29 import org.junit.Ignore;
30 import org.junit.Test;
31 import org.openecomp.mso.bpmn.common.WorkflowTest;
32 import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
33 import org.openecomp.mso.bpmn.mock.FileUtil;
36 * Unit test cases for UpdateVfModuleVolume.bpmn
38 public class DeleteVfModuleVolumeInfraV1Test extends WorkflowTest {
40 private final CallbackSet callbacks = new CallbackSet();
42 public DeleteVfModuleVolumeInfraV1Test() throws IOException {
43 callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
44 "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
48 * Happy path scenario.
53 @Ignore // BROKEN TEST
54 @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
55 "subprocess/FalloutHandler.bpmn",
56 "subprocess/CompleteMsoProcess.bpmn",
57 "subprocess/VnfAdapterRestV1.bpmn"})
58 public void happyPath() throws Exception {
62 // DeleteVfModuleVolumeInfraV1_success();
64 String businessKey = UUID.randomUUID().toString();
65 String deleteVfModuleVolRequest =
66 FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
68 Map<String, Object> testVariables = new HashMap<String, Object>();
69 testVariables.put("requestId", "TEST-REQUEST-ID-0123");
70 testVariables.put("volumeGroupId", "78987");
71 testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
73 TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
74 "v1", businessKey, deleteVfModuleVolRequest, testVariables);
75 WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
77 String responseBody = response.getResponse();
78 System.out.println("Workflow (Synch) Response:\n" + responseBody);
80 injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
82 waitForProcessEnd(businessKey, 100000);
83 checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", true);
89 * Test fails - vf module in use
94 @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
95 "subprocess/FalloutHandler.bpmn",
96 "subprocess/CompleteMsoProcess.bpmn",
97 "subprocess/VnfAdapterRestV1.bpmn"})
98 public void TestVfModuleInUseError() throws Exception {
102 // DeleteVfModuleVolumeInfraV1_inUseError(); // no assertions to check
104 String businessKey = UUID.randomUUID().toString();
105 String deleteVfModuleVolRequest =
106 FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
108 Map<String, Object> testVariables = new HashMap<String, Object>();
109 testVariables.put("requestId", "TEST-REQUEST-ID-0123");
110 testVariables.put("volumeGroupId", "78987");
112 TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
113 "v1", businessKey, deleteVfModuleVolRequest, testVariables);
114 WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
116 String responseBody = response.getResponse();
117 System.out.println("Workflow (Synch) Response:\n" + responseBody);
119 //injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
121 waitForProcessEnd(businessKey, 100000);
122 checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false);
128 * Test fails on vnf adapter call
133 @Ignore // BROKEN TEST
134 @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
135 "subprocess/FalloutHandler.bpmn",
136 "subprocess/CompleteMsoProcess.bpmn",
137 "subprocess/VnfAdapterRestV1.bpmn"})
138 public void TestVnfAdapterCallfail() throws Exception {
142 // DeleteVfModuleVolumeInfraV1_fail();
144 String businessKey = UUID.randomUUID().toString();
145 String deleteVfModuleVolRequest =
146 FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
148 Map<String, Object> testVariables = new HashMap<String, Object>();
149 testVariables.put("requestId", "TEST-REQUEST-ID-0123");
150 testVariables.put("volumeGroupId", "78987");
152 TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
153 "v1", businessKey, deleteVfModuleVolRequest, testVariables);
154 WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
156 String responseBody = response.getResponse();
157 System.out.println("Workflow (Synch) Response:\n" + responseBody);
159 //injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
161 waitForProcessEnd(businessKey, 100000);
162 checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false);