aboutsummaryrefslogtreecommitdiffstats
path: root/aai-resources/src/test/java
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2024-01-09 19:28:36 +0100
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2024-01-10 14:07:41 +0100
commit1d77fc5b646f3c3a9a0f14dba5218d7f866e48ba (patch)
treeace6828cfa3d5b97a26a7df3584a0be6a7ae87c2 /aai-resources/src/test/java
parent8c73a2f4ebf8067e630ce7525183f75bbf8a9bce (diff)
Return an index of invalid bulk operation if there are missing parameters on request
Catch AAIException on AAI Bulk poplulateIntrospectors method to prepare an exception body with failing operation number. Issue-ID: AAI-3722 Change-Id: I38b2e1c802ae7f2843cda5c188365890a86f65af Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Diffstat (limited to 'aai-resources/src/test/java')
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java
index 7629178..fb9f13f 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java
@@ -354,6 +354,19 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract
assertEquals("Request success", Response.Status.CREATED.getStatusCode(), response.getStatus());
}
+ @Test
+ public void invalidNodeCreationPaylodTest() throws IOException {
+ String payload = getBulkPayload("single-transaction/put-complex-with-missing-properties")
+ .replaceAll("<methodName>", name.getMethodName());
+ Response response = executeRequest(payload);
+
+ assertEquals("Request fails with 400", Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
+ assertThat("Response contains correct index of failed operation.", response.getEntity().toString(),
+ containsString("Error with operation 0"));
+ assertThat("Response contains information about missing properties.", response.getEntity().toString(),
+ containsString("Missing required property:"));
+ }
+
protected Response executeRequest(String finalPayload) {
MockHttpServletRequest mockReq = new MockHttpServletRequest(HttpMethod.POST, "http://www.test.com");