Implement Subnet Capability query functionality
[so.git] / mso-api-handlers / mso-api-handler-infra / src / test / java / org / onap / so / apihandlerinfra / Onap3gppServiceInstancesTest.java
index 503af1b..c3c92be 100644 (file)
@@ -49,6 +49,9 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.web.util.UriComponentsBuilder;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.QuerySubnetCapability;
+import org.springframework.beans.factory.annotation.Autowired;
 
 public class Onap3gppServiceInstancesTest extends BaseTest {
 
@@ -56,6 +59,9 @@ public class Onap3gppServiceInstancesTest extends BaseTest {
 
     private final ObjectMapper mapper = new ObjectMapper();
 
+    @Autowired
+    private Onap3gppServiceInstances objUnderTest;
+
     @Before
     public void init() throws JsonProcessingException {
 
@@ -176,6 +182,17 @@ public class Onap3gppServiceInstancesTest extends BaseTest {
         assertEquals(expectedResponse, actualResponse);
     }
 
+    @Test
+    public void getSliceSubnetCapabilitiesTest() throws IOException, ApiException {
+        String request = "{\"subnetTypes\":[\"AN\"]}";
+        QuerySubnetCapability subnetCapabilityRequest = mapper.readValue(request, QuerySubnetCapability.class);
+        String expectedResponse =
+                "{\"AN\":{\"latency\":\"5\",\"maxNumberofUEs\":\"100\",\"maxThroughput\":\"150\",\"terminalDensity\":\"50\"}}";
+        Response response = objUnderTest.getSliceSubnetCapabilities(subnetCapabilityRequest, "v1");
+        String actualResponse = (String) response.getEntity();
+        assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+        assertEquals(expectedResponse, actualResponse);
+    }
 }