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.onap.so.bpmn.common;
26 import static org.junit.Assert.assertEquals;
27 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById;
29 import java.util.HashMap;
31 import java.util.UUID;
33 import org.junit.Test;
34 import org.onap.so.BaseIntegrationTest;
37 * Please describe the ConfirmVolumeGroupTenantTest.java class
41 public class ConfirmVolumeGroupTenantIT extends BaseIntegrationTest {
44 public void testRemoveLayer3Service_success() throws Exception{
45 MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml");
47 Map<String, Object> variables = new HashMap<>();
48 setVariables(variables);
50 String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
52 String actualNameMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch",processId);
53 String actualIdMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch",processId);
54 String actualResponse = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "volumeHeatStackId",processId);
56 assertEquals("Response", "true", actualNameMatch);
57 assertEquals("Response", "true", actualIdMatch);
58 assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse);
62 public void testRemoveLayer3Service_idsNotMatch() throws Exception{
63 MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
65 Map<String, Object> variables = new HashMap<>();
66 setVariables(variables);
68 String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
71 String actualNameMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch",processId);
72 String actualIdMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch",processId);
73 String actualResponse = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "WorkflowException",processId);
75 assertEquals("Response", "true", actualNameMatch);
76 assertEquals("Response", "false", actualIdMatch);
77 assertEquals("Response", "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant,workStep=*]", actualResponse);
81 private void setVariables(Map<String, Object> variables) {
82 variables.put("isDebugLogEnabled", "true");
83 variables.put("volumeGroupId","a8399879-31b3-4973-be26-0a0cbe776b58");
84 variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
85 variables.put("aicCloudRegion", "MDTWNJ21");
86 variables.put("mso-request-id", UUID.randomUUID().toString());