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/so-bpmn-tasks/src/test/java | |
parent | c9296dc7147f22ed636f928f6c38ad099e3ed398 (diff) | |
parent | aaa93d4351b712762d6951a8c82bbe84c2077795 (diff) |
Merge "replace all fixed wiremock ports"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java')
9 files changed, 62 insertions, 64 deletions
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))); |