summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java37
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java)17
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java6
7 files changed, 48 insertions, 53 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java
index 9ca49788ae..a2880ce07f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java
@@ -25,11 +25,13 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.Assert.assertEquals;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
import org.onap.so.adapters.nwrest.CreateNetworkError;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
@@ -44,12 +46,11 @@ import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
import org.onap.so.adapters.nwrest.UpdateNetworkError;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
-import org.onap.so.BaseIntegrationTest;
+import org.onap.so.client.policy.JettisonStyleMapperProvider;
import org.onap.so.openstack.beans.NetworkRollback;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
public class NetworkAdapterClientIT extends BaseIntegrationTest{
@@ -58,7 +59,7 @@ public class NetworkAdapterClientIT extends BaseIntegrationTest{
private static final String REST_ENDPOINT = "/networks/rest/v1/networks";
private NetworkAdapterClientImpl client = new NetworkAdapterClientImpl();
- private ObjectMapper mapper = new ObjectMapper();
+ private ObjectMapper mapper = new JettisonStyleMapperProvider().getMapper();
@BeforeClass
public static void setUp() {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java
index 0f9e11f354..3387920d40 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java
@@ -31,6 +31,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
@@ -42,7 +43,8 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
-import org.onap.so.BaseIntegrationTest;
+import org.onap.so.client.policy.JettisonStyleMapperProvider;
+
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -54,7 +56,7 @@ public class VnfAdapterClientIT extends BaseIntegrationTest{
private static final String REST_ENDPOINT = "/services/rest/v1/vnfs";
private VnfAdapterClientImpl client = new VnfAdapterClientImpl();
- private ObjectMapper mapper = new ObjectMapper();
+ private ObjectMapper mapper = new JettisonStyleMapperProvider().getMapper();
@BeforeClass
public static void setUp() {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
index 149417d89b..0b33b1d187 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
@@ -20,20 +20,21 @@
package org.onap.so.client.oof;
-import com.fasterxml.jackson.core.JsonProcessingException;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+
import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.client.oof.OofClient;
import org.onap.so.client.oof.beans.OofRequest;
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.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import com.fasterxml.jackson.core.JsonProcessingException;
-public class OofClientTestIT {
+public class OofClientTestIT extends BaseIntegrationTest {
@Autowired
private OofClient client;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
index 8bb46d80d7..4d90a3fcc9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
@@ -27,11 +27,15 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.net.URI;
+import java.net.URISyntaxException;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.common.data.TestDataSetup;
@@ -68,49 +72,34 @@ public class SDNCConfigurationResourcesTest extends TestDataSetup{
@Before
public void setUp(){
-
customer = buildCustomer();
-
requestContext = buildRequestContext();
-
serviceInstance = buildServiceInstance();
-
- vpnBondingLink = buildVpnBondingLink();
-
+ vpnBondingLink = buildVpnBondingLink();
vnf = vpnBondingLink.getInfrastructureServiceProxy().getServiceInstance().getVnfs().get(0);
}
@Test
- public void activateVnrConfigurationTest() throws BadResponseException, MapperException {
-
- doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class));
- String response = sdncConfigurationResources.activateVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf);
- verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class));
+ public void activateVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException {
+ GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.activateVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf,"uuid",new URI("http://localhost"));
assertNotNull(response);
}
@Test
- public void assignVnrConfigurationTest() throws BadResponseException, MapperException {
-
- doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class));
- String response = sdncConfigurationResources.assignVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf);
- verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class));
+ public void assignVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException {
+ GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.assignVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf,"uuid",new URI("http://localhost"));
assertNotNull(response);
}
@Test
- public void unAssignVnrConfigurationTest() throws BadResponseException, MapperException {
- doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class));
- String response = sdncConfigurationResources.unAssignVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration());
- verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class));
+ public void unAssignVnrConfigurationTest() throws BadResponseException, MapperException , URISyntaxException{
+ GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.unAssignVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration(),"uuid",new URI("http://localhost"));
assertNotNull(response);
}
@Test
- public void deactivateVnrConfigurationTest() throws BadResponseException, MapperException {
- doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class));
- String response = sdncConfigurationResources.deactivateVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration());
- verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class));
+ public void deactivateVnrConfigurationTest() throws BadResponseException, MapperException , URISyntaxException{
+ GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.deactivateVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration(),"uuid",new URI("http://localhost"));
assertNotNull(response);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
index 66ec514039..cc1c5c5329 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
@@ -23,37 +23,30 @@ package org.onap.so.client.sdnc;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
-import org.junit.Rule;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
-import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.skyscreamer.jsonassert.JSONAssert;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-public class SDNCClientTest extends BaseIntegrationTest {
+public class SDNCClientIT extends BaseIntegrationTest {
private final static String JSON_FILE_LOCATION = "src/test/resources/__files/";
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8446));
-
@Test
public void getTest() throws BadResponseException, MapperException, IOException {
String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientGetResponse.json")));
String queryLink = "/topologyQuery";
- wireMockRule.stubFor(get(urlEqualTo(queryLink))
+ stubFor(get(urlEqualTo(queryLink))
.willReturn(aResponse().withStatus(200)
.withHeader("Content-Type", "application/json").withBody(responseJson)));
String response = SPY_sdncClient.get(queryLink);
@@ -66,7 +59,7 @@ public class SDNCClientTest extends BaseIntegrationTest {
String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
- wireMockRule.stubFor(post(urlMatching(queryLink))
+ stubFor(post(urlMatching(queryLink))
.willReturn(aResponse().withStatus(200)
.withHeader("Content-Type", "application/json").withBody(responseJson)));
@@ -79,7 +72,7 @@ public class SDNCClientTest extends BaseIntegrationTest {
String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
- wireMockRule.stubFor(post(urlMatching(queryLink))
+ stubFor(post(urlMatching(queryLink))
.willReturn(aResponse().withStatus(200)
.withHeader("Content-Type", "application/json").withBody(responseJson)));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
index 7c5e9ccf26..f01eeaeae8 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
@@ -20,6 +20,8 @@
package org.onap.so.client.sdnc.mapper;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.List;
@@ -44,7 +46,7 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup{
private GCTopologyOperationRequestMapper genObjMapper = new GCTopologyOperationRequestMapper();
@Test
- public void deactivateOrUnassignVnrReqMapperTest() {
+ public void deactivateOrUnassignVnrReqMapperTest() throws URISyntaxException {
RequestContext requestContext = new RequestContext();
requestContext.setMsoRequestId("MsoRequestId");
ServiceInstance serviceInstance = new ServiceInstance();
@@ -52,10 +54,15 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup{
Configuration Configuration = new Configuration();
Configuration.setConfigurationId("ConfigurationId");
GenericResourceApiGcTopologyOperationInformation genericInfo = genObjMapper.deactivateOrUnassignVnrReqMapper
- (SDNCSvcAction.UNASSIGN, serviceInstance, requestContext, Configuration);
+ (SDNCSvcAction.UNASSIGN, serviceInstance, requestContext, Configuration,"uuid",new URI("http://localhost"));
Assert.assertNotNull(genericInfo);
- Assert.assertNotNull(genericInfo.getSdncRequestHeader().getSvcRequestId());
+ Assert.assertNotNull(genericInfo.getRequestInformation());
+ Assert.assertNotNull(genericInfo.getSdncRequestHeader());
+ Assert.assertNotNull(genericInfo.getClass());
+ Assert.assertNotNull(genericInfo.getServiceInformation());
+ Assert.assertEquals("uuid",genericInfo.getSdncRequestHeader().getSvcRequestId());
+ Assert.assertEquals("http://localhost",genericInfo.getSdncRequestHeader().getSvcNotificationUrl());
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java
index e5eb6bce54..3387e9ddef 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java
@@ -22,18 +22,20 @@ package org.onap.so.client.sniro;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+
import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.sniro.beans.SniroConductorRequest;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
import org.springframework.beans.factory.annotation.Autowired;
import com.fasterxml.jackson.core.JsonProcessingException;
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-public class SniroClientTestIT{
+public class SniroClientTestIT extends BaseIntegrationTest {
@Autowired
private SniroClient client;