diff options
author | Steve Smokowski <ss835w@att.com> | 2019-04-01 16:49:50 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-01 16:49:50 +0000 |
commit | eaac1814e8341b556b43d54e43165c46c3facc08 (patch) | |
tree | bf398f61977d71762c993c24adca756cf08af705 /bpmn | |
parent | c9296dc7147f22ed636f928f6c38ad099e3ed398 (diff) | |
parent | aaa93d4351b712762d6951a8c82bbe84c2077795 (diff) |
Merge "replace all fixed wiremock ports"
Diffstat (limited to 'bpmn')
95 files changed, 1142 insertions, 1181 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index b115d36a0a..4da7ba5339 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -155,6 +155,9 @@ </configuration> </execution> </executions> + <configuration> + <parallel>suites</parallel> + </configuration> </plugin> </plugins> <pluginManagement> diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index 49acf37078..d17a3c42a6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -167,7 +167,7 @@ class OofHoming extends AbstractServiceTaskProcessor { Response httpResponse = httpClient.post(oofRequest) int responseCode = httpResponse.getStatus() - logDebug("OOF sync response code is: " + responseCode) + logger.debug("OOF sync response code is: " + responseCode) logger.debug( "*** Completed Homing Call OOF ***") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index b68e979b3c..2f46630715 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -518,9 +518,9 @@ class OofUtils { Response response = client.post(request.getBody().toString()) int responseCode = response.getStatus() - logDebug("CatalogDB response code is: " + responseCode) + logger.debug("CatalogDB response code is: " + responseCode) String syncResponse = response.readEntity(String.class) - logDebug("CatalogDB response is: " + syncResponse) + logger.debug("CatalogDB response is: " + syncResponse) if(responseCode != 202){ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index 69d5f02df5..fdd53b2f05 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -399,4 +399,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } } + + public Logger getLogger() { + return logger; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy index f91bf54edc..e56091ad65 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy @@ -294,4 +294,8 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 { exceptionUtil.buildWorkflowException(execution, 5300, msg) } } + + public Logger getLogger() { + return logger; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index aacd385a3b..9215eabc57 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -450,4 +450,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { Node child = getChild(node, name) return child == null ? null : child.text() } + + public Logger getLogger() { + return logger; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn index 7a9a7f8308..e2da44d272 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn @@ -10,8 +10,7 @@ def statusCode = execution.getVariable('SDNCREST_sdncAdapterStatusCode') String response = String.valueOf(execution.getVariable('SDNCREST_sdncAdapterResponse')) def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') def processKey = sdncAdapterRestV1.getProcessKey(execution) -sdncAdapterRestV1.logDebug(processKey + " received response from SDNCAdapter: statusCode=" + statusCode + - " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)</bpmn2:script> +sdncAdapterRestV1.getLogger().debug("{} received response from SDNCAdapter: statusCode= {} response={}", processKey, statusCode, (response.isEmpty() ? "" : "\n" + response))</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_17</bpmn2:incoming> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn index cee6e43f93..a262801005 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV2.bpmn @@ -11,8 +11,7 @@ def statusCode = execution.getVariable('SDNCREST_sdncAdapterStatusCode') String response = String.valueOf(execution.getVariable('SDNCREST_sdncAdapterResponse')) def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') def processKey = sdncAdapterRestV2.getProcessKey(execution) -sdncAdapterRestV2.logDebug(processKey + " received response from SDNCAdapter: statusCode=" + statusCode + - " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)</bpmn2:script> +sdncAdapterRestV2.getLogger().debug("{} received response from SDNCAdapter: statusCode= {} response={}", processKey, statusCode, (response.isEmpty() ? "" : "\n" + response))</bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_17</bpmn2:incoming> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn index cdd710d102..db93df9f09 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn @@ -10,8 +10,7 @@ def statusCode = execution.getVariable('VNFREST_vnfAdapterStatusCode') String response = String.valueOf(execution.getVariable('VNFREST_vnfAdapterResponse')) def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') def processKey = vnfAdapterRestV1.getProcessKey(execution) -vnfAdapterRestV1.logDebug(processKey + " received response from VnfAdapter: statusCode=" + statusCode + - " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)]]></bpmn2:script> +vnfAdapterRestV1.getLogger().debug("{} received response from VnfAdapter: statusCode= {} response={}", processKey, statusCode, (response.isEmpty() ? "" : "\n" + response))]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)"> <bpmn2:incoming>SequenceFlow_17</bpmn2:incoming> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy index 60385a7990..9a778a7380 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy @@ -40,8 +40,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) @Ignore class PrepareUpdateAAIVfModuleTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy index b093aaa491..e3942f0d2e 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1Test.groovy @@ -70,9 +70,6 @@ class SniroHomingV1Test { serviceDecomp.setVnfResources(vnfResourceList) } - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy index 6a4d53654b..12c437fc0a 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy @@ -48,8 +48,6 @@ import static org.mockito.Mockito.* class UpdateAAIGenericVnfTest { String getVfModuleResponse = FileUtil.readResourceFile("__files/VfModularity/GenericVnf.xml") - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy index 72bcfcf359..99b178c044 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy @@ -50,9 +50,6 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { @Spy UpdateAAIVfModule updateAAIVfModule; - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java index 5d6f98c907..0f702fca2d 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java @@ -41,11 +41,11 @@ import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.test.categories.SpringAware; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.http.HttpHeaders; import org.springframework.test.context.ActiveProfiles; @@ -54,7 +54,7 @@ import org.springframework.test.context.junit4.SpringRunner; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.WireMockServer; @RunWith(SpringRunner.class) @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -77,6 +77,9 @@ public abstract class BaseTest extends BuildingBlockTestDataSetup { @Autowired private RepositoryService repositoryService; + + @Autowired + protected WireMockServer wireMockServer; /* * Mocked for injection via autowiring */ @@ -118,7 +121,7 @@ public abstract class BaseTest extends BuildingBlockTestDataSetup { @Before public void baseTestBefore() { - WireMock.reset(); + wireMockServer.resetAll(); variables.put("gBuildingBlockExecution", execution); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java index 819962f16c..052fd5dc94 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java @@ -22,15 +22,16 @@ package org.onap.so.bpmn.common; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import com.github.tomakehurst.wiremock.WireMockServer; + public class MockAAIDeleteGenericVnf { - public MockAAIDeleteGenericVnf(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021")) + public MockAAIDeleteGenericVnf(WireMockServer wireMockServer){ + wireMockServer.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")) + wireMockServer.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") diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java index 9cb10a0494..1cbe0b9244 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java @@ -23,31 +23,32 @@ package org.onap.so.bpmn.common; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; 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.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import com.github.tomakehurst.wiremock.WireMockServer; + public class MockAAIDeleteVfModule { - public MockAAIDeleteVfModule() + public MockAAIDeleteVfModule(WireMockServer wireMockServer) { - stubFor(delete(urlMatching( + wireMockServer.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( + wireMockServer.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( + wireMockServer.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( + wireMockServer.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=.*")) + wireMockServer.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/.*")) + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) .willReturn(aResponse().withStatus(200))); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java index b46d528cc5..1d6337ffc4 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java @@ -22,30 +22,31 @@ 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.stubFor; 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(){ + public MockAAIGenericVnfSearch(WireMockServer wireMockServer){ 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")) + 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"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1")) + 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"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1")) + 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") @@ -78,12 +79,12 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1")) + 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))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) + 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") @@ -126,12 +127,12 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1")) + 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))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1")) + 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") @@ -139,13 +140,13 @@ public class MockAAIGenericVnfSearch { // 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")) + 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"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1")) + 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") @@ -178,7 +179,7 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) + 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") @@ -221,7 +222,7 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1")) + 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") @@ -264,7 +265,7 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1")) + 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") @@ -297,7 +298,7 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1")) + 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") @@ -330,7 +331,7 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + 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")) + 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") diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java index f84a76468f..1be7c652b9 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java @@ -34,8 +34,6 @@ import org.junit.Test; import org.onap.so.BaseTest; import org.springframework.core.ParameterizedTypeReference; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; - import wiremock.org.apache.http.entity.ContentType; @@ -46,7 +44,7 @@ public class BaseClientTest extends BaseTest { BaseClient<String, String> client = new BaseClient<>(); String response = "{\"hello\" : \"world\"}"; client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString()); - stubFor(get(urlEqualTo("/test")) + wireMockServer.stubFor(get(urlEqualTo("/test")) .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString()))); String result = client.get("", new ParameterizedTypeReference<String>() {}); @@ -58,7 +56,7 @@ public class BaseClientTest extends BaseTest { BaseClient<String, Map<String, Object>> client = new BaseClient<>(); String response = "{\"hello\" : \"world\"}"; client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString()); - stubFor(get(urlEqualTo("/test")) + wireMockServer.stubFor(get(urlEqualTo("/test")) .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString()))); Map<String, Object> result = client.get("", new ParameterizedTypeReference<Map<String, Object>>() {}); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnRestClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnRestClientTest.java index 85507afd3f..465ec416b5 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnRestClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/BpmnRestClientTest.java @@ -20,16 +20,19 @@ package org.onap.so.bpmn.common.recipe; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; + import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.junit.Test; import org.onap.so.BaseTest; import org.springframework.beans.factory.annotation.Autowired; -import java.io.IOException; - -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; public class BpmnRestClientTest extends BaseTest{ @@ -38,7 +41,7 @@ public class BpmnRestClientTest extends BaseTest{ @Test public void postTest() throws IOException, Exception{ - stubFor(post(urlPathMatching("/testRecipeUri")) + wireMockServer.stubFor(post(urlPathMatching("/testRecipeUri")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(org.springframework.http.HttpStatus.OK.value()).withBody("{}"))); HttpResponse httpResponse = bpmnRestClient.post( diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java index ddca319708..a074174f6e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java @@ -19,23 +19,17 @@ */ package org.onap.so.bpmn.common.resource; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Rule; import org.junit.Test; -import org.mockito.Mock; import org.onap.so.BaseTest; -import org.onap.so.bpmn.core.UrnPropertiesReader; -import org.springframework.core.env.Environment; - -import static com.github.tomakehurst.wiremock.client.WireMock.*; public class ResourceRequestBuilderTest extends BaseTest { @@ -45,7 +39,7 @@ public class ResourceRequestBuilderTest extends BaseTest { - stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) + wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n" + "\t\t\"modelName\" : \"demoVFWCL\",\n" + @@ -137,7 +131,7 @@ public class ResourceRequestBuilderTest extends BaseTest { @Test public void getResourceInputDefaultValueTest() throws Exception { - stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) + wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n" + "\t\t\"modelName\" : \"demoVFWCL\",\n" + @@ -228,7 +222,7 @@ public class ResourceRequestBuilderTest extends BaseTest { @Test public void getResourceInputValueNoDefaultTest() throws Exception { - stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) + wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n" + "\t\t\"modelName\" : \"demoVFWCL\",\n" + @@ -319,7 +313,7 @@ public class ResourceRequestBuilderTest extends BaseTest { @Test public void getResourceSequenceTest() throws Exception { - stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) + wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n" + "\t\t\"modelName\" : \"demoVFWCL\",\n" + @@ -409,7 +403,7 @@ public class ResourceRequestBuilderTest extends BaseTest { @Test public void getResourceInputWithEmptyServiceResourcesTest() throws Exception { - stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) + wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5")) .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n" + "\t\t\"modelName\" : \"demoVFWCL\",\n" + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java index 79b0d33062..80d8d928aa 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java @@ -20,17 +20,19 @@ package org.onap.so.bpmn.mock; -import static com.github.tomakehurst.wiremock.client.WireMock.*; +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.equalTo; 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.patch; +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 com.github.tomakehurst.wiremock.WireMockServer; + /** * Reusable Mock StubResponses for AAI Endpoints @@ -46,40 +48,40 @@ public class StubResponseAAI { /** * Allotted Resource Mock StubResponses below */ - public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + public static void MockGetAllottedResource(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + public static void MockPutAllottedResource(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) .willReturn(aResponse() .withStatus(200))); } - public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + public static void MockPutAllottedResource_500(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) .willReturn(aResponse() .withStatus(500))); } - public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) { - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion)) + public static void MockDeleteAllottedResource(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) { + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(204))); } - public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { - stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + public static void MockPatchAllottedResource(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { + wireMockServer.stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) .willReturn(aResponse() .withStatus(200))); } - public static void MockQueryAllottedResourceById(String allottedResourceId, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=allotted-resource[&]filter=id:EQUALS:" + allottedResourceId)) + public static void MockQueryAllottedResourceById(WireMockServer wireMockServer, String allottedResourceId, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=allotted-resource[&]filter=id:EQUALS:" + allottedResourceId)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") @@ -90,8 +92,8 @@ public class StubResponseAAI { /** * Service Instance Mock StubResponses below */ - public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId) { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + public static void MockGetServiceInstance(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml"))); @@ -100,127 +102,127 @@ public class StubResponseAAI { /** * Service Instance Mock StubResponses below */ - public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + public static void MockGetServiceInstance(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + public static void MockGetServiceInstance_404(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) .willReturn(aResponse() .withStatus(404))); } - public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + public static void MockGetServiceInstance_500(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) .willReturn(aResponse() .withStatus(500))); } - public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + public static void MockGetServiceInstance_500(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) .willReturn(aResponse() .withStatus(500) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName)) + public static void MockNodeQueryServiceInstanceByName(WireMockServer wireMockServer, String serviceInstanceName, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) + public static void MockNodeQueryServiceInstanceByName_404(WireMockServer wireMockServer, String serviceInstanceName){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) .willReturn(aResponse() .withStatus(404))); } - public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) + public static void MockNodeQueryServiceInstanceByName_500(WireMockServer wireMockServer, String serviceInstanceName){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) .willReturn(aResponse() .withStatus(500))); } - public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId)) + public static void MockNodeQueryServiceInstanceById(WireMockServer wireMockServer, String serviceInstanceId, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) + public static void MockNodeQueryServiceInstanceById_404(WireMockServer wireMockServer, String serviceInstanceId){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) .willReturn(aResponse() .withStatus(404))); } - public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) + public static void MockNodeQueryServiceInstanceById_500(WireMockServer wireMockServer, String serviceInstanceId){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) .willReturn(aResponse() .withStatus(500))); } - public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + public static void MockDeleteServiceInstance(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(204))); } - public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + public static void MockGetServiceInstance(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(statusCode))); } - public static void MockGetServiceInstance(String customer, String serviceSubscription, int statusCode){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription)) + public static void MockGetServiceInstance(WireMockServer wireMockServer, String customer, String serviceSubscription, int statusCode){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml"))); } - public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + public static void MockDeleteServiceInstance(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(statusCode))); } - public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234)) + public static void MockDeleteServiceInstance(WireMockServer wireMockServer, String customer, String serviceSubscription, String resourceVersion, int statusCode){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234)) .willReturn(aResponse() .withStatus(statusCode))); } - public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + public static void MockDeleteServiceInstance_404(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(404))); } - public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + public static void MockDeleteServiceInstance_500(WireMockServer wireMockServer, String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(500))); } - public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + public static void MockPutServiceInstance(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + public static void MockPutServiceInstance_500(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) .willReturn(aResponse() .withStatus(500))); } @@ -228,34 +230,34 @@ public class StubResponseAAI { /** * Service-Subscription Mock StubResponses below */ - public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + public static void MockGetServiceSubscription(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String responseFile) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + public static void MockDeleteServiceSubscription(WireMockServer wireMockServer, String globalCustId, String subscriptionType, int statusCode) { + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) .willReturn(aResponse() .withStatus(statusCode))); } - public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) { - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + public static void MockDeleteServiceInstanceId(WireMockServer wireMockServer, String globalCustId, String subscriptionType, String serviceInstanceId) { + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) .willReturn(aResponse() .withStatus(200))); } - public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + public static void MockPutServiceSubscription(WireMockServer wireMockServer, String globalCustId, String subscriptionType) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) .willReturn(aResponse() .withStatus(200))); } - public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + public static void MockGetServiceSubscription(WireMockServer wireMockServer, String globalCustId, String subscriptionType, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) .willReturn(aResponse() .withStatus(statusCode))); } @@ -263,28 +265,28 @@ public class StubResponseAAI { /** * Customer Mock StubResponses below */ - public static void MockGetCustomer(String globalCustId, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + public static void MockGetCustomer(WireMockServer wireMockServer, String globalCustId, String responseFile) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockDeleteCustomer(String globalCustId) { - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + public static void MockDeleteCustomer(WireMockServer wireMockServer, String globalCustId) { + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) .willReturn(aResponse() .withStatus(200))); } - public static void MockPutCustomer(String globalCustId) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + public static void MockPutCustomer(WireMockServer wireMockServer, String globalCustId) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) .willReturn(aResponse() .withStatus(200))); } - public static void MockPutCustomer_500(String globalCustId) { - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + public static void MockPutCustomer_500(WireMockServer wireMockServer, String globalCustId) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) .willReturn(aResponse() .withStatus(500))); } @@ -294,24 +296,24 @@ public class StubResponseAAI { * Generic-Vnf Mock StubResponses below */ - public static void MockGetGenericVnfById(String vnfId, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")) + public static void MockGetGenericVnfById(WireMockServer wireMockServer, String vnfId, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + public static void MockGetGenericVnfById(WireMockServer wireMockServer, String vnfId, String responseFile, int statusCode){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + public static void MockGetGenericVnfByIdWithPriority(WireMockServer wireMockServer, String vnfId, int statusCode, String responseFile) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) .atPriority(1) .willReturn(aResponse() .withStatus(statusCode) @@ -319,8 +321,8 @@ public class StubResponseAAI { .withBodyFile(responseFile))); } - public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + public static void MockGetGenericVnfByIdWithPriority(WireMockServer wireMockServer, String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .atPriority(priority) .willReturn(aResponse() .withStatus(statusCode) @@ -328,138 +330,138 @@ public class StubResponseAAI { .withBodyFile(responseFile))); } - public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth)) + public static void MockGetGenericVnfByIdWithDepth(WireMockServer wireMockServer, String vnfId, int depth, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetGenericVnfById_404(String vnfId){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + public static void MockGetGenericVnfById_404(WireMockServer wireMockServer, String vnfId){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) .willReturn(aResponse() .withStatus(404))); } - public static void MockGetGenericVnfById_500(String vnfId){ - stubFor(get(urlMatching("/aai/v9/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")) + public static void MockGetGenericVnfById_500(WireMockServer wireMockServer, String vnfId){ + wireMockServer.stubFor(get(urlMatching("/aai/v9/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")) .withQueryParam("depth", equalTo("1")) .willReturn(aResponse() .withStatus(500))); } - public static void MockGetGenericVnfByName(String vnfName, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) + public static void MockGetGenericVnfByName(WireMockServer wireMockServer, String vnfName, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth)) + public static void MockGetGenericVnfByNameWithDepth(WireMockServer wireMockServer, String vnfName, int depth, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetGenericVnfByName_404(String vnfName){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) + public static void MockGetGenericVnfByName_404(WireMockServer wireMockServer, String vnfName){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) .willReturn(aResponse() .withStatus(404))); } - public static void MockDeleteGenericVnf(String vnfId, String resourceVersion){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + public static void MockDeleteGenericVnf(WireMockServer wireMockServer, String vnfId, String resourceVersion){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(204))); } - public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + public static void MockDeleteGenericVnf(WireMockServer wireMockServer, String vnfId, String resourceVersion, int statusCode){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(statusCode))); } - public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + public static void MockDeleteGenericVnf_500(WireMockServer wireMockServer, String vnfId, String resourceVersion){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(500))); } - public static void MockPutGenericVnf(String vnfId){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId){ + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) .willReturn(aResponse() .withStatus(200))); } - public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId, String requestBodyContaining, int statusCode) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) .withRequestBody(containing(requestBodyContaining)) .willReturn(aResponse() .withStatus(statusCode))); } - public static void MockPutGenericVnf(String vnfId, int statusCode) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + public static void MockPutGenericVnf(WireMockServer wireMockServer, String vnfId, int statusCode) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) .willReturn(aResponse() .withStatus(statusCode))); } - public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + public static void MockPutGenericVnf_Bad(WireMockServer wireMockServer, String vnfId, int statusCode){ + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) .willReturn(aResponse() .withStatus(statusCode))); } - public static void MockPatchGenericVnf(String vnfId){ - stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + public static void MockPatchGenericVnf(WireMockServer wireMockServer, String vnfId){ + wireMockServer.stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) .willReturn(aResponse() .withStatus(200))); } /** * Vce Mock StubResponses below */ - public static void MockGetVceById(String vnfId, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) + public static void MockGetVceById(WireMockServer wireMockServer, String vnfId, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetVceByName(String vnfName, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName)) + public static void MockGetVceByName(WireMockServer wireMockServer, String vnfName, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion)) + public static void MockDeleteVce(WireMockServer wireMockServer, String vnfId, String resourceVersion, int statusCode){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(statusCode))); } - public static void MockPutVce(String vnfId){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) + public static void MockPutVce(WireMockServer wireMockServer, String vnfId){ + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) .willReturn(aResponse() .withStatus(200))); } - public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth)) + public static void MockGetGenericVceByNameWithDepth(WireMockServer wireMockServer, String vnfName, int depth, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile){ - stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:" + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth)) + public static void MockGetVceGenericQuery(WireMockServer wireMockServer, String serviceInstanceName, int depth, int statusCode, String responseFile){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:" + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") @@ -469,16 +471,16 @@ public class StubResponseAAI { /** * Tenant Mock StubResponses below */ - public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:" + customer + "&key=service-subscription.service-type:" + serviceType + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1")) + public static void MockGetTenantGenericQuery(WireMockServer wireMockServer, String customer, String serviceType, String responseFile) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:" + customer + "&key=service-subscription.service-type:" + serviceType + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetTenant(String tenantId, String responseFile) { - stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId)) + public static void MockGetTenant(WireMockServer wireMockServer, String tenantId, String responseFile) { + wireMockServer.stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") @@ -488,169 +490,169 @@ public class StubResponseAAI { /** * Network Mock StubResponses below */ - public static void MockGetNetwork(String networkId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) + public static void MockGetNetwork(WireMockServer wireMockServer, String networkId, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth)) + public static void MockGetNetworkByIdWithDepth(WireMockServer wireMockServer, String networkId, String responseFile, String depth) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegion)) + public static void MockGetNetworkCloudRegion(WireMockServer wireMockServer, String responseFile, String cloudRegion) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegion)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkByName(String networkName, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) + public static void MockGetNetworkByName(WireMockServer wireMockServer, String networkName, String responseFile) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkByName_404(String responseFile, String networkName) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) + public static void MockGetNetworkByName_404(WireMockServer wireMockServer, String responseFile, String networkName) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) .willReturn(aResponse() .withStatus(404) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkCloudRegion_404(String cloudRegion) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegion)) + public static void MockGetNetworkCloudRegion_404(WireMockServer wireMockServer, String cloudRegion) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegion)) .willReturn(aResponse() .withStatus(404))); } - public static void MockPutNetwork(String networkId, int statusCode, String responseFile) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) + public static void MockPutNetwork(WireMockServer wireMockServer, String networkId, int statusCode, String responseFile) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId)) + public static void MockPutNetwork(WireMockServer wireMockServer, String networkPolicyId, String responseFile, int statusCode) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName)) + public static void MockGetNetworkName(WireMockServer wireMockServer, String networkPolicyName, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkVpnBinding(String responseFile, String vpnBinding) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/"+vpnBinding + "[?]depth=all")) + public static void MockGetNetworkVpnBinding(WireMockServer wireMockServer, String responseFile, String vpnBinding) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/"+vpnBinding + "[?]depth=all")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkPolicy(String responseFile, String policy) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all")) + public static void MockGetNetworkPolicy(WireMockServer wireMockServer, String responseFile, String policy) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId)) + public static void MockGetNetworkVpnBinding(WireMockServer wireMockServer, String networkBindingId, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy)) + public static void MockGetNetworkPolicy(WireMockServer wireMockServer, String networkPolicy, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkTableReference(String responseFile, String tableReference) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all")) + public static void MockGetNetworkTableReference(WireMockServer wireMockServer, String responseFile, String tableReference) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth )) + public static void MockPutNetworkIdWithDepth(WireMockServer wireMockServer, String responseFile, String networkId, String depth) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth )) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy)) + public static void MockGetNetworkPolicyfqdn(WireMockServer wireMockServer, String networkPolicy, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId)) + public static void MockGetNetworkRouteTable(WireMockServer wireMockServer, String networkRouteId, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockPatchVfModuleId(String vnfId, String vfModuleId) { - stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + public static void MockPatchVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId) { + wireMockServer.stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .willReturn(aResponse() .withStatus(200))); } ///////////// - public static void MockVNFAdapterRestVfModule() { - stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool")) + public static void MockVNFAdapterRestVfModule(WireMockServer wireMockServer) { + wireMockServer.stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool")) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/xml"))); - stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules")) + wireMockServer.stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules")) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/xml"))); - stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules")) + wireMockServer.stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules")) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/xml"))); - stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987")) + wireMockServer.stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987")) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/xml"))); } - public static void MockDBUpdateVfModule(){ - stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + public static void MockDBUpdateVfModule(WireMockServer wireMockServer){ + wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") @@ -658,9 +660,9 @@ public class StubResponseAAI { } // start of mocks used locally and by other VF Module unit tests - public static void MockSDNCAdapterVfModule() { + public static void MockSDNCAdapterVfModule(WireMockServer wireMockServer) { // simplified the implementation to return "success" for all requests - stubFor(post(urlEqualTo("/SDNCAdapter")) + wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter")) // .withRequestBody(containing("SvcInstanceId><")) .willReturn(aResponse() .withStatus(200) @@ -670,79 +672,79 @@ public class StubResponseAAI { } // start of mocks used locally and by other VF Module unit tests - public static void MockAAIVfModule() { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) + public static void MockAAIVfModule(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) .atPriority(1) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/VfModule-supercool.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm")) + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm")) .atPriority(2) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/VfModule-lukewarm.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) .atPriority(5) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/VfModule-new.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1")) + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask[?]depth=1")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/GenericVnf.xml"))); - stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) + wireMockServer.stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) // .withRequestBody(containing("PCRF")) .willReturn(aResponse() .withStatus(200))); - stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) + wireMockServer.stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) // .withRequestBody(containing("PCRF")) .willReturn(aResponse() .withStatus(200))); // HTTP PUT stub still used by CreateAAIvfModuleVolumeGroup - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) .withRequestBody(containing("PCRF")) .willReturn(aResponse() .withStatus(200))); // HTTP PUT stub still used by DoCreateVfModuleTest - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/.*")) .withRequestBody(containing("MODULELABEL")) .willReturn(aResponse() .withStatus(200))); - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987")) + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987")) + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group[?]volume-group-id=78987")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/ConfirmVolumeGroupTenantResponse.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/MDTWNJ21/volume-groups/volume-group/78987")) + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/MDTWNJ21/volume-groups/volume-group/78987")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/VolumeGroup.xml"))); - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/volume-groups/volume-group/78987")) + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/volume-groups/volume-group/78987")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/VolumeGroup.xml"))); - stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020")) + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/78987[?]resource-version=0000020")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("DeleteCinderVolumeV1/DeleteVolumeId_AAIResponse_Success.xml"))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/AddNetworkPolicy_AAIResponse_Success.xml"))); - stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId")) + wireMockServer.stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/NEWvBNGModuleId")) .withRequestBody(containing("NEWvBNGModuleId")) .willReturn(aResponse() .withStatus(200))); @@ -756,8 +758,8 @@ public class StubResponseAAI { * Cloud infrastructure below */ - public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId)) + public static void MockGetCloudRegion(WireMockServer wireMockServer, String cloudRegionId, int statusCode, String responseFile) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") @@ -767,48 +769,48 @@ public class StubResponseAAI { /** * Volume Group StubResponse below */ - public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) { - MockGetVolumeGroupById(cloudRegionId, volumeGroupId, responseFile, 200); + public static void MockGetVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId, String responseFile) { + MockGetVolumeGroupById(wireMockServer, cloudRegionId, volumeGroupId, responseFile, 200); } - public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int responseCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) + public static void MockGetVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId, String responseFile, int responseCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) .willReturn(aResponse() .withStatus(responseCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) { - stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) + public static void MockPutVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) + public static void MockGetVolumeGroupByName(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) { - stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) + public static void MockDeleteVolumeGroupById(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) { + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(statusCode))); } - public static void MockGetVolumeGroupByName_404(String cloudRegionId, String volumeGroupName) { - stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) + public static void MockGetVolumeGroupByName_404(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupName) { + wireMockServer.stubFor(get(urlMatching("/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) .willReturn(aResponse() .withStatus(404))); } - public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) { - stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) + public static void MockDeleteVolumeGroup(WireMockServer wireMockServer, String cloudRegionId, String volumeGroupId, String resourceVersion) { + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(200))); } @@ -817,103 +819,103 @@ public class StubResponseAAI { * VF-Module StubResponse below * @param statusCode TODO */ - public static void MockGetVfModuleId(String vnfId, String vfModuleId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + public static void MockGetVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth)) + public static void MockGetVfModuleByNameWithDepth(WireMockServer wireMockServer, String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetVfModuleByName(String vnfId, String vfModuleName, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName)) + public static void MockGetVfModuleByName(WireMockServer wireMockServer, String vnfId, String vfModuleName, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + public static void MockGetVfModuleIdNoResponse(WireMockServer wireMockServer, String vnfId, String requestContaining, String vfModuleId) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .withRequestBody(containing(requestContaining)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml"))); } - public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId)) + public static void MockPutVfModuleIdNoResponse(WireMockServer wireMockServer, String vnfId, String requestContaining, String vfModuleId) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId)) .withRequestBody(containing(requestContaining)) .willReturn(aResponse() .withStatus(200))); } - public static void MockPutVfModuleId(String vnfId, String vfModuleId) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + public static void MockPutVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .willReturn(aResponse() .withStatus(200))); } - public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) { - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + public static void MockPutVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId, int returnCode) { + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .willReturn(aResponse() .withStatus(returnCode))); } - public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) { - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion)) + public static void MockDeleteVfModuleId(WireMockServer wireMockServer, String vnfId, String vfModuleId, String resourceVersion, int returnCode) { + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(returnCode))); } - public static void MockAAIVfModuleBadPatch(String endpoint, int statusCode) { - stubFor(patch(urlMatching(endpoint)) + public static void MockAAIVfModuleBadPatch(WireMockServer wireMockServer, String endpoint, int statusCode) { + wireMockServer.stubFor(patch(urlMatching(endpoint)) .willReturn(aResponse() .withStatus(statusCode))); } /* AAI Pserver Queries */ - public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) { - stubFor(put(urlMatching("/aai/v1[0-9]/query.*")) + public static void MockGetPserverByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile, int statusCode) { + wireMockServer.stubFor(put(urlMatching("/aai/v1[0-9]/query.*")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/json") .withBodyFile(responseFile))); } - public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) + public static void MockGetGenericVnfsByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/json; charset=utf-8") .withBodyFile(responseFile))); } - public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) { - stubFor(patch(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) + public static void MockSetInMaintFlagByVnfId(WireMockServer wireMockServer, String vnfId, int statusCode) { + wireMockServer.stubFor(patch(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) .willReturn(aResponse() .withStatus(statusCode) )); } - public static void MockSetInMaintFlagByVnfId(String vnfId, String responseFile, int statusCode) { - stubFor(post(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) + public static void MockSetInMaintFlagByVnfId(WireMockServer wireMockServer, String vnfId, String responseFile, int statusCode) { + wireMockServer.stubFor(post(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) .willReturn(aResponse() .withStatus(statusCode) .withBodyFile(responseFile) )); } - public static void MockGetDefaultCloudRegionByCloudRegionId(String cloudRegionId, String responseFile, int statusCode) { - stubFor(get(urlMatching("/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegionId + ".*")) + public static void MockGetDefaultCloudRegionByCloudRegionId(WireMockServer wireMockServer, String cloudRegionId, String responseFile, int statusCode) { + wireMockServer.stubFor(get(urlMatching("/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/"+cloudRegionId + ".*")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/json; charset=utf-8") @@ -922,152 +924,152 @@ public class StubResponseAAI { //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above //// @Deprecated - public static void MockGetVceById(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1")) + public static void MockGetVceById(WireMockServer wireMockServer){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("GenericFlows/getVceResponse.xml"))); } @Deprecated - public static void MockGetVceByName(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123")) + public static void MockGetVceByName(WireMockServer wireMockServer){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("GenericFlows/getVceByNameResponse.xml"))); } @Deprecated - public static void MockPutVce(){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123")) + public static void MockPutVce(WireMockServer wireMockServer){ + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123")) .willReturn(aResponse() .withStatus(200))); } @Deprecated - public static void MockDeleteVce(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) + public static void MockDeleteVce(WireMockServer wireMockServer){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) .willReturn(aResponse() .withStatus(204))); } @Deprecated - public static void MockDeleteVce_404(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) + public static void MockDeleteVce_404(WireMockServer wireMockServer){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) .willReturn(aResponse() .withStatus(404))); } @Deprecated - public static void MockDeleteServiceSubscription(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) + public static void MockDeleteServiceSubscription(WireMockServer wireMockServer){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) .willReturn(aResponse() .withStatus(204))); } @Deprecated - public static void MockGetServiceSubscription(){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) + public static void MockGetServiceSubscription(WireMockServer wireMockServer){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("GenericFlows/getServiceSubscription.xml"))); } @Deprecated - public static void MockGetServiceSubscription_200Empty(){ - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) + public static void MockGetServiceSubscription_200Empty(WireMockServer wireMockServer){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBody(" "))); } @Deprecated - public static void MockGetServiceSubscription_404() { - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) + public static void MockGetServiceSubscription_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) .willReturn(aResponse() .withStatus(404))); } @Deprecated - public static void MockGetGenericVnfById(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + public static void MockGetGenericVnfById(WireMockServer wireMockServer){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml"))); } @Deprecated - public static void MockGetGenericVnfById_404(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + public static void MockGetGenericVnfById_404(WireMockServer wireMockServer){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) .willReturn(aResponse() .withStatus(404))); } @Deprecated - public static void MockGetGenericVnfByName(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + public static void MockGetGenericVnfByName(WireMockServer wireMockServer){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))); } @Deprecated - public static void MockGetGenericVnfByName_hasRelationships(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + public static void MockGetGenericVnfByName_hasRelationships(WireMockServer wireMockServer){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); } @Deprecated - public static void MockGetGenericVnfById_hasRelationships(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + public static void MockGetGenericVnfById_hasRelationships(WireMockServer wireMockServer){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); } @Deprecated - public static void MockGetGenericVnfById_500(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + public static void MockGetGenericVnfById_500(WireMockServer wireMockServer){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) .willReturn(aResponse() .withStatus(500))); } @Deprecated - public static void MockGetGenericVnfByName_404(){ - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + public static void MockGetGenericVnfByName_404(WireMockServer wireMockServer){ + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) .willReturn(aResponse() .withStatus(404))); } @Deprecated - public static void MockPutGenericVnf(){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + public static void MockPutGenericVnf(WireMockServer wireMockServer){ + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) .willReturn(aResponse() .withStatus(200))); } @Deprecated - public static void MockPutGenericVnf_400(){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + public static void MockPutGenericVnf_400(WireMockServer wireMockServer){ + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) .willReturn(aResponse() .withStatus(400))); } @Deprecated - public static void MockDeleteGenericVnf(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + public static void MockDeleteGenericVnf(WireMockServer wireMockServer){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) .willReturn(aResponse() .withStatus(204))); } @Deprecated - public static void MockDeleteGenericVnf_404(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + public static void MockDeleteGenericVnf_404(WireMockServer wireMockServer){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) .willReturn(aResponse() .withStatus(404))); } @Deprecated - public static void MockDeleteGenericVnf_500(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + public static void MockDeleteGenericVnf_500(WireMockServer wireMockServer){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) .willReturn(aResponse() .withStatus(500))); } @Deprecated - public static void MockDeleteGenericVnf_412(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123")) + public static void MockDeleteGenericVnf_412(WireMockServer wireMockServer){ + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123")) .willReturn(aResponse() .withStatus(412))); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAPPC.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAPPC.java index 58e7dcdaad..2f2cf45814 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAPPC.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAPPC.java @@ -21,16 +21,12 @@ package org.onap.so.bpmn.mock; 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.patch; 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 com.github.tomakehurst.wiremock.WireMockServer; + /** * Reusable Mock StubResponses for Policy * @@ -42,14 +38,14 @@ public class StubResponseAPPC { } // start of Policy mocks - public static void MockAppcError() { - stubFor(get(urlMatching("/events/.*")) + public static void MockAppcError(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlMatching("/events/.*")) // .withRequestBody(containing("APPC")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile("APPC/appc_error.json"))); - stubFor(put(urlMatching("/events/.*")) + wireMockServer.stubFor(put(urlMatching("/events/.*")) // .withRequestBody(containing("APPC")) .willReturn(aResponse() .withStatus(200) diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java index 6227b05d07..8fd745d765 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseDatabase.java @@ -21,11 +21,12 @@ package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import com.github.tomakehurst.wiremock.WireMockServer; + /** * Stub response class for Database stubs * including database adapter, catalog db, @@ -37,54 +38,54 @@ public class StubResponseDatabase { } - public static void MockUpdateRequestDB(String fileName){ - stubFor(post(urlEqualTo("/services/RequestsDbAdapter")) + public static void MockUpdateRequestDB(WireMockServer wireMockServer, String fileName){ + wireMockServer.stubFor(post(urlEqualTo("/services/RequestsDbAdapter")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(fileName))); } - public static void mockUpdateRequestDB(int statusCode, String reponseFile) { - stubFor(post(urlEqualTo("/services/RequestsDbAdapter")) + public static void mockUpdateRequestDB(WireMockServer wireMockServer, int statusCode, String reponseFile) { + wireMockServer.stubFor(post(urlEqualTo("/services/RequestsDbAdapter")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(reponseFile))); } - public static void MockGetAllottedResourcesByModelInvariantId(String modelInvariantId, String responseFile){ - stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId)) + public static void MockGetAllottedResourcesByModelInvariantId(WireMockServer wireMockServer, String modelInvariantId, String responseFile){ + wireMockServer.stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile(responseFile))); } - public static void MockGetAllottedResourcesByModelInvariantId_500(String modelInvariantId, String responseFile){ - stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId)) + public static void MockGetAllottedResourcesByModelInvariantId_500(WireMockServer wireMockServer, String modelInvariantId, String responseFile){ + wireMockServer.stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId)) .willReturn(aResponse() .withStatus(500))); } - public static void MockGetVnfCatalogDataCustomizationUuid(String vnfModelCustomizationUuid, String responseFile){ - stubFor(get(urlEqualTo("/v2/serviceVnfs?vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)) + public static void MockGetVnfCatalogDataCustomizationUuid(WireMockServer wireMockServer, String vnfModelCustomizationUuid, String responseFile){ + wireMockServer.stubFor(get(urlEqualTo("/v2/serviceVnfs?vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile(responseFile))); } - public static void MockGetVfModuleByModelNameCatalogData(String vfModuleModelName, String responseFile){ - stubFor(get(urlEqualTo("/v2/vfModules?vfModuleModelName=" + vfModuleModelName)) + public static void MockGetVfModuleByModelNameCatalogData(WireMockServer wireMockServer, String vfModuleModelName, String responseFile){ + wireMockServer.stubFor(get(urlEqualTo("/v2/vfModules?vfModuleModelName=" + vfModuleModelName)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile(responseFile))); } - public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String serviceModelVersion, String responseFile){ - stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelInvariantUuid=" + + public static void MockGetServiceResourcesCatalogData(WireMockServer wireMockServer, String serviceModelInvariantUuid, String serviceModelVersion, String responseFile){ + wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid + "&serviceModelVersion=" + serviceModelVersion)) .willReturn(aResponse() @@ -93,24 +94,24 @@ public class StubResponseDatabase { .withBodyFile(responseFile))); } - public static void MockGetServiceResourcesCatalogData(String serviceModelInvariantUuid, String responseFile){ - stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid)) + public static void MockGetServiceResourcesCatalogData(WireMockServer wireMockServer, String serviceModelInvariantUuid, String responseFile){ + wireMockServer.stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelInvariantUuid=" + serviceModelInvariantUuid)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile(responseFile))); } - public static void MockGetServiceResourcesCatalogDataByModelUuid(String serviceModelUuid, String responseFile){ - stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=" + serviceModelUuid)) + public static void MockGetServiceResourcesCatalogDataByModelUuid(WireMockServer wireMockServer, String serviceModelUuid, String responseFile){ + wireMockServer.stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=" + serviceModelUuid)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile(responseFile))); } - public static void MockPostRequestDB(){ - stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + public static void MockPostRequestDB(WireMockServer wireMockServer){ + wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml"))); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.java index d88509cb57..3e1567412a 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseNetworkAdapter.java @@ -22,12 +22,13 @@ package org.onap.so.bpmn.mock; 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.post; import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import com.github.tomakehurst.wiremock.WireMockServer; + /** * Please describe the StubResponseNetwork.java class * @@ -41,28 +42,28 @@ public class StubResponseNetworkAdapter { } - public static void MockNetworkAdapter() { - stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + public static void MockNetworkAdapter(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter")) .willReturn(aResponse() .withStatus(200))); } - public static void MockNetworkAdapter(String response) { - stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + public static void MockNetworkAdapter(WireMockServer wireMockServer, String response) { + wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(response))); } - public static void MockNetworkAdapter_500() { - stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + public static void MockNetworkAdapter_500(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter")) .willReturn(aResponse() .withStatus(500))); } - public static void MockNetworkAdapterPost(String responseFile, String requestContaining) { - stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + public static void MockNetworkAdapterPost(WireMockServer wireMockServer, String responseFile, String requestContaining) { + wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter")) .withRequestBody(containing(requestContaining)) .willReturn(aResponse() .withStatus(200) @@ -70,16 +71,16 @@ public class StubResponseNetworkAdapter { .withBodyFile(responseFile))); } - public static void MockNetworkAdapter(String networkId, int statusCode, String responseFile) { - stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId)) + public static void MockNetworkAdapter(WireMockServer wireMockServer, String networkId, int statusCode, String responseFile) { + wireMockServer.stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml") .withBodyFile(responseFile))); } - public static void MockNetworkAdapterContainingRequest(String requestContaining, int statusCode, String responseFile) { - stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + public static void MockNetworkAdapterContainingRequest(WireMockServer wireMockServer, String requestContaining, int statusCode, String responseFile) { + wireMockServer.stubFor(post(urlEqualTo("/networks/NetworkAdapter")) .withRequestBody(containing(requestContaining)) .willReturn(aResponse() .withStatus(statusCode) @@ -87,8 +88,8 @@ public class StubResponseNetworkAdapter { .withBodyFile(responseFile))); } - public static void MockPutNetworkAdapter(String networkId, String requestContaining, int statusCode, String responseFile) { - stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId)) + public static void MockPutNetworkAdapter(WireMockServer wireMockServer, String networkId, String requestContaining, int statusCode, String responseFile) { + wireMockServer.stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId)) .withRequestBody(containing(requestContaining)) .willReturn(aResponse() .withStatus(statusCode) @@ -96,16 +97,16 @@ public class StubResponseNetworkAdapter { .withBodyFile(responseFile))); } - public static void MockNetworkAdapterRestRollbackDelete(String responseFile, String networkId) { - stubFor(delete(urlEqualTo("/networks/NetworkAdapter/"+networkId+"/rollback")) + public static void MockNetworkAdapterRestRollbackDelete(WireMockServer wireMockServer, String responseFile, String networkId) { + wireMockServer.stubFor(delete(urlEqualTo("/networks/NetworkAdapter/"+networkId+"/rollback")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void MockNetworkAdapterRestPut(String responseFile, String networkId) { - stubFor(put(urlEqualTo("/networks/NetworkAdapter/"+networkId)) + public static void MockNetworkAdapterRestPut(WireMockServer wireMockServer, String responseFile, String networkId) { + wireMockServer.stubFor(put(urlEqualTo("/networks/NetworkAdapter/"+networkId)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java index 335fd94f5b..fe6c6a1396 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseOof.java @@ -22,9 +22,10 @@ package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import com.github.tomakehurst.wiremock.WireMockServer; + /** * StubResponseOof.java class */ @@ -34,30 +35,30 @@ public class StubResponseOof { } - public static void mockOof() { - stubFor(post(urlEqualTo("/api/oof/v1/placement")) + public static void mockOof(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/json"))); } - public static void mockOof(String responseFile) { - stubFor(post(urlEqualTo("/api/oof/v1/placement")) + public static void mockOof(WireMockServer wireMockServer, String responseFile) { + wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/json") .withBodyFile(responseFile))); } - public static void mockOof_400() { - stubFor(post(urlEqualTo("/api/oof/v1/placement")) + public static void mockOof_400(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")) .willReturn(aResponse() .withStatus(400) .withHeader("Content-Type", "application/json"))); } - public static void mockOof_500() { - stubFor(post(urlEqualTo("/api/oof/v1/placement")) + public static void mockOof_500(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")) .willReturn(aResponse() .withStatus(500) .withHeader("Content-Type", "application/json"))); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java index 809616dff0..a6c7fa57f0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponsePolicy.java @@ -22,14 +22,10 @@ package org.onap.so.bpmn.mock; 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.patch; -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 com.github.tomakehurst.wiremock.WireMockServer; /** * Reusable Mock StubResponses for Policy @@ -42,36 +38,36 @@ public class StubResponsePolicy { } // start of Policy mocks - public static void MockPolicyAbort() { - stubFor(post(urlEqualTo("/pdp/api/getDecision")) + public static void MockPolicyAbort(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")) .withRequestBody(containing("BB1")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile("policyAbortResponse.json"))); - stubFor(post(urlEqualTo("/pdp/api/getDecision")) + wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")) .withRequestBody(containing("UPDVnfI")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile("policyAbortResponse.json"))); - stubFor(post(urlEqualTo("/pdp/api/getDecision")) + wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")) .withRequestBody(containing("RPLVnfI")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile("policyAbortResponse.json"))); - stubFor(post(urlEqualTo("/pdp/api/getDecision")) + wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")) .withRequestBody(containing("VnfIPU")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile("policyAbortResponse.json"))); - stubFor(post(urlEqualTo("/pdp/api/getDecision")) + wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")) .withRequestBody(containing("VnfCU")) .willReturn(aResponse() .withStatus(200) @@ -82,36 +78,36 @@ public class StubResponsePolicy { } - public static void MockPolicySkip() { - stubFor(post(urlEqualTo("/pdp/api/getDecision")) + public static void MockPolicySkip(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")) .withRequestBody(containing("BB1")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile("Policy/policySkipResponse.json"))); - stubFor(post(urlEqualTo("/pdp/api/getDecision")) + wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")) .withRequestBody(containing("UPDVnfI")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile("Policy/policySkipResponse.json"))); - stubFor(post(urlEqualTo("/pdp/api/getDecision")) + wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")) .withRequestBody(containing("RPLVnfI")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile("Policy/policySkipResponse.json"))); - stubFor(post(urlEqualTo("/pdp/api/getDecision")) + wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")) .withRequestBody(containing("VnfIPU")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBodyFile("Policy/policySkipResponse.json"))); - stubFor(post(urlEqualTo("/pdp/api/getDecision")) + wireMockServer.stubFor(post(urlEqualTo("/pdp/api/getDecision")) .withRequestBody(containing("VnfCU")) .willReturn(aResponse() .withStatus(200) diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java index 66dc1f9910..10557ce091 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java @@ -23,10 +23,11 @@ package org.onap.so.bpmn.mock; 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.post; -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 com.github.tomakehurst.wiremock.WireMockServer; + /** * Please describe the StubResponseSDNC.java class */ @@ -36,43 +37,43 @@ public class StubResponseSDNCAdapter { } - public static void mockSDNCAdapter_500() { - stubFor(post(urlEqualTo("/SDNCAdapter")) + public static void mockSDNCAdapter_500(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter")) .willReturn(aResponse() .withStatus(500))); } - public static void mockSDNCAdapter_500(String requestContaining) { - stubFor(post(urlEqualTo("/SDNCAdapter")) + public static void mockSDNCAdapter_500(WireMockServer wireMockServer, String requestContaining) { + wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter")) .withRequestBody(containing(requestContaining)) .willReturn(aResponse() .withStatus(500))); } - public static void mockSDNCAdapter(int statusCode) { - stubFor(post(urlMatching(".*/SDNCAdapter")) + public static void mockSDNCAdapter(WireMockServer wireMockServer, int statusCode) { + wireMockServer.stubFor(post(urlMatching(".*/SDNCAdapter")) .willReturn(aResponse() .withStatus(statusCode))); } - public static void mockSDNCAdapter(String endpoint, int statusCode, String responseFile) { - stubFor(post(urlEqualTo(endpoint)) + public static void mockSDNCAdapter(WireMockServer wireMockServer, String endpoint, int statusCode, String responseFile) { + wireMockServer.stubFor(post(urlEqualTo(endpoint)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void mockSDNCAdapter(String responseFile) { - stubFor(post(urlEqualTo("/SDNCAdapter")) + public static void mockSDNCAdapter(WireMockServer wireMockServer, String responseFile) { + wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void mockSDNCAdapter(String endpoint, String requestContaining, int statusCode, String responseFile) { - stubFor(post(urlEqualTo(endpoint)) + public static void mockSDNCAdapter(WireMockServer wireMockServer, String endpoint, String requestContaining, int statusCode, String responseFile) { + wireMockServer.stubFor(post(urlEqualTo(endpoint)) .withRequestBody(containing(requestContaining)) .willReturn(aResponse() .withStatus(statusCode) @@ -80,30 +81,30 @@ public class StubResponseSDNCAdapter { .withBodyFile(responseFile))); } - public static void mockSDNCAdapterRest() { - stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + public static void mockSDNCAdapterRest(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/json"))); } - public static void mockSDNCAdapterRest_500() { - stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + public static void mockSDNCAdapterRest_500(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) .willReturn(aResponse() .withStatus(500) .withHeader("Content-Type", "application/json"))); } - public static void mockSDNCAdapterRest(String requestContaining) { - stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + public static void mockSDNCAdapterRest(WireMockServer wireMockServer, String requestContaining) { + wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) .withRequestBody(containing(requestContaining)) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/json"))); } - public static void mockSDNCAdapterRest_500(String requestContaining) { - stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + public static void mockSDNCAdapterRest_500(WireMockServer wireMockServer, String requestContaining) { + wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) .withRequestBody(containing(requestContaining)) .willReturn(aResponse() .withStatus(500) diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java index 22d3191821..f040a0973c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSNIRO.java @@ -22,9 +22,10 @@ package org.onap.so.bpmn.mock; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import com.github.tomakehurst.wiremock.WireMockServer; + /** * Please describe the StubResponseSNIRO.java class * @@ -35,30 +36,30 @@ public class StubResponseSNIRO { } - public static void mockSNIRO() { - stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + public static void mockSNIRO(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement")) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/json"))); } - public static void mockSNIRO(String responseFile) { - stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + public static void mockSNIRO(WireMockServer wireMockServer, String responseFile) { + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement")) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/json") .withBodyFile(responseFile))); } - public static void mockSNIRO_400() { - stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + public static void mockSNIRO_400(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement")) .willReturn(aResponse() .withStatus(400) .withHeader("Content-Type", "application/json"))); } - public static void mockSNIRO_500() { - stubFor(post(urlEqualTo("/sniro/api/v2/placement")) + public static void mockSNIRO_500(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/v2/placement")) .willReturn(aResponse() .withStatus(500) .withHeader("Content-Type", "application/json"))); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java index 75283515af..e90d358ba8 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java @@ -21,161 +21,161 @@ package org.onap.so.bpmn.mock; 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.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 com.github.tomakehurst.wiremock.WireMockServer; + /** * Please describe the StubResponseVNF.java class */ public class StubResponseVNFAdapter { - public static void mockVNFAdapter() { - stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + public static void mockVNFAdapter(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) .willReturn(aResponse() .withStatus(200))); } - public static void mockVNFAdapter(String responseFile) { - stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + public static void mockVNFAdapter(WireMockServer wireMockServer, String responseFile) { + wireMockServer.stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - public static void mockVNFAdapter_500() { - stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + public static void mockVNFAdapter_500(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) .willReturn(aResponse() .withStatus(500))); } - public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) { - stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) + public static void mockVNFPost(WireMockServer wireMockServer, String vfModuleId, int statusCode, String vnfId) { + wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); } - public static void mockVNFPut(String vfModuleId, int statusCode) { - stubFor(put(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId)) + public static void mockVNFPut(WireMockServer wireMockServer, String vfModuleId, int statusCode) { + wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(put(urlEqualTo("/services/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId)) + wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); } - public static void mockVNFPut(String vnfId, String vfModuleId, int statusCode) { - stubFor(put(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) + public static void mockVNFPut(WireMockServer wireMockServer, String vnfId, String vfModuleId, int statusCode) { + wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(put(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + wireMockServer.stubFor(put(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); } - public static void mockVNFDelete(String vnfId, String vfModuleId, int statusCode) { - stubFor(delete(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) + public static void mockVNFDelete(WireMockServer wireMockServer, String vnfId, String vfModuleId, int statusCode) { + wireMockServer.stubFor(delete(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + wireMockServer.stubFor(delete(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); } - public static void mockVNFRollbackDelete(String vfModuleId, int statusCode) { - stubFor(delete(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId + "/rollback")) + public static void mockVNFRollbackDelete(WireMockServer wireMockServer, String vfModuleId, int statusCode) { + wireMockServer.stubFor(delete(urlEqualTo("/services/rest/v1/vnfsvnfId/vf-modules" + vfModuleId + "/rollback")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlEqualTo("/services/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback")) + wireMockServer.stubFor(delete(urlEqualTo("/services/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); } - public static void mockPutVNFVolumeGroup(String volumeGroupId, int statusCode) { - stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/" + volumeGroupId)) + public static void mockPutVNFVolumeGroup(WireMockServer wireMockServer, String volumeGroupId, int statusCode) { + wireMockServer.stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/" + volumeGroupId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(put(urlEqualTo("/vnfs/rest/v1/volume-groups/" + volumeGroupId)) + wireMockServer.stubFor(put(urlEqualTo("/vnfs/rest/v1/volume-groups/" + volumeGroupId)) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); } - public static void mockPutVNFVolumeGroupRollback(String volumeGroupId, int statusCode) { - stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId + "/rollback")) + public static void mockPutVNFVolumeGroupRollback(WireMockServer wireMockServer, String volumeGroupId, int statusCode) { + wireMockServer.stubFor(delete(urlMatching("/vnfs/v1/volume-groups/" + volumeGroupId + "/rollback")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/" + volumeGroupId + "/rollback")) + wireMockServer.stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/" + volumeGroupId + "/rollback")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); } - public static void mockPostVNFVolumeGroup(int statusCode) { - stubFor(post(urlEqualTo("/vnfs/v1/volume-groups")) + public static void mockPostVNFVolumeGroup(WireMockServer wireMockServer, int statusCode) { + wireMockServer.stubFor(post(urlEqualTo("/vnfs/v1/volume-groups")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(post(urlEqualTo("/vnfs/rest/v1/volume-groups")) + wireMockServer.stubFor(post(urlEqualTo("/vnfs/rest/v1/volume-groups")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); } - public static void mockVNFAdapterRest(String vnfId) { - stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules")) + public static void mockVNFAdapterRest(WireMockServer wireMockServer, String vnfId) { + wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules")) .willReturn(aResponse() .withStatus(200))); - stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules")) + wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules")) .willReturn(aResponse() .withStatus(200))); } - public static void mockVNFAdapterRest_500(String vnfId) { - stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules")) + public static void mockVNFAdapterRest_500(WireMockServer wireMockServer, String vnfId) { + wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules")) .willReturn(aResponse() .withStatus(500))); - stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules")) + wireMockServer.stubFor(post(urlEqualTo("/services/rest/v1/vnfs/" + vnfId + "/vf-modules")) .willReturn(aResponse() .withStatus(500))); } - public static void mockVfModuleDelete(String volumeGroupId) { - stubFor(delete(urlMatching("/vnfs/v1/volume-groups/"+ volumeGroupId)) + public static void mockVfModuleDelete(WireMockServer wireMockServer, String volumeGroupId) { + wireMockServer.stubFor(delete(urlMatching("/vnfs/v1/volume-groups/"+ volumeGroupId)) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/"+ volumeGroupId)) + wireMockServer.stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/"+ volumeGroupId)) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/xml"))); } - public static void mockVfModuleDelete(String volumeGroupId, int statusCode) { - stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987")) + public static void mockVfModuleDelete(WireMockServer wireMockServer, String volumeGroupId, int statusCode) { + wireMockServer.stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); - stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/78987")) + wireMockServer.stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/78987")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java index b5511f67e3..fc21ff905d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java @@ -32,6 +32,7 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; +import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.WireMock; @RunWith(SpringRunner.class) @@ -46,9 +47,12 @@ public abstract class BaseIntegrationTest extends WorkflowTest { @Value("${wiremock.server.port}") protected String wiremockPort; + @Autowired + protected WireMockServer wireMockServer; + @After public void baseAfterTest() { - WireMock.reset(); + wireMockServer.resetAll(); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java index 470cc2220d..f528205d17 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java @@ -38,7 +38,7 @@ import org.onap.so.BaseIntegrationTest; public class CompleteMsoProcessIT extends BaseIntegrationTest { private void executeFlow(String inputRequestFile) throws InterruptedException { - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); variables.put("CompleteMsoProcessRequest",inputRequestFile); variables.put("mso-request-id", UUID.randomUUID().toString()); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java index 0ef856bb9d..cc3ca941e4 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java @@ -46,7 +46,7 @@ public class ConfirmVolumeGroupNameIT extends BaseIntegrationTest { @Test public void sunnyDay() throws Exception { logStart(); - MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); + MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); @@ -72,7 +72,7 @@ public class ConfirmVolumeGroupNameIT extends BaseIntegrationTest { logStart(); // does not exist would return a 404 from AAI - MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST", "aai-volume-group-id-info.xml", 404); + MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST", "aai-volume-group-id-info.xml", 404); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); @@ -98,7 +98,7 @@ public class ConfirmVolumeGroupNameIT extends BaseIntegrationTest { public void rainyDayNameDoesNotMatch() throws Exception { logStart(); - MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml", 200); + MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml", 200); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java index af9ab7d3e4..fd1f7c1a2b 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java @@ -42,7 +42,7 @@ public class ConfirmVolumeGroupTenantIT extends BaseIntegrationTest { @Test public void testRemoveLayer3Service_success() throws Exception{ - MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml"); + MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml"); Map<String, Object> variables = new HashMap<>(); setVariables(variables); @@ -60,7 +60,7 @@ public class ConfirmVolumeGroupTenantIT extends BaseIntegrationTest { @Test public void testRemoveLayer3Service_idsNotMatch() throws Exception{ - MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml"); + MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml"); Map<String, Object> variables = new HashMap<>(); setVariables(variables); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java index f6284f3535..f6cd74a55b 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java @@ -25,10 +25,8 @@ package org.onap.so.bpmn.common; 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.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; - import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -40,6 +38,8 @@ import org.onap.so.bpmn.core.WorkflowException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.github.tomakehurst.wiremock.WireMockServer; + /** * Unit test for CreateAAIVfModule.bpmn. */ @@ -51,9 +51,9 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { @Test public void TestCreateGenericVnfSuccess_200() { - new MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); + new MockAAIGenericVnfSearch(wireMockServer); + MockAAICreateGenericVnf(wireMockServer); + MockAAIVfModulePUT(wireMockServer, true); Map<String, Object> variables = new HashMap<>(); variables.put("mso-request-id", UUID.randomUUID().toString()); @@ -76,9 +76,9 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { @Test public void TestCreateVfModuleSuccess_200() { // create Add-on VF Module for existing Generic VNF - new MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); + new MockAAIGenericVnfSearch(wireMockServer); + MockAAICreateGenericVnf(wireMockServer); + MockAAIVfModulePUT(wireMockServer, true); Map<String, Object> variables = new HashMap<>(); variables.put("mso-request-id", UUID.randomUUID().toString()); variables.put("isDebugLogEnabled","true"); @@ -98,9 +98,9 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { @Test public void TestQueryGenericVnfFailure_5000() { - new MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); + new MockAAIGenericVnfSearch(wireMockServer); + MockAAICreateGenericVnf(wireMockServer); + MockAAIVfModulePUT(wireMockServer, true); Map<String, Object> variables = new HashMap<>(); variables.put("mso-request-id", UUID.randomUUID().toString()); @@ -121,9 +121,9 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { @Test public void TestCreateDupGenericVnfFailure_1002() { - new MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); + new MockAAIGenericVnfSearch(wireMockServer); + MockAAICreateGenericVnf(wireMockServer); + MockAAIVfModulePUT(wireMockServer, true); Map<String, Object> variables = new HashMap<>(); variables.put("mso-request-id", UUID.randomUUID().toString()); @@ -144,9 +144,9 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { @Test public void TestCreateDupVfModuleFailure_1002() { - new MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); + new MockAAIGenericVnfSearch(wireMockServer); + MockAAICreateGenericVnf(wireMockServer); + MockAAIVfModulePUT(wireMockServer, true); Map<String, Object> variables = new HashMap<>(); variables.put("mso-request-id", UUID.randomUUID().toString()); @@ -167,9 +167,9 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { @Test public void TestCreateGenericVnfFailure_5000() { - new MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); + new MockAAIGenericVnfSearch(wireMockServer); + MockAAICreateGenericVnf(wireMockServer); + MockAAIVfModulePUT(wireMockServer, true); Map<String, Object> variables = new HashMap<>(); variables.put("mso-request-id", UUID.randomUUID().toString()); @@ -190,9 +190,9 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { @Test public void TestCreateGenericVnfFailure_1002() { - new MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); + new MockAAIGenericVnfSearch(wireMockServer); + MockAAICreateGenericVnf(wireMockServer); + MockAAIVfModulePUT(wireMockServer, true); Map<String, Object> variables = new HashMap<>(); variables.put("mso-request-id", UUID.randomUUID().toString()); @@ -213,9 +213,9 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { @Test public void TestCreateVfModuleFailure_5000() { - new MockAAIGenericVnfSearch(); - MockAAICreateGenericVnf(); - MockAAIVfModulePUT(true); + new MockAAIGenericVnfSearch(wireMockServer); + MockAAICreateGenericVnf(wireMockServer); + MockAAIVfModulePUT(wireMockServer, true); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); @@ -234,12 +234,12 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { logger.debug(exception.getErrorMessage()); } - public static void MockAAICreateGenericVnf(){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + public static void MockAAICreateGenericVnf(WireMockServer wireMockServer){ + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) .withRequestBody(containing("<service-id>00000000-0000-0000-0000-000000000000</service-id>")) .willReturn(aResponse() .withStatus(201))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) .withRequestBody(containing("<service-id>99999999-9999-9999-9999-999999999999</service-id>")) .willReturn(aResponse() .withStatus(500) @@ -248,18 +248,18 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { } // start of mocks used locally and by other VF Module unit tests - public static void MockAAIVfModulePUT(boolean isCreate){ - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) + public static void MockAAIVfModulePUT(WireMockServer wireMockServer, boolean isCreate){ + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) .withRequestBody(containing("MMSC")) .willReturn(aResponse() .withStatus(isCreate ? 201 : 200))); - stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) + wireMockServer.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")) + wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721")) .willReturn(aResponse() .withStatus(200))); } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java index f72ca79dc6..39a7e0c74b 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java @@ -56,8 +56,8 @@ public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { logStart(); String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); - MockGetGenericVnfByIdWithPriority("skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2); - MockPutVfModuleIdNoResponse("skask", "PCRF", "lukewarm"); + MockGetGenericVnfByIdWithPriority(wireMockServer, "skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2); + MockPutVfModuleIdNoResponse(wireMockServer, "skask", "PCRF", "lukewarm"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -85,7 +85,7 @@ public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { logStart(); String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); - MockGetVfModuleId("skask", ".*", "VfModularity/VfModule-supercool.xml", 404); + MockGetVfModuleId(wireMockServer, "skask", ".*", "VfModularity/VfModule-supercool.xml", 404); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -112,8 +112,8 @@ public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { logStart(); String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); - MockGetVfModuleId("skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200); - MockPutVfModuleId("skask", "lukewarm", 404); + MockGetVfModuleId(wireMockServer, "skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200); + MockPutVfModuleId(wireMockServer, "skask", "lukewarm", 404); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java index 7acaf449e3..3d15a4b29b 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java @@ -46,7 +46,7 @@ public class DecomposeServiceIT extends BaseIntegrationTest { @Test public void testDecomposeService_success() throws Exception{ - MockGetServiceResourcesCatalogData("cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataWithConfig.json"); + MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataWithConfig.json"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -62,7 +62,7 @@ public class DecomposeServiceIT extends BaseIntegrationTest { //@Test @Test public void testDecomposeService_success_partial() throws Exception{ - MockGetServiceResourcesCatalogData("cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataNoNetwork.json"); + MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataNoNetwork.json"); String businessKey = UUID.randomUUID().toString(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java index f98e4477aa..99e4b8cbde 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java @@ -20,18 +20,10 @@ package org.onap.so.bpmn.common; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -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.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; - import java.util.HashMap; import java.util.Map; import java.util.UUID; -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.test.Deployment; import org.junit.Assert; import org.junit.Test; import org.onap.so.BaseIntegrationTest; @@ -52,9 +44,9 @@ public class DeleteAAIVfModuleIT extends BaseIntegrationTest { public void TestDeleteGenericVnfSuccess_200() { // delete the Base Module and Generic Vnf // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 - new MockAAIGenericVnfSearch(); - new MockAAIDeleteGenericVnf(); - new MockAAIDeleteVfModule(); + new MockAAIGenericVnfSearch(wireMockServer); + new MockAAIDeleteGenericVnf(wireMockServer); + new MockAAIDeleteVfModule(wireMockServer); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); @@ -86,9 +78,9 @@ public class DeleteAAIVfModuleIT extends BaseIntegrationTest { " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>" + EOL; - new MockAAIGenericVnfSearch(); - new MockAAIDeleteGenericVnf(); - new MockAAIDeleteVfModule(); + new MockAAIGenericVnfSearch(wireMockServer); + new MockAAIDeleteGenericVnf(wireMockServer); + new MockAAIDeleteVfModule(wireMockServer); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); @@ -119,9 +111,9 @@ public class DeleteAAIVfModuleIT extends BaseIntegrationTest { " </vnf-inputs>" + EOL + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>" + EOL; - new MockAAIGenericVnfSearch(); - new MockAAIDeleteGenericVnf(); - new MockAAIDeleteVfModule(); + new MockAAIGenericVnfSearch(wireMockServer); + new MockAAIDeleteGenericVnf(wireMockServer); + new MockAAIDeleteVfModule(wireMockServer); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); @@ -152,9 +144,9 @@ public class DeleteAAIVfModuleIT extends BaseIntegrationTest { " </vnf-inputs>" + EOL + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>" + EOL; - new MockAAIGenericVnfSearch(); - new MockAAIDeleteGenericVnf(); - new MockAAIDeleteVfModule(); + new MockAAIGenericVnfSearch(wireMockServer); + new MockAAIDeleteGenericVnf(wireMockServer); + new MockAAIDeleteVfModule(wireMockServer); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); @@ -185,9 +177,9 @@ public class DeleteAAIVfModuleIT extends BaseIntegrationTest { " </vnf-inputs>" + EOL + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>" + EOL; - new MockAAIGenericVnfSearch(); - new MockAAIDeleteGenericVnf(); - new MockAAIDeleteVfModule(); + new MockAAIGenericVnfSearch(wireMockServer); + new MockAAIDeleteGenericVnf(wireMockServer); + new MockAAIDeleteVfModule(wireMockServer); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); @@ -218,9 +210,9 @@ public class DeleteAAIVfModuleIT extends BaseIntegrationTest { " </vnf-inputs>" + EOL + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>" + EOL; - new MockAAIGenericVnfSearch(); - new MockAAIDeleteGenericVnf(); - new MockAAIDeleteVfModule(); + new MockAAIGenericVnfSearch(wireMockServer); + new MockAAIDeleteGenericVnf(wireMockServer); + new MockAAIDeleteVfModule(wireMockServer); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); @@ -251,9 +243,9 @@ public class DeleteAAIVfModuleIT extends BaseIntegrationTest { " </vnf-inputs>" + EOL + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>" + EOL; - new MockAAIGenericVnfSearch(); - new MockAAIDeleteGenericVnf(); - new MockAAIDeleteVfModule(); + new MockAAIGenericVnfSearch(wireMockServer); + new MockAAIDeleteGenericVnf(wireMockServer); + new MockAAIDeleteVfModule(wireMockServer); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); @@ -270,9 +262,9 @@ public class DeleteAAIVfModuleIT extends BaseIntegrationTest { public void TestDeleteVfModuleFailure_1002_2() { // failure attempting to delete a Vf Module that does not exist (A&AI returns 404) // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76 - new MockAAIGenericVnfSearch(); - new MockAAIDeleteGenericVnf(); - new MockAAIDeleteVfModule(); + new MockAAIGenericVnfSearch(wireMockServer); + new MockAAIDeleteGenericVnf(wireMockServer); + new MockAAIDeleteVfModule(wireMockServer); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java index f477926f99..88f8e5deb7 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java @@ -24,7 +24,6 @@ package org.onap.so.bpmn.common; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish; @@ -48,12 +47,12 @@ public class FalloutHandlerIT extends BaseIntegrationTest { private void setupMocks() { - stubFor(post(urlEqualTo("/dbadapters/AttRequestsDbAdapter")) + wireMockServer.stubFor(post(urlEqualTo("/dbadapters/AttRequestsDbAdapter")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBody("<DbTag>Notified</DbTag>"))); - stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java index fa8823a5b4..7299e0602e 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java @@ -61,7 +61,7 @@ public class GenerateVfModuleNameIT extends BaseIntegrationTest { " <vnf-params xmlns:tns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>" + EOL; - MockGetGenericVnfById(".*", "GenericFlows/getGenericVnfByNameResponse.xml"); + MockGetGenericVnfById(wireMockServer, ".*", "GenericFlows/getGenericVnfByNameResponse.xml"); RuntimeService runtimeService = processEngine.getRuntimeService(); Map<String, Object> variables = new HashMap<String, Object>(); variables.put("isDebugLogEnabled","true"); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java index 67ae7de928..53d29c51bf 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java @@ -46,7 +46,7 @@ public class ManualHandlingIT extends BaseIntegrationTest { @Test public void TestManualHandlingSuccess() { - MockPostRequestDB(); + MockPostRequestDB(wireMockServer); Map<String, Object> variables = new HashMap<>(); variables.put("isDebugLogEnabled","true"); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java index 819962f16c..052fd5dc94 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java @@ -22,15 +22,16 @@ package org.onap.so.bpmn.common; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import com.github.tomakehurst.wiremock.WireMockServer; + public class MockAAIDeleteGenericVnf { - public MockAAIDeleteGenericVnf(){ - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021")) + public MockAAIDeleteGenericVnf(WireMockServer wireMockServer){ + wireMockServer.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")) + wireMockServer.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") diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java index 9cb10a0494..1cbe0b9244 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java @@ -23,31 +23,32 @@ package org.onap.so.bpmn.common; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; 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.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import com.github.tomakehurst.wiremock.WireMockServer; + public class MockAAIDeleteVfModule { - public MockAAIDeleteVfModule() + public MockAAIDeleteVfModule(WireMockServer wireMockServer) { - stubFor(delete(urlMatching( + wireMockServer.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( + wireMockServer.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( + wireMockServer.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( + wireMockServer.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=.*")) + wireMockServer.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/.*")) + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) .willReturn(aResponse().withStatus(200))); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java index b46d528cc5..1d6337ffc4 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java @@ -22,30 +22,31 @@ 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.stubFor; 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(){ + public MockAAIGenericVnfSearch(WireMockServer wireMockServer){ 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")) + 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"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1")) + 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"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1")) + 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") @@ -78,12 +79,12 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1")) + 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))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) + 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") @@ -126,12 +127,12 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1")) + 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))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1")) + 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") @@ -139,13 +140,13 @@ public class MockAAIGenericVnfSearch { // 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")) + 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"))); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1")) + 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") @@ -178,7 +179,7 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) + 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") @@ -221,7 +222,7 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1")) + 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") @@ -264,7 +265,7 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1")) + 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") @@ -297,7 +298,7 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL; - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1")) + 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") @@ -330,7 +331,7 @@ public class MockAAIGenericVnfSearch { " <l-interfaces/>" + EOL + " <lag-interfaces/>" + EOL + "</generic-vnf>" + 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")) + 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") diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java index 0c88b58b72..4d7a127a85 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java @@ -271,7 +271,7 @@ public class OofHomingIT extends BaseIntegrationTest { @Test public void testHoming_success_2AR1Vnf() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -323,7 +323,7 @@ public class OofHomingIT extends BaseIntegrationTest { @Test public void testHoming_success_2AR1Vnf2Net() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -398,7 +398,7 @@ public class OofHomingIT extends BaseIntegrationTest { public void testHoming_success_vnfResourceList() throws Exception { // Create a Service Decomposition - MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", + MockGetServiceResourcesCatalogDataByModelUuid(wireMockServer, "2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/oofCatalogResp.json"); String busKey = UUID.randomUUID().toString(); Map<String, Object> vars = new HashMap<>(); @@ -413,7 +413,7 @@ public class OofHomingIT extends BaseIntegrationTest { // Invoke Homing - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -479,7 +479,7 @@ public class OofHomingIT extends BaseIntegrationTest { @Test public void testHoming_success_existingLicense() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<String, Object>(); @@ -549,7 +549,7 @@ public class OofHomingIT extends BaseIntegrationTest { @Test public void testHoming_error_badResponse() throws Exception { - mockOof_500(); + mockOof_500(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -568,7 +568,7 @@ public class OofHomingIT extends BaseIntegrationTest { @Test public void testHoming_error_oofNoSolution() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -590,7 +590,7 @@ public class OofHomingIT extends BaseIntegrationTest { @Test public void testHoming_error_oofPolicyException() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -613,7 +613,7 @@ public class OofHomingIT extends BaseIntegrationTest { @Test public void testHoming_error_oofServiceException() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java index b370e6c48f..390f5294aa 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java @@ -279,7 +279,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { public void testHoming_success_2AR1Vnf() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -332,7 +332,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { public void testHoming_success_2AR1Vnf2Net() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -409,7 +409,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { public void testHoming_success_vnfResourceList() throws Exception { // Create a Service Decomposition - MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", + MockGetServiceResourcesCatalogDataByModelUuid(wireMockServer, "2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/oofCatalogResp.json"); String busKey = UUID.randomUUID().toString(); Map<String, Object> vars = new HashMap<>(); @@ -425,7 +425,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { // Invoke Homing - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -489,7 +489,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { @Test public void testHoming_success_existingLicense() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<String, Object>(); @@ -560,7 +560,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { @Test public void testHoming_error_badResponse() throws Exception { - mockOof_500(); + mockOof_500(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -581,7 +581,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { @Test public void testHoming_error_oofNoSolution() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -604,7 +604,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { @Test public void testHoming_error_oofPolicyException() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -628,7 +628,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { @Test public void testHoming_error_oofServiceException() throws Exception { - mockOof(); + mockOof(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java index 8b8abab6b2..c994173cd7 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java @@ -61,9 +61,9 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200); - MockPatchVfModuleId("skask", "supercool"); + MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200); + MockPatchVfModuleId(wireMockServer, "skask", "supercool"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -95,7 +95,7 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { logStart(); String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); - MockGetGenericVnfById_404("skask[?]depth=1"); + MockGetGenericVnfById_404(wireMockServer, "skask[?]depth=1"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -128,7 +128,7 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "lukewarm"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -156,7 +156,7 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "notsocool"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -184,8 +184,8 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404); + MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml"); + MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java index 7b85edf49a..2f6d2ae85b 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java @@ -52,7 +52,7 @@ public class RainyDayHandlerIT extends BaseIntegrationTest { variables.put("errorText", "update failed"); variables.put("vnfName", "vSAMP1"); - MockPolicyAbort(); + MockPolicyAbort(wireMockServer); String businessKey = UUID.randomUUID().toString(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java index 12e12dc7d6..bf3fefdf9c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java @@ -24,7 +24,6 @@ package org.onap.so.bpmn.common; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import java.io.IOException; @@ -115,7 +114,7 @@ public class SDNCAdapterRestV2IT extends BaseIntegrationTest { * Defines WireMock stubs needed by these tests. */ private void mocks() { - stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc")) + wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc")) .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/json"))); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java index 2205d01cca..c7ba702212 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java @@ -140,7 +140,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { public void testHoming_success_2AR1Vnf() throws Exception { - mockSNIRO(); + mockSNIRO(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -184,7 +184,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { public void testHoming_success_2AR1Vnf2Net() throws Exception { - mockSNIRO(); + mockSNIRO(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -239,7 +239,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { public void testHoming_success_vnfResourceList() throws Exception { // Create a Service Decomposition - MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/catalogResp.json"); + MockGetServiceResourcesCatalogDataByModelUuid(wireMockServer, "2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/catalogResp.json"); String busKey = UUID.randomUUID().toString(); Map<String, Object> vars = new HashMap<>(); setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff"); @@ -251,7 +251,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { // Invoke Homing - mockSNIRO(); + mockSNIRO(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -290,7 +290,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { public void testHoming_success_existingLicense() throws Exception { - mockSNIRO(); + mockSNIRO(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<String, Object>(); @@ -351,7 +351,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { @Test public void testHoming_error_badResponse() throws Exception { - mockSNIRO_500(); + mockSNIRO_500(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -371,7 +371,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { // 1802 merge public void testHoming_error_sniroNoSolution() throws Exception { - mockSNIRO(); + mockSNIRO(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -392,7 +392,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { @Test public void testHoming_error_sniroPolicyException() throws Exception { - mockSNIRO(); + mockSNIRO(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -413,7 +413,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { @Test public void testHoming_error_sniroServiceException() throws Exception { - mockSNIRO(); + mockSNIRO(wireMockServer); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java index 48790708f0..5015a1351a 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java @@ -62,9 +62,9 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { logStart(); String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutGenericVnf("/skask", 200); - MockPatchGenericVnf("skask"); + MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf(wireMockServer, "/skask", 200); + MockPatchGenericVnf(wireMockServer, "skask"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -95,7 +95,7 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -123,7 +123,7 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); - MockGetGenericVnfById_404("skask[?]depth=1"); + MockGetGenericVnfById_404(wireMockServer, "skask[?]depth=1"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -153,9 +153,9 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); - MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutGenericVnf_Bad("skask", 404); - MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404); + MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf_Bad(wireMockServer, "skask", 404); + MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java index 2ba5c7286e..0a3931a12f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java @@ -61,9 +61,9 @@ public class UpdateAAIVfModuleIT extends BaseIntegrationTest { logStart(); String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); - MockGetGenericVnfByIdWithPriority("/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml"); - MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200); - MockPatchVfModuleId("skask", "supercool"); + MockGetGenericVnfByIdWithPriority(wireMockServer, "/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml"); + MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200); + MockPatchVfModuleId(wireMockServer, "skask", "supercool"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -92,7 +92,7 @@ public class UpdateAAIVfModuleIT extends BaseIntegrationTest { logStart(); String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); - MockGetGenericVnfById("/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404); + MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -121,9 +121,9 @@ public class UpdateAAIVfModuleIT extends BaseIntegrationTest { logStart(); String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); - MockGetGenericVnfById_404("/skask/vf-modules/vf-module/supercool"); - MockGetGenericVnfById("/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200); - MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404); + MockGetGenericVnfById_404(wireMockServer, "/skask/vf-modules/vf-module/supercool"); + MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200); + MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java index 1ef864b543..c0482a52ca 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java @@ -247,7 +247,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { public void testCreateVfModuleSuccess() throws Exception { logStart(); - mockVNFPost("", 202, "vnfId"); + mockVNFPost(wireMockServer, "", 202, "vnfId"); String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; String messageId = requestId + "-" + System.currentTimeMillis(); @@ -276,7 +276,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { public void testUpdateVfModuleSuccess() throws Exception { logStart(); - mockVNFPut("/vfModuleId", 202); + mockVNFPut(wireMockServer, "/vfModuleId", 202); String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; String messageId = requestId + "-" + System.currentTimeMillis(); @@ -305,7 +305,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { public void testDeleteVfModuleSuccess() throws Exception { logStart(); - mockVNFDelete("vnfId", "/vfModuleId", 202); + mockVNFDelete(wireMockServer, "vnfId", "/vfModuleId", 202); String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; String messageId = requestId + "-" + System.currentTimeMillis(); @@ -334,7 +334,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { public void testRollbackVfModuleSuccess() throws Exception { logStart(); - mockVNFRollbackDelete("/vfModuleId", 202); + mockVNFRollbackDelete(wireMockServer, "/vfModuleId", 202); String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; String messageId = requestId + "-" + System.currentTimeMillis(); @@ -363,7 +363,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { public void testCreateVfModuleException() throws Exception { logStart(); - mockVNFPost("", 202, "vnfId"); + mockVNFPost(wireMockServer, "", 202, "vnfId"); String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; String messageId = requestId + "-" + System.currentTimeMillis(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java index 610930665c..aa65474acc 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java @@ -24,7 +24,6 @@ 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.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.urlMatching; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -101,43 +100,43 @@ public class CreateVcpeResCustServiceIT extends AbstractTestBase { @Test public void testCreateVcpeResCustService_Success() throws Exception { System.out.println("starting: testCreateVcpeResCustService_Success\n"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2","VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); - StubResponseOof.mockOof(); + MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2","VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + StubResponseOof.mockOof(wireMockServer); // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockGetGenericVnfByIdWithDepth(".*", 1, "VCPE/CreateVcpeResCustService/GenericVnf.xml"); - - MockPutGenericVnf(".*"); - MockPatchGenericVnf(".*"); - - MockGetGenericVnfByIdWithPriority(".*", ".*", 200, "VfModularity/VfModule-new.xml", 5); - // MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); - MockPutVfModuleIdNoResponse(".*", "PCRF", ".*"); - MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200); - - MockGetNetworkPolicyfqdn(".*","CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml",200); - MockNodeQueryServiceInstanceByName_404(".*"); - - mockVNFPost("", 202, ".*"); - - stubFor(post(urlMatching("/services/rest/v1/vnfs" + ".*" + "/vf-modules" )).willReturn(aResponse().withStatus(202))); - stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); - stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); - stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); - stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); - MockPostRequestDB(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - mockSDNCAdapter(200); + MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockGetGenericVnfByIdWithDepth(wireMockServer, ".*", 1, "VCPE/CreateVcpeResCustService/GenericVnf.xml"); + + MockPutGenericVnf(wireMockServer, ".*"); + MockPatchGenericVnf(wireMockServer, ".*"); + + MockGetGenericVnfByIdWithPriority(wireMockServer, ".*", ".*", 200, "VfModularity/VfModule-new.xml", 5); + // MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml"); + MockPutVfModuleIdNoResponse(wireMockServer, ".*", "PCRF", ".*"); + MockPutNetwork(wireMockServer, ".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200); + + MockGetNetworkPolicyfqdn(wireMockServer, ".*","CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml",200); + MockNodeQueryServiceInstanceByName_404(wireMockServer, ".*"); + + mockVNFPost(wireMockServer, "", 202, ".*"); + + wireMockServer.stubFor(post(urlMatching("/services/rest/v1/vnfs" + ".*" + "/vf-modules" )).willReturn(aResponse().withStatus(202))); + wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); + wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); + wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); + wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); + MockPostRequestDB(wireMockServer); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); + mockSDNCAdapter(wireMockServer, 200); Map<String, Object> variables = setupVariables(); @@ -195,33 +194,33 @@ public class CreateVcpeResCustServiceIT extends AbstractTestBase { @Test public void testCreateVcpeResCustService_NoParts() throws Exception { System.out.println("starting: testCreateVcpeResCustService_NoParts\n" ); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); + MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); + MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); // TODO: should these really be PARENT_INST, or should they be INST? - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - StubResponseOof.mockOof(); - stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); - stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); - stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); - stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); - MockPostRequestDB(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); + + StubResponseOof.mockOof(wireMockServer); + wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); + wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); + wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); + wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); + MockPostRequestDB(wireMockServer); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = setupVariables(); @@ -253,30 +252,30 @@ public class CreateVcpeResCustServiceIT extends AbstractTestBase { @Test public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception { System.out.println("starting: testCreateVcpeResCustService_Fault_NoRollback\n"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance_500(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - - mockSDNCAdapter(404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - StubResponseOof.mockOof(); - stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); - stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); - stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); - stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); - MockPostRequestDB(); + MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance_500(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + + mockSDNCAdapter(wireMockServer, 404); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); + + StubResponseOof.mockOof(wireMockServer); + wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); + wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); + wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); + wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); + MockPostRequestDB(wireMockServer); Map<String, Object> variables = setupVariables(); @@ -305,33 +304,33 @@ public class CreateVcpeResCustServiceIT extends AbstractTestBase { @Test public void testCreateVcpeResCustService_Fault_Rollback() throws Exception { System.out.println("starting: testCreateVcpeResCustService_Fault_Rollback\n"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); - MockGetAllottedResource(CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockDeleteAllottedResource(CUST, SVC, PARENT_INST, ARID, ARVERS); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - StubResponseOof.mockOof(); - stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); - stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); - stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); - stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); - MockPostRequestDB(); + MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID, ARVERS); + + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); + + StubResponseOof.mockOof(wireMockServer); + wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404))); + wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200))); + wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200))); + wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200))); + MockPostRequestDB(wireMockServer); String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestRollback.json"); Map<String, Object> variables = setupVariables(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java index ca81d99832..aaabf59e6b 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java @@ -20,22 +20,9 @@ package org.onap.so.bpmn.vcpe; -import com.github.tomakehurst.wiremock.stubbing.Scenario; -import org.junit.Before; -import org.junit.Test; -import org.onap.so.bpmn.common.BPMNUtil; -import org.onap.so.bpmn.mock.FileUtil; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; 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.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -51,6 +38,19 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceByI import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.common.BPMNUtil; +import org.onap.so.bpmn.mock.FileUtil; + +import com.github.tomakehurst.wiremock.stubbing.Scenario; + public class DeleteVcpeResCustServiceIT extends AbstractTestBase { private static final String PROCNAME = "DeleteVcpeResCustService"; @@ -77,7 +77,7 @@ public class DeleteVcpeResCustServiceIT extends AbstractTestBase { @Test public void testDeleteVcpeResCustService_Success() throws Exception { logStart(); - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml"); // TODO: use INST instead of DEC_INST /* @@ -85,15 +85,15 @@ public class DeleteVcpeResCustServiceIT extends AbstractTestBase { * fail to URL-encode the SI id before performing the query so we'll * add a stub for that case, too. */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml"); /* - * cannot use MockGetServiceInstance(), because we need to return + * cannot use MockGetServiceInstance(wireMockServer, ), because we need to return * different responses as we traverse through the flow */ // initially, the SI includes the ARs - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) .inScenario("SI retrieval") .whenScenarioStateIs(Scenario.STARTED) .willReturn(aResponse() @@ -103,7 +103,7 @@ public class DeleteVcpeResCustServiceIT extends AbstractTestBase { .willSetStateTo("ARs Deleted")); // once the ARs have been deleted, the SI should be empty - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) .inScenario("SI retrieval") .whenScenarioStateIs("ARs Deleted") .willReturn(aResponse() @@ -112,34 +112,34 @@ public class DeleteVcpeResCustServiceIT extends AbstractTestBase { .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"))); // for BRG - MockQueryAllottedResourceById(AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, AR_BRG_ID); - MockDeleteAllottedResource(CUST, SVC, INST, AR_BRG_ID, ARVERS); + MockQueryAllottedResourceById(wireMockServer, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID, ARVERS); // for TXC - MockQueryAllottedResourceById(AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, AR_TXC_ID); - MockDeleteAllottedResource(CUST, SVC, INST, AR_TXC_ID, ARVERS); + MockQueryAllottedResourceById(wireMockServer, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID, ARVERS); //MockGetGenericVnfById("vnfX.*", "GenericFlows/getGenericVnfByNameResponse.xml"); - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml"))); - stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) .willReturn(aResponse() .withStatus(204) .withHeader("Content-Type", "text/xml"))); - MockDeleteServiceInstance(CUST,SVC,INST,SVC); + MockDeleteServiceInstance(wireMockServer, CUST,SVC,INST,SVC); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = setupVariables(businessKey); @@ -193,7 +193,7 @@ public class DeleteVcpeResCustServiceIT extends AbstractTestBase { @Test public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception { logStart(); - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml"); // TODO: use INST instead of DEC_INST /* @@ -201,12 +201,12 @@ public class DeleteVcpeResCustServiceIT extends AbstractTestBase { * fail to URL-encode the SI id before performing the query so we'll * add a stub for that case, too. */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = setupVariables(businessKey); @@ -242,7 +242,7 @@ public class DeleteVcpeResCustServiceIT extends AbstractTestBase { @Test public void testDeleteVcpeResCustService_Fault() throws Exception { logStart(); - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml"); // TODO: use INST instead of DEC_INST /* @@ -250,14 +250,14 @@ public class DeleteVcpeResCustServiceIT extends AbstractTestBase { * fail to URL-encode the SI id before performing the query so we'll * add a stub for that case, too. */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); // generate failure - mockSDNCAdapter(404); + mockSDNCAdapter(wireMockServer, 404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = setupVariables(businessKey); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java index 2b1b5a3bd0..da9b45c8c8 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java @@ -60,15 +60,15 @@ public class DoCreateAllottedResourceBRGIT extends AbstractTestBase { * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables,"testRequestId123"); @@ -99,15 +99,15 @@ public class DoCreateAllottedResourceBRGIT extends AbstractTestBase { * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables,"testRequestId124"); @@ -133,16 +133,16 @@ public class DoCreateAllottedResourceBRGIT extends AbstractTestBase { * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables,"testRequestId125"); @@ -174,15 +174,15 @@ public class DoCreateAllottedResourceBRGIT extends AbstractTestBase { * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables,"testRequestId126"); @@ -208,15 +208,15 @@ public class DoCreateAllottedResourceBRGIT extends AbstractTestBase { * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(wireMockServer, 404); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables,"testRequestId127"); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java index a19dec1f98..f0d275c5cc 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java @@ -56,11 +56,11 @@ public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -86,11 +86,11 @@ public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -115,9 +115,9 @@ public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -142,11 +142,11 @@ public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -173,11 +173,11 @@ public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -204,11 +204,11 @@ public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -238,12 +238,12 @@ public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); - mockSDNCAdapter(404); + mockSDNCAdapter(wireMockServer, 404); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -265,11 +265,11 @@ public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java index 473661c860..6ecec3240d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java @@ -65,15 +65,15 @@ public class DoCreateAllottedResourceTXCIT extends AbstractTestBase { * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables, "testRequestId123"); @@ -108,15 +108,15 @@ public class DoCreateAllottedResourceTXCIT extends AbstractTestBase { * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables, "testRequestId123"); @@ -142,16 +142,16 @@ public class DoCreateAllottedResourceTXCIT extends AbstractTestBase { * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables, "testRequestId123"); @@ -184,16 +184,16 @@ public class DoCreateAllottedResourceTXCIT extends AbstractTestBase { * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables, "testRequestId123"); @@ -219,15 +219,15 @@ public class DoCreateAllottedResourceTXCIT extends AbstractTestBase { * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(wireMockServer, 404); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables, "testRequestId123"); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java index 8b47174b3b..4f81a4f725 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java @@ -56,11 +56,11 @@ public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -86,11 +86,11 @@ public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -115,9 +115,9 @@ public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -142,11 +142,11 @@ public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -173,11 +173,11 @@ public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -204,11 +204,11 @@ public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -238,12 +238,12 @@ public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); - mockSDNCAdapter(404); + mockSDNCAdapter(wireMockServer, 404); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -265,11 +265,11 @@ public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase { @Test public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception { logStart(); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java index 4edaf7d21f..42f32b8ecc 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java @@ -50,12 +50,12 @@ public class DoDeleteAllottedResourceBRGIT extends AbstractTestBase { @Test public void testDoDeleteAllottedResourceBRG_Success() { logStart(); - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -79,12 +79,12 @@ public class DoDeleteAllottedResourceBRGIT extends AbstractTestBase { @Test public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() { logStart(); - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); @@ -109,13 +109,13 @@ public class DoDeleteAllottedResourceBRGIT extends AbstractTestBase { @Test public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception { logStart(); - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); - mockSDNCAdapter(500); + mockSDNCAdapter(wireMockServer, 500); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java index 520beaf07b..13ca58be03 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java @@ -50,12 +50,12 @@ public class DoDeleteAllottedResourceTXCIT extends AbstractTestBase { @Test public void testDoDeleteAllottedResourceTXC_Success() throws Exception { logStart(); - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables); @@ -78,12 +78,12 @@ public class DoDeleteAllottedResourceTXCIT extends AbstractTestBase { @Test public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception { logStart(); - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(wireMockServer, 200); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables); @@ -104,13 +104,13 @@ public class DoDeleteAllottedResourceTXCIT extends AbstractTestBase { @Test public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception { logStart(); - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); + MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID); + MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml"); - mockSDNCAdapter(500); + mockSDNCAdapter(wireMockServer, 500); Map<String, Object> variables = new HashMap<>(); setVariablesSuccess(variables); diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml index 0971a9d54e..09706746af 100644 --- a/bpmn/so-bpmn-building-blocks/pom.xml +++ b/bpmn/so-bpmn-building-blocks/pom.xml @@ -36,6 +36,9 @@ </configuration> </execution> </executions> + <configuration> + <parallel>suites</parallel> + </configuration> </plugin> </plugins> diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index 9ba278a119..e3ba0284dc 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -138,6 +138,9 @@ </configuration> </execution> </executions> + <configuration> + <parallel>suites</parallel> + </configuration> </plugin> </plugins> </pluginManagement> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy index ae40e9d7c6..101db4f021 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy @@ -41,9 +41,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) class CreateCustomE2EServiceInstanceTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - @Before public void init() throws IOException { MockitoAnnotations.initMocks(this); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy index 77220da94f..c5fd377a72 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy @@ -44,9 +44,6 @@ class CreateVfModuleInfraTest { def prefix = "CVFMI_" def requestInfo = "<requestInfo><request-id>12345</request-id></requestInfo>" - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy index 5ee10bc931..9214b386eb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy @@ -55,10 +55,7 @@ import org.apache.commons.lang3.* @RunWith(MockitoJUnitRunner.class) class DoCreateNetworkInstanceRollbackTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - - def utils = new MsoUtils() + def utils = new MsoUtils() String Prefix="CRENWKIR_" diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy index b246caf40e..90c7b71a07 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy @@ -41,9 +41,6 @@ class DoCreateServiceInstanceTest extends MsoGroovyTest{ def prefix = "DCRESI_" @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - - @Rule public ExpectedException thrown = ExpectedException.none() @Before diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy index fc5960b92f..dd18049b5f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy @@ -62,9 +62,6 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ @Spy DoCreateVfModuleRollback doCreateVfModuleRollback - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy index 30e3779b53..faa6a0e395 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy @@ -47,9 +47,6 @@ import static org.mockito.Mockito.* class DoCreateVfModuleTest { def prefix = "DCVFM_" - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy index 47db6b3b7b..a8c818e69c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy @@ -54,9 +54,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) class DoCreateVnfAndModulesTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy index 9b421d8b63..d7ba10ad93 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy @@ -44,9 +44,6 @@ import static org.mockito.Mockito.* class DoCreateVnfTest { def prefix = "DoCVNF_" - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy index a8bdfb0633..ea79e0eadd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy @@ -46,9 +46,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) class DoDeleteServiceInstanceTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy index cfdeee2c32..f356845a1e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy @@ -54,9 +54,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy index 7776ab3fe6..b56e108faf 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy @@ -61,9 +61,6 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{ @Spy DoDeleteVfModule doDeleteVfModule - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy index 94aec7a73f..eab1b89e10 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy @@ -56,8 +56,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy index f98d454eb0..9e4ab6f757 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy @@ -50,9 +50,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) public class DoDeleteVnfAndModulesTest extends MsoGroovyTest{ - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy index 0189d065df..7bc82c1ccc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy @@ -52,9 +52,6 @@ import org.apache.commons.lang3.* @RunWith(MockitoJUnitRunner.class) class DoUpdateNetworkInstanceRollbackTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - def utils = new MsoUtils() String Prefix="UPDNETIR_" diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy index 59a2b0eda3..f16bc575a4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy @@ -57,9 +57,6 @@ class DoUpdateVfModuleTest extends MsoGroovyTest{ @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Spy DoUpdateVfModule doUpdateVfModule diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy index a86029ea30..8e81e91228 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy @@ -47,9 +47,6 @@ class DoUpdateVnfAndModulesTest { @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - @Before public void init() { MockitoAnnotations.initMocks(this) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy index 41a862e00e..5c3521f5ba 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy @@ -238,8 +238,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") @@ -265,8 +265,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) when(mex.getVariable("aaiARPath")).thenReturn(null) @@ -354,8 +354,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) @@ -366,8 +366,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenReturn("") @@ -381,8 +381,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) @@ -396,8 +396,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy index f094ef25fa..09244bedc4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy @@ -94,7 +94,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { @Test @Ignore public void getAaiAR() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -107,7 +107,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { @Test public void getAaiAR_Duplicate() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -122,7 +122,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { @Test public void getAaiAR_NotActive() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -138,7 +138,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { @Test @Ignore public void getAaiAR_NoStatus() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -205,7 +205,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { when(mex.getVariable("PSI_resourceLink")).thenReturn(null) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() @@ -217,7 +217,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initCreateAaiAr(mex) - MockPutAllottedResource_500(CUST, SVC, INST, ARID) + MockPutAllottedResource_500(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() @@ -231,7 +231,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { when(mex.getVariable("aai.endpoint")).thenThrow(new BpmnError("expected exception")) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() @@ -245,7 +245,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { when(mex.getVariable("aai.endpoint")).thenThrow(new RuntimeException("expected exception")) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() @@ -621,7 +621,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { @Test @Ignore public void updateAaiAROrchStatus() { - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy index a877ce42e7..e25f43f796 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy @@ -238,8 +238,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") @@ -265,8 +265,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) when(mex.getVariable("aaiARPath")).thenReturn(null) @@ -354,8 +354,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) @@ -366,8 +366,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenReturn("") @@ -381,8 +381,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) @@ -396,8 +396,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy index b53e5fce21..901bdaf7b3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy @@ -93,7 +93,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { @Test @Ignore public void getAaiAR() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -107,7 +107,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { @Test public void getAaiAR_Duplicate() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -122,7 +122,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { @Test public void getAaiAR_NotActive() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -138,7 +138,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { @Test @Ignore public void getAaiAR_NoStatus() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -177,7 +177,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { when(mex.getVariable("PSI_resourceLink")).thenReturn(null) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() @@ -189,7 +189,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initCreateAaiAr(mex) - MockPutAllottedResource_500(CUST, SVC, INST, ARID) + MockPutAllottedResource_500(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() @@ -203,7 +203,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { when(mex.getVariable("aai.endpoint")).thenThrow(new BpmnError("expected exception")) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() @@ -217,7 +217,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { when(mex.getVariable("aai.endpoint")).thenThrow(new RuntimeException("expected exception")) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() @@ -559,7 +559,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { @Test @Ignore public void updateAaiAROrchStatus() { - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy index e77c1dd9ed..ab9be8217d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy @@ -132,7 +132,7 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() DoDeleteAllottedResourceBRG.updateAaiAROrchStatus(mex, "success") @@ -412,8 +412,8 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() DoDeleteAllottedResourceBRG.deleteAaiAR(mex) @@ -424,8 +424,8 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenReturn("") @@ -439,8 +439,8 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) @@ -454,8 +454,8 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy index 23115874a2..6a75c145ff 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy @@ -132,7 +132,7 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() DoDeleteAllottedResourceTXC.updateAaiAROrchStatus(mex, "success") @@ -412,8 +412,8 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() DoDeleteAllottedResourceTXC.deleteAaiAR(mex) @@ -424,8 +424,8 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenReturn("") @@ -439,8 +439,8 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) @@ -454,8 +454,8 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml index b3275eb6ec..59b9027000 100644 --- a/bpmn/so-bpmn-infrastructure-flows/pom.xml +++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml @@ -104,6 +104,9 @@ </configuration> </execution> </executions> + <configuration> + <parallel>suites</parallel> + </configuration> </plugin> </plugins> </pluginManagement> diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml index 8adffb29b5..14eb42ff79 100644 --- a/bpmn/so-bpmn-tasks/pom.xml +++ b/bpmn/so-bpmn-tasks/pom.xml @@ -43,6 +43,9 @@ </configuration> </execution> </executions> + <configuration> + <parallel>suites</parallel> + </configuration> </plugin> <plugin> <groupId>io.swagger</groupId> diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseIntegrationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseIntegrationTest.java index 6500e3a850..aefe4c64bf 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseIntegrationTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseIntegrationTest.java @@ -31,6 +31,7 @@ import org.onap.so.client.orchestration.SDNOHealthCheckResources; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sniro.SniroClient; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; @@ -40,7 +41,7 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; -import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.WireMockServer; @RunWith(SpringRunner.class) @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -69,10 +70,13 @@ public abstract class BaseIntegrationTest extends TestDataSetup { @MockBean protected CatalogDbClient catalogDbClient; + + @Autowired + protected WireMockServer wireMockServer; @Before public void baseTestBefore() { - WireMock.reset(); + wireMockServer.resetAll(); } public String readResourceFile(String fileName) { InputStream stream; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java index c4129a3b96..b50cd69f73 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -41,6 +40,7 @@ import org.json.JSONObject; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -53,7 +53,7 @@ import org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate; import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.sniro.beans.SniroManagerRequest; -import org.onap.so.BaseIntegrationTest; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -117,7 +117,7 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ public void testCallSniro_success_1VpnLink() throws BadResponseException, IOException{ beforeVpnBondingLink("1"); - stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -138,7 +138,7 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ beforeVpnBondingLink("2"); beforeVpnBondingLink("3"); - stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -157,7 +157,7 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ public void testCallSniro_success_3Allotteds() throws BadResponseException, JsonProcessingException{ beforeAllottedResource(); - stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -176,7 +176,7 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ public void testCallSniro_success_1Vnf() throws JsonProcessingException, BadResponseException{ beforeVnf(); - stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -193,7 +193,7 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ beforeAllottedResource(); beforeVnf(); - stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -482,7 +482,7 @@ public class SniroHomingV2IT extends BaseIntegrationTest{ beforeAllottedResource(); mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}"; - stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java index d362996948..fe9e1c1608 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java @@ -26,11 +26,12 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; 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.urlPathEqualTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; + import javax.ws.rs.core.Response; + import org.junit.BeforeClass; import org.junit.Test; import org.onap.so.BaseIntegrationTest; @@ -75,7 +76,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{ CreateNetworkResponse mockResponse = new CreateNetworkResponse(); mockResponse.setNetworkCreated(true); - stubFor(post(urlPathEqualTo(REST_ENDPOINT)) + wireMockServer.stubFor(post(urlPathEqualTo(REST_ENDPOINT)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); @@ -90,7 +91,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{ CreateNetworkError mockResponse = new CreateNetworkError(); mockResponse.setMessage("Error in create network"); - stubFor(post(urlPathEqualTo(REST_ENDPOINT)) + wireMockServer.stubFor(post(urlPathEqualTo(REST_ENDPOINT)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); @@ -105,7 +106,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{ DeleteNetworkResponse mockResponse = new DeleteNetworkResponse(); mockResponse.setNetworkDeleted(true); - stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + wireMockServer.stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); @@ -120,7 +121,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{ DeleteNetworkError mockResponse = new DeleteNetworkError(); mockResponse.setMessage("Error in delete network"); - stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + wireMockServer.stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); @@ -137,7 +138,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{ RollbackNetworkResponse mockResponse = new RollbackNetworkResponse(); mockResponse.setNetworkRolledBack(true); - stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + wireMockServer.stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); @@ -155,7 +156,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{ RollbackNetworkError mockResponse = new RollbackNetworkError(); mockResponse.setMessage("Error in rollback network"); - stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + wireMockServer.stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); @@ -167,7 +168,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{ QueryNetworkResponse mockResponse = new QueryNetworkResponse(); mockResponse.setNetworkExists(true); - stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID)) + wireMockServer.stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID)) .withQueryParam("tenantId", equalTo(TESTING_ID)) .withQueryParam("networkStackId", equalTo("networkStackId")).withQueryParam("skipAAI", equalTo("true")) .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) @@ -185,7 +186,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{ QueryNetworkError mockResponse = new QueryNetworkError(); mockResponse.setMessage("Error in query network"); - stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID)) + wireMockServer.stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID)) .withQueryParam("tenantId", equalTo(TESTING_ID)) .withQueryParam("networkStackId", equalTo("networkStackId")).withQueryParam("skipAAI", equalTo("true")) .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) @@ -205,7 +206,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{ UpdateNetworkResponse mockResponse = new UpdateNetworkResponse(); mockResponse.setNetworkId("test1"); - stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + wireMockServer.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); @@ -221,7 +222,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{ UpdateNetworkResponse mockResponse = new UpdateNetworkResponse(); mockResponse.setNetworkId("test1"); - stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + wireMockServer.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); @@ -237,7 +238,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{ UpdateNetworkError mockResponse = new UpdateNetworkError(); mockResponse.setMessage("Error in update network"); - stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + wireMockServer.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java index cb3d91b82a..90e99eb0ad 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java @@ -26,7 +26,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; 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.urlPathEqualTo; import static org.junit.Assert.assertEquals; @@ -71,7 +70,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{ CreateVfModuleResponse mockResponse = new CreateVfModuleResponse(); mockResponse.setVfModuleCreated(true); - stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules")) + wireMockServer.stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); @@ -86,7 +85,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{ VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); mockResponse.setMessage("Error in create Vf module"); - stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules")) + wireMockServer.stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); @@ -102,8 +101,8 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{ RollbackVfModuleResponse mockResponse = new RollbackVfModuleResponse(); mockResponse.setVfModuleRolledback(true); - stubFor( - delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback")) + wireMockServer.stubFor( + delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); @@ -120,8 +119,8 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{ VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); mockResponse.setMessage("Error in rollback Vf module"); - stubFor( - delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback")) + wireMockServer.stubFor( + delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); @@ -135,7 +134,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{ DeleteVfModuleResponse mockResponse = new DeleteVfModuleResponse(); mockResponse.setVfModuleDeleted(true); - stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + wireMockServer.stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); @@ -150,7 +149,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{ VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); mockResponse.setMessage("Error in delete Vf module"); - stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + wireMockServer.stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); @@ -165,7 +164,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{ UpdateVfModuleResponse mockResponse = new UpdateVfModuleResponse(); mockResponse.setVfModuleId("test1"); - stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + wireMockServer.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); @@ -181,7 +180,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{ VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); mockResponse.setMessage("Error in update Vf module"); - stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + wireMockServer.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); @@ -193,7 +192,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{ QueryVfModuleResponse mockResponse = new QueryVfModuleResponse(); mockResponse.setVnfId(AAI_VNF_ID); mockResponse.setVfModuleId(AAI_VF_MODULE_ID); - stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + wireMockServer.stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) .withQueryParam("cloudSiteId", equalTo(TESTING_ID)) .withQueryParam("tenantId", equalTo(TESTING_ID)) .withQueryParam("vfModuleName", equalTo("someName")) @@ -211,7 +210,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{ public void queryVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException { VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); mockResponse.setMessage("Error in update Vf module"); - stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + wireMockServer.stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) .withQueryParam("cloudSiteId", equalTo(TESTING_ID)) .withQueryParam("tenantId", equalTo(TESTING_ID)) .withQueryParam("vfModuleName", equalTo("someName")) diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java index 40b6498034..4a006f8b66 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java @@ -44,8 +44,6 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; import org.onap.so.client.adapter.rest.AdapterRestClient; import org.onap.so.BaseIntegrationTest; - -@RunWith(MockitoJUnitRunner.Silent.class) public class VnfVolumeAdapterClientIT extends BaseIntegrationTest{ private static final String TESTING_ID = "___TESTING___"; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java index d6f8c70aa1..4bae5b40e4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java @@ -23,7 +23,6 @@ package org.onap.so.client.namingservice; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.delete; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static org.junit.Assert.assertTrue; @@ -55,7 +54,7 @@ public class NamingClientTest extends BaseIntegrationTest{ @Test public void assignNameGenRequest() throws BadResponseException, IOException{ - stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + wireMockServer.stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("NamingClient/AssignResponse.json") .withStatus(HttpStatus.SC_ACCEPTED))); @@ -66,7 +65,7 @@ public class NamingClientTest extends BaseIntegrationTest{ } @Test public void assignNameGenRequestError() throws BadResponseException, IOException{ - stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + wireMockServer.stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("NamingClient/ErrorResponse.json") .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); @@ -78,7 +77,7 @@ public class NamingClientTest extends BaseIntegrationTest{ } @Test public void unassignNameGenRequest() throws BadResponseException, IOException{ - stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + wireMockServer.stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("NamingClient/UnassignResponse.json") .withStatus(HttpStatus.SC_ACCEPTED))); @@ -88,7 +87,7 @@ public class NamingClientTest extends BaseIntegrationTest{ } @Test public void unassignNameGenRequestError() throws BadResponseException, IOException{ - stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + wireMockServer.stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("NamingClient/ErrorResponse.json") .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java index 0b33b1d187..05ba512c9d 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java @@ -22,7 +22,6 @@ package org.onap.so.client.oof; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import org.junit.Test; @@ -44,7 +43,7 @@ public class OofClientTestIT extends BaseIntegrationTest { public void testPostDemands_success() throws BadResponseException, JsonProcessingException { String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}"; - stubFor(post(urlEqualTo("/api/oof/v1/placement")) + wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -56,7 +55,7 @@ public class OofClientTestIT extends BaseIntegrationTest { public void testAsyncResponse_success() throws BadResponseException, JsonProcessingException { String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}"; - stubFor(post(urlEqualTo("/api/oof/v1/placement")) + wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -68,7 +67,7 @@ public class OofClientTestIT extends BaseIntegrationTest { public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException { String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}"; - stubFor(post(urlEqualTo("/api/oof/v1/placement")) + wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -84,7 +83,7 @@ public class OofClientTestIT extends BaseIntegrationTest { public void testPostDemands_error_noMessage() throws JsonProcessingException, BadResponseException { String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}"; - stubFor(post(urlEqualTo("/api/oof/v1/placement")) + wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -98,7 +97,7 @@ public class OofClientTestIT extends BaseIntegrationTest { public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException { String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}"; - stubFor(post(urlEqualTo("/api/oof/v1/placement")) + wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -112,7 +111,7 @@ public class OofClientTestIT extends BaseIntegrationTest { public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException { String mockResponse = "{ }"; - stubFor(post(urlEqualTo("/api/oof/v1/placement")) + wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java index 9117b8ea64..70f196db8c 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java @@ -23,7 +23,6 @@ package org.onap.so.client.sdnc; 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.post; -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; @@ -46,7 +45,7 @@ public class SDNCClientIT extends BaseIntegrationTest { String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientGetResponse.json"))); String queryLink = "/topologyQuery"; - stubFor(get(urlEqualTo(queryLink)) + wireMockServer.stubFor(get(urlEqualTo(queryLink)) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json").withBody(responseJson))); String response = SPY_sdncClient.get(queryLink); @@ -59,7 +58,7 @@ public class SDNCClientIT extends BaseIntegrationTest { String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/"; - stubFor(post(urlMatching(queryLink)) + wireMockServer.stubFor(post(urlMatching(queryLink)) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json").withBody(responseJson))); @@ -72,7 +71,7 @@ public class SDNCClientIT extends BaseIntegrationTest { String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/"; - stubFor(post(urlMatching(queryLink)) + wireMockServer.stubFor(post(urlMatching(queryLink)) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json").withBody(responseJson))); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java index 3387e9ddef..722180f54b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java @@ -22,7 +22,6 @@ package org.onap.so.client.sniro; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import org.junit.Test; @@ -45,7 +44,7 @@ public class SniroClientTestIT extends BaseIntegrationTest { public void testPostDemands_success() throws BadResponseException, JsonProcessingException { String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"corys cool\", \"requestStatus\": \"accepted\"}"; - stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -58,7 +57,7 @@ public class SniroClientTestIT extends BaseIntegrationTest { public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException { String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}"; - stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -74,7 +73,7 @@ public class SniroClientTestIT extends BaseIntegrationTest { public void testPostDemands_error_noMessage() throws JsonProcessingException, BadResponseException { String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}"; - stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -88,7 +87,7 @@ public class SniroClientTestIT extends BaseIntegrationTest { public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException { String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}"; - stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -102,7 +101,7 @@ public class SniroClientTestIT extends BaseIntegrationTest { public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException { String mockResponse = "{ }"; - stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -115,7 +114,7 @@ public class SniroClientTestIT extends BaseIntegrationTest { public void testPostRelease_success() throws BadResponseException, JsonProcessingException { String mockResponse = "{\"status\": \"success\", \"message\": \"corys cool\"}"; - stubFor(post(urlEqualTo("/v1/release-orders")) + wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -127,7 +126,7 @@ public class SniroClientTestIT extends BaseIntegrationTest { public void testPostRelease_error_failed() throws BadResponseException, JsonProcessingException { String mockResponse = "{\"status\": \"failure\", \"message\": \"corys cool\"}"; - stubFor(post(urlEqualTo("/v1/release-orders")) + wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -139,7 +138,7 @@ public class SniroClientTestIT extends BaseIntegrationTest { public void testPostRelease_error_noStatus() throws BadResponseException, JsonProcessingException { String mockResponse = "{\"status\": \"\", \"message\": \"corys cool\"}"; - stubFor(post(urlEqualTo("/v1/release-orders")) + wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -152,7 +151,7 @@ public class SniroClientTestIT extends BaseIntegrationTest { public void testPostRelease_error_noMessage() throws BadResponseException, JsonProcessingException { String mockResponse = "{\"status\": \"failure\", \"message\": null}"; - stubFor(post(urlEqualTo("/v1/release-orders")) + wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); @@ -165,7 +164,7 @@ public class SniroClientTestIT extends BaseIntegrationTest { public void testPostRelease_error_empty() throws BadResponseException, JsonProcessingException { String mockResponse = "{ }"; - stubFor(post(urlEqualTo("/v1/release-orders")) + wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(mockResponse))); |