aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-openstack-adapters/src')
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java148
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java77
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java62
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java32
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java10
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java32
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java45
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java45
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java172
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java49
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java42
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java46
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java72
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java44
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java44
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java279
16 files changed, 609 insertions, 590 deletions
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)));
}