aboutsummaryrefslogtreecommitdiffstats
path: root/aai-resources/src/test/java
diff options
context:
space:
mode:
authorMaharajh, Robby (rx2202) <rx2202@us.att.com>2017-12-04 16:43:59 -0500
committerMaharajh, Robby (rx2202) <rx2202@us.att.com>2017-12-04 16:44:06 -0500
commit944224b1a452ba90913bac6bee842f5a6bd61770 (patch)
treea9c58365afea882ff9ddfdea33ea1f5bea35b53f /aai-resources/src/test/java
parent4febf4b4c10d435e2a12e4df34d590254263e38b (diff)
Update the aai-resources to verify bulk limits
Issue-ID: AAI-529 Change-Id: Ia87e3298ce9c46f3b409587df6e9bd6e2065ec8a Signed-off-by: Maharajh, Robby (rx2202) <rx2202@us.att.com>
Diffstat (limited to 'aai-resources/src/test/java')
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java24
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java24
2 files changed, 48 insertions, 0 deletions
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java
index 66afeeb..e734d98 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java
@@ -107,6 +107,30 @@ public class BulkAddConsumerTest extends BulkProcessorTestAbstraction {
assertEquals("Bad Request", Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
assertEquals("Contains error code", true, response.getEntity().toString().contains("ERR.5.4.6111"));
}
+
+ @Test
+ public void bulkAddCheckMeetsLimit() throws IOException{
+ when(uriInfo.getPath()).thenReturn(uri);
+ when(uriInfo.getPath(false)).thenReturn(uri);
+
+ String payload = getBulkPayload("pserver-bulk-limit-meet");
+ Response response = executeRequest(payload);
+
+ assertEquals("Created", Response.Status.CREATED.getStatusCode(), response.getStatus());
+ assertEquals("Contains 30 {\"201\":null}", 30, StringUtils.countMatches(response.getEntity().toString(), "{\"201\":null}"));
+ }
+
+ @Test
+ public void bulkAddCheckExceedsLimit() throws IOException{
+ when(uriInfo.getPath()).thenReturn(uri);
+ when(uriInfo.getPath(false)).thenReturn(uri);
+
+ String payload = getBulkPayload("pserver-bulk-limit-exceed");
+ Response response = executeRequest(payload);
+
+ assertEquals("Bad Request", Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
+ assertEquals("Contains error code", true, response.getEntity().toString().contains("ERR.5.4.6147"));
+ }
@Override
protected BulkConsumer getConsumer(){
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java
index 8a75a96..1e3a4e4 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java
@@ -246,6 +246,30 @@ public class BulkProcessConsumerTest extends BulkProcessorTestAbstraction {
assertEquals("Bad Request", Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
assertEquals("Contains error code", true, response.getEntity().toString().contains("ERR.5.4.6111"));
}
+ @Test
+ public void bulkProcessCheckMeetsLimit() throws IOException{
+ when(uriInfo.getPath()).thenReturn(uri);
+ when(uriInfo.getPath(false)).thenReturn(uri);
+
+ String payload = getBulkPayload("pserver-bulk-limit-meet");
+ Response response = executeRequest(payload);
+
+ assertEquals("Created", Response.Status.CREATED.getStatusCode(), response.getStatus());
+ //assertEquals("Contains error code", true, response.getEntity().toString().contains("ERR.5.4.6147"));
+ assertEquals("Contains 30 {\"201\":null}", 30, StringUtils.countMatches(response.getEntity().toString(), "{\"201\":null}"));
+ }
+
+ @Test
+ public void bulkProcessCheckExceedsLimit() throws IOException{
+ when(uriInfo.getPath()).thenReturn(uri);
+ when(uriInfo.getPath(false)).thenReturn(uri);
+
+ String payload = getBulkPayload("pserver-bulk-limit-exceed");
+ Response response = executeRequest(payload);
+
+ assertEquals("Bad Request", Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
+ assertEquals("Contains error code", true, response.getEntity().toString().contains("ERR.5.4.6147"));
+ }
@Override
protected BulkConsumer getConsumer(){