aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/pom.xml18
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/AllTestsTestSuite.java32
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java32
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java76
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java37
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java32
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java8
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java22
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml18
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java32
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java21
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java28
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java6
-rw-r--r--adapters/mso-openstack-adapters/pom.xml18
-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
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml18
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/AllTestsTestSuite.java32
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsSchedulerTest.java16
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java34
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java14
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java19
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java56
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java6
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml18
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/AllTestsTestSuite.java32
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java8
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java5
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java12
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java13
47 files changed, 1068 insertions, 812 deletions
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml
index f94d5d60b8..ed76354792 100644
--- a/adapters/mso-adapter-utils/pom.xml
+++ b/adapters/mso-adapter-utils/pom.xml
@@ -55,6 +55,24 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/AllTestsTestSuite.java</include>
+ </includes>
+ <parallel>suites</parallel>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/AllTestsTestSuite.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/AllTestsTestSuite.java
new file mode 100644
index 0000000000..a74dbf614b
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/AllTestsTestSuite.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so;
+import org.junit.runner.RunWith;
+
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+
+@RunWith(WildcardPatternSuite.class)
+@SuiteClasses("**/*Test.class")
+public class AllTestsTestSuite {
+ // the class remains empty,
+ // used only as a holder for the above annotations
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java
index 9cfdf53094..82b18d86ed 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java
@@ -23,7 +23,16 @@
package org.onap.so;
-import com.github.tomakehurst.wiremock.client.WireMock;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+
import org.apache.http.HttpHeaders;
import org.apache.http.HttpStatus;
import org.junit.After;
@@ -33,20 +42,15 @@ import org.onap.so.db.catalog.beans.AuthenticationType;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.ServerType;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
-import javax.ws.rs.core.MediaType;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.client.WireMock;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@@ -56,10 +60,12 @@ public abstract class BaseTest extends TestDataSetup {
@Value("${wiremock.server.port}")
protected int wireMockPort;
+ @Autowired
+ protected WireMockServer wireMockServer;
@After
public void after() {
- WireMock.reset();
+ wireMockServer.resetAll();
}
protected static String getBody(String body, int port, String urlPath) throws IOException {
@@ -74,15 +80,15 @@ public abstract class BaseTest extends TestDataSetup {
}
private void mockCloud(CloudIdentity identity, CloudSite cloudSite) throws IOException {
- stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse()
.withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse()
.withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
.withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/cloudIdentity/mtn13")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/cloudIdentity/mtn13")).willReturn(aResponse()
.withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, ""))
.withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java
index 0820076c66..ae3fb8271a 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java
@@ -27,38 +27,40 @@ import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
+
import org.apache.http.HttpStatus;
+import com.github.tomakehurst.wiremock.WireMockServer;
+
public class StubOpenStack {
- public static void mockOpenStackResponseAccess(int port) throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public static void mockOpenStackResponseAccess(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access.json", port, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackResponseUnauthorized(int port) throws IOException {
- stubFor(
+ public static void mockOpenStackResponseUnauthorized(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(
post(urlPathEqualTo("/v2.0/tokens"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access.json", port, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_UNAUTHORIZED)));
}
- public static void mockOpenStackDelete(String id) {
- stubFor(delete(urlMatching("/mockPublicUrl/stacks/" + id)).willReturn(aResponse()
+ public static void mockOpenStackDelete(WireMockServer wireMockServer, String id) {
+ wireMockServer.stubFor(delete(urlMatching("/mockPublicUrl/stacks/" + id)).willReturn(aResponse()
.withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGet(String id) {
- stubFor(
+ public static void mockOpenStackGet(WireMockServer wireMockServer, String id) {
+ wireMockServer.stubFor(
get(urlPathEqualTo("/mockPublicUrl/stacks/" + id))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Stack_Created.json")
@@ -66,82 +68,82 @@ public class StubOpenStack {
}
- public static void mockOpenStackPostStack_200(String filename) {
- stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse()
+ public static void mockOpenStackPostStack_200(WireMockServer wireMockServer, String filename) {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPostTenantWithBodyFile_200() throws IOException {
- stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants"))
+ public static void mockOpenStackPostTenantWithBodyFile_200(WireMockServer wireMockServer) throws IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants"))
.willReturn(aResponse().withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetTenantByName(String tenantName) throws IOException {
- stubFor(get(urlMatching("/mockPublicUrl/tenants/[?]name=" + tenantName))
+ public static void mockOpenStackGetTenantByName(WireMockServer wireMockServer, String tenantName) throws IOException {
+ wireMockServer.stubFor(get(urlMatching("/mockPublicUrl/tenants/[?]name=" + tenantName))
.willReturn(aResponse().withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetTenantById(String tenantId) throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId"))
+ public static void mockOpenStackGetTenantById(WireMockServer wireMockServer, String tenantId) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId"))
.willReturn(aResponse().withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackDeleteTenantById_200(String tenantId) {
- stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse()
+ public static void mockOpenStackDeleteTenantById_200(WireMockServer wireMockServer, String tenantId) {
+ wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse()
.withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetUserById(String user) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)).willReturn(aResponse()
+ public static void mockOpenStackGetUserById(WireMockServer wireMockServer, String user) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_User.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetUserByName(String userName) {
- stubFor(get(urlMatching("/mockPublicUrl/users/[?]name=" + userName)).willReturn(aResponse()
+ public static void mockOpenStackGetUserByName(WireMockServer wireMockServer, String userName) {
+ wireMockServer.stubFor(get(urlMatching("/mockPublicUrl/users/[?]name=" + userName)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_User.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetUserByName_500(String userName) {
- stubFor(get(urlMatching("/mockPublicUrl/users/[?]name=" + userName)).willReturn(aResponse()
+ public static void mockOpenStackGetUserByName_500(WireMockServer wireMockServer, String userName) {
+ wireMockServer.stubFor(get(urlMatching("/mockPublicUrl/users/[?]name=" + userName)).willReturn(aResponse()
.withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
}
- public static void mockOpenStackGetRoles_200(String roleFor) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")).willReturn(aResponse()
+ public static void mockOpenStackGetRoles_200(WireMockServer wireMockServer, String roleFor) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Roles.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenstackPostNetwork(String responseFile) {
- stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse()
+ public static void mockOpenstackPostNetwork(WireMockServer wireMockServer, String responseFile) {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile(responseFile)
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenstackPutNetwork(String responseFile, String networkId) {
- stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse()
+ public static void mockOpenstackPutNetwork(WireMockServer wireMockServer, String responseFile, String networkId) {
+ wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile(responseFile)
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetNeutronNetwork(String filename,String networkId) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId))
+ public static void mockOpenStackGetNeutronNetwork(WireMockServer wireMockServer, String filename,String networkId) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetNeutronNetwork_500(String networkId) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId))
+ public static void mockOpenStackGetNeutronNetwork_500(WireMockServer wireMockServer, String networkId) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId))
.willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
}
- public static void mockOpenStackDeleteNeutronNetwork(String networkId) {
- stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId))
+ public static void mockOpenStackDeleteNeutronNetwork(WireMockServer wireMockServer, String networkId) {
+ wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId))
.willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
index c771a75976..925365f00e 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -24,19 +24,17 @@ package org.onap.so.openstack.utils;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertNotNull;
-import com.woorea.openstack.heat.Heat;
-import com.woorea.openstack.heat.model.CreateStackParam;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import org.apache.http.HttpStatus;
import org.junit.Assert;
import org.junit.Test;
@@ -59,6 +57,9 @@ import org.onap.so.openstack.exceptions.MsoIOException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
import org.springframework.beans.factory.annotation.Autowired;
+import com.woorea.openstack.heat.Heat;
+import com.woorea.openstack.heat.model.CreateStackParam;
+
public class MsoHeatUtilsTest extends BaseTest{
@Autowired
@@ -94,10 +95,10 @@ public class MsoHeatUtilsTest extends BaseTest{
Map<String, Object> inputs = new HashMap<>();
boolean rollbackOnFailure = true;
- StubOpenStack.mockOpenStackResponseAccess(wireMockPort);
- StubOpenStack.mockOpenStackPostStack_200("OpenstackResponse_Stack_Created.json");
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceName/stackId"))
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceName/stackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_StackId.json")
.withStatus(HttpStatus.SC_OK)));
@@ -123,10 +124,10 @@ public class MsoHeatUtilsTest extends BaseTest{
cloudInfo.setTenantId("tenantId");
String instanceId = "instanceId";
- StubOpenStack.mockOpenStackResponseAccess(wireMockPort);
- StubOpenStack.mockOpenStackPostStack_200("OpenstackResponse_Stack_Created.json");
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId"))
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_StackId.json")
.withStatus(HttpStatus.SC_OK)));
@@ -152,10 +153,10 @@ public class MsoHeatUtilsTest extends BaseTest{
int timeoutInMinutes = 1;
- StubOpenStack.mockOpenStackResponseAccess(wireMockPort);
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId")).willReturn(aResponse().withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
- StubOpenStack.mockOpenStackDelete("name/da886914-efb2-4917-b335-c8381528d90b");
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/name/da886914-efb2-4917-b335-c8381528d90b")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_DeleteComplete.json").withStatus(HttpStatus.SC_OK)));
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId")).willReturn(aResponse().withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+ StubOpenStack.mockOpenStackDelete(wireMockServer, "name/da886914-efb2-4917-b335-c8381528d90b");
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/name/da886914-efb2-4917-b335-c8381528d90b")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_DeleteComplete.json").withStatus(HttpStatus.SC_OK)));
VduInstance actual = heatUtils.deleteVdu(cloudInfo, instanceId, timeoutInMinutes);
@@ -195,7 +196,7 @@ public class MsoHeatUtilsTest extends BaseTest{
@Test
public final void getHeatClientSuccessTest() throws MsoException, IOException {
CloudSite cloudSite = getCloudSite(getCloudIdentity());
- StubOpenStack.mockOpenStackResponseAccess(wireMockPort);
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
Heat heatClient = heatUtils.getHeatClient(cloudSite, "TEST-tenant");
assertNotNull(heatClient);
}
@@ -210,7 +211,7 @@ public class MsoHeatUtilsTest extends BaseTest{
@Test(expected = MsoAdapterException.class)
public final void getHeatClientOpenStackResponseException401Test() throws MsoException, IOException {
CloudSite cloudSite = getCloudSite(getCloudIdentity());
- StubOpenStack.mockOpenStackResponseUnauthorized(wireMockPort);
+ StubOpenStack.mockOpenStackResponseUnauthorized(wireMockServer, wireMockPort);
heatUtils.getHeatClient(cloudSite, "TEST-tenant");
}
@@ -226,9 +227,9 @@ public class MsoHeatUtilsTest extends BaseTest{
@Test
public final void createStackSuccessTest() throws MsoException, IOException {
CloudSite cloudSite = getCloudSite(getCloudIdentity());
- StubOpenStack.mockOpenStackResponseAccess(wireMockPort);
- StubOpenStack.mockOpenStackPostStack_200("OpenstackResponse_Stack_Created.json");
- StubOpenStack.mockOpenStackGet("TEST-stack/stackId");
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
+ StubOpenStack.mockOpenStackGet(wireMockServer, "TEST-stack/stackId");
StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack", null,
"TEST-heat", new HashMap<>(), false, 1, "TEST-env",
new HashMap<>(), new HashMap<>(), false);
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java
index 5100407633..3526a68ef6 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java
@@ -39,15 +39,15 @@ public class MsoKeystoneUtilsTest extends BaseTest {
@Before
public void before() throws IOException {
- StubOpenStack.mockOpenStackResponseAccess(wireMockPort);
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
}
@Test
public void createTenantTest() throws Exception {
- StubOpenStack.mockOpenStackPostTenantWithBodyFile_200();
+ StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(wireMockServer);
- StubOpenStack.mockOpenStackGetUserById("john");
- StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM");
+ StubOpenStack.mockOpenStackGetUserById(wireMockServer, "john");
+ StubOpenStack.mockOpenStackGetRoles_200(wireMockServer, "OS-KSADM");
String response = msoKeystoneUtils.createTenant("tenant", "MTN13", new HashMap<>(), true);
Assert.assertEquals("tenantId", response);
@@ -55,10 +55,10 @@ public class MsoKeystoneUtilsTest extends BaseTest {
@Test
public void createTenantTest_FindUserByName() throws Exception {
- StubOpenStack.mockOpenStackPostTenantWithBodyFile_200();
+ StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(wireMockServer);
- StubOpenStack.mockOpenStackGetUserByName("john");
- StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM");
+ StubOpenStack.mockOpenStackGetUserByName(wireMockServer, "john");
+ StubOpenStack.mockOpenStackGetRoles_200(wireMockServer, "OS-KSADM");
String response = msoKeystoneUtils.createTenant("tenant", "MTN13", new HashMap<>(), true);
Assert.assertEquals("tenantId", response);
@@ -67,15 +67,15 @@ public class MsoKeystoneUtilsTest extends BaseTest {
@Test
public void createTenantTest_Exception() throws Exception {
expectedException.expect(MsoException.class);
- StubOpenStack.mockOpenStackPostTenantWithBodyFile_200();
- StubOpenStack.mockOpenStackGetUserByName_500("john");
- StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM");
+ StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(wireMockServer);
+ StubOpenStack.mockOpenStackGetUserByName_500(wireMockServer, "john");
+ StubOpenStack.mockOpenStackGetRoles_200(wireMockServer, "OS-KSADM");
msoKeystoneUtils.createTenant("tenant", "Test", new HashMap<>(), true);
}
@Test
public void queryTenantTest() throws Exception {
- StubOpenStack.mockOpenStackGetTenantById("tenantId");
+ StubOpenStack.mockOpenStackGetTenantById(wireMockServer, "tenantId");
MsoTenant msoTenant = msoKeystoneUtils.queryTenant("tenantId", "MTN13");
@@ -84,7 +84,7 @@ public class MsoKeystoneUtilsTest extends BaseTest {
@Test
public void queryTenantByNameTest() throws Exception {
- StubOpenStack.mockOpenStackGetTenantByName("tenant");
+ StubOpenStack.mockOpenStackGetTenantByName(wireMockServer, "tenant");
MsoTenant msoTenant = msoKeystoneUtils.queryTenantByName("tenant", "MTN13");
@@ -93,8 +93,8 @@ public class MsoKeystoneUtilsTest extends BaseTest {
@Test
public void deleteTenantTest() throws Exception {
- StubOpenStack.mockOpenStackGetTenantById("tenantId");
- StubOpenStack.mockOpenStackDeleteTenantById_200("tenantId");
+ StubOpenStack.mockOpenStackGetTenantById(wireMockServer, "tenantId");
+ StubOpenStack.mockOpenStackDeleteTenantById_200(wireMockServer, "tenantId");
boolean result = msoKeystoneUtils.deleteTenant("tenantId", "MTN13");
Assert.assertTrue(result);
@@ -102,8 +102,8 @@ public class MsoKeystoneUtilsTest extends BaseTest {
@Test
public void deleteTenantByNameTest() throws Exception {
- StubOpenStack.mockOpenStackGetTenantByName("tenant");
- StubOpenStack.mockOpenStackDeleteTenantById_200("tenantId");
+ StubOpenStack.mockOpenStackGetTenantByName(wireMockServer, "tenant");
+ StubOpenStack.mockOpenStackDeleteTenantById_200(wireMockServer, "tenantId");
boolean result = msoKeystoneUtils.deleteTenantByName("tenant", "MTN13");
Assert.assertTrue(result);
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
index b2a69ded46..3b3e30183b 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
@@ -22,7 +22,6 @@ package org.onap.so.openstack.utils;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -32,6 +31,7 @@ import static org.mockito.Mockito.when;
import java.io.IOException;
import java.util.HashMap;
import java.util.Optional;
+
import org.apache.http.HttpStatus;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -61,7 +61,7 @@ public class MsoMulticloudUtilsTest extends BaseTest {
@Test
public void createStackSuccess() throws MsoException, IOException {
- stubFor(post(urlPathEqualTo("/v2.0"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(CREATE_STACK_RESPONSE)
.withStatus(HttpStatus.SC_CREATED)));
@@ -93,7 +93,7 @@ public class MsoMulticloudUtilsTest extends BaseTest {
@Test
public void createStackBadRequest() {
try {
- stubFor(post(urlPathEqualTo("/v2.0"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_BAD_REQUEST)));
multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
@@ -108,7 +108,7 @@ public class MsoMulticloudUtilsTest extends BaseTest {
@Test
public void createStackEmptyResponseEntity() throws MsoException {
- stubFor(post(urlPathEqualTo("/v2.0"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_CREATED)));
StackInfo result = multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java
index f679e1f776..8c337865df 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java
@@ -44,7 +44,7 @@ public class MsoNeutronUtilsTest extends BaseTest{
public void before() throws IOException {
vlans = new ArrayList<>();
vlans.add(3014);
- StubOpenStack.mockOpenStackResponseAccess(wireMockPort);
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
}
@Test
@@ -56,7 +56,7 @@ public class MsoNeutronUtilsTest extends BaseTest{
@Test
public void createNetworkTest_NetworkTypeAsMultiProvider() throws Exception {
- StubOpenStack.mockOpenstackPostNetwork("OpenstackCreateNeutronNetworkResponse.json");
+ StubOpenStack.mockOpenstackPostNetwork(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json");
NetworkInfo networkInfo = msoNeutronUtils.createNetwork("MTN13", "tenantId",
MsoNeutronUtils.NetworkType.MULTI_PROVIDER,"networkName","PROVIDER", vlans);
@@ -65,7 +65,7 @@ public class MsoNeutronUtilsTest extends BaseTest{
@Test
public void createNetworkTest() throws Exception {
- StubOpenStack.mockOpenstackPostNetwork("OpenstackCreateNeutronNetworkResponse.json");
+ StubOpenStack.mockOpenstackPostNetwork(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json");
NetworkInfo networkInfo = msoNeutronUtils.createNetwork("MTN13", "tenantId",
MsoNeutronUtils.NetworkType.PROVIDER,"networkName","PROVIDER", vlans);
@@ -74,7 +74,7 @@ public class MsoNeutronUtilsTest extends BaseTest{
@Test
public void queryNetworkTest() throws Exception {
- StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+ StubOpenStack.mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13");
Assert.assertEquals("net1",networkInfo.getName());
@@ -89,15 +89,15 @@ public class MsoNeutronUtilsTest extends BaseTest{
@Test
public void queryNetworkTest_500() throws Exception {
expectedException.expect(MsoException.class);
- StubOpenStack.mockOpenStackGetNeutronNetwork_500("43173f6a-d699-414b-888f-ab243dda6dfe");
+ StubOpenStack.mockOpenStackGetNeutronNetwork_500(wireMockServer, "43173f6a-d699-414b-888f-ab243dda6dfe");
msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13");
}
@Test
public void deleteNetworkkTest() throws Exception {
- StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
- StubOpenStack.mockOpenStackDeleteNeutronNetwork("43173f6a-d699-414b-888f-ab243dda6dfe");
+ StubOpenStack.mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+ StubOpenStack.mockOpenStackDeleteNeutronNetwork(wireMockServer, "43173f6a-d699-414b-888f-ab243dda6dfe");
Boolean result = msoNeutronUtils.deleteNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13");
Assert.assertTrue(result);
@@ -105,8 +105,8 @@ public class MsoNeutronUtilsTest extends BaseTest{
@Test
public void updateNetworkTest() throws Exception {
- StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
- StubOpenStack.mockOpenstackPutNetwork("OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+ StubOpenStack.mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+ StubOpenStack.mockOpenstackPutNetwork(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("MTN13", "tenantId",
"43173f6a-d699-414b-888f-ab243dda6dfe",MsoNeutronUtils.NetworkType.PROVIDER,"PROVIDER", vlans);
@@ -115,8 +115,8 @@ public class MsoNeutronUtilsTest extends BaseTest{
@Test
public void updateNetworkTest_NetworkTypeAsMultiProvider() throws Exception {
- StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
- StubOpenStack.mockOpenstackPutNetwork("OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+ StubOpenStack.mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+ StubOpenStack.mockOpenstackPutNetwork(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("MTN13", "tenantId",
"43173f6a-d699-414b-888f-ab243dda6dfe",MsoNeutronUtils.NetworkType.MULTI_PROVIDER,"PROVIDER", vlans);
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index 390c775cb2..1f6ea413ec 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -63,6 +63,24 @@
</compilerArgs>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/AllTestsTestSuite.java</include>
+ </includes>
+ <parallel>suites</parallel>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java
new file mode 100644
index 0000000000..3c05f8164b
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb;
+import org.junit.runner.RunWith;
+
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+
+@RunWith(WildcardPatternSuite.class)
+@SuiteClasses("**/*Test.class")
+public class AllTestsTestSuite {
+ // the class remains empty,
+ // used only as a holder for the above annotations
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
new file mode 100644
index 0000000000..b2a20681d9
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
@@ -0,0 +1,21 @@
+package org.onap.so.adapters.catalogdb;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class CatalogDbAdapterBaseTest {
+
+ @LocalServerPort
+ protected int port;
+
+
+ @Test
+ public void testNothing(){}
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index a97029ef5b..bd8c5bc3e3 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -20,7 +20,8 @@
package org.onap.so.adapters.catalogdb.catalogrest;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.onap.so.logger.MdcConstants.ENDTIME;
import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
import static org.onap.so.logger.MdcConstants.PARTNERNAME;
@@ -29,45 +30,29 @@ import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
import static org.onap.so.logger.MdcConstants.STATUSCODE;
-
import java.io.IOException;
import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
import org.json.JSONException;
-import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.adapters.catalogdb.CatalogDBApplication;
-
+import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
-import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.annotation.DirtiesContext.ClassMode;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.util.UriComponentsBuilder;
import ch.qos.logback.classic.spi.ILoggingEvent;
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
-public class CatalogDBRestTest {
+public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
private static final String ECOMP_MSO_CATALOG_V2_VF_MODULES = "ecomp/mso/catalog/v2/vfModules";
@@ -81,9 +66,6 @@ public class CatalogDBRestTest {
private static final String ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES = "ecomp/mso/catalog/v2/serviceResources";
- @LocalServerPort
- private int port;
-
TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
HttpHeaders headers = new HttpHeaders();
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
index 5a6ab747c5..f2f06d7f3d 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
@@ -27,6 +27,7 @@ import javax.ws.rs.core.Response;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
import org.onap.so.db.catalog.beans.AuthenticationType;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
@@ -44,10 +45,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
-public class CloudConfigTest {
+public class CloudConfigTest extends CatalogDbAdapterBaseTest {
protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
index 898e8eadf1..78ac4ca095 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
@@ -36,6 +36,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.VfModule;
@@ -56,10 +57,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.beans.BeanUtils;
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
-public class CvnfcCatalogDbQueryTest {
+public class CvnfcCatalogDbQueryTest extends CatalogDbAdapterBaseTest {
@Autowired
private CvnfcCustomizationRepository cvnfcCustomizationRepository;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
index 89a7ba3d17..e6a281a375 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
@@ -35,6 +35,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
@@ -50,10 +51,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
-public class NetworkCollectionCatalogDbQueryTest {
+public class NetworkCollectionCatalogDbQueryTest extends CatalogDbAdapterBaseTest {
private static final Logger logger = LoggerFactory.getLogger(NetworkCollectionCatalogDbQueryTest.class);
private static final String NETWORKCOLLECTION = "NetworkCollection";
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index ea8cb5d616..461fce555f 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -31,6 +31,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
import org.onap.so.db.catalog.beans.AuthenticationType;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
@@ -59,10 +60,7 @@ import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
-public class CatalogDbClientTest {
+public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public static final String MTN13 = "mtn13";
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 73f50ed908..9c3ef2578f 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -37,6 +37,24 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/AllTestsTestSuite.java</include>
+ </includes>
+ <parallel>suites</parallel>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<!-- run the following plugin only when there's a wsdl change and you need to recompile the java classes
<plugin>
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
index 707af7b6be..7bfb8c1d76 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
@@ -64,9 +64,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameNeutronModeGetNetworkException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenstackGet("/mockPublicUrl/v2.0/networks",HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ mockOpenstackGet(wireMockServer, "/mockPublicUrl/v2.0/networks",HttpStatus.SC_INTERNAL_SERVER_ERROR);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -77,13 +77,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameNeutronModeCreateNetworkException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetNeutronNetwork_404("dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetNeutronNetwork_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc");
- mockOpenStackGetAllNeutronNetworks_404();
+ mockOpenStackGetAllNeutronNetworks_404(wireMockServer);
- mockOpenstackPost("/mockPublicUrl/v2.0/networks", HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ mockOpenstackPost(wireMockServer, "/mockPublicUrl/v2.0/networks", HttpStatus.SC_INTERNAL_SERVER_ERROR);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -94,13 +94,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameNeutronMode() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetNeutronNetwork_404("dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetNeutronNetwork_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc");
- mockOpenStackGetAllNeutronNetworks_404();
+ mockOpenStackGetAllNeutronNetworks_404(wireMockServer);
- mockOpenStackPostNeutronNetwork_200("OpenstackCreateNeutronNetworkResponse.json");
+ mockOpenStackPostNeutronNetwork_200(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -111,9 +111,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameAlreadyExistNeutronMode() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetAllNeutronNetworks_200("OpenstackGetNeutronNetworks.json");
+ mockOpenStackGetAllNeutronNetworks_200(wireMockServer, "OpenstackGetNeutronNetworks.json");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -124,9 +124,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameAlreadyExistNeutronModeFailIfExistTrue() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetAllNeutronNetworks_200("OpenstackGetNeutronNetworks.json");
+ mockOpenStackGetAllNeutronNetworks_200(wireMockServer, "OpenstackGetNeutronNetworks.json");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -137,13 +137,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameHeatMode() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStack_404("dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStack_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc");
- mockOpenStackPostStack_200("OpenstackResponse_Stack.json");
+ mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
- mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc/stackId");
+ mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc/stackId");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -154,11 +154,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameAlreadyExistHeatMode() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPostStack_200("OpenstackResponse_Stack.json");
+ mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
- mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -169,9 +169,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameAlreadyExistHeatModeFailIfExistTrue() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -183,9 +183,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameHeatModeQueryNetworkException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenstackGet("/mockPublicUrl/stacks/dvspg-VCE_VPE-mtjnj40avbc",HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ mockOpenstackGet(wireMockServer, "/mockPublicUrl/stacks/dvspg-VCE_VPE-mtjnj40avbc",HttpStatus.SC_INTERNAL_SERVER_ERROR);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -196,11 +196,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameHeatModeCreateNetworkException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStack_404("dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStack_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc");
- mockOpenstackPost("/mockPublicUrl/stacks",HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ mockOpenstackPost(wireMockServer, "/mockPublicUrl/stacks",HttpStatus.SC_INTERNAL_SERVER_ERROR);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -211,11 +211,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameCloudSiteNotPresentError() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPostStack_200("OpenstackResponse_Stack.json");
+ mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
- mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -226,13 +226,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkHeatModeSuccess() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json");
+ mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_DeleteComplete.json");
- mockOpenStackDeleteStack_200();
+ mockOpenStackDeleteStack_200(wireMockServer);
- mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+ mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -243,13 +243,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkDeleteStackException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json");
+ mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_DeleteComplete.json");
- mockOpenStackDeleteStack_500();
+ mockOpenStackDeleteStack_500(wireMockServer);
- mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+ mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -260,13 +260,13 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkError() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json");
+ mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_DeleteComplete.json");
- mockOpenStackDeleteStack_200();
+ mockOpenStackDeleteStack_200(wireMockServer);
- mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
+ mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -278,11 +278,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkNeureonMode() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
+ mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
- mockOpenStackDeleteNeutronNetwork(NETWORK_ID,HttpStatus.SC_OK);
+ mockOpenStackDeleteNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_OK);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -293,11 +293,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkNeutronModeDeleteStackException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
+ mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
- mockOpenStackDeleteNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ mockOpenStackDeleteNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
//mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_ID);
@@ -310,10 +310,10 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkNeutronModeSuccess() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
- mockOpenStackPutNeutronNetwork_200("OpenstackCreateNeutronNetworkResponse.json",NETWORK_ID);
+ mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
+ mockOpenStackPutNeutronNetwork_200(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json",NETWORK_ID);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -324,10 +324,10 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkNeutronUpdateException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
- mockOpenStackPutNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
+ mockOpenStackPutNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -338,11 +338,11 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkHeatUpdateException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_NAME);
+ mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", NETWORK_NAME);
- mockOpenStackPutStack(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ mockOpenStackPutStack(wireMockServer, NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -353,9 +353,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkHeatQueryException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStack_500(NETWORK_NAME);
+ mockOpenStackGetStack_500(wireMockServer, NETWORK_NAME);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -366,9 +366,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkHeatStackNotFound() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStack_404(NETWORK_NAME);
+ mockOpenStackGetStack_404(wireMockServer, NETWORK_NAME);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -379,9 +379,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkNeutronQueryException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ mockOpenStackGetNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -392,9 +392,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkNeutronStackNotFound() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_NOT_FOUND);
+ mockOpenStackGetNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_NOT_FOUND);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -405,9 +405,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void queryNetworkHeatModesuccess() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_ID);
+ mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", NETWORK_ID);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -418,9 +418,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void queryNetworkHeatModeQueryException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStack_500(NETWORK_ID);
+ mockOpenStackGetStack_500(wireMockServer, NETWORK_ID);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -431,9 +431,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void queryNetworkNeutronModeSuccess() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
+ mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -444,9 +444,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void queryNetworkNeutronModeException() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ mockOpenStackGetNeutronNetwork(wireMockServer, NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java
index f8dcddde04..21ca860b54 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java
@@ -20,22 +20,9 @@
package org.onap.so.adapters.network;
-import org.apache.http.HttpStatus;
-import org.junit.Test;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.onap.so.entity.MsoRequest;
-import org.onap.so.openstack.beans.NetworkRollback;
-import org.onap.so.openstack.beans.Subnet;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.containing;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.onap.so.bpmn.mock.StubOpenStack.getBodyFromFile;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedVUSP_200;
@@ -45,6 +32,18 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccessQueryNetwork;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.apache.http.HttpStatus;
+import org.junit.Test;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.beans.NetworkRollback;
+import org.onap.so.openstack.beans.Subnet;
+import org.springframework.beans.factory.annotation.Autowired;
+
public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
@Autowired
MsoNetworkAdapterAsyncImpl impl;
@@ -57,12 +56,12 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
@Test
public void rollbackNetworkATest() throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens"))
.withRequestBody(containing("tenantId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
- stubFor(post(urlPathEqualTo("/notificationUrl"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
.withRequestBody(containing("<completed>true</completed>"))
.willReturn(aResponse()
.withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" +
@@ -79,12 +78,12 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
@Test
public void rollbackNetworkATest_NotifyException() throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens"))
.withRequestBody(containing("tenantId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
- stubFor(post(urlPathEqualTo("/notificationUrl"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
.withRequestBody(containing("<completed>true</completed>"))
.willReturn(aResponse()
.withStatus(HttpStatus.SC_NOT_FOUND)));
@@ -124,12 +123,12 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkATest() throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens"))
.withRequestBody(containing("tenantId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
- stubFor(post(urlPathEqualTo("/notificationUrl"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
.withRequestBody(containing("<completed>true</completed>"))
.willReturn(aResponse()
.withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" +
@@ -146,12 +145,12 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkATest_NotifyException() throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens"))
.withRequestBody(containing("tenantId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
- stubFor(post(urlPathEqualTo("/notificationUrl"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
.withRequestBody(containing("<completed>true</completed>"))
.willReturn(aResponse()
.withStatus(HttpStatus.SC_NOT_FOUND)));
@@ -167,15 +166,15 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkATest() throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens"))
.withRequestBody(containing("tenantId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
- mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_UpdateComplete.json");
- mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200();
- stubFor(post(urlPathEqualTo("/notificationUrl"))
+ mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json");
+ mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer);
+ wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
.withRequestBody(containing("updateNetworkNotification"))
.willReturn(aResponse()
.withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" +
@@ -196,14 +195,14 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkATest_NotifyExcpetion() throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens"))
.withRequestBody(containing("tenantId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
- mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_UpdateComplete.json");
- mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200();
+ mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json");
+ mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer);
HashMap<String,String> networkParams = new HashMap<String,String>();
networkParams.put("shared", "true");
networkParams.put("external", "false");
@@ -220,19 +219,19 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
@Test
public void queryNetworkATest() throws IOException {
- mockOpenStackResponseAccessQueryNetwork(wireMockPort);
+ mockOpenStackResponseAccessQueryNetwork(wireMockServer, wireMockPort);
impl.queryNetworkA("mtn13", "tenantId", "networkId", "messageId", new MsoRequest(),
"http://localhost:"+wireMockPort+"/notificationUrl");
}
@Test
public void createNetworkATest() throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens"))
.withRequestBody(containing("tenantId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
- stubFor(post(urlPathEqualTo("/notificationUrl"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
.withRequestBody(containing("createNetworkNotification"))
.willReturn(aResponse()
.withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" +
@@ -243,9 +242,9 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
" </soapenv:Body>\n" +
"</soapenv:Envelope>")
.withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreatedVUSP_200();
- mockOpenStackPostStacks_200();
- mockOpenStackPostStacks_200();
+ mockOpenStackGetStackCreatedVUSP_200(wireMockServer);
+ mockOpenStackPostStacks_200(wireMockServer);
+ mockOpenStackPostStacks_200(wireMockServer);
HashMap<String,String> networkParams = new HashMap<String,String>();
impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0",
"physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), networkParams, "messageId",
@@ -254,13 +253,13 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
@Test
public void createNetworkATest_NotifyException() throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens"))
.withRequestBody(containing("tenantId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreatedVUSP_200();
- mockOpenStackPostStacks_200();
+ mockOpenStackGetStackCreatedVUSP_200(wireMockServer);
+ mockOpenStackPostStacks_200(wireMockServer);
HashMap<String,String> networkParams = new HashMap<String,String>();
networkParams.put("shared", "true");
networkParams.put("external", "false");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
index 4e2d5e5da2..97392adeef 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
@@ -102,13 +102,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
request.setNetworkTechnology(networkTechnology);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPostPublicUrlWithBodyFile_200();
+ mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
- mockOpenStackGetStackCreatedVUSP_200();
+ mockOpenStackGetStackCreatedVUSP_200(wireMockServer);
- mockOpenStackGetStackVUSP_404();
+ mockOpenStackGetStackVUSP_404(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<CreateNetworkRequest> entity = new HttpEntity<CreateNetworkRequest>(request, headers);
@@ -127,13 +127,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPostPublicUrlWithBodyFile_200();
+ mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
- mockOpenStackGetStackCreatedAppC_200();
+ mockOpenStackGetStackCreatedAppC_200(wireMockServer);
- mockOpenStackGetStackAppC_404();
+ mockOpenStackGetStackAppC_404(wireMockServer);
headers.add("Content-Type", MediaType.APPLICATION_JSON);
headers.add("Accept", MediaType.APPLICATION_JSON);
@@ -170,13 +170,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
request.setNetworkStackId(NETWORK_ID);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPublicUrlStackByID_200(wireMockPort);
+ mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort);
- mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockPort);
+ mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort);
- mockOpenStackDeletePublicUrlStackByNameAndID_204();
+ mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
@@ -203,13 +203,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
msoReq.setRequestId(MSO_REQUEST_ID);
msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPublicUrlStackByID_200(wireMockPort);
+ mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort);
- mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockPort);
+ mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort);
- mockOpenStackDeletePublicUrlStackByNameAndID_204();
+ mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
@@ -247,8 +247,8 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
@Test
public void testQueryNetwork() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers);
@@ -280,15 +280,15 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
request.setNetworkStackId(NETWORK_ID);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPublicUrlStackByName_200(wireMockPort);
+ mockOpenStackPublicUrlStackByName_200(wireMockServer, wireMockPort);
- mockOpenStackPublicUrlStackByID_200(wireMockPort);
+ mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort);
- mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockPort);
+ mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockServer, wireMockPort);
- mockOpenStackPutPublicUrlStackByNameAndID_200();
+ mockOpenStackPutPublicUrlStackByNameAndID_200(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
@@ -307,13 +307,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
@Test
public void testCreateNetworkCNRC_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException {
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPostPublicUrlWithBodyFile_200();
+ mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
- mockOpenStackGetStackCreatedAppC_200();
+ mockOpenStackGetStackCreatedAppC_200(wireMockServer);
- mockOpenStackGetStackAppC_404();
+ mockOpenStackGetStackAppC_404(wireMockServer);
headers.add("Content-Type", MediaType.APPLICATION_JSON);
headers.add("Accept", MediaType.APPLICATION_JSON);
@@ -334,13 +334,13 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
@Test
public void testCreateNetworkNC_Shared_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException {
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPostPublicUrlWithBodyFile_200();
+ mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
- mockOpenStackGetStackCreatedAppC_200();
+ mockOpenStackGetStackCreatedAppC_200(wireMockServer);
- mockOpenStackGetStackAppC_404();
+ mockOpenStackGetStackAppC_404(wireMockServer);
headers.add("Content-Type", MediaType.APPLICATION_JSON);
headers.add("Accept", MediaType.APPLICATION_JSON);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
index 405118cb30..f24a5a5292 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
@@ -90,19 +90,19 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
request.setBackout(backout);
request.setFailIfExists(failIfExists);
- mockOpenStackResponseAccessAdmin(wireMockPort);
+ mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort);
- mockOpenStackGetTenantByName_404(tenantName);
+ mockOpenStackGetTenantByName_404(wireMockServer, tenantName);
- mockOpenStackPostTenantWithBodyFile_200();
+ mockOpenStackPostTenantWithBodyFile_200(wireMockServer);
- mockOpenStackGetUser_200("m93945");
+ mockOpenStackGetUser_200(wireMockServer, "m93945");
- mockOpenStackGetRoles_200("OS-KSADM");
+ mockOpenStackGetRoles_200(wireMockServer, "OS-KSADM");
- mockOpenStackPutRolesAdmin_200("OS-KSADM");
+ mockOpenStackPutRolesAdmin_200(wireMockServer, "OS-KSADM");
- mockOpenStackPostMetadata_200();
+ mockOpenStackPostMetadata_200(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<CreateTenantRequest> entity = new HttpEntity<CreateTenantRequest>(request, headers);
@@ -141,13 +141,13 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
request.setBackout(backout);
request.setFailIfExists(failIfExists);
- mockOpenStackResponseAccessAdmin(wireMockPort);
+ mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort);
- mockOpenStackGetTenantByName_200(tenantName);
+ mockOpenStackGetTenantByName_200(wireMockServer, tenantName);
- mockOpenStackPostTenant_200();
+ mockOpenStackPostTenant_200(wireMockServer);
- mockOpenStackGetMetadata_200();
+ mockOpenStackGetMetadata_200(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<CreateTenantRequest> entity = new HttpEntity<CreateTenantRequest>(request, headers);
@@ -180,11 +180,11 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
request.setTenantId(tenantId);
request.setMsoRequest(msoReq);
- mockOpenStackResponseAccessAdmin(wireMockPort);
+ mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort);
- mockOpenStackGetTenantById_200(tenantId);
+ mockOpenStackGetTenantById_200(wireMockServer, tenantId);
- mockOpenStackDeleteTenantById_200(tenantId);
+ mockOpenStackDeleteTenantById_200(wireMockServer, tenantId);
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<DeleteTenantRequest> entity = new HttpEntity<DeleteTenantRequest>(request, headers);
@@ -218,9 +218,9 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
request.setTenantId(tenantId);
request.setMsoRequest(msoReq);
- mockOpenStackResponseAccessAdmin(wireMockPort);
+ mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort);
- mockOpenStackGetTenantById_404(tenantId);
+ mockOpenStackGetTenantById_404(wireMockServer, tenantId);
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<DeleteTenantRequest> entity = new HttpEntity<DeleteTenantRequest>(request, headers);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
index 8f6a18225d..0b83386ccc 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
@@ -59,7 +59,7 @@ public class ValetClientTest extends BaseRestTestUtils {
ValetCreateResponse vcr = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"), ValetCreateResponse.class);
GenericValetResponse<ValetCreateResponse> expected = new GenericValetResponse<ValetCreateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr);
- mockValetCreatePostResponse_200("requestId", mapper.writeValueAsString(vcr));
+ mockValetCreatePostResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vcr));
GenericValetResponse<ValetCreateResponse> actual = client.callValetCreateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
@@ -71,7 +71,7 @@ public class ValetClientTest extends BaseRestTestUtils {
ValetUpdateResponse vur = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"), ValetUpdateResponse.class);
GenericValetResponse<ValetUpdateResponse> expected = new GenericValetResponse<ValetUpdateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vur);
- mockValetCreatePutResponse_200("requestId", mapper.writeValueAsString(vur));
+ mockValetCreatePutResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vur));
GenericValetResponse<ValetUpdateResponse> actual = client.callValetUpdateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
@@ -83,7 +83,7 @@ public class ValetClientTest extends BaseRestTestUtils {
ValetDeleteResponse vdr = mapper.readValue(new File("src/test/resources/__files/ValetDeleteRequest.json"), ValetDeleteResponse.class);
GenericValetResponse<ValetDeleteResponse> expected = new GenericValetResponse<ValetDeleteResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vdr);
- mockValetDeleteDeleteResponse_200("requestId", mapper.writeValueAsString(vdr));
+ mockValetDeleteDeleteResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vdr));
GenericValetResponse<ValetDeleteResponse> actual = client.callValetDeleteRequest("requestId", "regionId", "ownerId", "tenantId", "vfModuleId", "vfModuleName");
@@ -95,7 +95,7 @@ public class ValetClientTest extends BaseRestTestUtils {
ValetConfirmResponse vcr = new ValetConfirmResponse();
GenericValetResponse<ValetConfirmResponse> expected = new GenericValetResponse<ValetConfirmResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr);
- mockValetConfirmPutRequest_200("requestId", "{}");
+ mockValetConfirmPutRequest_200(wireMockServer, "requestId", "{}");
GenericValetResponse<ValetConfirmResponse> actual = client.callValetConfirmRequest("requestId", "stackId");
@@ -107,7 +107,7 @@ public class ValetClientTest extends BaseRestTestUtils {
ValetRollbackResponse vrr = new ValetRollbackResponse();
GenericValetResponse<ValetRollbackResponse> expected = new GenericValetResponse<ValetRollbackResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vrr);
- mockValetRollbackPutRequest_200("requestId", "{}");
+ mockValetRollbackPutRequest_200(wireMockServer, "requestId", "{}");
GenericValetResponse<ValetRollbackResponse> actual = client.callValetRollbackRequest("requestId", "stackId", true, "error");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java
new file mode 100644
index 0000000000..f086653fea
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnf;
+import org.junit.runner.RunWith;
+
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+
+@RunWith(WildcardPatternSuite.class)
+@SuiteClasses("**/*Test.class")
+public class AllTestsTestSuite {
+ // the class remains empty,
+ // used only as a holder for the above annotations
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
index 017aa26758..b9edb68bb1 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
@@ -20,10 +20,17 @@
package org.onap.so.adapters.vnf;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+
import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Test;
@@ -37,25 +44,19 @@ import org.onap.so.db.catalog.beans.ServerType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.http.HttpHeaders;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
-import javax.ws.rs.core.MediaType;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.reset;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.tomakehurst.wiremock.WireMockServer;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = MsoOpenstackAdaptersApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@@ -64,6 +65,10 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
public abstract class BaseRestTestUtils {
@Value("${wiremock.server.port}")
protected int wireMockPort;
+
+ @Autowired
+ protected WireMockServer wireMockServer;
+
@Autowired
CloudConfig cloudConfig;
@@ -112,7 +117,7 @@ public abstract class BaseRestTestUtils {
*/
@Before
public void setUp() throws Exception {
- reset();
+ wireMockServer.resetAll();
mapper = new ObjectMapper();
CloudIdentity identity = new CloudIdentity();
identity.setId("MTN13");
@@ -134,15 +139,15 @@ public abstract class BaseRestTestUtils {
identity.setIdentityServerType(ServerType.KEYSTONE);
cloudSite.setIdentityService(identity);
- stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse()
.withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
.withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse()
.withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
.withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")).willReturn(aResponse()
.withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, ""))
.withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
index cbf252ec3a..02fbe2c530 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
@@ -21,33 +21,26 @@
package org.onap.so.adapters.vnf;
-import org.apache.http.HttpStatus;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.entity.MsoRequest;
-import org.onap.so.openstack.beans.VnfRollback;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.mock.mockito.SpyBean;
-
-import java.util.HashMap;
-import java.util.Map;
-
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.containing;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.verify;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doThrow;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.http.HttpStatus;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.springframework.beans.factory.annotation.Autowired;
+
public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
@Autowired
@@ -67,9 +60,9 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_200();
- stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
+ wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody
(containing("messageId"))
.willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
@@ -79,7 +72,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
"volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId",
msoRequest, notificationUrl);
- verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")));
+ wireMockServer.verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")));
}
@Test
@@ -89,7 +82,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
"volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId",
null, notificationUrl);
- verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")));
+ wireMockServer.verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")));
}
@@ -101,7 +94,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody
+ wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody
(containing("messageId"))
.willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest";
@@ -118,14 +111,14 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody
+ wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody
(containing("messageId"))
.willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest";
instance.updateVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
"volumeGroupHeatStackId|1", map, "messageId", msoRequest,
notificationUrl);
- verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")));
+ wireMockServer.verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")));
}
@Test
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
index 0816bc55a6..e40aab9ba1 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
@@ -21,7 +21,23 @@
package org.onap.so.adapters.vnf;
-import com.github.tomakehurst.wiremock.client.WireMock;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGetWithResponse;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.ws.Holder;
+
import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Ignore;
@@ -38,8 +54,6 @@ import org.onap.so.db.catalog.beans.HeatTemplateParam;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResource;
-import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.entity.MsoRequest;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
@@ -47,25 +61,8 @@ import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.mock.mockito.MockBean;
-import javax.xml.ws.Holder;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.when;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGetWithResponse;
+import com.github.tomakehurst.wiremock.client.WireMock;
public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@@ -80,13 +77,6 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId";
- @Before
- public void before() throws Exception {
- MockitoAnnotations.initMocks(this);
- WireMock.reset();
- setUp();
- }
-
@Test
@Ignore
public void healthCheckVNFTest() {
@@ -99,8 +89,8 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
StackInfo info = new StackInfo();
info.setStatus(HeatStatus.CREATED);
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
MsoRequest msoRequest = getMsoRequest();
@@ -115,9 +105,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVnfTest_HeatStatusUpdating() throws Exception {
expectedException.expect(VnfAlreadyExists.class);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Stack_Updating_VfModule.json")
.withStatus(HttpStatus.SC_OK)));
@@ -135,9 +125,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVnfTest_HeatStatusUpdated() throws Exception {
expectedException.expect(VnfAlreadyExists.class);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_StackId.json")
.withStatus(HttpStatus.SC_OK)));
@@ -155,9 +145,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVnfTest_HeatStatusFailed() throws Exception {
expectedException.expect(VnfAlreadyExists.class);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Stack_Failed_VfModule.json")
.withStatus(HttpStatus.SC_OK)));
@@ -175,9 +165,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVnfTest_HeatStatusCreated() throws Exception {
expectedException.expect(VnfAlreadyExists.class);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackGetStackVfModule_200(wireMockServer);
MsoRequest msoRequest = getMsoRequest();
@@ -206,8 +196,8 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVnfTest_NestedHeatStatusNotFound() throws Exception {
expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_404();
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_404(wireMockServer);
MsoRequest msoRequest = getMsoRequest();
@@ -222,9 +212,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVnfTest_ExceptionInGettingNestedHeat() throws Exception {
expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_404();
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_404(wireMockServer);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
@@ -241,9 +231,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVnfTest_NestedBaseHeatStatus_NotFound() throws Exception {
expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_404();
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_404(wireMockServer);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Stack_Created_VfModule.json")
.withStatus(HttpStatus.SC_OK)));
@@ -261,10 +251,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVnfTest_ExceptionInGettingBaseNestedHeat() throws Exception {
expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_404();
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_404(wireMockServer);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
MsoRequest msoRequest = getMsoRequest();
@@ -279,10 +269,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVnfTest_ExceptionInCreateStack() throws Exception {
expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_404();
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_404(wireMockServer);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
VfModule vfModule = new VfModule();
@@ -311,10 +301,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVnfTest_ModelCustUuidIsNull() throws Exception {
expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_404();
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_404(wireMockServer);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
VfModule vfModule = new VfModule();
@@ -348,10 +338,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVnfTest_HeatEnvironment_ContainsParameters() throws Exception {
expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_404();
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_404(wireMockServer);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
MsoRequest msoRequest = getMsoRequest();
@@ -387,7 +377,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
public void updateVnfTest_HeatStackNotFound() throws Exception {
expectedException.expect(VnfNotFound.class);
MsoRequest msoRequest = getMsoRequest();
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
@@ -400,9 +390,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
public void updateVnfTest_ExceptionInGettingNestedHeatStack() throws Exception {
expectedException.expect(VnfException.class);
MsoRequest msoRequest = getMsoRequest();
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_200();
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
Map<String, Object> map = new HashMap<>();
@@ -417,9 +407,9 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
public void updateVnfTest_NestedHeatStackNotFound() throws Exception {
expectedException.expect(VnfException.class);
MsoRequest msoRequest = getMsoRequest();
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_200();
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_NOT_FOUND)));
Map<String, Object> map = new HashMap<>();
@@ -434,10 +424,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
public void updateVnfTest_ExceptionInGettingNestedBaseHeatStack() throws Exception {
expectedException.expect(VnfException.class);
MsoRequest msoRequest = getMsoRequest();
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_200();
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_INTERNAL_SERVER_ERROR,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_INTERNAL_SERVER_ERROR,"OpenstackResponse_Stack_Created_VfModule.json");
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
@@ -450,10 +440,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
public void updateVnfTest_NestedBaseHeatStackNotFound() throws Exception {
expectedException.expect(VnfException.class);
MsoRequest msoRequest = getMsoRequest();
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_200();
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_NOT_FOUND,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_NOT_FOUND,"OpenstackResponse_Stack_Created_VfModule.json");
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
@@ -466,10 +456,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
public void updateVnfTest_MissingParams() throws Exception {
expectedException.expect(VnfException.class);
MsoRequest msoRequest = getMsoRequest();
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_200();
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
@@ -482,10 +472,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
public void updateVnfTest_UpdateStackException() throws Exception {
expectedException.expect(VnfException.class);
MsoRequest msoRequest = getMsoRequest();
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_200();
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
VfModuleCustomization vfModuleCustomization = getVfModuleCustomization();
vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>());
@@ -500,12 +490,12 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateVnfTest() throws Exception {
MsoRequest msoRequest = getMsoRequest();
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/"+vnfName,HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json");
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
- mockOpenStackPutStack("null/stackId", HttpStatus.SC_OK);
- mockOpenstackGetWithResponse("/mockPublicUrl/stacks/null/stackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/"+vnfName,HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json");
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
+ mockOpenStackPutStack(wireMockServer, "null/stackId", HttpStatus.SC_OK);
+ mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/null/stackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json");
VfModuleCustomization vfModuleCustomization = getVfModuleCustomization();
vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>());
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
index fbb9a224b3..0ace6e4249 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
@@ -21,6 +21,17 @@
package org.onap.so.adapters.vnf;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.Holder;
+
import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Rule;
@@ -33,12 +44,6 @@ import org.onap.so.entity.MsoRequest;
import org.onap.so.openstack.beans.VnfRollback;
import org.springframework.beans.factory.annotation.Autowired;
-import javax.xml.ws.Holder;
-import java.util.HashMap;
-import java.util.Map;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-
public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
@Rule
@@ -62,15 +67,15 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
@Test
public void queryVnfExceptionTest() throws Exception {
- reset();
- expectedException.expect(VnfException.class);
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
-
+ Holder <Map <String, String>> outputs = new Holder<>();
instance.queryVnf("siteid", "CloudOwner", "1234", "vfname",
msoRequest, new Holder<>(), new Holder<>(), new Holder<>(),
- new Holder<>());
+ outputs);
+
+ assertTrue(outputs.value.isEmpty());
}
@Test
@@ -78,19 +83,19 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse()
.withBody("{ \"id\": \"123\" }")
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse()
.withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
.withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse()
.withBodyFile("OpenstackResponse_Access.json")
.withStatus(HttpStatus.SC_OK)));
@@ -115,19 +120,19 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse()
.withBody("{ \"id\": \"123\" }")
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse()
.withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
.withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse()
.withBodyFile("OpenstackResponse_Access.json")
.withStatus(HttpStatus.SC_OK)));
@@ -225,19 +230,19 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse()
.withBody("{ \"id\": \"123\" }")
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse()
.withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
.withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse()
.withBodyFile("OpenstackResponse_Access.json")
.withStatus(HttpStatus.SC_OK)));
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
index 342a21a49c..152c23e9b8 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
@@ -20,31 +20,25 @@
package org.onap.so.adapters.vnf;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.Holder;
+
import org.apache.http.HttpStatus;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.onap.so.adapters.openstack.MsoOpenstackAdaptersApplication;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.entity.MsoRequest;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.web.server.LocalServerPort;
-
-import javax.xml.ws.Holder;
-import java.util.HashMap;
-import java.util.Map;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{
@Rule
@@ -76,19 +70,19 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/vfname")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/vfname")).willReturn(aResponse()
//.withHeader()
.withStatus(HttpStatus.SC_NOT_FOUND)));
- stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse()
//.withHeader()
.withBodyFile("MulticloudResponse_Stack.json")
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/vfname/outputs")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/vfname/outputs")).willReturn(aResponse()
.withStatus(HttpStatus.SC_NOT_FOUND)));
- stubFor(post(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload")).willReturn(aResponse()
+ wireMockServer.stubFor(post(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload")).willReturn(aResponse()
.withBodyFile("MulticloudResponse_Stack_Create.json")
.withStatus(HttpStatus.SC_CREATED)));
@@ -101,11 +95,11 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse()
.withBodyFile("MulticloudResponse_Stack.json")
.withStatus(HttpStatus.SC_OK)));
- stubFor(delete(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse()
+ wireMockServer.stubFor(delete(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse()
.withStatus(HttpStatus.SC_NO_CONTENT)));
instance.deleteVfModule("MTN13", "CloudOwner", "123", "workload-id", msoRequest, new Holder<>());
@@ -117,7 +111,7 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse()
+ wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse()
.withBodyFile("MulticloudResponse_Stack.json")
.withStatus(HttpStatus.SC_OK)));
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
index 3dcb52b8b7..50272dca20 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
@@ -20,6 +20,19 @@
package org.onap.so.adapters.vnf;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.Holder;
+
import org.apache.http.HttpStatus;
import org.junit.Rule;
import org.junit.Test;
@@ -29,19 +42,6 @@ import org.onap.so.entity.MsoRequest;
import org.onap.so.openstack.beans.VnfRollback;
import org.springframework.beans.factory.annotation.Autowired;
-import javax.xml.ws.Holder;
-import java.util.HashMap;
-import java.util.Map;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
-
public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
@Rule
@@ -90,8 +90,8 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVfModule_INSTANTIATED() throws Exception {
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
@@ -105,7 +105,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVfModule_queryVduNotFoundWithVolumeGroupId() throws Exception {
expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
@@ -118,9 +118,9 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
@Test
public void createVfModule_CreateVduException() throws Exception {
expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_404();
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_404(wireMockServer);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Stack_Created_VfModule.json")
.withStatus(HttpStatus.SC_OK)));
@@ -144,13 +144,13 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteVfModule_DeleteVduException() throws Exception {
expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_200();
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vSAMP12"))
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vSAMP12"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Stack_Created_VfModule.json")
.withStatus(HttpStatus.SC_OK)));
- stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
MsoRequest msoRequest = getMsoRequest();
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
index 50bae8a074..bf00faa41b 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
@@ -107,13 +107,13 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
CreateVfModuleRequest request = populateCreateVfModuleRequest();
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackVfModule_404();
+ mockOpenStackGetStackVfModule_404(wireMockServer);
- mockOpenStackPostStacks_200();
+ mockOpenStackPostStacks_200(wireMockServer);
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackGetStackVfModule_200(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
@@ -141,10 +141,10 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
CreateVfModuleRequest request = populateCreateVfModuleRequest();
request.setNotificationUrl( createURLWithPort("/mso/WorkflowMesssage"));
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStackVfModule_404();
- mockOpenStackPostStacks_200();
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStackVfModule_404(wireMockServer);
+ mockOpenStackPostStacks_200(wireMockServer);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
@@ -204,13 +204,13 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
request.setVfModuleParams(vfModuleParams);
request.setMessageId(MESSAGE_ID);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackVfModule_404();
+ mockOpenStackGetStackVfModule_404(wireMockServer);
- mockOpenStackPostStacks_200();
+ mockOpenStackPostStacks_200(wireMockServer);
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackGetStackVfModule_200(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
@@ -272,15 +272,15 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
request.setVfModuleParams(vfModuleParams);
request.setMessageId(MESSAGE_ID);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackVfModule_404();
+ mockOpenStackGetStackVfModule_404(wireMockServer);
- mockOpenStackGetStacks_404();
+ mockOpenStackGetStacks_404(wireMockServer);
- mockOpenStackPostStacks_200();
+ mockOpenStackPostStacks_200(wireMockServer);
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackGetStackVfModule_200(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
@@ -291,7 +291,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- mockOpenStackGetStacksWithBody_200("DELETE_IN_PROGRESS");
+ mockOpenStackGetStacksWithBody_200(wireMockServer, "DELETE_IN_PROGRESS");
response = restTemplate.exchange(
createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
@@ -299,7 +299,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- mockOpenStackGetStacksWithBody_200("DELETE_FAILED");
+ mockOpenStackGetStacksWithBody_200(wireMockServer, "DELETE_FAILED");
response = restTemplate.exchange(
createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
@@ -307,7 +307,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE");
+ mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE");
response = restTemplate.exchange(
createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
@@ -315,7 +315,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- mockOpenStackGetStacksWithBody_404();
+ mockOpenStackGetStacksWithBody_404(wireMockServer);
response = restTemplate.exchange(
createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST,
@@ -341,15 +341,15 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
request.setVnfId(AAI_VNF_ID);
request.setMsoRequest(msoRequest);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPostStacks_200();
+ mockOpenStackPostStacks_200(wireMockServer);
- mockOpenStackGetStacksStackId_404();
+ mockOpenStackGetStacksStackId_404(wireMockServer);
- mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockPort);
+ mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockServer, wireMockPort);
- mockOpenStackDeletePublicUrlStackByNameAndID_204();
+ mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
@@ -408,15 +408,15 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
request.setBackout(backout);
request.setVfModuleParams(vfModuleParams);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStacksVfModuleWithLocationHeader_200(wireMockPort);
+ mockOpenStackGetStacksVfModuleWithLocationHeader_200(wireMockServer, wireMockPort);
- mockOpenStackGetStacksVfModule_200(wireMockPort);
+ mockOpenStackGetStacksVfModule_200(wireMockServer, wireMockPort);
- mockOpenStackGetStacksBaseStack_200(wireMockPort);
+ mockOpenStackGetStacksBaseStack_200(wireMockServer, wireMockPort);
- mockOpenStackPutStacks_200();
+ mockOpenStackPutStacks_200(wireMockServer);
UpdateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
new File("src/test/resources/__files/UpdateVfModuleResponse.json"), UpdateVfModuleResponse.class);
@@ -455,13 +455,13 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
RollbackVfModuleRequest request = new RollbackVfModuleRequest();
request.setVfModuleRollback(vfModuleRollback);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStacksStackId_200(wireMockPort);
+ mockOpenStackGetStacksStackId_200(wireMockServer, wireMockPort);
- mockOpenStackDeleteStacks();
+ mockOpenStackDeleteStacks(wireMockServer);
- mockOpenStackGetStacksVUSP_404();
+ mockOpenStackGetStacksVUSP_404(wireMockServer);
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<RollbackVfModuleRequest> entity = new HttpEntity<RollbackVfModuleRequest>(request, headers);
@@ -489,7 +489,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
.build().toString();
System.out.println(testUri);
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
headers.add("Accept", MediaType.APPLICATION_JSON);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java
index f602690a10..20372b81d9 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java
@@ -50,9 +50,9 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
@Test
public void testCreateVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackPostStacks_200();
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackPostStacks_200(wireMockServer);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
@@ -65,9 +65,9 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
@Test
public void testCreateVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackPostStacks_200();
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackPostStacks_200(wireMockServer);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
request.setNotificationUrl("http://localhost:8080");
@@ -80,7 +80,7 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
@Test
public void testDeleteVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange(
@@ -91,7 +91,7 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
@Test
public void testDeleteVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
request.setNotificationUrl("http://localhost:8080");
HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
@@ -103,7 +103,7 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
@Test
public void testRollbackVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange(
@@ -114,7 +114,7 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
@Test
public void testRollbackVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
request.setNotificationUrl("http://localhost:8080");
HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
@@ -126,8 +126,8 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
@Test
public void testQueryVNFVolumes() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE");
javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID);
builder.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID)
.queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true)
@@ -142,8 +142,8 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
@Test
public void testQueryVNFVolumesError() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE");
javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID);
builder.queryParam("tenantId", TENANT_ID)
.queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true)
@@ -158,10 +158,10 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
@Test
public void testUpdateVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE");
- mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200);
- mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE");
+ mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME+"/stackId",200);
+ mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE");
UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange(
@@ -172,10 +172,10 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
@Test
public void testUpdateVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE");
- mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200);
- mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE");
+ mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME+"/stackId",200);
+ mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE");
UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
request.setNotificationUrl("http://localhost:8080");
HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java
index dba169c311..abdc2609a1 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java
@@ -49,9 +49,9 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
@Test
public void testCreateVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackPostStacks_200();
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackPostStacks_200(wireMockServer);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
@@ -64,9 +64,9 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
@Test
public void testCreateVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackPostStacks_200();
- mockOpenStackGetStackVfModule_200();
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackPostStacks_200(wireMockServer);
+ mockOpenStackGetStackVfModule_200(wireMockServer);
CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
request.setNotificationUrl("http://localhost:8080");
HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
@@ -78,7 +78,7 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
@Test
public void testDeleteVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange(
@@ -89,7 +89,7 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
@Test
public void testDeleteVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
request.setNotificationUrl("http://localhost:8080");
HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
@@ -101,7 +101,7 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
@Test
public void testRollbackVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange(
@@ -112,7 +112,7 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
@Test
public void testRollbackVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
request.setNotificationUrl("http://localhost:8080");
HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
@@ -124,8 +124,8 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
@Test
public void testQueryVNFVolumes() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE");
javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID);
builder.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID)
.queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true)
@@ -140,8 +140,8 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
@Test
public void testQueryVNFVolumesError() throws IOException{
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE");
javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID);
builder.queryParam("tenantId", TENANT_ID)
.queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true)
@@ -155,10 +155,10 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
}
@Test
public void testUpdateVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE");
- mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200);
- mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE");
+ mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME+"/stackId",200);
+ mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE");
UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange(
@@ -169,10 +169,10 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
@Test
public void testUpdateVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockPort);
- mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE");
- mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200);
- mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE");
+ mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE");
+ mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME+"/stackId",200);
+ mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE");
UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
request.setNotificationUrl("http://localhost:8080");
HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
index 569a845caa..de12f2cfbe 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
@@ -27,7 +27,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
@@ -37,428 +36,430 @@ import java.io.IOException;
import org.apache.http.HttpStatus;
+import com.github.tomakehurst.wiremock.WireMockServer;
+
public class StubOpenStack {
private static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0";
private static final String NETWORK_ID = "da886914-efb2-4917-b335-c8381528d90b";
private static final String NETWORK_NAME_2 = "stackname";
private static final String NETWORK_ID_2 = "stackId";
- public static void mockOpenStackResponseAccess(int port) throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public static void mockOpenStackResponseAccess(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access.json", port, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackResponseAccessMulticloud(int port) throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public static void mockOpenStackResponseAccessMulticloud(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_AccessMulticloud.json", port, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackResponseAccessQueryNetwork(int port) throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens"))
+ public static void mockOpenStackResponseAccessQueryNetwork(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens"))
.withRequestBody(containing("tenantId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access_queryNetwork.json", port, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackResponseAccessAdmin(int port) throws IOException {
- stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public static void mockOpenStackResponseAccessAdmin(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFile("OpenstackResponse_Access_Admin.json", port, "/mockPublicUrl"))
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPublicUrlStackByName_200(int port) throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME)).willReturn(aResponse()
+ public static void mockOpenStackPublicUrlStackByName_200(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME)).willReturn(aResponse()
.withHeader("X-Openstack-Request-Id", "openstackRquest")
.withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME)
.withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME))
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPublicUrlStackByID_200(int port) throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_ID)).willReturn(aResponse()
+ public static void mockOpenStackPublicUrlStackByID_200(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_ID)).willReturn(aResponse()
.withHeader("X-Openstack-Request-Id", "openstackRquest")
.withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME)
.withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME))
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetPublicUrlStackByNameAndID_200(int port) throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
+ public static void mockOpenStackGetPublicUrlStackByNameAndID_200(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
.withHeader("X-Openstack-Request-Id", "openstackRquest")
.withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME)
.withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME))
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetPublicUrlStackByNameAndID_204(int port) throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
+ public static void mockOpenStackGetPublicUrlStackByNameAndID_204(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
.withHeader("X-Openstack-Request-Id", "openstackRquest")
.withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)
.withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME))
.withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackPutPublicUrlStackByNameAndID_200() {
- stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
+ public static void mockOpenStackPutPublicUrlStackByNameAndID_200(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
.withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200() {
- stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME_2+"/"+NETWORK_ID_2)).willReturn(aResponse()
+ public static void mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME_2+"/"+NETWORK_ID_2)).willReturn(aResponse()
.withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackDeletePublicUrlStackByNameAndID_204() {
- stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
+ public static void mockOpenStackDeletePublicUrlStackByNameAndID_204(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse()
.withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NO_CONTENT)));
}
- public static void mockOpenStackPostPublicUrlWithBodyFile_200() {
- stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks"))
+ public static void mockOpenStackPostPublicUrlWithBodyFile_200(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Stack.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetStackCreatedAppC_200() {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3/stackId"))
+ public static void mockOpenStackGetStackCreatedAppC_200(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3/stackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Stack_Created.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetStackAppC_404() {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3"))
+ public static void mockOpenStackGetStackAppC_404(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3"))
.willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackGetStackCreatedVUSP_200() {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/stackId"))
+ public static void mockOpenStackGetStackCreatedVUSP_200(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/stackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Stack_Created.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetStackVUSP_404() {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0"))
+ public static void mockOpenStackGetStackVUSP_404(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0"))
.willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackPostStack_200(String filename) {
- stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse()
+ public static void mockOpenStackPostStack_200(WireMockServer wireMockServer, String filename) {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPostNeutronNetwork_200(String filename) {
- stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse()
+ public static void mockOpenStackPostNeutronNetwork_200(WireMockServer wireMockServer, String filename) {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPutNeutronNetwork_200(String filename,String networkId) {
- stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse()
+ public static void mockOpenStackPutNeutronNetwork_200(WireMockServer wireMockServer, String filename,String networkId) {
+ wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPutNeutronNetwork(String networkId, int responseCode) {
- stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse()
+ public static void mockOpenStackPutNeutronNetwork(WireMockServer wireMockServer, String networkId, int responseCode) {
+ wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withStatus(responseCode)));
}
- public static void mockOpenStackGetAllNeutronNetworks_200(String filename){
- stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse()
+ public static void mockOpenStackGetAllNeutronNetworks_200(WireMockServer wireMockServer, String filename){
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetNeutronNetwork_404(String networkName) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkName)).willReturn(aResponse()
+ public static void mockOpenStackGetNeutronNetwork_404(WireMockServer wireMockServer, String networkName) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkName)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackGetAllNeutronNetworks_404() {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse()
+ public static void mockOpenStackGetAllNeutronNetworks_404(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenstackGetWithResponse(String url,int responseCode, String responseFile) {
- stubFor(get(urlPathEqualTo(url)).willReturn(aResponse()
+ public static void mockOpenstackGetWithResponse(WireMockServer wireMockServer, String url,int responseCode, String responseFile) {
+ wireMockServer.stubFor(get(urlPathEqualTo(url)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile(responseFile)
.withStatus(responseCode)));
}
- public static void mockOpenstackPostWithResponse(String url,int responseCode, String responseFile) {
- stubFor(post(urlPathEqualTo(url)).willReturn(aResponse()
+ public static void mockOpenstackPostWithResponse(WireMockServer wireMockServer, String url,int responseCode, String responseFile) {
+ wireMockServer.stubFor(post(urlPathEqualTo(url)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile(responseFile)
.withStatus(responseCode)));
}
- public static void mockOpenstackGet(String url,int responseCode) {
- stubFor(get(urlPathEqualTo(url)).willReturn(aResponse()
+ public static void mockOpenstackGet(WireMockServer wireMockServer, String url,int responseCode) {
+ wireMockServer.stubFor(get(urlPathEqualTo(url)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withStatus(responseCode)));
}
- public static void mockOpenstackPost(String url,int responseCode) {
- stubFor(post(urlPathEqualTo(url)).willReturn(aResponse()
+ public static void mockOpenstackPost(WireMockServer wireMockServer, String url,int responseCode) {
+ wireMockServer.stubFor(post(urlPathEqualTo(url)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withStatus(responseCode)));
}
- public static void mockOpenStackGetStackVfModule_200() {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ public static void mockOpenStackGetStackVfModule_200(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Stack_Created_VfModule.json")
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetStackVfModule_404() {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001"))
+ public static void mockOpenStackGetStackVfModule_404(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackPostStacks_200() {
- stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks"))
+ public static void mockOpenStackPostStacks_200(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Stack.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetStacks_404() {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/3d7ff7b4-720b-4604-be0a-1974fc58ed96"))
+ public static void mockOpenStackGetStacks_404(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/3d7ff7b4-720b-4604-be0a-1974fc58ed96"))
.willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackGetStacksWithBody_200(String replaceWith) throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001"))
+ public static void mockOpenStackGetStacksWithBody_200(WireMockServer wireMockServer, String replaceWith) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFileVnfAdapter(replaceWith))
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetStackWithBody_200(String replaceWith) throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
+ public static void mockOpenStackGetStackWithBody_200(WireMockServer wireMockServer, String replaceWith) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFileVnfAdapter(replaceWith))
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetStacksWithBody_404() throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001"))
+ public static void mockOpenStackGetStacksWithBody_404(WireMockServer wireMockServer) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(getBodyFromFileVnfAdapter(null))
.withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackGetStacksStackId_404() {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/stackId"))
+ public static void mockOpenStackGetStacksStackId_404(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/stackId"))
.willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackGetStacksVfModule_200(int port) throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse()
+ public static void mockOpenStackGetStacksVfModule_200(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse()
.withHeader("X-Openstack-Request-Id", "openstackRquest")
.withBody(getBodyFromFile("OpenstackResponse_VnfStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetStacksVfModuleWithLocationHeader_200(int port) throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse()
+ public static void mockOpenStackGetStacksVfModuleWithLocationHeader_200(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse()
.withHeader("X-Openstack-Request-Id", "openstackRquest")
.withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")
.withBody(getBodyFromFile("OpenstackResponse_VnfStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetStacksBaseStack_200(int port) throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfModuleStackId")).willReturn(aResponse()
+ public static void mockOpenStackGetStacksBaseStack_200(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfModuleStackId")).willReturn(aResponse()
.withHeader("X-Openstack-Request-Id", "openstackRquest")
.withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/baseVfModuleStackId")
.withBody(getBodyFromFile("OpenstackResponse_VnfBaseStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPutStacks_200() {
- stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse()
+ public static void mockOpenStackPutStacks_200(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse()
.withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPutStack(String networkId,int responseCode) {
- stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+networkId))
+ public static void mockOpenStackPutStack(WireMockServer wireMockServer, String networkId,int responseCode) {
+ wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+networkId))
.willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withStatus(responseCode)));
}
- public static void mockOpenStackGetStacksStackId_200(int port) throws IOException {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/StackId")).willReturn(aResponse()
+ public static void mockOpenStackGetStacksStackId_200(WireMockServer wireMockServer, int port) throws IOException {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/StackId")).willReturn(aResponse()
.withHeader("X-Openstack-Request-Id", "openstackRquest")
.withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/stackId")
.withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackDeleteStacks() {
- stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b"))
+ public static void mockOpenStackDeleteStacks(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b"))
.willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest")));
}
- public static void mockOpenStackGetStacksVUSP_404() {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b"))
+ public static void mockOpenStackGetStacksVUSP_404(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b"))
.willReturn(aResponse()
.withHeader("X-Openstack-Request-Id", "openstackRquest")
.withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackGetStackCreated_200(String filename, String networkName) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName))
+ public static void mockOpenStackGetStackCreated_200(WireMockServer wireMockServer, String filename, String networkName) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetStack_404(String networkName) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName))
+ public static void mockOpenStackGetStack_404(WireMockServer wireMockServer, String networkName) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackGetStack_500(String networkName) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName))
+ public static void mockOpenStackGetStack_500(WireMockServer wireMockServer, String networkName) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
}
- public static void mockOpenStackGetStackDeleteOrUpdateComplete_200(String filename) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2))
+ public static void mockOpenStackGetStackDeleteOrUpdateComplete_200(WireMockServer wireMockServer, String filename) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile(filename).withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetNeutronNetwork(String filename,String networkId,int status) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId))
+ public static void mockOpenStackGetNeutronNetwork(WireMockServer wireMockServer, String filename,String networkId,int status) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile(filename).withStatus(status)));
}
- public static void mockOpenStackGetNeutronNetwork(String networkId,int status) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId))
+ public static void mockOpenStackGetNeutronNetwork(WireMockServer wireMockServer, String networkId,int status) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(status)));
}
- public static void mockOpenStackDeleteStack_200() {
- stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2))
+ public static void mockOpenStackDeleteStack_200(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2))
.willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackDeleteStack_500() {
- stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2))
+ public static void mockOpenStackDeleteStack_500(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2))
.willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
}
- public static void mockOpenStackDeleteNeutronNetwork(String networkId,int responseCode) {
- stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId))
+ public static void mockOpenStackDeleteNeutronNetwork(WireMockServer wireMockServer, String networkId,int responseCode) {
+ wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId))
.willReturn(aResponse().withStatus(responseCode)));
}
- public static void mockOpenStackPostMetadata_200() {
- stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse()
+ public static void mockOpenStackPostMetadata_200(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Metadata.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetMetadata_200() {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse()
+ public static void mockOpenStackGetMetadata_200(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Metadata.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPostTenantWithBodyFile_200() throws IOException {
- stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants"))
+ public static void mockOpenStackPostTenantWithBodyFile_200(WireMockServer wireMockServer) throws IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants"))
.withRequestBody(equalToJson(readFile("src/test/resources/__files/OpenstackRequest_Tenant.json"))).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPostTenant_200() throws IOException {
- stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")).willReturn(aResponse()
+ public static void mockOpenStackPostTenant_200(WireMockServer wireMockServer) throws IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")).willReturn(aResponse()
.withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetTenantByName_200(String tenantName) {
- stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse()
+ public static void mockOpenStackGetTenantByName_200(WireMockServer wireMockServer, String tenantName) {
+ wireMockServer.stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetTenantByName_404(String tenantName) {
- stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse()
+ public static void mockOpenStackGetTenantByName_404(WireMockServer wireMockServer, String tenantName) {
+ wireMockServer.stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse()
.withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackGetTenantById_200(String tenantId) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse()
+ public static void mockOpenStackGetTenantById_200(WireMockServer wireMockServer, String tenantId) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetTenantById_404(String tenantId) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse()
+ public static void mockOpenStackGetTenantById_404(WireMockServer wireMockServer, String tenantId) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse()
.withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND)));
}
- public static void mockOpenStackDeleteTenantById_200(String tenantId) {
- stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse()
+ public static void mockOpenStackDeleteTenantById_200(WireMockServer wireMockServer, String tenantId) {
+ wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse()
.withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetUser_200(String user) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)).willReturn(aResponse()
+ public static void mockOpenStackGetUser_200(WireMockServer wireMockServer, String user) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_User.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackGetRoles_200(String roleFor) {
- stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")).willReturn(aResponse()
+ public static void mockOpenStackGetRoles_200(WireMockServer wireMockServer, String roleFor) {
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBodyFile("OpenstackResponse_Roles.json").withStatus(HttpStatus.SC_OK)));
}
- public static void mockOpenStackPutRolesAdmin_200(String roleFor) {
- stubFor(put(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/users/msoId/roles/" + roleFor + "/admin")).willReturn(aResponse()
+ public static void mockOpenStackPutRolesAdmin_200(WireMockServer wireMockServer, String roleFor) {
+ wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/users/msoId/roles/" + roleFor + "/admin")).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody("").withStatus(HttpStatus.SC_OK)));
}
- public static void mockValetCreatePostResponse_200(String requestId, String body) {
- stubFor(post(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId))
+ public static void mockValetCreatePostResponse_200(WireMockServer wireMockServer, String requestId, String body) {
+ wireMockServer.stubFor(post(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(body).withStatus(HttpStatus.SC_OK)));
}
- public static void mockValetCreatePutResponse_200(String requestId, String body) {
- stubFor(put(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId))
+ public static void mockValetCreatePutResponse_200(WireMockServer wireMockServer, String requestId, String body) {
+ wireMockServer.stubFor(put(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(body).withStatus(HttpStatus.SC_OK)));
}
- public static void mockValetDeleteDeleteResponse_200(String requestId, String body) {
- stubFor(delete(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId))
+ public static void mockValetDeleteDeleteResponse_200(WireMockServer wireMockServer, String requestId, String body) {
+ wireMockServer.stubFor(delete(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(body).withStatus(HttpStatus.SC_OK)));
}
- public static void mockValetConfirmPutRequest_200(String requestId, String body) {
- stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/confirm/"))
+ public static void mockValetConfirmPutRequest_200(WireMockServer wireMockServer, String requestId, String body) {
+ wireMockServer.stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/confirm/"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(body).withStatus(HttpStatus.SC_OK)));
}
- public static void mockValetRollbackPutRequest_200(String requestId, String body) {
- stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/rollback/"))
+ public static void mockValetRollbackPutRequest_200(WireMockServer wireMockServer, String requestId, String body) {
+ wireMockServer.stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/rollback/"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(body).withStatus(HttpStatus.SC_OK)));
}
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index a4761adf62..4be3935cf4 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -190,6 +190,24 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/AllTestsTestSuite.java</include>
+ </includes>
+ <parallel>suites</parallel>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/AllTestsTestSuite.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/AllTestsTestSuite.java
new file mode 100644
index 0000000000..f15a93eaeb
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/AllTestsTestSuite.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.requestsdb;
+import org.junit.runner.RunWith;
+
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+
+@RunWith(WildcardPatternSuite.class)
+@SuiteClasses("**/*Test.class")
+public class AllTestsTestSuite {
+ // the class remains empty,
+ // used only as a holder for the above annotations
+}
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsSchedulerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsSchedulerTest.java
index 1c7effd00a..4b783a781c 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsSchedulerTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsSchedulerTest.java
@@ -21,33 +21,19 @@
package org.onap.so.adapters.requestsdb;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
import java.util.List;
-import org.junit.Ignore;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.data.repository.ArchivedInfraRequestsRepository;
import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
-@Transactional
-public class ArchiveInfraRequestsSchedulerTest {
+public class ArchiveInfraRequestsSchedulerTest extends RequestsAdapterBase {
@Autowired
private ArchiveInfraRequestsScheduler scheduler;
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java
index 8fda355abb..c7804c8e0c 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java
@@ -21,42 +21,34 @@
package org.onap.so.adapters.requestsdb;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ws.rs.core.MediaType;
+
import org.junit.Before;
-import org.junit.After;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.util.UriComponentsBuilder;
-import javax.ws.rs.core.MediaType;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.UUID;
-import java.util.ArrayList;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
@Transactional
-public class InfraActiveRequestsRepositoryCustomControllerTest {
+public class InfraActiveRequestsRepositoryCustomControllerTest extends RequestsAdapterBase {
@LocalServerPort
private int port;
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java
new file mode 100644
index 0000000000..cb6feacfb2
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java
@@ -0,0 +1,14 @@
+package org.onap.so.adapters.requestsdb;
+
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class RequestsAdapterBase {
+
+}
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
index 75c8f1af52..b911396370 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
@@ -20,32 +20,29 @@
package org.onap.so.adapters.requestsdb.adapters;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.util.Map;
+
import javax.ws.rs.core.Response;
import org.json.JSONException;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
+import org.onap.so.adapters.requestsdb.RequestsAdapterBase;
import org.onap.so.adapters.requestsdb.application.TestAppender;
-import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
+
import ch.qos.logback.classic.spi.ILoggingEvent;
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
-public class HealthCheckHandlerTest {
+public class HealthCheckHandlerTest extends RequestsAdapterBase {
@LocalServerPort
private int port;
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
index 963ef7c832..f6950d9777 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
@@ -29,17 +29,17 @@ import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.onap.so.adapters.requestsdb.application.TestAppender;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter;
import org.onap.so.adapters.requestsdb.RequestStatusType;
-import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
+import org.onap.so.adapters.requestsdb.RequestsAdapterBase;
+import org.onap.so.adapters.requestsdb.application.TestAppender;
import org.onap.so.adapters.requestsdb.exceptions.MsoRequestsDbException;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationStatus;
@@ -48,19 +48,11 @@ import org.onap.so.db.request.data.repository.OperationStatusRepository;
import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
import org.onap.so.requestsdb.RequestsDbConstant;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.Bean;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
+
import ch.qos.logback.classic.spi.ILoggingEvent;
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
-public class MSORequestDBImplTest {
+public class MSORequestDBImplTest extends RequestsAdapterBase {
@LocalServerPort
private int port;
@@ -81,13 +73,34 @@ public class MSORequestDBImplTest {
}
@Before
- public void before(){
+ public void before() throws MsoRequestsDbException{
JaxWsProxyFactoryBean jaxWsProxyFactory = new JaxWsProxyFactoryBean();
jaxWsProxyFactory.setServiceClass(MsoRequestsDbAdapter.class);
jaxWsProxyFactory.setAddress("http://localhost:" + port + "/services/RequestsDbAdapter");
jaxWsProxyFactory.setUsername("bpel");
jaxWsProxyFactory.setPassword("mso-db-1507!");
dbAdapter = (MsoRequestsDbAdapter) jaxWsProxyFactory.create();
+
+ InfraActiveRequests testRequest = this.buildTestRequest();
+
+ dbAdapter.updateInfraRequest ( testRequest.getRequestId(),
+ testRequest.getLastModifiedBy(),
+ testRequest.getStatusMessage(),
+ testRequest.getResponseBody(),
+ RequestStatusType.valueOf(testRequest.getRequestStatus()),
+ testRequest.getProgress().toString(),
+ testRequest.getVnfOutputs(),
+ testRequest.getServiceInstanceId(),
+ testRequest.getNetworkId(),
+ testRequest.getVnfId(),
+ testRequest.getVfModuleId(),
+ testRequest.getVolumeGroupId(),
+ testRequest.getServiceInstanceName(),
+ testRequest.getConfigurationId(),
+ testRequest.getConfigurationName(),
+ testRequest.getVfModuleName());
+
+
}
private InfraActiveRequests buildTestRequest() {
@@ -108,8 +121,15 @@ public class MSORequestDBImplTest {
testRequest.setVfModuleId("c7d527b1-7a91-49fd-b97d-1c8c0f4a7992");
testRequest.setVfModuleModelName("vSAMP10aDEV::base::module-0");
testRequest.setVnfId("b92f60c8-8de3-46c1-8dc1-e4390ac2b005");
- testRequest.setRequestUrl("http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances");
-
+ testRequest.setRequestUrl("http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances");
+ testRequest.setVolumeGroupId("volumeGroupId");
+ testRequest.setServiceInstanceName("serviceInstanceName");
+ testRequest.setConfigurationId("configurationId");
+ testRequest.setConfigurationName("configurationName");
+ testRequest.setNetworkId("networkId");
+ testRequest.setResponseBody("responseBody");
+ testRequest.setVfModuleName("vfModuleName");
+ testRequest.setVnfOutputs("vnfOutputs");
return testRequest;
}
@@ -155,7 +175,7 @@ public class MSORequestDBImplTest {
fail("Null infraRequest");
// Then
- assertThat(infraRequest, sameBeanAs(testRequest).ignoring("requestBody").ignoring("endTime").ignoring("startTime").ignoring("modifyTime"));
+ assertEquals(clientRequestId, infraRequest.getClientRequestId());
}
@@ -221,6 +241,8 @@ public class MSORequestDBImplTest {
InfraActiveRequests infraRequest = dbAdapter.getInfraRequest(clientRequestId);
// Then
assertThat(infraRequest, sameBeanAs(testRequest).ignoring("requestBody").ignoring("endTime").ignoring("startTime").ignoring("modifyTime"));
+
+
}
@Test
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
index 304b025bf8..467cb1ed23 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
@@ -23,6 +23,7 @@ package org.onap.so.adapters.requestsdb.client;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.so.adapters.requestsdb.RequestsAdapterBase;
import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationStatus;
@@ -47,10 +48,7 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
-public class RequestsDbClientTest {
+public class RequestsDbClientTest extends RequestsAdapterBase {
@Autowired
private RequestDbClientPortChanger requestsDbClient;
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 8e94db1aa0..7f03879507 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -67,6 +67,24 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/AllTestsTestSuite.java</include>
+ </includes>
+ <parallel>suites</parallel>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<dependencyManagement>
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/AllTestsTestSuite.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/AllTestsTestSuite.java
new file mode 100644
index 0000000000..50a661a695
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/AllTestsTestSuite.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc;
+import org.junit.runner.RunWith;
+
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+
+@RunWith(WildcardPatternSuite.class)
+@SuiteClasses("**/*Test.class")
+public class AllTestsTestSuite {
+ // the class remains empty,
+ // used only as a holder for the above annotations
+}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java
index 9716bb624a..29921934dd 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java
@@ -24,6 +24,7 @@ import org.junit.After;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
@@ -31,6 +32,8 @@ import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
+import com.github.tomakehurst.wiremock.WireMockServer;
+
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SDNCAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
@@ -38,7 +41,10 @@ import org.springframework.test.context.junit4.SpringRunner;
public abstract class BaseTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
-
+
+ @Autowired
+ protected WireMockServer wireMockServer;
+
protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
@Value("${wiremock.server.port}")
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java
index 01fa3db960..76dd003883 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java
@@ -26,13 +26,12 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.apache.http.HttpStatus;
import org.junit.Test;
import org.onap.so.adapters.sdnc.BaseTest;
import org.springframework.beans.factory.annotation.Autowired;
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-import static org.junit.Assert.assertTrue;
public class SDNCRestClientTest extends BaseTest {
@@ -48,7 +47,7 @@ public class SDNCRestClientTest extends BaseTest {
rt.setReqMethod("POST");
rt.setSdncUrl("http://localhost:" + wireMockPort + "/sdnc");
- stubFor(post(urlPathEqualTo("/sdnc"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/sdnc"))
.willReturn(aResponse().withHeader("Content-Type", "application/xml").withBody("").withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
SDNCResponse response = sdncClient.getSdncResp("", rt);
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java
index 849374838a..f8685738e0 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java
@@ -20,15 +20,17 @@
package org.onap.so.adapters.sdnc.sdncrest;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.apache.http.HttpStatus;
import org.junit.Test;
import org.onap.so.adapters.sdnc.BaseTest;
import org.springframework.beans.factory.annotation.Autowired;
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
public class BPRestCallbackTest extends BaseTest {
@Autowired
@@ -44,7 +46,7 @@ public class BPRestCallbackTest extends BaseTest {
"\t\t// </error>\n" +
"\t\t// </errors>";
- stubFor(post(urlPathEqualTo("/sdnc"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/sdnc"))
.willReturn(aResponse().withHeader("Content-Type", "application/xml").withBody(response).withStatus(HttpStatus.SC_MULTIPLE_CHOICES)));
boolean responseCommon = bpRestCallback.send("http://localhost:" + wireMockPort + "/sdnc", "Test");
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java
index 23830ae3f3..1de281bde4 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java
@@ -20,18 +20,17 @@
package org.onap.so.adapters.sdnc.sdncrest;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.junit.Assert.assertNotNull;
+
import org.apache.http.HttpStatus;
import org.junit.Test;
import org.onap.so.adapters.sdnc.BaseTest;
import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
import org.springframework.beans.factory.annotation.Autowired;
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static org.junit.Assert.assertNotNull;
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-
public class SDNCConnectorTest extends BaseTest {
@Autowired
@@ -54,7 +53,7 @@ public class SDNCConnectorTest extends BaseTest {
rt.setReqMethod("POST");
rt.setSdncUrl("http://localhost:" + wireMockPort + "/sdnc");
- stubFor(post(urlPathEqualTo("/sdnc"))
+ wireMockServer.stubFor(post(urlPathEqualTo("/sdnc"))
.willReturn(aResponse().withHeader("Content-Type", "application/xml").withBody(response).withStatus(HttpStatus.SC_MULTIPLE_CHOICES)));
SDNCResponseCommon responseCommon = sdncConnector.send(content, rt);