diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-03-20 14:12:06 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-01 09:45:03 -0400 |
commit | aaa93d4351b712762d6951a8c82bbe84c2077795 (patch) | |
tree | 69dab8e5203fe3aa6afb0a26b4da101213a3bf9f | |
parent | 24117e55159518d2e3599fd7cf6705d476cfda81 (diff) |
replace all fixed wiremock ports
trying to get the tests that can be threaded to pass
started to remove fixed port references
Change-Id: I7bfe067a8f36c908039700646571681321e9a6f5
Issue-ID: SO-1676
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
171 files changed, 2738 insertions, 2468 deletions
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml index f94d5d60b8..ed76354792 100644 --- a/adapters/mso-adapter-utils/pom.xml +++ b/adapters/mso-adapter-utils/pom.xml @@ -55,6 +55,24 @@ <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <goals> + <goal>test</goal> + </goals> + <configuration> + <includes> + <include>**/AllTestsTestSuite.java</include> + </includes> + <parallel>suites</parallel> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/AllTestsTestSuite.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/AllTestsTestSuite.java new file mode 100644 index 0000000000..a74dbf614b --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/AllTestsTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses("**/*Test.class") +public class AllTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java index 9cfdf53094..82b18d86ed 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java @@ -23,7 +23,16 @@ package org.onap.so; -import com.github.tomakehurst.wiremock.client.WireMock; +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.urlPathEqualTo; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; + +import javax.ws.rs.core.MediaType; + import org.apache.http.HttpHeaders; import org.apache.http.HttpStatus; import org.junit.After; @@ -33,20 +42,15 @@ import org.onap.so.db.catalog.beans.AuthenticationType; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.ServerType; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; -import javax.ws.rs.core.MediaType; -import java.io.BufferedReader; -import java.io.FileReader; -import java.io.IOException; - -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.urlPathEqualTo; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.client.WireMock; @RunWith(SpringRunner.class) @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -56,10 +60,12 @@ public abstract class BaseTest extends TestDataSetup { @Value("${wiremock.server.port}") protected int wireMockPort; + @Autowired + protected WireMockServer wireMockServer; @After public void after() { - WireMock.reset(); + wireMockServer.resetAll(); } protected static String getBody(String body, int port, String urlPath) throws IOException { @@ -74,15 +80,15 @@ public abstract class BaseTest extends TestDataSetup { } private void mockCloud(CloudIdentity identity, CloudSite cloudSite) throws IOException { - stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse() .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse() .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) .withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/cloudIdentity/mtn13")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/cloudIdentity/mtn13")).willReturn(aResponse() .withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, "")) .withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java index 0820076c66..ae3fb8271a 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java @@ -27,38 +27,40 @@ import static com.github.tomakehurst.wiremock.client.WireMock.delete; import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; + import org.apache.http.HttpStatus; +import com.github.tomakehurst.wiremock.WireMockServer; + public class StubOpenStack { - public static void mockOpenStackResponseAccess(int port) throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") + public static void mockOpenStackResponseAccess(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access.json", port, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackResponseUnauthorized(int port) throws IOException { - stubFor( + public static void mockOpenStackResponseUnauthorized(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor( post(urlPathEqualTo("/v2.0/tokens")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access.json", port, "/mockPublicUrl")) .withStatus(HttpStatus.SC_UNAUTHORIZED))); } - public static void mockOpenStackDelete(String id) { - stubFor(delete(urlMatching("/mockPublicUrl/stacks/" + id)).willReturn(aResponse() + public static void mockOpenStackDelete(WireMockServer wireMockServer, String id) { + wireMockServer.stubFor(delete(urlMatching("/mockPublicUrl/stacks/" + id)).willReturn(aResponse() .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGet(String id) { - stubFor( + public static void mockOpenStackGet(WireMockServer wireMockServer, String id) { + wireMockServer.stubFor( get(urlPathEqualTo("/mockPublicUrl/stacks/" + id)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Stack_Created.json") @@ -66,82 +68,82 @@ public class StubOpenStack { } - public static void mockOpenStackPostStack_200(String filename) { - stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse() + public static void mockOpenStackPostStack_200(WireMockServer wireMockServer, String filename) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPostTenantWithBodyFile_200() throws IOException { - stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")) + public static void mockOpenStackPostTenantWithBodyFile_200(WireMockServer wireMockServer) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")) .willReturn(aResponse().withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetTenantByName(String tenantName) throws IOException { - stubFor(get(urlMatching("/mockPublicUrl/tenants/[?]name=" + tenantName)) + public static void mockOpenStackGetTenantByName(WireMockServer wireMockServer, String tenantName) throws IOException { + wireMockServer.stubFor(get(urlMatching("/mockPublicUrl/tenants/[?]name=" + tenantName)) .willReturn(aResponse().withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetTenantById(String tenantId) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId")) + public static void mockOpenStackGetTenantById(WireMockServer wireMockServer, String tenantId) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId")) .willReturn(aResponse().withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackDeleteTenantById_200(String tenantId) { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() + public static void mockOpenStackDeleteTenantById_200(WireMockServer wireMockServer, String tenantId) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetUserById(String user) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)).willReturn(aResponse() + public static void mockOpenStackGetUserById(WireMockServer wireMockServer, String user) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_User.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetUserByName(String userName) { - stubFor(get(urlMatching("/mockPublicUrl/users/[?]name=" + userName)).willReturn(aResponse() + public static void mockOpenStackGetUserByName(WireMockServer wireMockServer, String userName) { + wireMockServer.stubFor(get(urlMatching("/mockPublicUrl/users/[?]name=" + userName)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_User.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetUserByName_500(String userName) { - stubFor(get(urlMatching("/mockPublicUrl/users/[?]name=" + userName)).willReturn(aResponse() + public static void mockOpenStackGetUserByName_500(WireMockServer wireMockServer, String userName) { + wireMockServer.stubFor(get(urlMatching("/mockPublicUrl/users/[?]name=" + userName)).willReturn(aResponse() .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); } - public static void mockOpenStackGetRoles_200(String roleFor) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")).willReturn(aResponse() + public static void mockOpenStackGetRoles_200(WireMockServer wireMockServer, String roleFor) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Roles.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenstackPostNetwork(String responseFile) { - stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() + public static void mockOpenstackPostNetwork(WireMockServer wireMockServer, String responseFile) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile(responseFile) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenstackPutNetwork(String responseFile, String networkId) { - stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse() + public static void mockOpenstackPutNetwork(WireMockServer wireMockServer, String responseFile, String networkId) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile(responseFile) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetNeutronNetwork(String filename,String networkId) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) + public static void mockOpenStackGetNeutronNetwork(WireMockServer wireMockServer, String filename,String networkId) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetNeutronNetwork_500(String networkId) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) + public static void mockOpenStackGetNeutronNetwork_500(WireMockServer wireMockServer, String networkId) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) .willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); } - public static void mockOpenStackDeleteNeutronNetwork(String networkId) { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId)) + public static void mockOpenStackDeleteNeutronNetwork(WireMockServer wireMockServer, String networkId) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId)) .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); } diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java index c771a75976..925365f00e 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java @@ -24,19 +24,17 @@ package org.onap.so.openstack.utils; 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.urlPathEqualTo; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertNotNull; -import com.woorea.openstack.heat.Heat; -import com.woorea.openstack.heat.model.CreateStackParam; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; + import org.apache.http.HttpStatus; import org.junit.Assert; import org.junit.Test; @@ -59,6 +57,9 @@ import org.onap.so.openstack.exceptions.MsoIOException; import org.onap.so.openstack.exceptions.MsoOpenstackException; import org.springframework.beans.factory.annotation.Autowired; +import com.woorea.openstack.heat.Heat; +import com.woorea.openstack.heat.model.CreateStackParam; + public class MsoHeatUtilsTest extends BaseTest{ @Autowired @@ -94,10 +95,10 @@ public class MsoHeatUtilsTest extends BaseTest{ Map<String, Object> inputs = new HashMap<>(); boolean rollbackOnFailure = true; - StubOpenStack.mockOpenStackResponseAccess(wireMockPort); - StubOpenStack.mockOpenStackPostStack_200("OpenstackResponse_Stack_Created.json"); + StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort); + StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json"); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceName/stackId")) + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceName/stackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_StackId.json") .withStatus(HttpStatus.SC_OK))); @@ -123,10 +124,10 @@ public class MsoHeatUtilsTest extends BaseTest{ cloudInfo.setTenantId("tenantId"); String instanceId = "instanceId"; - StubOpenStack.mockOpenStackResponseAccess(wireMockPort); - StubOpenStack.mockOpenStackPostStack_200("OpenstackResponse_Stack_Created.json"); + StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort); + StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json"); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId")) + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_StackId.json") .withStatus(HttpStatus.SC_OK))); @@ -152,10 +153,10 @@ public class MsoHeatUtilsTest extends BaseTest{ int timeoutInMinutes = 1; - StubOpenStack.mockOpenStackResponseAccess(wireMockPort); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId")).willReturn(aResponse().withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK))); - StubOpenStack.mockOpenStackDelete("name/da886914-efb2-4917-b335-c8381528d90b"); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/name/da886914-efb2-4917-b335-c8381528d90b")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_DeleteComplete.json").withStatus(HttpStatus.SC_OK))); + StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId")).willReturn(aResponse().withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK))); + StubOpenStack.mockOpenStackDelete(wireMockServer, "name/da886914-efb2-4917-b335-c8381528d90b"); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/name/da886914-efb2-4917-b335-c8381528d90b")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_DeleteComplete.json").withStatus(HttpStatus.SC_OK))); VduInstance actual = heatUtils.deleteVdu(cloudInfo, instanceId, timeoutInMinutes); @@ -195,7 +196,7 @@ public class MsoHeatUtilsTest extends BaseTest{ @Test public final void getHeatClientSuccessTest() throws MsoException, IOException { CloudSite cloudSite = getCloudSite(getCloudIdentity()); - StubOpenStack.mockOpenStackResponseAccess(wireMockPort); + StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort); Heat heatClient = heatUtils.getHeatClient(cloudSite, "TEST-tenant"); assertNotNull(heatClient); } @@ -210,7 +211,7 @@ public class MsoHeatUtilsTest extends BaseTest{ @Test(expected = MsoAdapterException.class) public final void getHeatClientOpenStackResponseException401Test() throws MsoException, IOException { CloudSite cloudSite = getCloudSite(getCloudIdentity()); - StubOpenStack.mockOpenStackResponseUnauthorized(wireMockPort); + StubOpenStack.mockOpenStackResponseUnauthorized(wireMockServer, wireMockPort); heatUtils.getHeatClient(cloudSite, "TEST-tenant"); } @@ -226,9 +227,9 @@ public class MsoHeatUtilsTest extends BaseTest{ @Test public final void createStackSuccessTest() throws MsoException, IOException { CloudSite cloudSite = getCloudSite(getCloudIdentity()); - StubOpenStack.mockOpenStackResponseAccess(wireMockPort); - StubOpenStack.mockOpenStackPostStack_200("OpenstackResponse_Stack_Created.json"); - StubOpenStack.mockOpenStackGet("TEST-stack/stackId"); + StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort); + StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json"); + StubOpenStack.mockOpenStackGet(wireMockServer, "TEST-stack/stackId"); StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack", null, "TEST-heat", new HashMap<>(), false, 1, "TEST-env", new HashMap<>(), new HashMap<>(), false); diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java index 5100407633..3526a68ef6 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java @@ -39,15 +39,15 @@ public class MsoKeystoneUtilsTest extends BaseTest { @Before public void before() throws IOException { - StubOpenStack.mockOpenStackResponseAccess(wireMockPort); + StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort); } @Test public void createTenantTest() throws Exception { - StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(); + StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(wireMockServer); - StubOpenStack.mockOpenStackGetUserById("john"); - StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM"); + StubOpenStack.mockOpenStackGetUserById(wireMockServer, "john"); + StubOpenStack.mockOpenStackGetRoles_200(wireMockServer, "OS-KSADM"); String response = msoKeystoneUtils.createTenant("tenant", "MTN13", new HashMap<>(), true); Assert.assertEquals("tenantId", response); @@ -55,10 +55,10 @@ public class MsoKeystoneUtilsTest extends BaseTest { @Test public void createTenantTest_FindUserByName() throws Exception { - StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(); + StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(wireMockServer); - StubOpenStack.mockOpenStackGetUserByName("john"); - StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM"); + StubOpenStack.mockOpenStackGetUserByName(wireMockServer, "john"); + StubOpenStack.mockOpenStackGetRoles_200(wireMockServer, "OS-KSADM"); String response = msoKeystoneUtils.createTenant("tenant", "MTN13", new HashMap<>(), true); Assert.assertEquals("tenantId", response); @@ -67,15 +67,15 @@ public class MsoKeystoneUtilsTest extends BaseTest { @Test public void createTenantTest_Exception() throws Exception { expectedException.expect(MsoException.class); - StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(); - StubOpenStack.mockOpenStackGetUserByName_500("john"); - StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM"); + StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(wireMockServer); + StubOpenStack.mockOpenStackGetUserByName_500(wireMockServer, "john"); + StubOpenStack.mockOpenStackGetRoles_200(wireMockServer, "OS-KSADM"); msoKeystoneUtils.createTenant("tenant", "Test", new HashMap<>(), true); } @Test public void queryTenantTest() throws Exception { - StubOpenStack.mockOpenStackGetTenantById("tenantId"); + StubOpenStack.mockOpenStackGetTenantById(wireMockServer, "tenantId"); MsoTenant msoTenant = msoKeystoneUtils.queryTenant("tenantId", "MTN13"); @@ -84,7 +84,7 @@ public class MsoKeystoneUtilsTest extends BaseTest { @Test public void queryTenantByNameTest() throws Exception { - StubOpenStack.mockOpenStackGetTenantByName("tenant"); + StubOpenStack.mockOpenStackGetTenantByName(wireMockServer, "tenant"); MsoTenant msoTenant = msoKeystoneUtils.queryTenantByName("tenant", "MTN13"); @@ -93,8 +93,8 @@ public class MsoKeystoneUtilsTest extends BaseTest { @Test public void deleteTenantTest() throws Exception { - StubOpenStack.mockOpenStackGetTenantById("tenantId"); - StubOpenStack.mockOpenStackDeleteTenantById_200("tenantId"); + StubOpenStack.mockOpenStackGetTenantById(wireMockServer, "tenantId"); + StubOpenStack.mockOpenStackDeleteTenantById_200(wireMockServer, "tenantId"); boolean result = msoKeystoneUtils.deleteTenant("tenantId", "MTN13"); Assert.assertTrue(result); @@ -102,8 +102,8 @@ public class MsoKeystoneUtilsTest extends BaseTest { @Test public void deleteTenantByNameTest() throws Exception { - StubOpenStack.mockOpenStackGetTenantByName("tenant"); - StubOpenStack.mockOpenStackDeleteTenantById_200("tenantId"); + StubOpenStack.mockOpenStackGetTenantByName(wireMockServer, "tenant"); + StubOpenStack.mockOpenStackDeleteTenantById_200(wireMockServer, "tenantId"); boolean result = msoKeystoneUtils.deleteTenantByName("tenant", "MTN13"); Assert.assertTrue(result); diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java index b2a69ded46..3b3e30183b 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java @@ -22,7 +22,6 @@ package org.onap.so.openstack.utils; 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.urlPathEqualTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -32,6 +31,7 @@ import static org.mockito.Mockito.when; import java.io.IOException; import java.util.HashMap; import java.util.Optional; + import org.apache.http.HttpStatus; import org.junit.Test; import org.mockito.InjectMocks; @@ -61,7 +61,7 @@ public class MsoMulticloudUtilsTest extends BaseTest { @Test public void createStackSuccess() throws MsoException, IOException { - stubFor(post(urlPathEqualTo("/v2.0")) + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(CREATE_STACK_RESPONSE) .withStatus(HttpStatus.SC_CREATED))); @@ -93,7 +93,7 @@ public class MsoMulticloudUtilsTest extends BaseTest { @Test public void createStackBadRequest() { try { - stubFor(post(urlPathEqualTo("/v2.0")) + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_BAD_REQUEST))); multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), @@ -108,7 +108,7 @@ public class MsoMulticloudUtilsTest extends BaseTest { @Test public void createStackEmptyResponseEntity() throws MsoException { - stubFor(post(urlPathEqualTo("/v2.0")) + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_CREATED))); StackInfo result = multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java index f679e1f776..8c337865df 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java @@ -44,7 +44,7 @@ public class MsoNeutronUtilsTest extends BaseTest{ public void before() throws IOException { vlans = new ArrayList<>(); vlans.add(3014); - StubOpenStack.mockOpenStackResponseAccess(wireMockPort); + StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort); } @Test @@ -56,7 +56,7 @@ public class MsoNeutronUtilsTest extends BaseTest{ @Test public void createNetworkTest_NetworkTypeAsMultiProvider() throws Exception { - StubOpenStack.mockOpenstackPostNetwork("OpenstackCreateNeutronNetworkResponse.json"); + StubOpenStack.mockOpenstackPostNetwork(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json"); NetworkInfo networkInfo = msoNeutronUtils.createNetwork("MTN13", "tenantId", MsoNeutronUtils.NetworkType.MULTI_PROVIDER,"networkName","PROVIDER", vlans); @@ -65,7 +65,7 @@ public class MsoNeutronUtilsTest extends BaseTest{ @Test public void createNetworkTest() throws Exception { - StubOpenStack.mockOpenstackPostNetwork("OpenstackCreateNeutronNetworkResponse.json"); + StubOpenStack.mockOpenstackPostNetwork(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json"); NetworkInfo networkInfo = msoNeutronUtils.createNetwork("MTN13", "tenantId", MsoNeutronUtils.NetworkType.PROVIDER,"networkName","PROVIDER", vlans); @@ -74,7 +74,7 @@ public class MsoNeutronUtilsTest extends BaseTest{ @Test public void queryNetworkTest() throws Exception { - StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + StubOpenStack.mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13"); Assert.assertEquals("net1",networkInfo.getName()); @@ -89,15 +89,15 @@ public class MsoNeutronUtilsTest extends BaseTest{ @Test public void queryNetworkTest_500() throws Exception { expectedException.expect(MsoException.class); - StubOpenStack.mockOpenStackGetNeutronNetwork_500("43173f6a-d699-414b-888f-ab243dda6dfe"); + StubOpenStack.mockOpenStackGetNeutronNetwork_500(wireMockServer, "43173f6a-d699-414b-888f-ab243dda6dfe"); msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13"); } @Test public void deleteNetworkkTest() throws Exception { - StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); - StubOpenStack.mockOpenStackDeleteNeutronNetwork("43173f6a-d699-414b-888f-ab243dda6dfe"); + StubOpenStack.mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + StubOpenStack.mockOpenStackDeleteNeutronNetwork(wireMockServer, "43173f6a-d699-414b-888f-ab243dda6dfe"); Boolean result = msoNeutronUtils.deleteNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13"); Assert.assertTrue(result); @@ -105,8 +105,8 @@ public class MsoNeutronUtilsTest extends BaseTest{ @Test public void updateNetworkTest() throws Exception { - StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); - StubOpenStack.mockOpenstackPutNetwork("OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + StubOpenStack.mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + StubOpenStack.mockOpenstackPutNetwork(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("MTN13", "tenantId", "43173f6a-d699-414b-888f-ab243dda6dfe",MsoNeutronUtils.NetworkType.PROVIDER,"PROVIDER", vlans); @@ -115,8 +115,8 @@ public class MsoNeutronUtilsTest extends BaseTest{ @Test public void updateNetworkTest_NetworkTypeAsMultiProvider() throws Exception { - StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); - StubOpenStack.mockOpenstackPutNetwork("OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + StubOpenStack.mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + StubOpenStack.mockOpenstackPutNetwork(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("MTN13", "tenantId", "43173f6a-d699-414b-888f-ab243dda6dfe",MsoNeutronUtils.NetworkType.MULTI_PROVIDER,"PROVIDER", vlans); diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml index 390c775cb2..1f6ea413ec 100644 --- a/adapters/mso-catalog-db-adapter/pom.xml +++ b/adapters/mso-catalog-db-adapter/pom.xml @@ -63,6 +63,24 @@ </compilerArgs> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <goals> + <goal>test</goal> + </goals> + <configuration> + <includes> + <include>**/AllTestsTestSuite.java</include> + </includes> + <parallel>suites</parallel> + </configuration> + </execution> + </executions> + </plugin> </plugins> <pluginManagement> <plugins> diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java new file mode 100644 index 0000000000..3c05f8164b --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses("**/*Test.class") +public class AllTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java new file mode 100644 index 0000000000..b2a20681d9 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java @@ -0,0 +1,21 @@ +package org.onap.so.adapters.catalogdb; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class CatalogDbAdapterBaseTest { + + @LocalServerPort + protected int port; + + + @Test + public void testNothing(){} +} diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java index a97029ef5b..bd8c5bc3e3 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java @@ -20,7 +20,8 @@ package org.onap.so.adapters.catalogdb.catalogrest; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.onap.so.logger.MdcConstants.ENDTIME; import static org.onap.so.logger.MdcConstants.INVOCATION_ID; import static org.onap.so.logger.MdcConstants.PARTNERNAME; @@ -29,45 +30,29 @@ import static org.onap.so.logger.MdcConstants.RESPONSEDESC; import static org.onap.so.logger.MdcConstants.SERVICE_NAME; import static org.onap.so.logger.MdcConstants.STATUSCODE; - import java.io.IOException; import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; + import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; - import org.json.JSONException; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.adapters.catalogdb.CatalogDBApplication; - +import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.annotation.DirtiesContext.ClassMode; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.util.UriComponentsBuilder; import ch.qos.logback.classic.spi.ILoggingEvent; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class CatalogDBRestTest { +public class CatalogDBRestTest extends CatalogDbAdapterBaseTest { private static final String ECOMP_MSO_CATALOG_V2_VF_MODULES = "ecomp/mso/catalog/v2/vfModules"; @@ -81,9 +66,6 @@ public class CatalogDBRestTest { private static final String ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES = "ecomp/mso/catalog/v2/serviceResources"; - @LocalServerPort - private int port; - TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); HttpHeaders headers = new HttpHeaders(); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java index 5a6ab747c5..f2f06d7f3d 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java @@ -27,6 +27,7 @@ import javax.ws.rs.core.Response; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.adapters.catalogdb.CatalogDBApplication; +import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest; import org.onap.so.db.catalog.beans.AuthenticationType; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; @@ -44,10 +45,7 @@ import org.springframework.web.util.UriComponentsBuilder; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class CloudConfigTest { +public class CloudConfigTest extends CatalogDbAdapterBaseTest { protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java index 898e8eadf1..78ac4ca095 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java @@ -36,6 +36,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.adapters.catalogdb.CatalogDBApplication; +import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest; import org.onap.so.db.catalog.beans.ConfigurationResource; import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.VfModule; @@ -56,10 +57,7 @@ import org.springframework.test.context.junit4.SpringRunner; import org.springframework.beans.BeanUtils; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class CvnfcCatalogDbQueryTest { +public class CvnfcCatalogDbQueryTest extends CatalogDbAdapterBaseTest { @Autowired private CvnfcCustomizationRepository cvnfcCustomizationRepository; diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java index 89a7ba3d17..e6a281a375 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java @@ -35,6 +35,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.adapters.catalogdb.CatalogDBApplication; +import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest; import org.onap.so.db.catalog.beans.BuildingBlockDetail; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; @@ -50,10 +51,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class NetworkCollectionCatalogDbQueryTest { +public class NetworkCollectionCatalogDbQueryTest extends CatalogDbAdapterBaseTest { private static final Logger logger = LoggerFactory.getLogger(NetworkCollectionCatalogDbQueryTest.class); private static final String NETWORKCOLLECTION = "NetworkCollection"; diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index ea8cb5d616..461fce555f 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -31,6 +31,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.adapters.catalogdb.CatalogDBApplication; +import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest; import org.onap.so.db.catalog.beans.AuthenticationType; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; @@ -59,10 +60,7 @@ import org.springframework.boot.web.server.LocalServerPort; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class CatalogDbClientTest { +public class CatalogDbClientTest extends CatalogDbAdapterBaseTest { public static final String MTN13 = "mtn13"; diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml index 73f50ed908..9c3ef2578f 100644 --- a/adapters/mso-openstack-adapters/pom.xml +++ b/adapters/mso-openstack-adapters/pom.xml @@ -37,6 +37,24 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <goals> + <goal>test</goal> + </goals> + <configuration> + <includes> + <include>**/AllTestsTestSuite.java</include> + </includes> + <parallel>suites</parallel> + </configuration> + </execution> + </executions> + </plugin> <!-- run the following plugin only when there's a wsdl change and you need to recompile the java classes <plugin> diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java index 707af7b6be..7bfb8c1d76 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java @@ -64,9 +64,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void createNetworkByModelNameNeutronModeGetNetworkException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenstackGet("/mockPublicUrl/v2.0/networks",HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenstackGet(wireMockServer, "/mockPublicUrl/v2.0/networks",HttpStatus.SC_INTERNAL_SERVER_ERROR); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -77,13 +77,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void createNetworkByModelNameNeutronModeCreateNetworkException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork_404("dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetNeutronNetwork_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetAllNeutronNetworks_404(); + mockOpenStackGetAllNeutronNetworks_404(wireMockServer); - mockOpenstackPost("/mockPublicUrl/v2.0/networks", HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenstackPost(wireMockServer, "/mockPublicUrl/v2.0/networks", HttpStatus.SC_INTERNAL_SERVER_ERROR); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -94,13 +94,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void createNetworkByModelNameNeutronMode() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork_404("dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetNeutronNetwork_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetAllNeutronNetworks_404(); + mockOpenStackGetAllNeutronNetworks_404(wireMockServer); - mockOpenStackPostNeutronNetwork_200("OpenstackCreateNeutronNetworkResponse.json"); + mockOpenStackPostNeutronNetwork_200(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json"); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -111,9 +111,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void createNetworkByModelNameAlreadyExistNeutronMode() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetAllNeutronNetworks_200("OpenstackGetNeutronNetworks.json"); + mockOpenStackGetAllNeutronNetworks_200(wireMockServer, "OpenstackGetNeutronNetworks.json"); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -124,9 +124,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void createNetworkByModelNameAlreadyExistNeutronModeFailIfExistTrue() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetAllNeutronNetworks_200("OpenstackGetNeutronNetworks.json"); + mockOpenStackGetAllNeutronNetworks_200(wireMockServer, "OpenstackGetNeutronNetworks.json"); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -137,13 +137,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void createNetworkByModelNameHeatMode() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStack_404("dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetStack_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackPostStack_200("OpenstackResponse_Stack.json"); + mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json"); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc/stackId"); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc/stackId"); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -154,11 +154,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void createNetworkByModelNameAlreadyExistHeatMode() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackPostStack_200("OpenstackResponse_Stack.json"); + mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json"); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -169,9 +169,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void createNetworkByModelNameAlreadyExistHeatModeFailIfExistTrue() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -183,9 +183,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void createNetworkByModelNameHeatModeQueryNetworkException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenstackGet("/mockPublicUrl/stacks/dvspg-VCE_VPE-mtjnj40avbc",HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenstackGet(wireMockServer, "/mockPublicUrl/stacks/dvspg-VCE_VPE-mtjnj40avbc",HttpStatus.SC_INTERNAL_SERVER_ERROR); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -196,11 +196,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void createNetworkByModelNameHeatModeCreateNetworkException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStack_404("dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetStack_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenstackPost("/mockPublicUrl/stacks",HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenstackPost(wireMockServer, "/mockPublicUrl/stacks",HttpStatus.SC_INTERNAL_SERVER_ERROR); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -211,11 +211,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void createNetworkByModelNameCloudSiteNotPresentError() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackPostStack_200("OpenstackResponse_Stack.json"); + mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json"); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -226,13 +226,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void deleteNetworkHeatModeSuccess() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json"); + mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_DeleteComplete.json"); - mockOpenStackDeleteStack_200(); + mockOpenStackDeleteStack_200(wireMockServer); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -243,13 +243,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void deleteNetworkDeleteStackException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json"); + mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_DeleteComplete.json"); - mockOpenStackDeleteStack_500(); + mockOpenStackDeleteStack_500(wireMockServer); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -260,13 +260,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void deleteNetworkError() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json"); + mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_DeleteComplete.json"); - mockOpenStackDeleteStack_200(); + mockOpenStackDeleteStack_200(wireMockServer); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -278,11 +278,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void deleteNetworkNeureonMode() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); + mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); - mockOpenStackDeleteNeutronNetwork(NETWORK_ID,HttpStatus.SC_OK); + mockOpenStackDeleteNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_OK); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -293,11 +293,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void deleteNetworkNeutronModeDeleteStackException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); + mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); - mockOpenStackDeleteNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenStackDeleteNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); //mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_ID); @@ -310,10 +310,10 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void updateNetworkNeutronModeSuccess() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); - mockOpenStackPutNeutronNetwork_200("OpenstackCreateNeutronNetworkResponse.json",NETWORK_ID); + mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); + mockOpenStackPutNeutronNetwork_200(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json",NETWORK_ID); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -324,10 +324,10 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void updateNetworkNeutronUpdateException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); - mockOpenStackPutNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); + mockOpenStackPutNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -338,11 +338,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void updateNetworkHeatUpdateException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_NAME); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", NETWORK_NAME); - mockOpenStackPutStack(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenStackPutStack(wireMockServer, NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -353,9 +353,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void updateNetworkHeatQueryException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStack_500(NETWORK_NAME); + mockOpenStackGetStack_500(wireMockServer, NETWORK_NAME); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -366,9 +366,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void updateNetworkHeatStackNotFound() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStack_404(NETWORK_NAME); + mockOpenStackGetStack_404(wireMockServer, NETWORK_NAME); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -379,9 +379,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void updateNetworkNeutronQueryException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenStackGetNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -392,9 +392,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void updateNetworkNeutronStackNotFound() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_NOT_FOUND); + mockOpenStackGetNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_NOT_FOUND); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -405,9 +405,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void queryNetworkHeatModesuccess() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_ID); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", NETWORK_ID); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -418,9 +418,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void queryNetworkHeatModeQueryException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStack_500(NETWORK_ID); + mockOpenStackGetStack_500(wireMockServer, NETWORK_ID); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -431,9 +431,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void queryNetworkNeutronModeSuccess() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); + mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); @@ -444,9 +444,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils { @Test public void queryNetworkNeutronModeException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenStackGetNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); String uri = "/services/NetworkAdapter"; headers.set("X-ECOMP-RequestID", "123456789456127"); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java index f8dcddde04..21ca860b54 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java @@ -20,22 +20,9 @@ package org.onap.so.adapters.network; -import org.apache.http.HttpStatus; -import org.junit.Test; -import org.onap.so.adapters.vnf.BaseRestTestUtils; -import org.onap.so.entity.MsoRequest; -import org.onap.so.openstack.beans.NetworkRollback; -import org.onap.so.openstack.beans.Subnet; -import org.springframework.beans.factory.annotation.Autowired; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; - 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.urlPathEqualTo; import static org.onap.so.bpmn.mock.StubOpenStack.getBodyFromFile; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedVUSP_200; @@ -45,6 +32,18 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccessQueryNetwork; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import org.apache.http.HttpStatus; +import org.junit.Test; +import org.onap.so.adapters.vnf.BaseRestTestUtils; +import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.NetworkRollback; +import org.onap.so.openstack.beans.Subnet; +import org.springframework.beans.factory.annotation.Autowired; + public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { @Autowired MsoNetworkAdapterAsyncImpl impl; @@ -57,12 +56,12 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { @Test public void rollbackNetworkATest() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) .withRequestBody(containing("tenantId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/notificationUrl")) + wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) .withRequestBody(containing("<completed>true</completed>")) .willReturn(aResponse() .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + @@ -79,12 +78,12 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { @Test public void rollbackNetworkATest_NotifyException() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) .withRequestBody(containing("tenantId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/notificationUrl")) + wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) .withRequestBody(containing("<completed>true</completed>")) .willReturn(aResponse() .withStatus(HttpStatus.SC_NOT_FOUND))); @@ -124,12 +123,12 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { @Test public void deleteNetworkATest() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) .withRequestBody(containing("tenantId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/notificationUrl")) + wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) .withRequestBody(containing("<completed>true</completed>")) .willReturn(aResponse() .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + @@ -146,12 +145,12 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { @Test public void deleteNetworkATest_NotifyException() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) .withRequestBody(containing("tenantId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/notificationUrl")) + wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) .withRequestBody(containing("<completed>true</completed>")) .willReturn(aResponse() .withStatus(HttpStatus.SC_NOT_FOUND))); @@ -167,15 +166,15 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { @Test public void updateNetworkATest() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) .withRequestBody(containing("tenantId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_UpdateComplete.json"); - mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(); - stubFor(post(urlPathEqualTo("/notificationUrl")) + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json"); + mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer); + wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) .withRequestBody(containing("updateNetworkNotification")) .willReturn(aResponse() .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + @@ -196,14 +195,14 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { @Test public void updateNetworkATest_NotifyExcpetion() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) .withRequestBody(containing("tenantId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_UpdateComplete.json"); - mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json"); + mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer); HashMap<String,String> networkParams = new HashMap<String,String>(); networkParams.put("shared", "true"); networkParams.put("external", "false"); @@ -220,19 +219,19 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { @Test public void queryNetworkATest() throws IOException { - mockOpenStackResponseAccessQueryNetwork(wireMockPort); + mockOpenStackResponseAccessQueryNetwork(wireMockServer, wireMockPort); impl.queryNetworkA("mtn13", "tenantId", "networkId", "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); } @Test public void createNetworkATest() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) .withRequestBody(containing("tenantId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/notificationUrl")) + wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) .withRequestBody(containing("createNetworkNotification")) .willReturn(aResponse() .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + @@ -243,9 +242,9 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { " </soapenv:Body>\n" + "</soapenv:Envelope>") .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreatedVUSP_200(); - mockOpenStackPostStacks_200(); - mockOpenStackPostStacks_200(); + mockOpenStackGetStackCreatedVUSP_200(wireMockServer); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackPostStacks_200(wireMockServer); HashMap<String,String> networkParams = new HashMap<String,String>(); impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), networkParams, "messageId", @@ -254,13 +253,13 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { @Test public void createNetworkATest_NotifyException() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) .withRequestBody(containing("tenantId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreatedVUSP_200(); - mockOpenStackPostStacks_200(); + mockOpenStackGetStackCreatedVUSP_200(wireMockServer); + mockOpenStackPostStacks_200(wireMockServer); HashMap<String,String> networkParams = new HashMap<String,String>(); networkParams.put("shared", "true"); networkParams.put("external", "false"); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java index 4e2d5e5da2..97392adeef 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java @@ -102,13 +102,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); request.setNetworkTechnology(networkTechnology); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackPostPublicUrlWithBodyFile_200(); + mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); - mockOpenStackGetStackCreatedVUSP_200(); + mockOpenStackGetStackCreatedVUSP_200(wireMockServer); - mockOpenStackGetStackVUSP_404(); + mockOpenStackGetStackVUSP_404(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); HttpEntity<CreateNetworkRequest> entity = new HttpEntity<CreateNetworkRequest>(request, headers); @@ -127,13 +127,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackPostPublicUrlWithBodyFile_200(); + mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); - mockOpenStackGetStackCreatedAppC_200(); + mockOpenStackGetStackCreatedAppC_200(wireMockServer); - mockOpenStackGetStackAppC_404(); + mockOpenStackGetStackAppC_404(wireMockServer); headers.add("Content-Type", MediaType.APPLICATION_JSON); headers.add("Accept", MediaType.APPLICATION_JSON); @@ -170,13 +170,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); request.setNetworkStackId(NETWORK_ID); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackPublicUrlStackByID_200(wireMockPort); + mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort); - mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockPort); + mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort); - mockOpenStackDeletePublicUrlStackByNameAndID_204(); + mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); @@ -203,13 +203,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { msoReq.setRequestId(MSO_REQUEST_ID); msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackPublicUrlStackByID_200(wireMockPort); + mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort); - mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockPort); + mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort); - mockOpenStackDeletePublicUrlStackByNameAndID_204(); + mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); @@ -247,8 +247,8 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { @Test public void testQueryNetwork() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers); @@ -280,15 +280,15 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); request.setNetworkStackId(NETWORK_ID); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackPublicUrlStackByName_200(wireMockPort); + mockOpenStackPublicUrlStackByName_200(wireMockServer, wireMockPort); - mockOpenStackPublicUrlStackByID_200(wireMockPort); + mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort); - mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockPort); + mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockServer, wireMockPort); - mockOpenStackPutPublicUrlStackByNameAndID_200(); + mockOpenStackPutPublicUrlStackByNameAndID_200(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); @@ -307,13 +307,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { @Test public void testCreateNetworkCNRC_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackPostPublicUrlWithBodyFile_200(); + mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); - mockOpenStackGetStackCreatedAppC_200(); + mockOpenStackGetStackCreatedAppC_200(wireMockServer); - mockOpenStackGetStackAppC_404(); + mockOpenStackGetStackAppC_404(wireMockServer); headers.add("Content-Type", MediaType.APPLICATION_JSON); headers.add("Accept", MediaType.APPLICATION_JSON); @@ -334,13 +334,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils { @Test public void testCreateNetworkNC_Shared_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackPostPublicUrlWithBodyFile_200(); + mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); - mockOpenStackGetStackCreatedAppC_200(); + mockOpenStackGetStackCreatedAppC_200(wireMockServer); - mockOpenStackGetStackAppC_404(); + mockOpenStackGetStackAppC_404(wireMockServer); headers.add("Content-Type", MediaType.APPLICATION_JSON); headers.add("Accept", MediaType.APPLICATION_JSON); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java index 405118cb30..f24a5a5292 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java @@ -90,19 +90,19 @@ public class TenantAdapterRestTest extends BaseRestTestUtils { request.setBackout(backout); request.setFailIfExists(failIfExists); - mockOpenStackResponseAccessAdmin(wireMockPort); + mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort); - mockOpenStackGetTenantByName_404(tenantName); + mockOpenStackGetTenantByName_404(wireMockServer, tenantName); - mockOpenStackPostTenantWithBodyFile_200(); + mockOpenStackPostTenantWithBodyFile_200(wireMockServer); - mockOpenStackGetUser_200("m93945"); + mockOpenStackGetUser_200(wireMockServer, "m93945"); - mockOpenStackGetRoles_200("OS-KSADM"); + mockOpenStackGetRoles_200(wireMockServer, "OS-KSADM"); - mockOpenStackPutRolesAdmin_200("OS-KSADM"); + mockOpenStackPutRolesAdmin_200(wireMockServer, "OS-KSADM"); - mockOpenStackPostMetadata_200(); + mockOpenStackPostMetadata_200(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); HttpEntity<CreateTenantRequest> entity = new HttpEntity<CreateTenantRequest>(request, headers); @@ -141,13 +141,13 @@ public class TenantAdapterRestTest extends BaseRestTestUtils { request.setBackout(backout); request.setFailIfExists(failIfExists); - mockOpenStackResponseAccessAdmin(wireMockPort); + mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort); - mockOpenStackGetTenantByName_200(tenantName); + mockOpenStackGetTenantByName_200(wireMockServer, tenantName); - mockOpenStackPostTenant_200(); + mockOpenStackPostTenant_200(wireMockServer); - mockOpenStackGetMetadata_200(); + mockOpenStackGetMetadata_200(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); HttpEntity<CreateTenantRequest> entity = new HttpEntity<CreateTenantRequest>(request, headers); @@ -180,11 +180,11 @@ public class TenantAdapterRestTest extends BaseRestTestUtils { request.setTenantId(tenantId); request.setMsoRequest(msoReq); - mockOpenStackResponseAccessAdmin(wireMockPort); + mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort); - mockOpenStackGetTenantById_200(tenantId); + mockOpenStackGetTenantById_200(wireMockServer, tenantId); - mockOpenStackDeleteTenantById_200(tenantId); + mockOpenStackDeleteTenantById_200(wireMockServer, tenantId); headers.add("Accept", MediaType.APPLICATION_JSON); HttpEntity<DeleteTenantRequest> entity = new HttpEntity<DeleteTenantRequest>(request, headers); @@ -218,9 +218,9 @@ public class TenantAdapterRestTest extends BaseRestTestUtils { request.setTenantId(tenantId); request.setMsoRequest(msoReq); - mockOpenStackResponseAccessAdmin(wireMockPort); + mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort); - mockOpenStackGetTenantById_404(tenantId); + mockOpenStackGetTenantById_404(wireMockServer, tenantId); headers.add("Accept", MediaType.APPLICATION_JSON); HttpEntity<DeleteTenantRequest> entity = new HttpEntity<DeleteTenantRequest>(request, headers); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java index 8f6a18225d..0b83386ccc 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java @@ -59,7 +59,7 @@ public class ValetClientTest extends BaseRestTestUtils { ValetCreateResponse vcr = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"), ValetCreateResponse.class); GenericValetResponse<ValetCreateResponse> expected = new GenericValetResponse<ValetCreateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr); - mockValetCreatePostResponse_200("requestId", mapper.writeValueAsString(vcr)); + mockValetCreatePostResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vcr)); GenericValetResponse<ValetCreateResponse> actual = client.callValetCreateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null); @@ -71,7 +71,7 @@ public class ValetClientTest extends BaseRestTestUtils { ValetUpdateResponse vur = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"), ValetUpdateResponse.class); GenericValetResponse<ValetUpdateResponse> expected = new GenericValetResponse<ValetUpdateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vur); - mockValetCreatePutResponse_200("requestId", mapper.writeValueAsString(vur)); + mockValetCreatePutResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vur)); GenericValetResponse<ValetUpdateResponse> actual = client.callValetUpdateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null); @@ -83,7 +83,7 @@ public class ValetClientTest extends BaseRestTestUtils { ValetDeleteResponse vdr = mapper.readValue(new File("src/test/resources/__files/ValetDeleteRequest.json"), ValetDeleteResponse.class); GenericValetResponse<ValetDeleteResponse> expected = new GenericValetResponse<ValetDeleteResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vdr); - mockValetDeleteDeleteResponse_200("requestId", mapper.writeValueAsString(vdr)); + mockValetDeleteDeleteResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vdr)); GenericValetResponse<ValetDeleteResponse> actual = client.callValetDeleteRequest("requestId", "regionId", "ownerId", "tenantId", "vfModuleId", "vfModuleName"); @@ -95,7 +95,7 @@ public class ValetClientTest extends BaseRestTestUtils { ValetConfirmResponse vcr = new ValetConfirmResponse(); GenericValetResponse<ValetConfirmResponse> expected = new GenericValetResponse<ValetConfirmResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr); - mockValetConfirmPutRequest_200("requestId", "{}"); + mockValetConfirmPutRequest_200(wireMockServer, "requestId", "{}"); GenericValetResponse<ValetConfirmResponse> actual = client.callValetConfirmRequest("requestId", "stackId"); @@ -107,7 +107,7 @@ public class ValetClientTest extends BaseRestTestUtils { ValetRollbackResponse vrr = new ValetRollbackResponse(); GenericValetResponse<ValetRollbackResponse> expected = new GenericValetResponse<ValetRollbackResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vrr); - mockValetRollbackPutRequest_200("requestId", "{}"); + mockValetRollbackPutRequest_200(wireMockServer, "requestId", "{}"); GenericValetResponse<ValetRollbackResponse> actual = client.callValetRollbackRequest("requestId", "stackId", true, "error"); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java new file mode 100644 index 0000000000..f086653fea --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnf; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses("**/*Test.class") +public class AllTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java index 017aa26758..b9edb68bb1 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java @@ -20,10 +20,17 @@ package org.onap.so.adapters.vnf; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; +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.urlPathEqualTo; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +import javax.ws.rs.core.MediaType; + import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; @@ -37,25 +44,19 @@ import org.onap.so.db.catalog.beans.ServerType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; 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.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; import org.springframework.test.context.junit4.SpringRunner; -import javax.ws.rs.core.MediaType; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; - -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.reset; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.tomakehurst.wiremock.WireMockServer; @RunWith(SpringRunner.class) @SpringBootTest(classes = MsoOpenstackAdaptersApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -64,6 +65,10 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; public abstract class BaseRestTestUtils { @Value("${wiremock.server.port}") protected int wireMockPort; + + @Autowired + protected WireMockServer wireMockServer; + @Autowired CloudConfig cloudConfig; @@ -112,7 +117,7 @@ public abstract class BaseRestTestUtils { */ @Before public void setUp() throws Exception { - reset(); + wireMockServer.resetAll(); mapper = new ObjectMapper(); CloudIdentity identity = new CloudIdentity(); identity.setId("MTN13"); @@ -134,15 +139,15 @@ public abstract class BaseRestTestUtils { identity.setIdentityServerType(ServerType.KEYSTONE); cloudSite.setIdentityService(identity); - stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse() .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse() .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")).willReturn(aResponse() .withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, "")) .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java index cbf252ec3a..02fbe2c530 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java @@ -21,33 +21,26 @@ package org.onap.so.adapters.vnf; -import org.apache.http.HttpStatus; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.onap.so.adapters.vnf.exceptions.VnfException; -import org.onap.so.entity.MsoRequest; -import org.onap.so.openstack.beans.VnfRollback; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.SpyBean; - -import java.util.HashMap; -import java.util.Map; - 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.postRequestedFor; -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.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.verify; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doThrow; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; +import java.util.HashMap; +import java.util.Map; + +import org.apache.http.HttpStatus; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.VnfRollback; +import org.springframework.beans.factory.annotation.Autowired; + public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { @Autowired @@ -67,9 +60,9 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody (containing("messageId")) .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); @@ -79,7 +72,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId", msoRequest, notificationUrl); - verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); + wireMockServer.verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); } @Test @@ -89,7 +82,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId", null, notificationUrl); - verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); + wireMockServer.verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); } @@ -101,7 +94,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody + wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody (containing("messageId")) .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; @@ -118,14 +111,14 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody + wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody (containing("messageId")) .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; instance.updateVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", "volumeGroupHeatStackId|1", map, "messageId", msoRequest, notificationUrl); - verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); + wireMockServer.verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); } @Test diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java index 0816bc55a6..e40aab9ba1 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java @@ -21,7 +21,23 @@ package org.onap.so.adapters.vnf; -import com.github.tomakehurst.wiremock.client.WireMock; +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.urlPathEqualTo; +import static org.mockito.Mockito.when; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGetWithResponse; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.xml.ws.Holder; + import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Ignore; @@ -38,8 +54,6 @@ import org.onap.so.db.catalog.beans.HeatTemplateParam; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResource; -import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; -import org.onap.so.db.catalog.data.repository.VnfResourceRepository; import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; @@ -47,25 +61,8 @@ import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.utils.MsoHeatUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import javax.xml.ws.Holder; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -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.urlPathEqualTo; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGetWithResponse; +import com.github.tomakehurst.wiremock.client.WireMock; public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @@ -80,13 +77,6 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; - @Before - public void before() throws Exception { - MockitoAnnotations.initMocks(this); - WireMock.reset(); - setUp(); - } - @Test @Ignore public void healthCheckVNFTest() { @@ -99,8 +89,8 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { StackInfo info = new StackInfo(); info.setStatus(HeatStatus.CREATED); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); MsoRequest msoRequest = getMsoRequest(); @@ -115,9 +105,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void createVnfTest_HeatStatusUpdating() throws Exception { expectedException.expect(VnfAlreadyExists.class); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Stack_Updating_VfModule.json") .withStatus(HttpStatus.SC_OK))); @@ -135,9 +125,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void createVnfTest_HeatStatusUpdated() throws Exception { expectedException.expect(VnfAlreadyExists.class); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_StackId.json") .withStatus(HttpStatus.SC_OK))); @@ -155,9 +145,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void createVnfTest_HeatStatusFailed() throws Exception { expectedException.expect(VnfAlreadyExists.class); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Stack_Failed_VfModule.json") .withStatus(HttpStatus.SC_OK))); @@ -175,9 +165,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void createVnfTest_HeatStatusCreated() throws Exception { expectedException.expect(VnfAlreadyExists.class); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackVfModule_200(); + mockOpenStackGetStackVfModule_200(wireMockServer); MsoRequest msoRequest = getMsoRequest(); @@ -206,8 +196,8 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void createVnfTest_NestedHeatStatusNotFound() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); MsoRequest msoRequest = getMsoRequest(); @@ -222,9 +212,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void createVnfTest_ExceptionInGettingNestedHeat() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); @@ -241,9 +231,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void createVnfTest_NestedBaseHeatStatus_NotFound() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json") .withStatus(HttpStatus.SC_OK))); @@ -261,10 +251,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void createVnfTest_ExceptionInGettingBaseNestedHeat() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); MsoRequest msoRequest = getMsoRequest(); @@ -279,10 +269,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void createVnfTest_ExceptionInCreateStack() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); VfModule vfModule = new VfModule(); @@ -311,10 +301,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void createVnfTest_ModelCustUuidIsNull() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); VfModule vfModule = new VfModule(); @@ -348,10 +338,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void createVnfTest_HeatEnvironment_ContainsParameters() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); MsoRequest msoRequest = getMsoRequest(); @@ -387,7 +377,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { public void updateVnfTest_HeatStackNotFound() throws Exception { expectedException.expect(VnfNotFound.class); MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", @@ -400,9 +390,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { public void updateVnfTest_ExceptionInGettingNestedHeatStack() throws Exception { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); Map<String, Object> map = new HashMap<>(); @@ -417,9 +407,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { public void updateVnfTest_NestedHeatStackNotFound() throws Exception { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_NOT_FOUND))); Map<String, Object> map = new HashMap<>(); @@ -434,10 +424,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { public void updateVnfTest_ExceptionInGettingNestedBaseHeatStack() throws Exception { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_INTERNAL_SERVER_ERROR,"OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_INTERNAL_SERVER_ERROR,"OpenstackResponse_Stack_Created_VfModule.json"); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", @@ -450,10 +440,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { public void updateVnfTest_NestedBaseHeatStackNotFound() throws Exception { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_NOT_FOUND,"OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_NOT_FOUND,"OpenstackResponse_Stack_Created_VfModule.json"); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", @@ -466,10 +456,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { public void updateVnfTest_MissingParams() throws Exception { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", @@ -482,10 +472,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { public void updateVnfTest_UpdateStackException() throws Exception { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); VfModuleCustomization vfModuleCustomization = getVfModuleCustomization(); vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); @@ -500,12 +490,12 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @Test public void updateVnfTest() throws Exception { MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/"+vnfName,HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenStackPutStack("null/stackId", HttpStatus.SC_OK); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/null/stackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/"+vnfName,HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenStackPutStack(wireMockServer, "null/stackId", HttpStatus.SC_OK); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/null/stackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json"); VfModuleCustomization vfModuleCustomization = getVfModuleCustomization(); vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java index fbb9a224b3..0ace6e4249 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java @@ -21,6 +21,17 @@ package org.onap.so.adapters.vnf; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.ws.Holder; + import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Rule; @@ -33,12 +44,6 @@ import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.VnfRollback; import org.springframework.beans.factory.annotation.Autowired; -import javax.xml.ws.Holder; -import java.util.HashMap; -import java.util.Map; - -import static com.github.tomakehurst.wiremock.client.WireMock.*; - public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { @Rule @@ -62,15 +67,15 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { @Test public void queryVnfExceptionTest() throws Exception { - reset(); - expectedException.expect(VnfException.class); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - + Holder <Map <String, String>> outputs = new Holder<>(); instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), new Holder<>(), - new Holder<>()); + outputs); + + assertTrue(outputs.value.isEmpty()); } @Test @@ -78,19 +83,19 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse() .withBody("{ \"id\": \"123\" }") .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse() .withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }") .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() + wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ") .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse() .withBodyFile("OpenstackResponse_Access.json") .withStatus(HttpStatus.SC_OK))); @@ -115,19 +120,19 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse() .withBody("{ \"id\": \"123\" }") .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse() .withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }") .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() + wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ") .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse() .withBodyFile("OpenstackResponse_Access.json") .withStatus(HttpStatus.SC_OK))); @@ -225,19 +230,19 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse() .withBody("{ \"id\": \"123\" }") .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse() .withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }") .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() + wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ") .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse() .withBodyFile("OpenstackResponse_Access.json") .withStatus(HttpStatus.SC_OK))); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java index 342a21a49c..152c23e9b8 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java @@ -20,31 +20,25 @@ package org.onap.so.adapters.vnf; +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.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.ws.Holder; + import org.apache.http.HttpStatus; -import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.onap.so.adapters.openstack.MsoOpenstackAdaptersApplication; -import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.cloud.CloudConfig; -import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.entity.MsoRequest; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.server.LocalServerPort; - -import javax.xml.ws.Holder; -import java.util.HashMap; -import java.util.Map; - -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.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ @Rule @@ -76,19 +70,19 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/vfname")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/vfname")).willReturn(aResponse() //.withHeader() .withStatus(HttpStatus.SC_NOT_FOUND))); - stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() //.withHeader() .withBodyFile("MulticloudResponse_Stack.json") .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/vfname/outputs")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/vfname/outputs")).willReturn(aResponse() .withStatus(HttpStatus.SC_NOT_FOUND))); - stubFor(post(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload")).willReturn(aResponse() + wireMockServer.stubFor(post(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload")).willReturn(aResponse() .withBodyFile("MulticloudResponse_Stack_Create.json") .withStatus(HttpStatus.SC_CREATED))); @@ -101,11 +95,11 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() .withBodyFile("MulticloudResponse_Stack.json") .withStatus(HttpStatus.SC_OK))); - stubFor(delete(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() + wireMockServer.stubFor(delete(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() .withStatus(HttpStatus.SC_NO_CONTENT))); instance.deleteVfModule("MTN13", "CloudOwner", "123", "workload-id", msoRequest, new Holder<>()); @@ -117,7 +111,7 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() + wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() .withBodyFile("MulticloudResponse_Stack.json") .withStatus(HttpStatus.SC_OK))); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java index 3dcb52b8b7..50272dca20 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java @@ -20,6 +20,19 @@ package org.onap.so.adapters.vnf; +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.urlPathEqualTo; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.ws.Holder; + import org.apache.http.HttpStatus; import org.junit.Rule; import org.junit.Test; @@ -29,19 +42,6 @@ import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.VnfRollback; import org.springframework.beans.factory.annotation.Autowired; -import javax.xml.ws.Holder; -import java.util.HashMap; -import java.util.Map; - -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.urlPathEqualTo; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; - public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { @Rule @@ -90,8 +90,8 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { @Test public void createVfModule_INSTANTIATED() throws Exception { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); @@ -105,7 +105,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { @Test public void createVfModule_queryVduNotFoundWithVolumeGroupId() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); @@ -118,9 +118,9 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { @Test public void createVfModule_CreateVduException() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json") .withStatus(HttpStatus.SC_OK))); @@ -144,13 +144,13 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { @Test public void deleteVfModule_DeleteVduException() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vSAMP12")) + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vSAMP12")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json") .withStatus(HttpStatus.SC_OK))); - stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); MsoRequest msoRequest = getMsoRequest(); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java index 50bae8a074..bf00faa41b 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java @@ -107,13 +107,13 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { CreateVfModuleRequest request = populateCreateVfModuleRequest(); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackVfModule_404(); + mockOpenStackGetStackVfModule_404(wireMockServer); - mockOpenStackPostStacks_200(); + mockOpenStackPostStacks_200(wireMockServer); - mockOpenStackGetStackVfModule_200(); + mockOpenStackGetStackVfModule_200(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers); @@ -141,10 +141,10 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { CreateVfModuleRequest request = populateCreateVfModuleRequest(); request.setNotificationUrl( createURLWithPort("/mso/WorkflowMesssage")); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - mockOpenStackPostStacks_200(); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackGetStackVfModule_200(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers); @@ -204,13 +204,13 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { request.setVfModuleParams(vfModuleParams); request.setMessageId(MESSAGE_ID); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackVfModule_404(); + mockOpenStackGetStackVfModule_404(wireMockServer); - mockOpenStackPostStacks_200(); + mockOpenStackPostStacks_200(wireMockServer); - mockOpenStackGetStackVfModule_200(); + mockOpenStackGetStackVfModule_200(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); @@ -272,15 +272,15 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { request.setVfModuleParams(vfModuleParams); request.setMessageId(MESSAGE_ID); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackVfModule_404(); + mockOpenStackGetStackVfModule_404(wireMockServer); - mockOpenStackGetStacks_404(); + mockOpenStackGetStacks_404(wireMockServer); - mockOpenStackPostStacks_200(); + mockOpenStackPostStacks_200(wireMockServer); - mockOpenStackGetStackVfModule_200(); + mockOpenStackGetStackVfModule_200(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers); @@ -291,7 +291,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - mockOpenStackGetStacksWithBody_200("DELETE_IN_PROGRESS"); + mockOpenStackGetStacksWithBody_200(wireMockServer, "DELETE_IN_PROGRESS"); response = restTemplate.exchange( createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, @@ -299,7 +299,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - mockOpenStackGetStacksWithBody_200("DELETE_FAILED"); + mockOpenStackGetStacksWithBody_200(wireMockServer, "DELETE_FAILED"); response = restTemplate.exchange( createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, @@ -307,7 +307,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE"); + mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE"); response = restTemplate.exchange( createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, @@ -315,7 +315,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - mockOpenStackGetStacksWithBody_404(); + mockOpenStackGetStacksWithBody_404(wireMockServer); response = restTemplate.exchange( createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, @@ -341,15 +341,15 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { request.setVnfId(AAI_VNF_ID); request.setMsoRequest(msoRequest); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackPostStacks_200(); + mockOpenStackPostStacks_200(wireMockServer); - mockOpenStackGetStacksStackId_404(); + mockOpenStackGetStacksStackId_404(wireMockServer); - mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockPort); + mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockServer, wireMockPort); - mockOpenStackDeletePublicUrlStackByNameAndID_204(); + mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); @@ -408,15 +408,15 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { request.setBackout(backout); request.setVfModuleParams(vfModuleParams); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStacksVfModuleWithLocationHeader_200(wireMockPort); + mockOpenStackGetStacksVfModuleWithLocationHeader_200(wireMockServer, wireMockPort); - mockOpenStackGetStacksVfModule_200(wireMockPort); + mockOpenStackGetStacksVfModule_200(wireMockServer, wireMockPort); - mockOpenStackGetStacksBaseStack_200(wireMockPort); + mockOpenStackGetStacksBaseStack_200(wireMockServer, wireMockPort); - mockOpenStackPutStacks_200(); + mockOpenStackPutStacks_200(wireMockServer); UpdateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( new File("src/test/resources/__files/UpdateVfModuleResponse.json"), UpdateVfModuleResponse.class); @@ -455,13 +455,13 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { RollbackVfModuleRequest request = new RollbackVfModuleRequest(); request.setVfModuleRollback(vfModuleRollback); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStacksStackId_200(wireMockPort); + mockOpenStackGetStacksStackId_200(wireMockServer, wireMockPort); - mockOpenStackDeleteStacks(); + mockOpenStackDeleteStacks(wireMockServer); - mockOpenStackGetStacksVUSP_404(); + mockOpenStackGetStacksVUSP_404(wireMockServer); headers.add("Accept", MediaType.APPLICATION_JSON); HttpEntity<RollbackVfModuleRequest> entity = new HttpEntity<RollbackVfModuleRequest>(request, headers); @@ -489,7 +489,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { .build().toString(); System.out.println(testUri); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); headers.add("Accept", MediaType.APPLICATION_JSON); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java index f602690a10..20372b81d9 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java @@ -50,9 +50,9 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { @Test public void testCreateVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackPostStacks_200(); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackGetStackVfModule_200(wireMockServer); CreateVolumeGroupRequest request = buildCreateVfModuleRequest(); HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); @@ -65,9 +65,9 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { @Test public void testCreateVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackPostStacks_200(); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackGetStackVfModule_200(wireMockServer); CreateVolumeGroupRequest request = buildCreateVfModuleRequest(); request.setNotificationUrl("http://localhost:8080"); @@ -80,7 +80,7 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { @Test public void testDeleteVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest(); HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers); ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange( @@ -91,7 +91,7 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { @Test public void testDeleteVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers); @@ -103,7 +103,7 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { @Test public void testRollbackVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest(); HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers); ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange( @@ -114,7 +114,7 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { @Test public void testRollbackVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers); @@ -126,8 +126,8 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { @Test public void testQueryVNFVolumes() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE"); javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID); builder.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID) .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true) @@ -142,8 +142,8 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { @Test public void testQueryVNFVolumesError() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE"); javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID); builder.queryParam("tenantId", TENANT_ID) .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true) @@ -158,10 +158,10 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { @Test public void testUpdateVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE"); - mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200); - mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE"); + mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME+"/stackId",200); + mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE"); UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest(); HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange( @@ -172,10 +172,10 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { @Test public void testUpdateVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE"); - mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200); - mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE"); + mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME+"/stackId",200); + mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE"); UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java index dba169c311..abdc2609a1 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java @@ -49,9 +49,9 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { @Test public void testCreateVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackPostStacks_200(); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackGetStackVfModule_200(wireMockServer); CreateVolumeGroupRequest request = buildCreateVfModuleRequest(); HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); @@ -64,9 +64,9 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { @Test public void testCreateVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackPostStacks_200(); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackGetStackVfModule_200(wireMockServer); CreateVolumeGroupRequest request = buildCreateVfModuleRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); @@ -78,7 +78,7 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { @Test public void testDeleteVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest(); HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers); ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange( @@ -89,7 +89,7 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { @Test public void testDeleteVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers); @@ -101,7 +101,7 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { @Test public void testRollbackVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest(); HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers); ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange( @@ -112,7 +112,7 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { @Test public void testRollbackVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers); @@ -124,8 +124,8 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { @Test public void testQueryVNFVolumes() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE"); javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID); builder.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID) .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true) @@ -140,8 +140,8 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { @Test public void testQueryVNFVolumesError() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE"); javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID); builder.queryParam("tenantId", TENANT_ID) .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true) @@ -155,10 +155,10 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { } @Test public void testUpdateVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE"); - mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200); - mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE"); + mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME+"/stackId",200); + mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE"); UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest(); HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange( @@ -169,10 +169,10 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { @Test public void testUpdateVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE"); - mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200); - mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE"); + mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME+"/stackId",200); + mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE"); UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java index 569a845caa..de12f2cfbe 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java @@ -27,7 +27,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; @@ -37,428 +36,430 @@ import java.io.IOException; import org.apache.http.HttpStatus; +import com.github.tomakehurst.wiremock.WireMockServer; + public class StubOpenStack { private static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0"; private static final String NETWORK_ID = "da886914-efb2-4917-b335-c8381528d90b"; private static final String NETWORK_NAME_2 = "stackname"; private static final String NETWORK_ID_2 = "stackId"; - public static void mockOpenStackResponseAccess(int port) throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") + public static void mockOpenStackResponseAccess(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access.json", port, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackResponseAccessMulticloud(int port) throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") + public static void mockOpenStackResponseAccessMulticloud(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_AccessMulticloud.json", port, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackResponseAccessQueryNetwork(int port) throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) + public static void mockOpenStackResponseAccessQueryNetwork(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) .withRequestBody(containing("tenantId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access_queryNetwork.json", port, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackResponseAccessAdmin(int port) throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") + public static void mockOpenStackResponseAccessAdmin(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFile("OpenstackResponse_Access_Admin.json", port, "/mockPublicUrl")) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPublicUrlStackByName_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME)).willReturn(aResponse() + public static void mockOpenStackPublicUrlStackByName_200(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME)).willReturn(aResponse() .withHeader("X-Openstack-Request-Id", "openstackRquest") .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME) .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME)) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPublicUrlStackByID_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_ID)).willReturn(aResponse() + public static void mockOpenStackPublicUrlStackByID_200(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_ID)).willReturn(aResponse() .withHeader("X-Openstack-Request-Id", "openstackRquest") .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME) .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME)) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetPublicUrlStackByNameAndID_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() + public static void mockOpenStackGetPublicUrlStackByNameAndID_200(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() .withHeader("X-Openstack-Request-Id", "openstackRquest") .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME) .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME)) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetPublicUrlStackByNameAndID_204(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() + public static void mockOpenStackGetPublicUrlStackByNameAndID_204(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() .withHeader("X-Openstack-Request-Id", "openstackRquest") .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID) .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME)) .withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackPutPublicUrlStackByNameAndID_200() { - stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() + public static void mockOpenStackPutPublicUrlStackByNameAndID_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200() { - stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME_2+"/"+NETWORK_ID_2)).willReturn(aResponse() + public static void mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME_2+"/"+NETWORK_ID_2)).willReturn(aResponse() .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackDeletePublicUrlStackByNameAndID_204() { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() + public static void mockOpenStackDeletePublicUrlStackByNameAndID_204(WireMockServer wireMockServer) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NO_CONTENT))); } - public static void mockOpenStackPostPublicUrlWithBodyFile_200() { - stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")) + public static void mockOpenStackPostPublicUrlWithBodyFile_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Stack.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetStackCreatedAppC_200() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3/stackId")) + public static void mockOpenStackGetStackCreatedAppC_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3/stackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Stack_Created.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetStackAppC_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3")) + public static void mockOpenStackGetStackAppC_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3")) .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackGetStackCreatedVUSP_200() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/stackId")) + public static void mockOpenStackGetStackCreatedVUSP_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/stackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Stack_Created.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetStackVUSP_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0")) + public static void mockOpenStackGetStackVUSP_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0")) .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackPostStack_200(String filename) { - stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse() + public static void mockOpenStackPostStack_200(WireMockServer wireMockServer, String filename) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPostNeutronNetwork_200(String filename) { - stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() + public static void mockOpenStackPostNeutronNetwork_200(WireMockServer wireMockServer, String filename) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPutNeutronNetwork_200(String filename,String networkId) { - stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse() + public static void mockOpenStackPutNeutronNetwork_200(WireMockServer wireMockServer, String filename,String networkId) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPutNeutronNetwork(String networkId, int responseCode) { - stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse() + public static void mockOpenStackPutNeutronNetwork(WireMockServer wireMockServer, String networkId, int responseCode) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withStatus(responseCode))); } - public static void mockOpenStackGetAllNeutronNetworks_200(String filename){ - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() + public static void mockOpenStackGetAllNeutronNetworks_200(WireMockServer wireMockServer, String filename){ + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetNeutronNetwork_404(String networkName) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkName)).willReturn(aResponse() + public static void mockOpenStackGetNeutronNetwork_404(WireMockServer wireMockServer, String networkName) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkName)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackGetAllNeutronNetworks_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() + public static void mockOpenStackGetAllNeutronNetworks_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenstackGetWithResponse(String url,int responseCode, String responseFile) { - stubFor(get(urlPathEqualTo(url)).willReturn(aResponse() + public static void mockOpenstackGetWithResponse(WireMockServer wireMockServer, String url,int responseCode, String responseFile) { + wireMockServer.stubFor(get(urlPathEqualTo(url)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile(responseFile) .withStatus(responseCode))); } - public static void mockOpenstackPostWithResponse(String url,int responseCode, String responseFile) { - stubFor(post(urlPathEqualTo(url)).willReturn(aResponse() + public static void mockOpenstackPostWithResponse(WireMockServer wireMockServer, String url,int responseCode, String responseFile) { + wireMockServer.stubFor(post(urlPathEqualTo(url)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile(responseFile) .withStatus(responseCode))); } - public static void mockOpenstackGet(String url,int responseCode) { - stubFor(get(urlPathEqualTo(url)).willReturn(aResponse() + public static void mockOpenstackGet(WireMockServer wireMockServer, String url,int responseCode) { + wireMockServer.stubFor(get(urlPathEqualTo(url)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withStatus(responseCode))); } - public static void mockOpenstackPost(String url,int responseCode) { - stubFor(post(urlPathEqualTo(url)).willReturn(aResponse() + public static void mockOpenstackPost(WireMockServer wireMockServer, String url,int responseCode) { + wireMockServer.stubFor(post(urlPathEqualTo(url)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withStatus(responseCode))); } - public static void mockOpenStackGetStackVfModule_200() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + public static void mockOpenStackGetStackVfModule_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json") .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetStackVfModule_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) + public static void mockOpenStackGetStackVfModule_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackPostStacks_200() { - stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")) + public static void mockOpenStackPostStacks_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Stack.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetStacks_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/3d7ff7b4-720b-4604-be0a-1974fc58ed96")) + public static void mockOpenStackGetStacks_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/3d7ff7b4-720b-4604-be0a-1974fc58ed96")) .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackGetStacksWithBody_200(String replaceWith) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) + public static void mockOpenStackGetStacksWithBody_200(WireMockServer wireMockServer, String replaceWith) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFileVnfAdapter(replaceWith)) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetStackWithBody_200(String replaceWith) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + public static void mockOpenStackGetStackWithBody_200(WireMockServer wireMockServer, String replaceWith) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFileVnfAdapter(replaceWith)) .withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetStacksWithBody_404() throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) + public static void mockOpenStackGetStacksWithBody_404(WireMockServer wireMockServer) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(getBodyFromFileVnfAdapter(null)) .withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackGetStacksStackId_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/stackId")) + public static void mockOpenStackGetStacksStackId_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/stackId")) .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackGetStacksVfModule_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse() + public static void mockOpenStackGetStacksVfModule_200(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse() .withHeader("X-Openstack-Request-Id", "openstackRquest") .withBody(getBodyFromFile("OpenstackResponse_VnfStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetStacksVfModuleWithLocationHeader_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse() + public static void mockOpenStackGetStacksVfModuleWithLocationHeader_200(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse() .withHeader("X-Openstack-Request-Id", "openstackRquest") .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001") .withBody(getBodyFromFile("OpenstackResponse_VnfStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetStacksBaseStack_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfModuleStackId")).willReturn(aResponse() + public static void mockOpenStackGetStacksBaseStack_200(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfModuleStackId")).willReturn(aResponse() .withHeader("X-Openstack-Request-Id", "openstackRquest") .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/baseVfModuleStackId") .withBody(getBodyFromFile("OpenstackResponse_VnfBaseStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPutStacks_200() { - stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse() + public static void mockOpenStackPutStacks_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse() .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPutStack(String networkId,int responseCode) { - stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+networkId)) + public static void mockOpenStackPutStack(WireMockServer wireMockServer, String networkId,int responseCode) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+networkId)) .willReturn(aResponse() .withHeader("Content-Type", "application/json") .withStatus(responseCode))); } - public static void mockOpenStackGetStacksStackId_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/StackId")).willReturn(aResponse() + public static void mockOpenStackGetStacksStackId_200(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/StackId")).willReturn(aResponse() .withHeader("X-Openstack-Request-Id", "openstackRquest") .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/stackId") .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackDeleteStacks() { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b")) + public static void mockOpenStackDeleteStacks(WireMockServer wireMockServer) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b")) .willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest"))); } - public static void mockOpenStackGetStacksVUSP_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b")) + public static void mockOpenStackGetStacksVUSP_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b")) .willReturn(aResponse() .withHeader("X-Openstack-Request-Id", "openstackRquest") .withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackGetStackCreated_200(String filename, String networkName) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)) + public static void mockOpenStackGetStackCreated_200(WireMockServer wireMockServer, String filename, String networkName) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetStack_404(String networkName) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)) + public static void mockOpenStackGetStack_404(WireMockServer wireMockServer, String networkName) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackGetStack_500(String networkName) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)) + public static void mockOpenStackGetStack_500(WireMockServer wireMockServer, String networkName) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); } - public static void mockOpenStackGetStackDeleteOrUpdateComplete_200(String filename) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) + public static void mockOpenStackGetStackDeleteOrUpdateComplete_200(WireMockServer wireMockServer, String filename) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetNeutronNetwork(String filename,String networkId,int status) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) + public static void mockOpenStackGetNeutronNetwork(WireMockServer wireMockServer, String filename,String networkId,int status) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile(filename).withStatus(status))); } - public static void mockOpenStackGetNeutronNetwork(String networkId,int status) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) + public static void mockOpenStackGetNeutronNetwork(WireMockServer wireMockServer, String networkId,int status) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(status))); } - public static void mockOpenStackDeleteStack_200() { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) + public static void mockOpenStackDeleteStack_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackDeleteStack_500() { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) + public static void mockOpenStackDeleteStack_500(WireMockServer wireMockServer) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) .willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); } - public static void mockOpenStackDeleteNeutronNetwork(String networkId,int responseCode) { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId)) + public static void mockOpenStackDeleteNeutronNetwork(WireMockServer wireMockServer, String networkId,int responseCode) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId)) .willReturn(aResponse().withStatus(responseCode))); } - public static void mockOpenStackPostMetadata_200() { - stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse() + public static void mockOpenStackPostMetadata_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Metadata.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetMetadata_200() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse() + public static void mockOpenStackGetMetadata_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Metadata.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPostTenantWithBodyFile_200() throws IOException { - stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")) + public static void mockOpenStackPostTenantWithBodyFile_200(WireMockServer wireMockServer) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")) .withRequestBody(equalToJson(readFile("src/test/resources/__files/OpenstackRequest_Tenant.json"))).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPostTenant_200() throws IOException { - stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")).willReturn(aResponse() + public static void mockOpenStackPostTenant_200(WireMockServer wireMockServer) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")).willReturn(aResponse() .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetTenantByName_200(String tenantName) { - stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse() + public static void mockOpenStackGetTenantByName_200(WireMockServer wireMockServer, String tenantName) { + wireMockServer.stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetTenantByName_404(String tenantName) { - stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse() + public static void mockOpenStackGetTenantByName_404(WireMockServer wireMockServer, String tenantName) { + wireMockServer.stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse() .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackGetTenantById_200(String tenantId) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() + public static void mockOpenStackGetTenantById_200(WireMockServer wireMockServer, String tenantId) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetTenantById_404(String tenantId) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() + public static void mockOpenStackGetTenantById_404(WireMockServer wireMockServer, String tenantId) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); } - public static void mockOpenStackDeleteTenantById_200(String tenantId) { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() + public static void mockOpenStackDeleteTenantById_200(WireMockServer wireMockServer, String tenantId) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetUser_200(String user) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)).willReturn(aResponse() + public static void mockOpenStackGetUser_200(WireMockServer wireMockServer, String user) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_User.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackGetRoles_200(String roleFor) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")).willReturn(aResponse() + public static void mockOpenStackGetRoles_200(WireMockServer wireMockServer, String roleFor) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBodyFile("OpenstackResponse_Roles.json").withStatus(HttpStatus.SC_OK))); } - public static void mockOpenStackPutRolesAdmin_200(String roleFor) { - stubFor(put(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/users/msoId/roles/" + roleFor + "/admin")).willReturn(aResponse() + public static void mockOpenStackPutRolesAdmin_200(WireMockServer wireMockServer, String roleFor) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/users/msoId/roles/" + roleFor + "/admin")).willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBody("").withStatus(HttpStatus.SC_OK))); } - public static void mockValetCreatePostResponse_200(String requestId, String body) { - stubFor(post(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)) + public static void mockValetCreatePostResponse_200(WireMockServer wireMockServer, String requestId, String body) { + wireMockServer.stubFor(post(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(body).withStatus(HttpStatus.SC_OK))); } - public static void mockValetCreatePutResponse_200(String requestId, String body) { - stubFor(put(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)) + public static void mockValetCreatePutResponse_200(WireMockServer wireMockServer, String requestId, String body) { + wireMockServer.stubFor(put(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(body).withStatus(HttpStatus.SC_OK))); } - public static void mockValetDeleteDeleteResponse_200(String requestId, String body) { - stubFor(delete(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)) + public static void mockValetDeleteDeleteResponse_200(WireMockServer wireMockServer, String requestId, String body) { + wireMockServer.stubFor(delete(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(body).withStatus(HttpStatus.SC_OK))); } - public static void mockValetConfirmPutRequest_200(String requestId, String body) { - stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/confirm/")) + public static void mockValetConfirmPutRequest_200(WireMockServer wireMockServer, String requestId, String body) { + wireMockServer.stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/confirm/")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(body).withStatus(HttpStatus.SC_OK))); } - public static void mockValetRollbackPutRequest_200(String requestId, String body) { - stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/rollback/")) + public static void mockValetRollbackPutRequest_200(WireMockServer wireMockServer, String requestId, String body) { + wireMockServer.stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/rollback/")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody(body).withStatus(HttpStatus.SC_OK))); } diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml index a4761adf62..4be3935cf4 100644 --- a/adapters/mso-requests-db-adapter/pom.xml +++ b/adapters/mso-requests-db-adapter/pom.xml @@ -190,6 +190,24 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <goals> + <goal>test</goal> + </goals> + <configuration> + <includes> + <include>**/AllTestsTestSuite.java</include> + </includes> + <parallel>suites</parallel> + </configuration> + </execution> + </executions> + </plugin> </plugins> <pluginManagement> <plugins> diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/AllTestsTestSuite.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/AllTestsTestSuite.java new file mode 100644 index 0000000000..f15a93eaeb --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/AllTestsTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.requestsdb; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses("**/*Test.class") +public class AllTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsSchedulerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsSchedulerTest.java index 1c7effd00a..4b783a781c 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsSchedulerTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsSchedulerTest.java @@ -21,33 +21,19 @@ package org.onap.so.adapters.requestsdb; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; import java.util.List; -import org.junit.Ignore; import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.data.repository.ArchivedInfraRequestsRepository; import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.data.domain.PageRequest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -@Transactional -public class ArchiveInfraRequestsSchedulerTest { +public class ArchiveInfraRequestsSchedulerTest extends RequestsAdapterBase { @Autowired private ArchiveInfraRequestsScheduler scheduler; diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java index 8fda355abb..c7804c8e0c 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java @@ -21,42 +21,34 @@ package org.onap.so.adapters.requestsdb; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.ws.rs.core.MediaType; + import org.junit.Before; -import org.junit.After; import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest; 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.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.util.UriComponentsBuilder; -import javax.ws.rs.core.MediaType; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.util.UUID; -import java.util.ArrayList; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") @Transactional -public class InfraActiveRequestsRepositoryCustomControllerTest { +public class InfraActiveRequestsRepositoryCustomControllerTest extends RequestsAdapterBase { @LocalServerPort private int port; diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java new file mode 100644 index 0000000000..cb6feacfb2 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java @@ -0,0 +1,14 @@ +package org.onap.so.adapters.requestsdb; + +import org.junit.runner.RunWith; +import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class RequestsAdapterBase { + +} diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java index 75c8f1af52..b911396370 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java @@ -20,32 +20,29 @@ package org.onap.so.adapters.requestsdb.adapters; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import java.util.Map; + import javax.ws.rs.core.Response; import org.json.JSONException; import org.junit.Test; -import org.junit.runner.RunWith; import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; +import org.onap.so.adapters.requestsdb.RequestsAdapterBase; import org.onap.so.adapters.requestsdb.application.TestAppender; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; + import ch.qos.logback.classic.spi.ILoggingEvent; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class HealthCheckHandlerTest { +public class HealthCheckHandlerTest extends RequestsAdapterBase { @LocalServerPort private int port; diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java index 963ef7c832..f6950d9777 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java @@ -29,17 +29,17 @@ import static org.junit.Assert.fail; import java.util.ArrayList; import java.util.List; import java.util.Map; + import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.onap.so.adapters.requestsdb.application.TestAppender; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter; import org.onap.so.adapters.requestsdb.RequestStatusType; -import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; +import org.onap.so.adapters.requestsdb.RequestsAdapterBase; +import org.onap.so.adapters.requestsdb.application.TestAppender; import org.onap.so.adapters.requestsdb.exceptions.MsoRequestsDbException; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.OperationStatus; @@ -48,19 +48,11 @@ import org.onap.so.db.request.data.repository.OperationStatusRepository; import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; import org.onap.so.requestsdb.RequestsDbConstant; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Bean; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; + import ch.qos.logback.classic.spi.ILoggingEvent; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class MSORequestDBImplTest { +public class MSORequestDBImplTest extends RequestsAdapterBase { @LocalServerPort private int port; @@ -81,13 +73,34 @@ public class MSORequestDBImplTest { } @Before - public void before(){ + public void before() throws MsoRequestsDbException{ JaxWsProxyFactoryBean jaxWsProxyFactory = new JaxWsProxyFactoryBean(); jaxWsProxyFactory.setServiceClass(MsoRequestsDbAdapter.class); jaxWsProxyFactory.setAddress("http://localhost:" + port + "/services/RequestsDbAdapter"); jaxWsProxyFactory.setUsername("bpel"); jaxWsProxyFactory.setPassword("mso-db-1507!"); dbAdapter = (MsoRequestsDbAdapter) jaxWsProxyFactory.create(); + + InfraActiveRequests testRequest = this.buildTestRequest(); + + dbAdapter.updateInfraRequest ( testRequest.getRequestId(), + testRequest.getLastModifiedBy(), + testRequest.getStatusMessage(), + testRequest.getResponseBody(), + RequestStatusType.valueOf(testRequest.getRequestStatus()), + testRequest.getProgress().toString(), + testRequest.getVnfOutputs(), + testRequest.getServiceInstanceId(), + testRequest.getNetworkId(), + testRequest.getVnfId(), + testRequest.getVfModuleId(), + testRequest.getVolumeGroupId(), + testRequest.getServiceInstanceName(), + testRequest.getConfigurationId(), + testRequest.getConfigurationName(), + testRequest.getVfModuleName()); + + } private InfraActiveRequests buildTestRequest() { @@ -108,8 +121,15 @@ public class MSORequestDBImplTest { testRequest.setVfModuleId("c7d527b1-7a91-49fd-b97d-1c8c0f4a7992"); testRequest.setVfModuleModelName("vSAMP10aDEV::base::module-0"); testRequest.setVnfId("b92f60c8-8de3-46c1-8dc1-e4390ac2b005"); - testRequest.setRequestUrl("http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances"); - + testRequest.setRequestUrl("http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances"); + testRequest.setVolumeGroupId("volumeGroupId"); + testRequest.setServiceInstanceName("serviceInstanceName"); + testRequest.setConfigurationId("configurationId"); + testRequest.setConfigurationName("configurationName"); + testRequest.setNetworkId("networkId"); + testRequest.setResponseBody("responseBody"); + testRequest.setVfModuleName("vfModuleName"); + testRequest.setVnfOutputs("vnfOutputs"); return testRequest; } @@ -155,7 +175,7 @@ public class MSORequestDBImplTest { fail("Null infraRequest"); // Then - assertThat(infraRequest, sameBeanAs(testRequest).ignoring("requestBody").ignoring("endTime").ignoring("startTime").ignoring("modifyTime")); + assertEquals(clientRequestId, infraRequest.getClientRequestId()); } @@ -221,6 +241,8 @@ public class MSORequestDBImplTest { InfraActiveRequests infraRequest = dbAdapter.getInfraRequest(clientRequestId); // Then assertThat(infraRequest, sameBeanAs(testRequest).ignoring("requestBody").ignoring("endTime").ignoring("startTime").ignoring("modifyTime")); + + } @Test diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java index 304b025bf8..467cb1ed23 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java @@ -23,6 +23,7 @@ package org.onap.so.adapters.requestsdb.client; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.onap.so.adapters.requestsdb.RequestsAdapterBase; import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.OperationStatus; @@ -47,10 +48,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertFalse; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class RequestsDbClientTest { +public class RequestsDbClientTest extends RequestsAdapterBase { @Autowired private RequestDbClientPortChanger requestsDbClient; diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml index 8e94db1aa0..7f03879507 100644 --- a/adapters/mso-sdnc-adapter/pom.xml +++ b/adapters/mso-sdnc-adapter/pom.xml @@ -67,6 +67,24 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <goals> + <goal>test</goal> + </goals> + <configuration> + <includes> + <include>**/AllTestsTestSuite.java</include> + </includes> + <parallel>suites</parallel> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> <dependencyManagement> diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/AllTestsTestSuite.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/AllTestsTestSuite.java new file mode 100644 index 0000000000..50a661a695 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/AllTestsTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses("**/*Test.class") +public class AllTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java index 9716bb624a..29921934dd 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java @@ -24,6 +24,7 @@ import org.junit.After; import org.junit.Rule; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; +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.web.client.TestRestTemplate; @@ -31,6 +32,8 @@ import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; +import com.github.tomakehurst.wiremock.WireMockServer; + @RunWith(SpringRunner.class) @SpringBootTest(classes = SDNCAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @@ -38,7 +41,10 @@ import org.springframework.test.context.junit4.SpringRunner; public abstract class BaseTest { @Rule public ExpectedException expectedException = ExpectedException.none(); - + + @Autowired + protected WireMockServer wireMockServer; + protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); @Value("${wiremock.server.port}") diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java index 01fa3db960..76dd003883 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java @@ -26,13 +26,12 @@ 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.urlPathEqualTo; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import org.apache.http.HttpStatus; import org.junit.Test; import org.onap.so.adapters.sdnc.BaseTest; import org.springframework.beans.factory.annotation.Autowired; -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.junit.Assert.assertTrue; public class SDNCRestClientTest extends BaseTest { @@ -48,7 +47,7 @@ public class SDNCRestClientTest extends BaseTest { rt.setReqMethod("POST"); rt.setSdncUrl("http://localhost:" + wireMockPort + "/sdnc"); - stubFor(post(urlPathEqualTo("/sdnc")) + wireMockServer.stubFor(post(urlPathEqualTo("/sdnc")) .willReturn(aResponse().withHeader("Content-Type", "application/xml").withBody("").withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); SDNCResponse response = sdncClient.getSdncResp("", rt); diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java index 849374838a..f8685738e0 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java @@ -20,15 +20,17 @@ package org.onap.so.adapters.sdnc.sdncrest; +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.urlPathEqualTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.apache.http.HttpStatus; import org.junit.Test; import org.onap.so.adapters.sdnc.BaseTest; import org.springframework.beans.factory.annotation.Autowired; -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - public class BPRestCallbackTest extends BaseTest { @Autowired @@ -44,7 +46,7 @@ public class BPRestCallbackTest extends BaseTest { "\t\t// </error>\n" + "\t\t// </errors>"; - stubFor(post(urlPathEqualTo("/sdnc")) + wireMockServer.stubFor(post(urlPathEqualTo("/sdnc")) .willReturn(aResponse().withHeader("Content-Type", "application/xml").withBody(response).withStatus(HttpStatus.SC_MULTIPLE_CHOICES))); boolean responseCommon = bpRestCallback.send("http://localhost:" + wireMockPort + "/sdnc", "Test"); diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java index 23830ae3f3..1de281bde4 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java @@ -20,18 +20,17 @@ package org.onap.so.adapters.sdnc.sdncrest; +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.urlPathEqualTo; +import static org.junit.Assert.assertNotNull; + import org.apache.http.HttpStatus; import org.junit.Test; import org.onap.so.adapters.sdnc.BaseTest; import org.onap.so.adapters.sdncrest.SDNCResponseCommon; import org.springframework.beans.factory.annotation.Autowired; -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.urlPathEqualTo; -import static org.junit.Assert.assertNotNull; -import static com.github.tomakehurst.wiremock.client.WireMock.*; - public class SDNCConnectorTest extends BaseTest { @Autowired @@ -54,7 +53,7 @@ public class SDNCConnectorTest extends BaseTest { rt.setReqMethod("POST"); rt.setSdncUrl("http://localhost:" + wireMockPort + "/sdnc"); - stubFor(post(urlPathEqualTo("/sdnc")) + wireMockServer.stubFor(post(urlPathEqualTo("/sdnc")) .willReturn(aResponse().withHeader("Content-Type", "application/xml").withBody(response).withStatus(HttpStatus.SC_MULTIPLE_CHOICES))); SDNCResponseCommon responseCommon = sdncConnector.send(content, rt); diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index 7b774a2cce..35fbf9108c 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -30,7 +30,6 @@ <version>0.7.7.201606060606</version> <configuration> <excludes> - + <exclude>**/resource-examples/**</exclude> </excludes> </configuration> @@ -143,6 +142,24 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <goals> + <goal>test</goal> + </goals> + <configuration> + <includes> + <include>**/AllTestsTestSuite.java</include> + </includes> + <parallel>suites</parallel> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> <dependencies> @@ -232,7 +249,7 @@ <groupId>org.antlr</groupId> <artifactId>antlr4</artifactId> <version>${antlr.version}</version> - + <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/AllTestsTestSuite.java b/asdc-controller/src/test/java/org/onap/so/asdc/AllTestsTestSuite.java new file mode 100644 index 0000000000..a100f26d5a --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/so/asdc/AllTestsTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.asdc; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses("**/*Test.class") +public class AllTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java index 74f0d60596..83d60aefea 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java @@ -29,6 +29,7 @@ import org.onap.so.asdc.installer.VfResourceStructure; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; import org.onap.so.asdc.tenantIsolation.WatchdogDistribution; import org.onap.so.spring.SpringContextHelper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer; import org.springframework.boot.test.context.SpringBootTest; @@ -39,6 +40,8 @@ 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; + @RunWith(SpringRunner.class) @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @@ -53,6 +56,8 @@ public abstract class BaseTest { protected WatchdogDistribution watchdogDistributionSpy; @SpyBean protected ToscaResourceInstaller toscaInstaller; + @Autowired + protected WireMockServer wireMockServer; @Value("${wiremock.server.port}") protected String wireMockPort; diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java index 85ecaaa3ea..03d0a0ff1e 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java @@ -21,7 +21,6 @@ package org.onap.so.asdc.client; import static com.github.tomakehurst.wiremock.client.WireMock.ok; 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.assertNull; @@ -144,7 +143,7 @@ public class ASDCControllerITTest extends BaseTest { String modelEndpoint = "/aai/v15/service-design-and-creation/models/model/" + serviceInvariantUuid + "/model-vers/model-ver/" + serviceUuid + "?depth=0"; - stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok())); + wireMockServer.stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok())); } /** diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index 546c4e2458..947da4f492 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -22,7 +22,6 @@ package org.onap.so.asdc.client.test.rest; 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.urlPathMatching; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; @@ -98,7 +97,7 @@ public class ASDCRestInterfaceTest extends BaseTest { @Transactional public void testAllottedResourceService() throws Exception { - stubFor(post(urlPathMatching("/aai/.*")) + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json"))); 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))); diff --git a/common/src/test/java/org/onap/so/client/HttpClientTest.java b/common/src/test/java/org/onap/so/client/HttpClientTest.java index 75ce5f322f..346bf1426d 100644 --- a/common/src/test/java/org/onap/so/client/HttpClientTest.java +++ b/common/src/test/java/org/onap/so/client/HttpClientTest.java @@ -25,18 +25,19 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; import static com.github.tomakehurst.wiremock.client.WireMock.exactly; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; -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.verify; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import com.github.tomakehurst.wiremock.junit.WireMockRule; import java.net.MalformedURLException; import java.net.URL; + import org.junit.Rule; import org.junit.Test; import org.onap.so.utils.TargetEntity; +import com.github.tomakehurst.wiremock.junit.WireMockRule; + public class HttpClientTest{ @@ -47,7 +48,7 @@ public class HttpClientTest{ @Test public void testPost_success() throws MalformedURLException{ - stubFor(post(urlEqualTo("/services/sdnc/post")) + wireMockRule.stubFor(post(urlEqualTo("/services/sdnc/post")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(""))); @@ -66,7 +67,7 @@ public class HttpClientTest{ @Test public void testPost_nullHeader() throws MalformedURLException{ - stubFor(post(urlEqualTo("/services/sdnc/post")) + wireMockRule.stubFor(post(urlEqualTo("/services/sdnc/post")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(""))); @@ -86,7 +87,7 @@ public class HttpClientTest{ @Test public void testPost_nullBasicAuth() throws MalformedURLException{ - stubFor(post(urlEqualTo("/services/sdnc/post")) + wireMockRule.stubFor(post(urlEqualTo("/services/sdnc/post")) .willReturn(aResponse().withStatus(200) .withHeader("Content-Type", "application/json") .withBody(""))); diff --git a/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java index f30d2e17aa..525dff7562 100644 --- a/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java +++ b/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java @@ -20,10 +20,6 @@ package org.onap.so.client.aai; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doNothing; @@ -34,7 +30,6 @@ import static org.mockito.Mockito.verify; import java.util.Optional; import java.util.UUID; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; @@ -42,18 +37,12 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.client.aai.entities.Configuration; import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; - -import com.github.tomakehurst.wiremock.junit.WireMockRule; @RunWith(MockitoJUnitRunner.class) public class AAIConfigurationClientTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443)); - @Mock AAIResourcesClient aaiClient; @@ -163,18 +152,4 @@ public class AAIConfigurationClientTest { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, uuid); assertEquals(uri, aaiConfigurationClient.getConfigurationURI(uuid)); } - - @Test - public void verifyNotExists() { - AAIUri path = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "test2"); - wireMockRule.stubFor(get( - urlMatching("/aai/v[0-9]+" + path.build() + ".*")) - .willReturn( - aResponse() - .withHeader("Content-Type", "text/plain") - .withBody("hello") - .withStatus(404))); - boolean result = aaiConfigurationClient.configurationExists("test2"); - assertEquals("path not found", false, result); - } } diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java index 5493d6778e..46e4c98b3e 100644 --- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java +++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java @@ -55,7 +55,7 @@ import com.github.tomakehurst.wiremock.junit.WireMockRule; public class AAIResourcesClientWithServiceInstanceUriTest { @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443)); + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort()); @Rule public ExpectedException thrown = ExpectedException.none(); @@ -69,8 +69,7 @@ public class AAIResourcesClientWithServiceInstanceUriTest { private ServiceInstanceUri uri; @Before public void setUp() { - - doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties(); + doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties(); wireMockRule.stubFor(get(urlMatching("/aai/v[0-9]+/nodes.*")) .willReturn(aResponse() .withStatus(404) diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java index 979ca39489..c369767e38 100644 --- a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java +++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java @@ -22,7 +22,6 @@ package org.onap.so.client.aai.entities.uri; 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.urlPathMatching; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; import static org.hamcrest.MatcherAssert.assertThat; @@ -197,7 +196,7 @@ public class ServiceInstanceUriTest { ServiceInstanceUri spy = spy(instance); AAIResourcesClient client = aaiClient; doReturn(client).when(spy).getResourcesClient(); - stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3")) + wireMockRule.stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3")) .willReturn(aResponse() .withStatus(404) .withHeader("Content-Type", "application/json") diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index 16dfa68244..1359a7f9db 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -233,6 +233,7 @@ <includes> <include>**/AllTestsTestSuite.java</include> </includes> + <parallel>suites</parallel> </configuration> </execution> </executions> diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java index 54e7b27168..170b305bb5 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java @@ -22,26 +22,28 @@ package org.onap.so.apihandlerinfra; -import com.github.tomakehurst.wiremock.client.WireMock; +import java.nio.file.Files; +import java.nio.file.Paths; + +import javax.transaction.Transactional; + import org.junit.After; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; 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.core.env.Environment; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; -import javax.transaction.Transactional; - -import java.nio.file.Files; -import java.nio.file.Paths; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.client.WireMock; @RunWith(SpringRunner.class) @SpringBootTest(classes = ApiHandlerApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -59,6 +61,9 @@ public abstract class BaseTest { @LocalServerPort private int port; + @Autowired + protected WireMockServer wireMockServer; + protected String createURLWithPort(String uri) { return "http://localhost:" + port + uri; } @@ -69,7 +74,7 @@ public abstract class BaseTest { @After public void tearDown(){ - WireMock.reset(); + wireMockServer.resetAll(); } public static String getResponseTemplate; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java index 8d5539cf8a..18eb46278d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java @@ -24,7 +24,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; 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.urlPathEqualTo; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; @@ -64,10 +63,10 @@ private final ObjectMapper mapper = new ObjectMapper(); @Before public void init() throws JsonProcessingException { - stubFor(post(urlPathEqualTo("/testOrchestrationUri")) + wireMockServer.stubFor(post(urlPathEqualTo("/testOrchestrationUri")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/infraActiveRequests/")).withRequestBody(equalToJson("{\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"Error parsing request: No valid requestorId is specified\",\"progress\":100,\"startTime\":1533541051247,\"endTime\":1533541051247,\"source\":null,\"vnfId\":null,\"vnfName\":null,\"vnfType\":null,\"serviceType\":null,\"aicNodeClli\":null,\"tenantId\":null,\"provStatus\":null,\"vnfParams\":null,\"vnfOutputs\":null,\"requestBody\":\"{\\r\\n \\\"service\\\":{\\r\\n \\\"name\\\":\\\"so_test4\\\",\\r\\n \\\"description\\\":\\\"so_test2\\\",\\r\\n \\\"serviceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561519\\\",\\r\\n \\\"serviceUuid\\\":\\\"592f9437-a9c0-4303-b9f6-c445bb7e9814\\\",\\r\\n \\\"globalSubscriberId\\\":\\\"123457\\\",\\r\\n \\\"serviceType\\\":\\\"voLTE\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"resources\\\":[\\r\\n {\\r\\n \\\"resourceName\\\":\\\"vIMS\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561516\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561512\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-vBAS-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-vMME-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"vEPC\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"61c3e96e-0970-4871-b6e0-3b6de7561516\\\",\\r\\n \\\"resourceUuid\\\":\\\"62c3e96e-0970-4871-b6e0-3b6de7561512\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-CSCF-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad1\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"underlayvpn\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561513\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561514\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"overlayvpn\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561517\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561518\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n\\r\\n ]\\r\\n }\\r\\n }\\r\\n ],\\r\\n \\\"requestInputs\\\":{\\r\\n \\\"externalDataNetworkName\\\":\\\"Flow_out_net\\\",\\r\\n \\\"m6000_mng_ip\\\":\\\"181.18.20.2\\\",\\r\\n \\\"externalCompanyFtpDataNetworkName\\\":\\\"Flow_out_net\\\",\\r\\n \\\"externalPluginManageNetworkName\\\":\\\"plugin_net_2014\\\",\\r\\n \\\"externalManageNetworkName\\\":\\\"mng_net_2017\\\",\\r\\n \\\"sfc_data_network\\\":\\\"sfc_data_net_2016\\\",\\r\\n \\\"NatIpRange\\\":\\\"210.1.1.10-210.1.1.20\\\",\\r\\n \\\"location\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\",\\r\\n \\\"sdncontroller\\\":\\\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\\\"\\r\\n }\\r\\n }\\r\\n\\r\\n }\\r\\n\\r\\n}\",\"responseBody\":null,\"lastModifiedBy\":\"APIH\",\"modifyTime\":null,\"requestType\":null,\"volumeGroupId\":null,\"volumeGroupName\":null,\"vfModuleId\":null,\"vfModuleName\":null,\"vfModuleModelName\":null,\"aaiServiceId\":null,\"aicCloudRegion\":null,\"callBackUrl\":null,\"correlator\":null,\"serviceInstanceId\":null,\"serviceInstanceName\":null,\"requestScope\":\"service\",\"requestAction\":\"createInstance\",\"networkId\":null,\"networkName\":null,\"networkType\":null,\"requestorId\":null,\"configurationId\":null,\"configurationName\":null,\"operationalEnvId\":null,\"operationalEnvName\":null,\"requestURI\":\"d167c9d0-1785-4e93-b319-996ebbcc3272\"}")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/")).withRequestBody(equalToJson("{\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"Error parsing request: No valid requestorId is specified\",\"progress\":100,\"startTime\":1533541051247,\"endTime\":1533541051247,\"source\":null,\"vnfId\":null,\"vnfName\":null,\"vnfType\":null,\"serviceType\":null,\"aicNodeClli\":null,\"tenantId\":null,\"provStatus\":null,\"vnfParams\":null,\"vnfOutputs\":null,\"requestBody\":\"{\\r\\n \\\"service\\\":{\\r\\n \\\"name\\\":\\\"so_test4\\\",\\r\\n \\\"description\\\":\\\"so_test2\\\",\\r\\n \\\"serviceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561519\\\",\\r\\n \\\"serviceUuid\\\":\\\"592f9437-a9c0-4303-b9f6-c445bb7e9814\\\",\\r\\n \\\"globalSubscriberId\\\":\\\"123457\\\",\\r\\n \\\"serviceType\\\":\\\"voLTE\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"resources\\\":[\\r\\n {\\r\\n \\\"resourceName\\\":\\\"vIMS\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561516\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561512\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-vBAS-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-vMME-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"vEPC\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"61c3e96e-0970-4871-b6e0-3b6de7561516\\\",\\r\\n \\\"resourceUuid\\\":\\\"62c3e96e-0970-4871-b6e0-3b6de7561512\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-CSCF-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad1\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"underlayvpn\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561513\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561514\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"overlayvpn\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561517\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561518\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n\\r\\n ]\\r\\n }\\r\\n }\\r\\n ],\\r\\n \\\"requestInputs\\\":{\\r\\n \\\"externalDataNetworkName\\\":\\\"Flow_out_net\\\",\\r\\n \\\"m6000_mng_ip\\\":\\\"181.18.20.2\\\",\\r\\n \\\"externalCompanyFtpDataNetworkName\\\":\\\"Flow_out_net\\\",\\r\\n \\\"externalPluginManageNetworkName\\\":\\\"plugin_net_2014\\\",\\r\\n \\\"externalManageNetworkName\\\":\\\"mng_net_2017\\\",\\r\\n \\\"sfc_data_network\\\":\\\"sfc_data_net_2016\\\",\\r\\n \\\"NatIpRange\\\":\\\"210.1.1.10-210.1.1.20\\\",\\r\\n \\\"location\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\",\\r\\n \\\"sdncontroller\\\":\\\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\\\"\\r\\n }\\r\\n }\\r\\n\\r\\n }\\r\\n\\r\\n}\",\"responseBody\":null,\"lastModifiedBy\":\"APIH\",\"modifyTime\":null,\"requestType\":null,\"volumeGroupId\":null,\"volumeGroupName\":null,\"vfModuleId\":null,\"vfModuleName\":null,\"vfModuleModelName\":null,\"aaiServiceId\":null,\"aicCloudRegion\":null,\"callBackUrl\":null,\"correlator\":null,\"serviceInstanceId\":null,\"serviceInstanceName\":null,\"requestScope\":\"service\",\"requestAction\":\"createInstance\",\"networkId\":null,\"networkName\":null,\"networkType\":null,\"requestorId\":null,\"configurationId\":null,\"configurationName\":null,\"operationalEnvId\":null,\"operationalEnvName\":null,\"requestURI\":\"d167c9d0-1785-4e93-b319-996ebbcc3272\"}")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); @@ -77,12 +76,12 @@ private final ObjectMapper mapper = new ObjectMapper(); serviceRecipe.setRecipeTimeout(180); serviceRecipe.setOrchestrationUri("/testOrchestrationUri"); - stubFor(get(urlPathEqualTo("/service/search/findFirstByModelNameOrderByModelVersionDesc")) + wireMockServer.stubFor(get(urlPathEqualTo("/service/search/findFirstByModelNameOrderByModelVersionDesc")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/serviceRecipe/search/findFirstByServiceModelUUIDAndAction")) + wireMockServer.stubFor(get(urlPathEqualTo("/serviceRecipe/search/findFirstByServiceModelUUIDAndAction")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -160,7 +159,7 @@ private final ObjectMapper mapper = new ObjectMapper(); @Test public void getE2EServiceInstanceNullOperationalStatus() throws IOException{ String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e/operations/9b9f02c0-298b-458a-bc9c-be3692e4f35e"; - stubFor(get(urlPathEqualTo("/operationStatus/search/findOneByServiceIdAndOperationId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationStatus/search/findOneByServiceIdAndOperationId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); ResponseEntity<String> response = sendRequest(inputStream("/Request.json"), uri, HttpMethod.GET); @@ -196,7 +195,7 @@ private final ObjectMapper mapper = new ObjectMapper(); OperationStatus status = new OperationStatus(); status.setOperationId("operationId"); status.setServiceId("9b9f02c0-298b-458a-bc9c-be3692e4f35e"); - stubFor(get(urlPathEqualTo("/operationStatus/search/findOneByServiceIdAndOperationId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationStatus/search/findOneByServiceIdAndOperationId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(status)) .withStatus(HttpStatus.SC_OK))); @@ -215,7 +214,7 @@ private final ObjectMapper mapper = new ObjectMapper(); } @Test public void compareModelWithTargetVersion() throws IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("Camunda/SuccessfulResponse.json").withStatus(org.apache.http.HttpStatus.SC_ACCEPTED))); @@ -229,7 +228,7 @@ private final ObjectMapper mapper = new ObjectMapper(); } @Test public void compareModelWithTargetVersionEmptyResponse() throws IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) .willReturn(aResponse().withFault(Fault.EMPTY_RESPONSE))); RequestError expectedResponse = new RequestError(); @@ -247,7 +246,7 @@ private final ObjectMapper mapper = new ObjectMapper(); } @Test public void compareModelWithTargetVersionBadBpelResponse() throws IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY))); @@ -260,7 +259,7 @@ private final ObjectMapper mapper = new ObjectMapper(); } @Test public void compareModelWithTargetVersionNoBPELResponse() throws IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody("{}").withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java index 146062533e..b70322cecf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java @@ -24,7 +24,6 @@ package org.onap.so.apihandlerinfra; 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.urlMatching; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; @@ -101,7 +100,7 @@ public class InstanceManagementTest extends BaseTest{ } catch (MalformedURLException e) { e.printStackTrace(); } - stubFor(post(urlMatching(".*/infraActiveRequests.*")) + wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); } @@ -155,11 +154,11 @@ public class InstanceManagementTest extends BaseTest{ @Test public void executeCustomWorkflow() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/VnfInPlaceUpdate")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/VnfInPlaceUpdate")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]" + + wireMockServer.stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]" + "nfRole=GR-API-DEFAULT&action=inPlaceSoftwareUpdate")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfRecipeInPlaceUpdate_Response.json")) diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java index 1943b42404..a22e61e75f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java @@ -22,8 +22,8 @@ package org.onap.so.apihandlerinfra; 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.urlPathEqualTo; +import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -75,7 +75,7 @@ public class ManualTasksTest extends BaseTest{ @Test public void testCreateOpEnvObjectMapperError() throws IOException { TestAppender.events.clear(); - stubFor(post(urlPathEqualTo("/sobpmnengine/task/55/complete")) + wireMockServer.stubFor(post(urlPathEqualTo("/sobpmnengine/task/55/complete")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); String taskId = "55"; @@ -212,7 +212,7 @@ public class ManualTasksTest extends BaseTest{ } @Test public void completeTaskBpelResponseError() throws IOException { - stubFor(post(urlPathEqualTo("/sobpmnengine/task/55/complete")) + wireMockServer.stubFor(post(urlPathEqualTo("/sobpmnengine/task/55/complete")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withFault(Fault.EMPTY_RESPONSE))); String taskId = "55"; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java index 28797d247b..e96558171d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java @@ -26,7 +26,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; 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.urlPathEqualTo; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; @@ -423,10 +422,10 @@ public class OrchestrationRequestsTest extends BaseTest { public void setupTestGetOrchestrationRequest() throws Exception{ //For testGetOrchestrationRequest - stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequest.json")))) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/")) + wireMockServer.stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/")) .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json")))) @@ -434,10 +433,10 @@ public class OrchestrationRequestsTest extends BaseTest { } public void setupTestGetOrchestrationRequestInstanceGroup() throws Exception{ //For testGetOrchestrationRequest - stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json")))) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/")) + wireMockServer.stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/")) .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json")))) @@ -445,13 +444,13 @@ public class OrchestrationRequestsTest extends BaseTest { } private void setupTestGetOrchestrationRequestRequestDetails(String requestId, String status) throws Exception{ - stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequestDetails.json")))) .withStatus(HttpStatus.SC_OK))); } private void setupTestUnlockOrchestrationRequest(String requestId, String status) { - stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(String.format(getResponseTemplate, requestId, status)) .withStatus(HttpStatus.SC_OK))); @@ -460,24 +459,24 @@ public class OrchestrationRequestsTest extends BaseTest { private void setupTestUnlockOrchestrationRequest_invalid_Json() { - stubFor(get(urlPathEqualTo(getTestUrl(INVALID_REQUEST_ID))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(INVALID_REQUEST_ID))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_NOT_FOUND))); } private void setupTestUnlockOrchestrationRequest_Valid_Status(String requestID, String status) { - stubFor(get(urlPathEqualTo(getTestUrl(requestID))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestID))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(String.format(getResponseTemplate, requestID, status)) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo(getTestUrl(""))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl(""))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(String.format(infraActivePost, requestID)) .withStatus(HttpStatus.SC_OK))); } private void setupTestGetOrchestrationRequestFilter() throws Exception{ //for testGetOrchestrationRequestFilter(); - stubFor(any(urlPathEqualTo("/infraActiveRequests/getOrchestrationFiltersFromInfraActive/")).withRequestBody(equalToJson("{\"modelType\":[\"EQUALS\",\"vfModule\"]}")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/getOrchestrationFiltersFromInfraActive/")).withRequestBody(equalToJson("{\"modelType\":[\"EQUALS\",\"vfModule\"]}")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json")))) .withStatus(HttpStatus.SC_OK))); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java index b1a6e9f826..a5f9514be2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java @@ -24,7 +24,6 @@ package org.onap.so.apihandlerinfra; 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.urlMatching; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -108,7 +107,7 @@ public class RequestHandlerUtilsTest extends BaseTest{ } catch (MalformedURLException e) { e.printStackTrace(); } - stubFor(post(urlMatching(".*/infraActiveRequests.*")) + wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); } @@ -184,7 +183,7 @@ public class RequestHandlerUtilsTest extends BaseTest{ Service defaultService = new Service(); defaultService.setServiceType("testServiceTypeALaCarte"); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); @@ -208,7 +207,7 @@ public class RequestHandlerUtilsTest extends BaseTest{ Service defaultService = new Service(); defaultService.setServiceType("testServiceType"); - stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a")) + wireMockServer.stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); @@ -232,10 +231,10 @@ public class RequestHandlerUtilsTest extends BaseTest{ Service defaultService = new Service(); defaultService.setServiceType("testServiceType"); - stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a")) + wireMockServer.stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_NOT_FOUND))); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); @@ -281,7 +280,7 @@ public class RequestHandlerUtilsTest extends BaseTest{ } @Test public void camundaHistoryCheckTest() throws ContactCamundaException, RequestDbFailureException{ - stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) + wireMockServer.stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/HistoryCheckResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -293,7 +292,7 @@ public class RequestHandlerUtilsTest extends BaseTest{ } @Test public void camundaHistoryCheckNoneFoundTest() throws ContactCamundaException, RequestDbFailureException{ - stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) + wireMockServer.stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody("[]").withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -305,7 +304,7 @@ public class RequestHandlerUtilsTest extends BaseTest{ } @Test public void camundaHistoryCheckNotInProgressTest()throws ContactCamundaException, RequestDbFailureException{ - stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) + wireMockServer.stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/HistoryCheckResponseCompleted.json").withStatus(org.apache.http.HttpStatus.SC_OK))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index 639367074b..52021c3587 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -24,7 +24,6 @@ package org.onap.so.apihandlerinfra; 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.urlMatching; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; @@ -48,8 +47,6 @@ import static org.onap.so.logger.HttpHeadersConstants.TRANSACTION_ID; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Paths; @@ -131,7 +128,7 @@ public class ServiceInstancesTest extends BaseTest{ } catch (MalformedURLException e) { e.printStackTrace(); } - stubFor(post(urlMatching(".*/infraActiveRequests.*")) + wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); } @@ -197,16 +194,16 @@ public class ServiceInstancesTest extends BaseTest{ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -266,17 +263,17 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/CreateGenericALaCarteServiceInstance")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CreateGenericALaCarteServiceInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -306,17 +303,17 @@ public class ServiceInstancesTest extends BaseTest{ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY))); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -337,15 +334,15 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY).withBody("{}"))); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -366,15 +363,15 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withFault(Fault.EMPTY_RESPONSE))); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -395,13 +392,13 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search/findFirstByServiceModelUUIDAndAction?serviceModelUUID=d88da85c-d9e8-4f73-b837-3a72a431622a&action=activateInstance")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search/findFirstByServiceModelUUIDAndAction?serviceModelUUID=d88da85c-d9e8-4f73-b837-3a72a431622a&action=activateInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_NOT_FOUND))); @@ -412,12 +409,12 @@ public class ServiceInstancesTest extends BaseTest{ uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate"; Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_NOT_FOUND))); @@ -436,16 +433,16 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -474,21 +471,21 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -517,21 +514,21 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -559,21 +556,21 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -602,21 +599,21 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/search/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -635,7 +632,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createPortConfiguration() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); //expected response @@ -661,7 +658,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void deletePortConfiguration() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -680,7 +677,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void enablePort() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); //expected response @@ -698,7 +695,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void disablePort() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); //expected response @@ -716,7 +713,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void activatePort() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); //expected response @@ -734,7 +731,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void deactivatePort() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); //expected response @@ -752,7 +749,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void addRelationships() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); //expected response @@ -770,7 +767,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void removeRelationships() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); //expected response @@ -788,22 +785,22 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createVnfInstanceNoALaCarte() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_ReplaceVnf_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vnfResources")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vnfResources")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResources_ReplaceVnf_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=createInstance")) + wireMockServer.stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=createInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfRecipeReplaceInstance_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -823,26 +820,26 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createVnfInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/5df8b6de-2083-11e7-93ae-92361f002672")) + wireMockServer.stubFor(get(urlMatching(".*/service/5df8b6de-2083-11e7-93ae-92361f002672")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("serviceVnf_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/5df8b6de-2083-11e7-93ae-92361f002672/vnfCustomizations")) + wireMockServer.stubFor(get(urlMatching(".*/service/5df8b6de-2083-11e7-93ae-92361f002672/vnfCustomizations")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomizationsList_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vnfResources")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vnfResources")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourcesCreateVnf_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=createInstance")) + wireMockServer.stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=createInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfRecipeCreateInstance_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -879,21 +876,21 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void replaceVnfInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_ReplaceVnf_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vnfResources")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vnfResources")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResources_ReplaceVnf_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=replaceInstance")) + wireMockServer.stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=replaceInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfRecipeReplaceInstance_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -912,21 +909,21 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void replaceVnfRecreateInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/RecreateInfraVce")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/RecreateInfraVce")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResources_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=TEST&action=replaceInstance")) + wireMockServer.stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=TEST&action=replaceInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfRecipe_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -947,21 +944,21 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void recreateVnfInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_Response")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResources_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=recreateInstance")) + wireMockServer.stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=recreateInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfRecipe_ResponseWorkflowAction.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -982,21 +979,21 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void updateVnfInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResources_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" + "[?]nfRole=GR-API-DEFAULT&action=updateInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("UpdateVnfRecipe_Response.json")) @@ -1017,12 +1014,12 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void applyUpdatedConfig() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/VnfConfigUpdate")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/VnfConfigUpdate")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" + "[?]nfRole=GR-API-DEFAULT&action=applyUpdatedConfig")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfRecipeApplyUpdatedConfig_Response.json")) @@ -1043,11 +1040,11 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void deleteVnfInstanceV5() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" + "[?]nfRole=GR-API-DEFAULT&action=deleteInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfRecipeDelete_Response.json")) @@ -1067,26 +1064,26 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createVfModuleInstance() throws IOException { - stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomization_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/vfModule")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/vfModule")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModule/20c4431c-246d-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vfModule/20c4431c-246d-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/mso/async/services/CreateVfModuleInfra")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CreateVfModuleInfra")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + "[?]vfModuleModelUUID=20c4431c-246d-11e7-93ae-92361f002671&vnfComponentType=vfModule&action=createInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipe_Response.json")) @@ -1107,44 +1104,44 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createVfModuleInstanceNoModelCustomization() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/CreateVfModuleInfra")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CreateVfModuleInfra")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fe")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fe")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceForVfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/search/findByModelInstanceNameAndVnfResources" + + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/search/findByModelInstanceNameAndVnfResources" + "[?]modelInstanceName=test&vnfResourceModelUUID=fe6478e4-ea33-3346-ac12-ab121484a3fe")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomizationForVfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationsPCM_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/search/findByModelCustomizationUUIDAndVfModuleModelUUID[?]" + + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/search/findByModelCustomizationUUIDAndVfModuleModelUUID[?]" + "modelCustomizationUUID=b4ea86b4-253f-11e7-93ae-92361f002672&vfModuleModelUUID=066de97e-253e-11e7-93ae-92361f002672")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationPCM_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModulePCM_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModule/066de97e-253e-11e7-93ae-92361f002672")) + wireMockServer.stubFor(get(urlMatching(".*/vfModule/066de97e-253e-11e7-93ae-92361f002672")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModulePCM_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVnfComponentTypeAndAction" + "[?]vnfComponentType=vfModule&action=createInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeVNF_API_Response.json")) @@ -1165,41 +1162,41 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void deleteVfModuleInstanceNoMatchingModelUUD() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResource/.*")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResource/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceForVfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/search/findByModelInstanceNameAndVnfResources.*")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/search/findByModelInstanceNameAndVnfResources.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomizationForVfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationsPCM_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationPCM_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModulePCM_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModule/066de97e-253e-11e7-93ae-92361f002672")) + wireMockServer.stubFor(get(urlMatching(".*/vfModule/066de97e-253e-11e7-93ae-92361f002672")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModulePCM_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=deleteInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeDeleteVfModule_Response.json")) @@ -1223,23 +1220,23 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void createVfModuleInstanceNoRecipe() throws IOException { - stubFor(get(urlMatching(".*/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fe")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fe")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceForVfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/search/findByModelInstanceNameAndVnfResources" + + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/search/findByModelInstanceNameAndVnfResources" + "[?]modelInstanceName=test&vnfResourceModelUUID=fe6478e4-ea33-3346-ac12-ab121484a3fe")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomizationForVfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationsPCM_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/search/findByModelCustomizationUUIDAndVfModuleModelUUID[?]" + + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/search/findByModelCustomizationUUIDAndVfModuleModelUUID[?]" + "modelCustomizationUUID=b4ea86b4-253f-11e7-93ae-92361f002672&vfModuleModelUUID=066de97e-253e-11e7-93ae-92361f002672")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationPCM_Response.json")) @@ -1254,17 +1251,17 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void replaceVfModuleInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModule/search/findFirstVfModuleByModelInvariantUUIDAndModelVersion[?]" + + wireMockServer.stubFor(get(urlMatching(".*/vfModule/search/findFirstVfModuleByModelInvariantUUIDAndModelVersion[?]" + "modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671&modelVersion=2")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=replaceInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeDeleteVfModule_Response.json")) @@ -1284,26 +1281,26 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void updateVfModuleInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomization_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/vfModule")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/vfModule")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModule/20c4431c-246d-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vfModule/20c4431c-246d-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=updateInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipe_GRAPI_Response.json")) @@ -1349,11 +1346,11 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void inPlaceSoftwareUpdate() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/VnfInPlaceUpdate")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/VnfInPlaceUpdate")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]" + + wireMockServer.stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]" + "nfRole=GR-API-DEFAULT&action=inPlaceSoftwareUpdate")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfRecipeInPlaceUpdate_Response.json")) @@ -1375,17 +1372,17 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void deleteVfModuleInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModule/search/findFirstVfModuleByModelInvariantUUIDAndModelVersion[?]" + + wireMockServer.stubFor(get(urlMatching(".*/vfModule/search/findFirstVfModuleByModelInvariantUUIDAndModelVersion[?]" + "modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671&modelVersion=2")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=deleteInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeDeleteVfModule_Response.json")) @@ -1406,11 +1403,11 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void deleteVfModuleNoModelInvariantId() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + "[?]vfModuleModelUUID=VNF-API-DEFAULT&vnfComponentType=vfModule&action=deleteInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeDeleteVfModule_Response.json")) @@ -1431,17 +1428,17 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void deactivateAndCloudDeleteVfModuleInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModule/search/findFirstVfModuleByModelInvariantUUIDAndModelVersion[?]" + + wireMockServer.stubFor(get(urlMatching(".*/vfModule/search/findFirstVfModuleByModelInvariantUUIDAndModelVersion[?]" + "modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671&modelVersion=2")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=deactivateAndCloudDelete")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeDeactivate_Response.json")) @@ -1462,21 +1459,21 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createVolumeGroupInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationVolGrp_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/vfModule")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/vfModule")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleVolGroup_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=volumeGroup&action=createInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeVolGrp_GRAPI_Response.json")) @@ -1498,21 +1495,21 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void updateVolumeGroupInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationVolGrp_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/vfModule")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/vfModule")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleVolGroup_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=volumeGroup&action=updateInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeVolGrp_GRAPI_Response.json")) @@ -1533,25 +1530,25 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void deleteVolumeGroupInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationVolGrp_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/vfModule")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/vfModule")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleVolGroup_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=volumeGroup&action=deleteInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeVolGrp_GRAPI_Response.json")) @@ -1572,21 +1569,21 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createNetworkInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + + wireMockServer.stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + "modelName=GR-API-DEFAULT&action=createInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")) @@ -1607,21 +1604,21 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void updateNetworkInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + + wireMockServer.stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + "modelName=GR-API-DEFAULT&action=updateInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")) @@ -1642,21 +1639,21 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void deleteNetworkInstance() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + + wireMockServer.stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + "modelName=VNF-API-DEFAULT&action=deleteInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")) @@ -1677,11 +1674,11 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void deleteNetworkInstanceNoReqParams() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + + wireMockServer.stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + "modelName=GR-API-DEFAULT&action=deleteInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")) @@ -1731,7 +1728,7 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void creatServiceInstanceGRTestApiNoCustomRecipeFound() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -1744,12 +1741,12 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -1771,21 +1768,21 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void createNetworkInstanceTestApiUndefinedUsePropertiesDefault() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + + wireMockServer.stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + "modelName=GR-API-DEFAULT&action=createInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")) @@ -1808,7 +1805,7 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void createNetworkInstanceTestApiIncorrectUsePropertiesDefault() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -1826,21 +1823,21 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void createNetworkInstanceTestApiGrApi() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + + wireMockServer.stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + "modelName=GR-API-DEFAULT&action=createInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")) @@ -1863,21 +1860,21 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void createNetworkInstanceTestApiVnfApi() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/CreateNetworkInstance")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CreateNetworkInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json")) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + + wireMockServer.stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + "modelName=VNF-API-DEFAULT&action=createInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkRecipeVNF_API_Response.json")) @@ -1909,16 +1906,16 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -1960,16 +1957,16 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponseInvalid2.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -1993,16 +1990,16 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/UnauthorizedResponse.json").withStatus(org.apache.http.HttpStatus.SC_UNAUTHORIZED))); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -2027,16 +2024,16 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponseInvalid.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -2059,20 +2056,20 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/CreateMacroServiceNetworkVnf")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CreateMacroServiceNetworkVnf")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponseInvalid.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -2128,32 +2125,32 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void scaleOutVfModule() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomization_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/vfModule")) + wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/vfModule")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModule/20c4431c-246d-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vfModule/20c4431c-246d-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" + "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=scaleOut")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeVfModuleScaleOut_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vfModule/search/findByModelInvariantUUIDOrderByModelVersionDesc[?]modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671")) + wireMockServer.stubFor(get(urlMatching(".*/vfModule/search/findByModelInvariantUUIDOrderByModelVersionDesc[?]modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModulesListByInvariantId_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -2182,16 +2179,16 @@ public class ServiceInstancesTest extends BaseTest{ Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestBadResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -2205,7 +2202,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createServiceInstanceDuplicateError() throws IOException{ - stubFor(post(urlMatching(".*/infraActiveRequests/checkInstanceNameDuplicate")) + wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/checkInstanceNameDuplicate")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); @@ -2218,11 +2215,11 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createServiceInstanceDuplicateHistoryCheck() throws IOException{ - stubFor(post(urlMatching(".*/infraActiveRequests/checkInstanceNameDuplicate")) + wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/checkInstanceNameDuplicate")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("InfraActiveRequests/createInfraActiveRequests.json") .withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) + wireMockServer.stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/HistoryCheckResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -2235,11 +2232,11 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createServiceInstanceDuplicateHistoryCheckException() throws IOException{ - stubFor(post(urlMatching(".*/infraActiveRequests/checkInstanceNameDuplicate")) + wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/checkInstanceNameDuplicate")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("InfraActiveRequests/createInfraActiveRequests.json") .withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) + wireMockServer.stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(org.apache.http.HttpStatus.SC_INTERNAL_SERVER_ERROR))); @@ -2252,7 +2249,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createServiceInstanceDuplicate() throws IOException{ - stubFor(post(urlMatching(".*/infraActiveRequests/checkInstanceNameDuplicate")) + wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/checkInstanceNameDuplicate")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); @@ -2274,15 +2271,15 @@ public class ServiceInstancesTest extends BaseTest{ serviceRecipe.setRecipeTimeout(180); Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); - stubFor(post(urlMatching(".*/infraActiveRequests/")) + wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); - stubFor(get(urlMatching(".*/service/.*")) + wireMockServer.stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/serviceRecipe/search.*")) + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); @@ -2296,10 +2293,10 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createPortConfigurationSaveError() throws IOException { - stubFor(post(urlMatching(".*/infraActiveRequests/")) + wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -2312,7 +2309,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createPortConfigDbUpdateError() throws IOException { - stubFor(post(urlMatching(".*/infraActiveRequests/")) + wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); @@ -2326,21 +2323,21 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void vnfUpdateWithNetworkInstanceGroup() throws IOException{ TestAppender.events.clear(); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/2ccae1b4-7d9e-46fa-a452-9180ce008d17")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/2ccae1b4-7d9e-46fa-a452-9180ce008d17")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources")) + wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vnfResources_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" + + wireMockServer.stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" + "[?]nfRole=GR-API-DEFAULT&action=updateInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("UpdateVnfRecipe_Response.json")) @@ -2371,7 +2368,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void createInstanceGroup() throws IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -2391,7 +2388,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void deleteInstanceGroup() throws IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -2450,7 +2447,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void addMembers() throws IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); //expect @@ -2469,7 +2466,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void removeMembers() throws IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); //expect @@ -2488,15 +2485,15 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void deleteNetworkInstanceNoCustomizationEntry() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_NOT_FOUND))); - stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + + wireMockServer.stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + "modelName=VNF-API-DEFAULT&action=deleteInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")) @@ -2517,7 +2514,7 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void updateNetworkInstanceNoCustomizationEntry() throws IOException { - stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) + wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_NOT_FOUND))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java index 5c6fd31422..327141e0f2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java @@ -23,7 +23,6 @@ package org.onap.so.apihandlerinfra; 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.urlPathEqualTo; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; @@ -60,10 +59,10 @@ public class TasksHandlerTest extends BaseTest{ @Test public void getTasksTestByOriginalRequestId() throws ParseException, JSONException, JsonParseException, JsonMappingException, IOException{ - stubFor(post(urlPathEqualTo("/sobpmnengine/task")) + wireMockServer.stubFor(post(urlPathEqualTo("/sobpmnengine/task")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/GetTaskResponse.json").withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/sobpmnengine/task/b5fa707a-f55a-11e7-a796-005056856d52/variables")) + wireMockServer.stubFor(get(urlPathEqualTo("/sobpmnengine/task/b5fa707a-f55a-11e7-a796-005056856d52/variables")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/GetTaskVariablesResponse.json").withStatus(HttpStatus.SC_OK))); String requestId = "4f6fe9ac-800c-4540-a93e-10d179fa1b0a"; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java index 1e11b74215..5c5a9e92b3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java @@ -20,7 +20,19 @@ package org.onap.so.apihandlerinfra.tenantisolation; -import com.fasterxml.jackson.databind.ObjectMapper; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +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.urlPathEqualTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; + +import javax.ws.rs.core.MediaType; + import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Ignore; @@ -36,13 +48,7 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.util.UriComponentsBuilder; -import javax.ws.rs.core.MediaType; -import java.io.File; -import java.io.IOException; - -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import com.fasterxml.jackson.databind.ObjectMapper; public class CloudOrchestrationTest extends BaseTest { @@ -53,7 +59,7 @@ public class CloudOrchestrationTest extends BaseTest { @Before public void setupTestClass() throws Exception{ - stubFor(post(urlPathEqualTo(getTestUrl(""))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_CREATED))); + wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl(""))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_CREATED))); } @Test @@ -95,7 +101,7 @@ public class CloudOrchestrationTest extends BaseTest { @Test public void testCreateOpEnvReqRecordDuplicateCheck() throws IOException { - stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":null,\"instanceName\":\"myOpEnv\",\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":null,\"instanceName\":\"myOpEnv\",\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(String.format(getResponseTemplate, "123", "PENDING")) .withStatus(HttpStatus.SC_OK))); ObjectMapper mapper = new ObjectMapper(); @@ -124,7 +130,7 @@ public class CloudOrchestrationTest extends BaseTest { HttpEntity<TenantIsolationRequest> entity = new HttpEntity<TenantIsolationRequest>(request, headers); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(path) + "/operationalEnvironments"); - stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":null,\"instanceName\":\"myOpEnv\",\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":null,\"instanceName\":\"myOpEnv\",\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_NOT_FOUND))); ResponseEntity<String> response = restTemplate.exchange( builder.toUriString(), @@ -134,7 +140,7 @@ public class CloudOrchestrationTest extends BaseTest { @Test public void testCreateVNFDuplicateCheck() throws IOException { - stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":null,\"instanceName\":\"myVnfOpEnv\",\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":null,\"instanceName\":\"myVnfOpEnv\",\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(String.format(getResponseTemplate, "requestId", Status.IN_PROGRESS.toString())) .withStatus(HttpStatus.SC_OK))); ObjectMapper mapper = new ObjectMapper(); @@ -160,7 +166,7 @@ public class CloudOrchestrationTest extends BaseTest { HttpEntity<TenantIsolationRequest> entity = new HttpEntity<TenantIsolationRequest>(request, headers); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(path) + "/operationalEnvironments"); - stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":null,\"instanceName\":\"myVnfOpEnv\",\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":null,\"instanceName\":\"myVnfOpEnv\",\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_NOT_FOUND))); ResponseEntity<String> response = restTemplate.exchange( @@ -178,10 +184,10 @@ public class CloudOrchestrationTest extends BaseTest { HttpEntity<TenantIsolationRequest> entity = new HttpEntity<TenantIsolationRequest>(request, headers); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(path) + "/operationalEnvironments/ff3514e3-5a33-55df-13ab-12abad84e7ff/activate"); - stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":{\"operationalEnvironmentId\":\"ff3514e3-5a33-55df-13ab-12abad84e7ff\"},\"instanceName\":\"myVnfOpEnv\",\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":{\"operationalEnvironmentId\":\"ff3514e3-5a33-55df-13ab-12abad84e7ff\"},\"instanceName\":\"myVnfOpEnv\",\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_NOT_FOUND))); - stubFor(get(urlPathEqualTo(getTestUrl("checkVnfIdStatus/ff3514e3-5a33-55df-13ab-12abad84e7ff"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl("checkVnfIdStatus/ff3514e3-5a33-55df-13ab-12abad84e7ff"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); ResponseEntity<String> response = restTemplate.exchange( @@ -201,10 +207,10 @@ public class CloudOrchestrationTest extends BaseTest { HttpEntity<TenantIsolationRequest> entity = new HttpEntity<TenantIsolationRequest>(request, headers); -// stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":{\"operationalEnvironmentId\":\"ff3514e3-5a33-55df-13ab-12abad84e7fa\"},\"instanceName\":null,\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) +// wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl("checkInstanceNameDuplicate"))).withRequestBody(equalTo("{\"instanceIdMap\":{\"operationalEnvironmentId\":\"ff3514e3-5a33-55df-13ab-12abad84e7fa\"},\"instanceName\":null,\"requestScope\":\"operationalEnvironment\"}")).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) // .withBodyFile((String.format(getResponseTemplate, "ff3514e3-5a33-55df-13ab-12abad84e7fa", Status.COMPLETE.toString()))).withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo(getTestUrl("checkVnfIdStatus/ff3514e3-5a33-55df-13ab-12abad84e7fa"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl("checkVnfIdStatus/ff3514e3-5a33-55df-13ab-12abad84e7fa"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(path) + "/operationalEnvironments/ff3514e3-5a33-55df-13ab-12abad84e7fa/deactivate"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java index 8ac84d6598..c119653ae3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java @@ -20,6 +20,17 @@ package org.onap.so.apihandlerinfra.tenantisolation; +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.urlPathEqualTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.text.ParseException; + +import javax.ws.rs.core.MediaType; + import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; @@ -31,13 +42,6 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.util.UriComponentsBuilder; -import javax.ws.rs.core.MediaType; -import java.text.ParseException; - -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class CloudResourcesOrchestrationTest extends BaseTest{ @@ -47,7 +51,7 @@ public class CloudResourcesOrchestrationTest extends BaseTest{ HttpHeaders headers = new HttpHeaders(); @Before public void setupTestClass() throws Exception{ - stubFor(post(urlPathEqualTo(getTestUrl(""))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_CREATED))); + wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl(""))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_CREATED))); } @Test public void testUnlockFailObjectMapping() { @@ -120,7 +124,7 @@ public class CloudResourcesOrchestrationTest extends BaseTest{ @Test public void testGetInfraActiveRequestNull() { - stubFor(get(urlPathEqualTo(getTestUrl("request-id-null-check"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl("request-id-null-check"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); @@ -139,7 +143,7 @@ public class CloudResourcesOrchestrationTest extends BaseTest{ @Test public void testUnlock() throws ParseException { - stubFor(get(urlPathEqualTo(getTestUrl("requestIdtestUnlock"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl("requestIdtestUnlock"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(String.format(getResponseTemplate, "requestIdtestUnlock", "IN_PROGRESS")) .withStatus(HttpStatus.SC_OK))); headers.set("Accept", MediaType.APPLICATION_JSON); @@ -157,7 +161,7 @@ public class CloudResourcesOrchestrationTest extends BaseTest{ @Test public void testUnlockComplete() throws ParseException { - stubFor(get(urlPathEqualTo(getTestUrl("requestIdtestUnlockComplete"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl("requestIdtestUnlockComplete"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(String.format(getResponseTemplate, "requestIdtestUnlockComplete", "COMPLETE")) .withStatus(HttpStatus.SC_OK))); @@ -177,7 +181,7 @@ public class CloudResourcesOrchestrationTest extends BaseTest{ @Test public void testGetOperationalEnvFilter() { - stubFor(get(urlPathEqualTo(getTestUrl("not-there"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl("not-there"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); @@ -198,7 +202,7 @@ public class CloudResourcesOrchestrationTest extends BaseTest{ @Test public void testGetOperationalEnvSuccess() throws ParseException { - stubFor(get(urlPathEqualTo(getTestUrl("90c56827-1c78-4827-bc4d-6afcdb37a51f"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl("90c56827-1c78-4827-bc4d-6afcdb37a51f"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(String.format(getResponseTemplateNoBody, "90c56827-1c78-4827-bc4d-6afcdb37a51f", "COMPLETE")) .withStatus(HttpStatus.SC_OK))); headers.set("Accept", MediaType.APPLICATION_JSON); @@ -223,11 +227,11 @@ public class CloudResourcesOrchestrationTest extends BaseTest{ @Test public void testGetOperationalEnvFilterSuccess() throws ParseException { - stubFor(get(urlPathEqualTo(getTestUrl("requestIdtestGetOperationalEnvFilterSuccess"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl("requestIdtestGetOperationalEnvFilterSuccess"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(String.format(getResponseTemplate, "requestIdtestGetOperationalEnvFilterSuccess", "COMPLETE")) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo(getTestUrl("getCloudOrchestrationFiltersFromInfraActive"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + wireMockServer.stubFor(post(urlPathEqualTo(getTestUrl("getCloudOrchestrationFiltersFromInfraActive"))).willReturn(aResponse().withHeader(javax.ws.rs.core.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody("{\"requestId\":\"getCloudOrchestrationFiltersFromInfraActive\", \"operationalEnvironmentName\":\"myVnfOpEnv\"}") .withBody("["+String.format(getResponseTemplateNoBody, "requestIdtestGetOperationalEnvFilterSuccess", "COMPLETE")+"]") .withStatus(HttpStatus.SC_OK))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java index 78315e9fad..6c5e968835 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.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.urlPathMatching; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -56,7 +55,7 @@ public class AAIClientHelperTest extends BaseTest{ @Test public void testGetAaiOperationalEnvironmentSuccess() throws Exception { - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED))); AAIResultWrapper wrapper = clientHelper.getAaiOperationalEnvironment("EMOE-001"); @@ -66,7 +65,7 @@ public class AAIClientHelperTest extends BaseTest{ @Test public void testUpdateSuccess() { - stubFor(post(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(post(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); OperationalEnvironment ecompEnv = new OperationalEnvironment(); @@ -86,7 +85,7 @@ public class AAIClientHelperTest extends BaseTest{ @Test public void testUpdateMapSuccess() { - stubFor(post(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(post(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); Map<String, String> payload = new HashMap<String, String>(); @@ -107,7 +106,7 @@ public class AAIClientHelperTest extends BaseTest{ @Test public void testCreateSuccess() { - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); OperationalEnvironment ecompEnv = new OperationalEnvironment(); @@ -128,7 +127,7 @@ public class AAIClientHelperTest extends BaseTest{ @Test public void testcreateRelationshipSuccess() { - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); OperationalEnvironment ecompEnv = new OperationalEnvironment(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelperTest.java index 76bf0b0dbc..39f5ed834f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelperTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelperTest.java @@ -22,7 +22,6 @@ package org.onap.so.apihandlerinfra.tenantisolation.helpers; 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.urlPathMatching; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -52,7 +51,7 @@ public class SDCClientHelperTest extends BaseTest{ jsonObject.put("message", "Success"); jsonObject.put("distributionId", "TEST_distributionId"); - stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_uuid1/distr.*")) + wireMockServer.stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_uuid1/distr.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED))); JSONObject jsonResponse = sdcClientUtils.postActivateOperationalEnvironment(serviceModelVersionId, operationalEnvironmentId, workloadContext); @@ -69,7 +68,7 @@ public class SDCClientHelperTest extends BaseTest{ JSONObject jsonErrorResponse = new JSONObject(); jsonErrorResponse.put("requestError", ""); - stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_uuid1/distr.*")) + wireMockServer.stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_uuid1/distr.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonErrorResponse.toString()).withStatus(HttpStatus.SC_BAD_REQUEST))); JSONObject jsonResponse = sdcClientUtils.postActivateOperationalEnvironment(serviceModelVersionId, operationalEnvironmentId, workloadContext); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java index 418ed4270a..4f12afcb71 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java @@ -21,21 +21,21 @@ package org.onap.so.apihandlerinfra.tenantisolation.process; 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.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.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; + import org.apache.http.HttpStatus; import org.json.JSONObject; import org.junit.Before; @@ -48,18 +48,18 @@ import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper; +import org.onap.so.apihandlerinfra.tenantisolationbeans.Manifest; +import org.onap.so.apihandlerinfra.tenantisolationbeans.RecoveryAction; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestDetails; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters; import org.onap.so.apihandlerinfra.tenantisolationbeans.ServiceModelList; -import org.onap.so.apihandlerinfra.tenantisolationbeans.RecoveryAction; -import org.onap.so.apihandlerinfra.tenantisolationbeans.Manifest; import org.onap.so.client.aai.AAIVersion; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.db.request.beans.InfraActiveRequests; import org.springframework.beans.factory.annotation.Autowired; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; public class ActivateVnfOperationalEnvironmentTest extends BaseTest{ @@ -86,11 +86,11 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{ @Before public void init(){ - stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) .withRequestBody(equalTo("{\"requestId\":\"TEST_requestId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":3,\"workloadContext\":\"PVT\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e66d\"}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestId\",\"distributionIdStatus\":\"SENT\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); @@ -102,7 +102,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{ OperationalEnvironment aaiOpEnv; - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironmentWithRelationship.json").withStatus(HttpStatus.SC_ACCEPTED))); AAIResultWrapper wrapper = clientHelper.getAaiOperationalEnvironment("EMOE-001"); @@ -139,9 +139,9 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{ jsonObject.put("message", "Success"); jsonObject.put("distributionId", sdcDistributionId); - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/activateOperationalEnvironmentWithRelationship.json").withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*")) + wireMockServer.stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED))); activateVnf.execute(requestId, request); } @@ -163,7 +163,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{ serviceModelList1.setServiceModelVersionId(serviceModelVersionId); serviceModelVersionIdList.add(serviceModelList1); - stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*")) + wireMockServer.stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED))); activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId); @@ -193,13 +193,13 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{ InfraActiveRequests iar = new InfraActiveRequests(); iar.setRequestId(requestId); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*")) + wireMockServer.stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonErrorResponse.toString()).withStatus(HttpStatus.SC_CONFLICT))); - stubFor(post(urlPathEqualTo("/infraActiveRequests/")) + wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/")) .withRequestBody(containing("operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\"")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java index c0250f7315..c6a74f3d4e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java @@ -21,26 +21,25 @@ package org.onap.so.apihandlerinfra.tenantisolation.process; 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.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.urlPathMatching; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; - import static org.junit.Assert.assertThat; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; + import org.apache.http.HttpStatus; import org.json.JSONObject; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; -import org.junit.Ignore; import org.junit.rules.ExpectedException; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.BaseTest; @@ -55,8 +54,8 @@ import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; import org.springframework.beans.factory.annotation.Autowired; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ @@ -115,11 +114,11 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); @@ -141,7 +140,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ serviceModelDb.setRetryCount(retryCountZero); serviceModelDb.setServiceModelVersionDistrStatus(statusError); serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -150,7 +149,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); @@ -177,7 +176,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ serviceModelDb.setRetryCount(retryCountTwo); serviceModelDb.setServiceModelVersionDistrStatus(statusError); serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -218,31 +217,31 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(distributionDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId")) + wireMockServer.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(put(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId")) + wireMockServer.stubFor(put(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); activateVnfStatus.execute(requestId, request); @@ -260,7 +259,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ serviceModelDb.setRetryCount(retryCountThree); serviceModelDb.setServiceModelVersionDistrStatus(statusError); serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); @@ -290,33 +289,33 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ jsonObject.put("message", "Success"); jsonObject.put("distributionId", sdcDistributionId1); - stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*")) + wireMockServer.stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(distributionDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_ERROR\",\"distributionIdErrorReason\":\"Unable to process.\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); activateVnfStatus.execute(requestId, request); @@ -361,30 +360,30 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(distributionDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*")) + wireMockServer.stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); try { @@ -441,29 +440,29 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ InfraActiveRequests iar = new InfraActiveRequests(); iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(distributionDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/infraActiveRequests/")) + wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/")) .withRequestBody(containing("operationalEnvId\":\"VNF_operationalEnvironmentId\"")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*")) + wireMockServer.stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonMessages.toString()).withStatus(HttpStatus.SC_CONFLICT))); - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); try { @@ -509,31 +508,31 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(distributionDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); activateVnfStatus.execute(requestId, request); @@ -574,32 +573,32 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ iar.setRequestId(requestIdOrig); iar.setRequestStatus("PENDING"); - stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceModelDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) + wireMockServer.stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(distributionDb)) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/")) .withRequestBody(containing("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_ERROR\"")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) + wireMockServer.stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/")) .withRequestBody(containing("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_ERROR\"")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); try { @@ -646,7 +645,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ request.setDistributionId(sdcDistributionId); request.setOperationalEnvironmentId(operationalEnvironmentId); - stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*")) + wireMockServer.stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED))); JSONObject jsonResponse = activateVnfStatus.callSDClientForRetry(distributionDb, serviceModelDb, distribution); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java index 65ec5fade6..22993b17cf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java @@ -20,12 +20,21 @@ package org.onap.so.apihandlerinfra.tenantisolation.process; -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.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.urlPathEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertThat; + import java.util.UUID; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; + +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; + import org.apache.http.HttpStatus; import org.junit.Test; import org.onap.so.apihandler.common.ErrorNumbers; @@ -44,8 +53,8 @@ import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.springframework.beans.factory.annotation.Autowired; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; public class CreateEcompOperationalEnvironmentTest extends BaseTest{ @@ -73,9 +82,9 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{ @Test public void testProcess() throws ApiException, JsonProcessingException { - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(post(urlPathMatching("/events/.*")) + wireMockServer.stubFor(post(urlPathMatching("/events/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); InfraActiveRequests iar = new InfraActiveRequests(); @@ -84,11 +93,11 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{ iar.setRequestScope("create"); iar.setRequestStatus("PENDING"); iar.setRequestAction("UNKNOWN"); - stubFor(get(urlPathEqualTo("/infraActiveRequests/123")) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/123")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/infraActiveRequests/")) + wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/")) .withRequestBody(containing("{\"requestId\":\"123\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL, operationalEnvironmentId - operationalEnvId; Success Message: SUCCESSFULLY Created ECOMP OperationalEnvironment.\",\"rollbackStatusMessage\":null,\"flowStatus\":null,\"retryStatusMessage\":null,\"progress\":100")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); @@ -98,9 +107,9 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{ @Test public void testProcessException() throws JsonProcessingException { - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(post(urlPathMatching("/events/.*")) + wireMockServer.stubFor(post(urlPathMatching("/events/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build(); ValidateException expectedException = new ValidateException.Builder("Could not publish DMaap", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER) @@ -113,11 +122,11 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{ iar.setRequestScope("create"); iar.setRequestStatus("PENDING"); iar.setRequestAction("UNKNOWN"); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+uuid)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+uuid)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/infraActiveRequests/")) + wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/")) .withRequestBody(containing("{\"requestId\":\""+uuid+ "\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE, operationalEnvironmentId - operationalEnvId; Error message:")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java index ac274dc8dc..59a65676e2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java @@ -20,7 +20,13 @@ package org.onap.so.apihandlerinfra.tenantisolation.process; -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.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.urlPathEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static org.junit.Assert.assertEquals; import java.io.File; @@ -28,7 +34,9 @@ import java.nio.file.Files; import java.util.List; import java.util.UUID; -import com.fasterxml.jackson.core.JsonProcessingException; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; + import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; @@ -42,11 +50,9 @@ import org.onap.so.client.grm.beans.ServiceEndPointList; import org.onap.so.db.request.beans.InfraActiveRequests; import org.springframework.beans.factory.annotation.Autowired; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; - public class CreateVnfOperationalEnvironmentTest extends BaseTest{ @@ -124,13 +130,13 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{ @Test public void testExecute() throws ApiException, JsonProcessingException { - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/findRunning")) + wireMockServer.stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/findRunning")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/endpoints.json").withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/add")) + wireMockServer.stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/add")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED))); String requestId = UUID.randomUUID().toString(); InfraActiveRequests iar = new InfraActiveRequests(); @@ -140,12 +146,12 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{ iar.setRequestStatus("PENDING"); iar.setRequestAction("UNKNOWN"); ObjectMapper mapper = new ObjectMapper(); - stubFor(post(urlPathEqualTo("/infraActiveRequests/")) + wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/")) .withRequestBody(containing("{\"requestId\":\""+ requestId+"\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); @@ -154,13 +160,13 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{ @Test public void testExecuteEndpointsListBeginWithUppercase() throws ApiException, JsonProcessingException { - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/findRunning")) + wireMockServer.stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/findRunning")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/endpoints2.json").withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/add")) + wireMockServer.stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/add")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED))); String requestId = UUID.randomUUID().toString(); InfraActiveRequests iar = new InfraActiveRequests(); @@ -170,12 +176,12 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{ iar.setRequestStatus("PENDING"); iar.setRequestAction("UNKNOWN"); ObjectMapper mapper = new ObjectMapper(); - stubFor(post(urlPathEqualTo("/infraActiveRequests/")) + wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/")) .withRequestBody(containing("{\"requestId\":\""+ requestId+"\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java index 7c24050775..1e4208c743 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java @@ -20,12 +20,20 @@ package org.onap.so.apihandlerinfra.tenantisolation.process; -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.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.urlPathEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static org.hamcrest.Matchers.hasProperty; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.startsWith; -import com.fasterxml.jackson.databind.ObjectMapper; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; + import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Rule; @@ -39,8 +47,7 @@ import org.onap.so.client.aai.AAIVersion; import org.onap.so.db.request.beans.InfraActiveRequests; import org.springframework.beans.factory.annotation.Autowired; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; +import com.fasterxml.jackson.databind.ObjectMapper; public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{ @@ -58,7 +65,7 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{ @Before public void init(){ - stubFor(post(urlPathEqualTo("/infraActiveRequests/")) + wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/")) .withRequestBody(containing("{\"requestId\":\""+ requestId+"\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); @@ -70,11 +77,11 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{ String json = "{\"operational-environment-status\" : \"ACTIVE\"}"; - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); - stubFor(post(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(post(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); InfraActiveRequests iar = new InfraActiveRequests(); @@ -83,7 +90,7 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{ iar.setRequestScope("create"); iar.setRequestStatus("PENDING"); iar.setRequestAction("UNKNOWN"); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); @@ -97,7 +104,7 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{ String json = "{\"operational-environment-status\" : \"SUCCESS\"}"; - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED))); thrown.expect(ValidateException.class); @@ -111,11 +118,11 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{ iar.setRequestScope("create"); iar.setRequestStatus("PENDING"); iar.setRequestAction("UNKNOWN"); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/infraActiveRequests/")) + wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/")) .withRequestBody(containing("{\"requestId\":\""+ requestId+"\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); @@ -130,7 +137,7 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{ String json = "{\"operational-environment-status\" : \"INACTIVE\"}"; - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED))); InfraActiveRequests iar = new InfraActiveRequests(); @@ -139,7 +146,7 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{ iar.setRequestScope("create"); iar.setRequestStatus("PENDING"); iar.setRequestAction("UNKNOWN"); - stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) + wireMockServer.stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); @@ -154,7 +161,7 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{ String json = "{\"operational-environment-status\" : \"\"}"; - stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + wireMockServer.stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED))); thrown.expect(ValidateException.class); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java index 6555a9a66e..580252ae73 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java @@ -25,10 +25,8 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; import static com.github.tomakehurst.wiremock.client.WireMock.matching; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; -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.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.verify; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -47,7 +45,6 @@ import org.junit.rules.ExpectedException; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandlerinfra.BaseTest; import org.onap.so.apihandlerinfra.TestAppender; -import org.onap.so.client.grm.GRMClient; import org.onap.so.client.grm.beans.ServiceEndPoint; import org.onap.so.client.grm.beans.ServiceEndPointList; import org.onap.so.client.grm.beans.ServiceEndPointLookupRequest; @@ -75,7 +72,7 @@ public class GRMClientTest extends BaseTest{ public void testFind() throws Exception { TestAppender.events.clear(); String endpoints = getFileContentsAsString("__files/grm/endpoints.json"); - stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning")) + wireMockServer.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", MediaType.APPLICATION_JSON) @@ -113,7 +110,7 @@ public class GRMClientTest extends BaseTest{ if(!foundInvokeReturn) fail("INVOKE RETURN Marker not found"); - verify(postRequestedFor(urlEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning")) + wireMockServer.verify(postRequestedFor(urlEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning")) .withHeader(ONAPLogConstants.Headers.INVOCATION_ID.toString(), matching(uuidRegex)) .withHeader(ONAPLogConstants.Headers.REQUEST_ID.toString(), matching(uuidRegex)) .withHeader(ONAPLogConstants.Headers.PARTNER_NAME.toString(), equalTo("SO"))); @@ -122,7 +119,7 @@ public class GRMClientTest extends BaseTest{ @Test public void testFindFail() throws Exception { - stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning")) + wireMockServer.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning")) .willReturn(aResponse() .withStatus(400) .withHeader("Content-Type", MediaType.APPLICATION_JSON) @@ -135,7 +132,7 @@ public class GRMClientTest extends BaseTest{ @Test public void testAddFail() throws Exception { - stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/add")) + wireMockServer.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/add")) .willReturn(aResponse() .withStatus(404) .withHeader("Content-Type", MediaType.APPLICATION_JSON) @@ -434,6 +434,9 @@ <so.log.level>DEBUG</so.log.level> </systemPropertyVariables> <rerunFailingTestsCount>2</rerunFailingTestsCount> + <parallel>classes</parallel> + <useUnlimitedThreads>false</useUnlimitedThreads> + <threadCount>1</threadCount> </configuration> </plugin> <plugin> |