diff options
author | 2024-01-09 19:28:36 +0100 | |
---|---|---|
committer | 2024-01-10 14:07:41 +0100 | |
commit | 1d77fc5b646f3c3a9a0f14dba5218d7f866e48ba (patch) | |
tree | ace6828cfa3d5b97a26a7df3584a0be6a7ae87c2 /aai-resources/src/test/java | |
parent | 8c73a2f4ebf8067e630ce7525183f75bbf8a9bce (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.java | 13 |
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 76291788..fb9f13fb 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"); |