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;
28 import java.util.HashMap;
30 import java.util.UUID;
31 import org.junit.Test;
32 import org.onap.so.BaseIntegrationTest;
35 * Please describe the ConfirmVolumeGroupTenantTest.java class
39 public class ConfirmVolumeGroupTenantIT extends BaseIntegrationTest {
42 public void testRemoveLayer3Service_success() throws Exception {
43 MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58",
44 "CRTGVNF_queryAAIResponseVolume.xml");
46 Map<String, Object> variables = new HashMap<>();
47 setVariables(variables);
49 String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
51 String actualNameMatch =
52 BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch", processId);
53 String actualIdMatch =
54 BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch", processId);
55 String actualResponse =
56 BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "volumeHeatStackId", processId);
58 assertEquals("Response", "true", actualNameMatch);
59 assertEquals("Response", "true", actualIdMatch);
60 assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse);
64 public void testRemoveLayer3Service_idsNotMatch() throws Exception {
65 MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58",
66 "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
68 Map<String, Object> variables = new HashMap<>();
69 setVariables(variables);
71 String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
74 String actualNameMatch =
75 BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch", processId);
76 String actualIdMatch =
77 BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch", processId);
78 String actualResponse =
79 BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "WorkflowException", processId);
81 assertEquals("Response", "true", actualNameMatch);
82 assertEquals("Response", "false", actualIdMatch);
83 assertEquals("Response",
84 "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant,workStep=*]",
89 private void setVariables(Map<String, Object> variables) {
90 variables.put("isDebugLogEnabled", "true");
91 variables.put("volumeGroupId", "a8399879-31b3-4973-be26-0a0cbe776b58");
92 variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
93 variables.put("aicCloudRegion", "MDTWNJ21");
94 variables.put("mso-request-id", UUID.randomUUID().toString());