/*-
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
*/
package org.openecomp.mso.bpmn.infrastructure;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.containing;
import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule;
import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Ignore;
import org.junit.Test;
import org.openecomp.mso.bpmn.common.WorkflowTest;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
import org.openecomp.mso.bpmn.core.WorkflowException;
import org.openecomp.mso.bpmn.mock.FileUtil;
import com.github.tomakehurst.wiremock.client.WireMock;
/**
* Unit test for DoDeleteVfModule.bpmn.
*/
public class DeleteVfModuleInfraTest extends WorkflowTest {
private final CallbackSet callbacks = new CallbackSet();
private static final String EOL = "\n";
private final String vnfAdapterDeleteCallback =
"" + EOL +
" a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL +
" true" + EOL +
" {{MESSAGE-ID}}" + EOL +
"" + EOL;
//private final String vnfAdapterDeleteCallback =
// "" + EOL +
// " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL +
// " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL +
// " true" + EOL +
// " {{MESSAGE-ID}}" + EOL +
// " " + EOL +
// " " + EOL +
// " policyKey1_contrail_network_policy_fqdn" + EOL +
// " MSOTest:DefaultPolicyFQDN1" + EOL +
// "" + EOL +
// "" + EOL +
// "policyKey2_contrail_network_policy_fqdn" + EOL +
// "MSOTest:DefaultPolicyFQDN2" + EOL +
// "" + EOL +
// " " + EOL +
// " oam_management_v4_address" + EOL +
// " 1234" + EOL +
// "" + EOL +
// " " + EOL +
// " oam_management_v6_address" + EOL +
// " 1234" + EOL +
// "" + EOL +
// "" + EOL +
// "" + EOL;
private final String vnfAdapterDeleteCallbackFail =
"" + EOL +
" Error processing request to VNF-Async. Not Found." + EOL +
" INTERNAL" + EOL +
" false" + EOL +
" {{MESSAGE-ID}}" + EOL +
"" + EOL;
private final String sdncAdapterDeleteCallback =
"" + EOL;
public DeleteVfModuleInfraTest() throws IOException {
callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
callbacks.put("vnfDelete", FileUtil.readResourceFile(
"__files/DeleteVfModuleCallbackResponse.xml"));
//callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
}
@Test
@Ignore // 1802 merge
@Deployment(resources = {
"process/DeleteVfModuleInfra.bpmn",
"subprocess/DoDeleteVfModule.bpmn",
"subprocess/PrepareUpdateAAIVfModule.bpmn",
"subprocess/UpdateAAIVfModule.bpmn",
"subprocess/UpdateAAIGenericVnf.bpmn",
"subprocess/DeleteAAIVfModule.bpmn",
"subprocess/SDNCAdapterV1.bpmn",
"subprocess/VnfAdapterRestV1.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/FalloutHandler.bpmn"
})
public void TestDeleteVfModuleSuccess() throws Exception {
// delete the Base Module
// vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
String request =
"" + EOL +
" " + EOL +
" a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL +
" DELETE_VF_MODULE" + EOL +
" PORTAL" + EOL +
" " + EOL +
" " + EOL +
" a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL +
" STMTN5MMSC21" + EOL +
" asc_heat-int" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL +
" STMTN5MMSC21-MMSC::module-0-0" + EOL +
" 00000000-0000-0000-0000-000000000000" + EOL +
" SDN-ETHERNET-INTERNET" + EOL +
" fba1bd1e195a404cacb9ce17a9b2b421" + EOL +
" pending-delete" + EOL +
" RDM2WAGPLCP" + EOL +
" " + EOL +
" " + EOL +
"" + EOL;
logStart();
WireMock.reset();
stubFor(post(urlEqualTo("/SDNCAdapter"))
.withRequestBody(containing("SvcAction>changedelete"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
stubFor(post(urlEqualTo("/SDNCAdapter"))
.withRequestBody(containing("SvcAction>delete"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
//mockVNFDelete("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", 202);
MockDoDeleteVfModule_DeleteVNFSuccess();
MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
// MockVNFAdapterRestVfModule();
// MockAAIGenericVnfSearch();
// MockAAIVfModulePUT(false);
// MockAAIDeleteGenericVnf();
// MockAAIDeleteVfModule();
mockUpdateRequestDB(200, "VfModularity/DBUpdateResponse.xml");
stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
.willReturn(aResponse()
.withStatus(200)));
stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
.willReturn(aResponse()
.withStatus(200)));
stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
.willReturn(aResponse()
.withStatus(200)));
stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
.willReturn(aResponse()
.withStatus(500)
.withHeader("Content-Type", "text/xml")
.withBodyFile("aaiFault.xml")));
stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
.willReturn(aResponse()
.withStatus(200)));
stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
.willReturn(aResponse()
.withStatus(200)));
stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
.willReturn(aResponse()
.withStatus(500)
.withHeader("Content-Type", "text/xml")
.withBodyFile("aaiFault.xml")));
stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
.withRequestBody(containing("MMSC"))
.willReturn(aResponse()
.withStatus(200)));
stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
.withRequestBody(containing("PCRF"))
.willReturn(aResponse()
.withStatus(500)
.withHeader("Content-Type", "text/xml")
.withBodyFile("aaiFault.xml")));
stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
.willReturn(aResponse()
.withStatus(200)));
String body;
// The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
.willReturn(aResponse()
.withStatus(500)
.withHeader("Content-Type", "text/xml")
.withBodyFile("aaiFault.xml")));
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
.willReturn(aResponse()
.withStatus(404)
.withHeader("Content-Type", "text/xml")
.withBody("Generic VNF Not Found")));
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
.willReturn(aResponse()
.withStatus(404)
.withHeader("Content-Type", "text/xml")
.withBody("Generic VNF Not Found")));
body =
"" + EOL +
" a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL +
" STMTN5MMSC21" + EOL +
" mmsc-capacity" + EOL +
" SDN-MOBILITY" + EOL +
" vMMSC" + EOL +
" pending-create" + EOL +
" false" + EOL +
" false" + EOL +
" 1508691" + EOL +
" " + EOL +
" " + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL +
" STMTN5MMSC21-MMSC::module-0-0" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL +
" 1.0" + EOL +
" true" + EOL +
" FILLED-IN-BY-MSO" + EOL +
" pending-create" + EOL +
" 1508692" + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
"" + EOL;
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBody(body)));
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBody(body)));
body =
"" + EOL +
" 2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4" + EOL +
" STMTN5MMSC20" + EOL +
" mmsc-capacity" + EOL +
" SDN-MOBILITY" + EOL +
" vMMSC" + EOL +
" pending-create" + EOL +
" false" + EOL +
" false" + EOL +
" 1508691" + EOL +
" " + EOL +
" " + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL +
" STMTN5MMSC20-MMSC::module-0-0" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL +
" 1.0" + EOL +
" true" + EOL +
" FILLED-IN-BY-MSO" + EOL +
" pending-create" + EOL +
" 1508692" + EOL +
" " + EOL +
" " + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL +
" STMTN5MMSC20-MMSC::module-1-0" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL +
" 1.0" + EOL +
" false" + EOL +
" FILLED-IN-BY-MSO" + EOL +
" pending-create" + EOL +
" 1508692" + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
"" + EOL;
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBody(body)));
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBody(body)));
// The following stubs are for DeleteAAIVfModule
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
.willReturn(aResponse()
.withStatus(500)
.withHeader("Content-Type", "text/xml")
.withBodyFile("aaiFault.xml")));
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
.willReturn(aResponse()
.withStatus(404)
.withHeader("Content-Type", "text/xml")
.withBody("Generic VNF Not Found")));
body =
"" + EOL +
" a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL +
" STMTN5MMSC21" + EOL +
" mmsc-capacity" + EOL +
" SDN-MOBILITY" + EOL +
" vMMSC" + EOL +
" pending-create" + EOL +
" false" + EOL +
" false" + EOL +
" 0000021" + EOL +
" " + EOL +
" " + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL +
" STMTN5MMSC21-MMSC::module-0-0" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL +
" 1.0" + EOL +
" true" + EOL +
" FILLED-IN-BY-MSO" + EOL +
" pending-create" + EOL +
" 0000073" + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
"" + EOL;
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBody(body)));
body =
"" + EOL +
" a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL +
" STMTN5MMSC20" + EOL +
" mmsc-capacity" + EOL +
" SDN-MOBILITY" + EOL +
" vMMSC" + EOL +
" pending-create" + EOL +
" false" + EOL +
" false" + EOL +
" 0000020" + EOL +
" " + EOL +
" " + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL +
" STMTN5MMSC20-MMSC::module-0-0" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL +
" 1.0" + EOL +
" true" + EOL +
" FILLED-IN-BY-MSO" + EOL +
" pending-create" + EOL +
" 0000074" + EOL +
" " + EOL +
" " + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL +
" STMTN5MMSC20-MMSC::module-1-0" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL +
" 1.0" + EOL +
" false" + EOL +
" FILLED-IN-BY-MSO" + EOL +
" pending-create" + EOL +
" 0000075" + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
"" + EOL;
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBody(body)));
body =
"" + EOL +
" a27ce5a9-29c4-4c22-a017-6615ac73c719" + EOL +
" STMTN5MMSC19" + EOL +
" mmsc-capacity" + EOL +
" SDN-MOBILITY" + EOL +
" vMMSC" + EOL +
" pending-create" + EOL +
" false" + EOL +
" false" + EOL +
" 0000019" + EOL +
" " + EOL +
" " + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL +
" STMTN5MMSC19-MMSC::module-0-0" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL +
" 1.0" + EOL +
" true" + EOL +
" FILLED-IN-BY-MSO" + EOL +
" pending-create" + EOL +
" 0000076" + EOL +
" " + EOL +
" " + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL +
" STMTN5MMSC19-MMSC::module-1-0" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL +
" 1.0" + EOL +
" false" + EOL +
" FILLED-IN-BY-MSO" + EOL +
" pending-create" + EOL +
" 0000077" + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
"" + EOL;
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBody(body)));
body =
"" + EOL +
" a27ce5a9-29c4-4c22-a017-6615ac73c718" + EOL +
" STMTN5MMSC18" + EOL +
" mmsc-capacity" + EOL +
" SDN-MOBILITY" + EOL +
" vMMSC" + EOL +
" pending-create" + EOL +
" false" + EOL +
" false" + EOL +
" 0000018" + EOL +
" " + EOL +
" " + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL +
" STMTN5MMSC18-MMSC::module-0-0" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL +
" 1.0" + EOL +
" true" + EOL +
" FILLED-IN-BY-MSO" + EOL +
" pending-create" + EOL +
" 0000078" + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
"" + EOL;
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBody(body)));
body =
"" + EOL +
" a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL +
" STMTN5MMSC21" + EOL +
" mmsc-capacity" + EOL +
" SDN-MOBILITY" + EOL +
" vMMSC" + EOL +
" pending-create" + EOL +
" false" + EOL +
" false" + EOL +
" 0000021" + EOL +
" " + EOL +
" " + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL +
" STMTN5MMSC21-MMSC::module-0-0" + EOL +
" 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL +
" 1.0" + EOL +
" true" + EOL +
" FILLED-IN-BY-MSO" + EOL +
" pending-create" + EOL +
" 0000073" + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
" " + EOL +
"" + EOL;
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBody(body)));
String businessKey = UUID.randomUUID().toString();
String deleteVfModuleRequest =
FileUtil.readResourceFile("__files/DeleteVfModule_VID_request.json");
//Map variables = new HashMap<>();
//variables.put("isDebugLogEnabled","true");
// variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
// variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
Map variables = setupVariablesSunnyDayVID();
TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleInfra",
"v1", businessKey, deleteVfModuleRequest, variables);
WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
String responseBody = response.getContent();
System.out.println("Workflow (Synch) Response:\n" + responseBody);
// "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
injectVNFRestCallbacks(callbacks, "vnfDelete");
waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
injectSDNCCallbacks(callbacks, "sdncDelete");
waitForProcessEnd(businessKey, 10000);
WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
checkVariable(businessKey, "DeleteVfModuleInfraSuccessIndicator", true);
checkVariable(businessKey, "WorkflowException", null);
if (wfe != null) {
System.out.println("TestDeleteVfModuleInfraSuccess: ErrorCode=" + wfe.getErrorCode() +
", ErrorMessage=" + wfe.getErrorMessage());
}
logEnd();
}
// Active Scenario
private Map setupVariablesSunnyDayVID() {
Map variables = new HashMap<>();
//try {
// variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
//}
//catch (Exception e) {
//}
//variables.put("mso-request-id", "testRequestId");
variables.put("requestId", "testRequestId");
variables.put("isBaseVfModule", "true");
variables.put("isDebugLogEnabled", "true");
variables.put("recipeTimeout", "0");
variables.put("requestAction", "DELETE_VF_MODULE");
variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
variables.put("volumeGroupId", "");
variables.put("serviceType", "MOG");
variables.put("vfModuleType", "");
return variables;
}
public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
.willReturn(aResponse()
.withStatus(202)
.withHeader("Content-Type", "application/xml")));
stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
.willReturn(aResponse()
.withStatus(202)
.withHeader("Content-Type", "application/xml")));
}
}