/*- * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ * Copyright (C) 2017 - 2018 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.onap.so.bpmn.common; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; import com.github.tomakehurst.wiremock.WireMockServer; public class MockAAIGenericVnfSearch { private static final String EOL = "\n"; public MockAAIGenericVnfSearch(WireMockServer wireMockServer) { String body; // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule wireMockServer.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"))); wireMockServer.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"))); wireMockServer.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; wireMockServer.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))); wireMockServer.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; wireMockServer.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))); wireMockServer.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 wireMockServer.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"))); wireMockServer.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; wireMockServer.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; wireMockServer.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; wireMockServer.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; wireMockServer.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; wireMockServer.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))); } }