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.openecomp.mso.bpmn.common;
26 import static org.junit.Assert.assertEquals;
27 import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
28 import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
29 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById;
31 import java.util.HashMap;
34 import org.camunda.bpm.engine.test.Deployment;
35 import org.junit.Test;
36 import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
39 * Please describe the ConfirmVolumeGroupTenantTest.java class
42 public class ConfirmVolumeGroupTenantTest extends WorkflowTest {
45 @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"})
46 public void testRemoveLayer3Service_success() throws Exception{
47 MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml");
49 Map<String, String> variables = new HashMap<String, String>();
50 setVariables(variables);
52 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables);
53 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
55 String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch");
56 String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch");
57 String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "volumeHeatStackId");
59 assertEquals("Response", "true", actualNameMatch);
60 assertEquals("Response", "true", actualIdMatch);
61 assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse);
65 @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"})
66 public void testRemoveLayer3Service_idsNotMatch() throws Exception{
67 MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
69 Map<String, String> variables = new HashMap<String, String>();
70 setVariables(variables);
72 WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables);
73 waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
75 String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch");
76 String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch");
77 String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "WorkflowException");
79 assertEquals("Response", "true", actualNameMatch);
80 assertEquals("Response", "false", actualIdMatch);
81 assertEquals("Response", "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant]", actualResponse);
85 private void setVariables(Map<String, String> variables) {
86 variables.put("isDebugLogEnabled", "true");
87 variables.put("volumeGroupId","a8399879-31b3-4973-be26-0a0cbe776b58");
88 variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
89 variables.put("aicCloudRegion", "MDTWNJ21");