summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-03-28 14:56:23 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-28 14:56:23 +0000
commit6ab58d3a85a31badcd1f1f4ace5c37d7a4ba7e96 (patch)
treef8a9b6024a7f9f395f443bfaf6cda909bfb5b22e
parent3805fcbaaf946b31442941d2285f214985910a68 (diff)
parentda8e738a75e8cfe9a8a8e2863a4a643c3ac367ba (diff)
Merge "JUnit tests for NetworkAdapterRest"
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java37
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/RollbackNetworkResponse.json5
2 files changed, 41 insertions, 1 deletions
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 3910d9ec44..4e2d5e5da2 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
@@ -51,9 +51,10 @@ import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
-import org.onap.so.adapters.nwrest.NetworkTechnology;
import org.onap.so.adapters.nwrest.QueryNetworkError;
import org.onap.so.adapters.nwrest.QueryNetworkResponse;
+import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
+import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.adapters.vnf.BaseRestTestUtils;
@@ -193,6 +194,40 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
}
@Test
+ public void testRollbackNetwork() throws IOException {
+
+ RollbackNetworkRequest request = new RollbackNetworkRequest();
+
+ MsoRequest msoReq = new MsoRequest();
+
+ msoReq.setRequestId(MSO_REQUEST_ID);
+ msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
+
+ mockOpenStackResponseAccess(wireMockPort);
+
+ mockOpenStackPublicUrlStackByID_200(wireMockPort);
+
+ mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockPort);
+
+ mockOpenStackDeletePublicUrlStackByNameAndID_204();
+
+ headers.add("Accept", MediaType.APPLICATION_JSON);
+
+ HttpEntity<RollbackNetworkRequest> entity = new HttpEntity<>(request, headers);
+
+ ResponseEntity<RollbackNetworkResponse> response = restTemplate
+ .exchange(createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b/rollback"),
+ HttpMethod.DELETE, entity, RollbackNetworkResponse.class);
+
+ RollbackNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper()
+ .readValue(new File("src/test/resources/__files/RollbackNetworkResponse.json"), RollbackNetworkResponse.class);
+
+ assertThat(response.getBody(), sameBeanAs(expectedResponse));
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+ @Test
public void testQueryNetwork_Exception() throws IOException{
MsoRequest msoReq = new MsoRequest();
msoReq.setRequestId(MSO_REQUEST_ID);
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/RollbackNetworkResponse.json b/adapters/mso-openstack-adapters/src/test/resources/__files/RollbackNetworkResponse.json
new file mode 100644
index 0000000000..d319fedecd
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/RollbackNetworkResponse.json
@@ -0,0 +1,5 @@
+{
+ "rollbackNetworkResponse" : {
+ "networkRolledBack" : true
+ }
+}