Skip to content

Commit 6fadaf5

Browse files
georgeajitgeorgeajit
authored andcommitted
#1264 - Modified api files.
1 parent 3ceb0d3 commit 6fadaf5

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/BulkIOCallersFnTest.java

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,17 @@ public static void tearDownAfterClass() throws Exception {
302302
deleteUserRole("ForbiddenRole");
303303
deleteRESTUser("ForbiddenUser");
304304

305-
associateRESTServerWithDB(modServerName, "Documents");
305+
associateRESTServerWithDB(modServerName, "App-Services");
306+
307+
associateRESTServerWithDB(restServerName, "Documents");
308+
associateRESTServerWithModuleDB(restServerName, "Modules");
309+
310+
deleteDB(dbName);
311+
deleteForest(fNames[0]);
312+
deleteDB(dbNameMod);
313+
deleteForest(fNamesMod[0]);
314+
deleteDB("TestDynamicIngest-modules");
315+
deleteForest("TestDynamicIngest-modules-1");
306316
// release client
307317
dbclient.release();
308318
}
@@ -829,17 +839,16 @@ public void TestBulkAnnotationSize() throws Exception {
829839
}
830840
}
831841

832-
// Verify errors from sjs module back to client. TODO Fix this test once Git # 1264 is addressed.
833-
@Ignore
842+
// Verify errors from sjs module back to client.
843+
@Test
834844
public void TestIngestEgressOnJsonDocsError() throws Exception {
835845
System.out.println("Running TestIngestEgressOnJsonDocsError");
836846
StringBuilder batchResults = new StringBuilder();
837-
StringBuilder err = new StringBuilder();
838847

848+
StringBuilder retryBuf = new StringBuilder();
839849
try {
840850
int startBatchIdx = 0;
841851
int maxDocSize = 5;
842-
StringBuilder retryBuf = new StringBuilder();
843852

844853
ObjectMapper om = new ObjectMapper();
845854
File apiFile = new File(ApiConfigDirPath + JsonIngestConfigName + ".api");
@@ -897,7 +906,7 @@ public void TestIngestEgressOnJsonDocsError() throws Exception {
897906
(retryCount, throwable, callContext)
898907
-> {
899908
retryBuf.append(throwable.getMessage());
900-
return IOEndpoint.BulkIOEndpointCaller.ErrorDisposition.SKIP_CALL;
909+
return IOEndpoint.BulkIOEndpointCaller.ErrorDisposition.STOP_ALL_CALLS;
901910
};
902911

903912
outputBulkCaller.setOutputListener(record -> {
@@ -906,33 +915,19 @@ public void TestIngestEgressOnJsonDocsError() throws Exception {
906915
String s = mapper.readValue(record, ObjectNode.class).toString();
907916
batchResults.append(s);
908917
} catch (IOException e) {
909-
err.append(e.getMessage());
910918
e.printStackTrace();
911919
}
912920
}
913921
);
914922
outputBulkCaller.setErrorListener(errorListener);
915923
outputBulkCaller.awaitCompletion();
916-
System.out.println("Error buffer is " + retryBuf.toString());
917-
System.out.println("Unloader completed in TestIngestEgressOnJsonDocsError");
918-
919924
} catch (Exception e) {
920925
e.printStackTrace();
921-
err.append(e.getMessage());
922926
}
923927
finally {
924-
String res = batchResults.toString();
925-
// # of root elements should be 5.
926-
System.out.println("Batch results from TestIngestEgressOnJsonDocs " + res);
927-
928-
assertTrue("No of docs egressed incorrect. Expected 5.", (res.split("\\btitle\\b").length -1) == 5);
929-
assertTrue("No of docs egressed incorrect. Expected only 1 wrote word.", (res.split("\\bwrote\\b").length - 1) == 1);
930-
assertTrue("No of docs egressed incorrect. Expected only 1 described word.", (res.split("\\bdescribed\\b").length - 1) == 1);
931-
assertTrue("No of docs egressed incorrect. Expected only 1 groundbreaking word.", (res.split("\\bgroundbreaking\\b").length - 1) == 1);
932-
assertTrue("No of docs egressed incorrect. Expected only 1 intellectual word.", (res.split("\\bintellectual\\b").length - 1) == 1);
933-
assertTrue("No of docs egressed incorrect. Expected only 1 unfortunately word.", (res.split("\\bunfortunately\\b").length - 1) == 1);
934-
assertTrue("Unexpected Errors during egress. Should not have any errors.", err.toString().isEmpty());
935-
System.out.println("End of TestIngestEgressOnJsonDocs");
928+
assertTrue("Error returned incorrect", retryBuf.toString().contains("Internal Server Error."));
929+
System.out.println("Error buffer is " + retryBuf.toString());
930+
System.out.println("Unloader completed in TestIngestEgressOnJsonDocsError");
936931
}
937932
}
938933

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/data/api/DynamicEgressServicesForJsonError.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@
2121
"multiple": true,
2222
"nullable": true
2323
}
24+
,
25+
"errorDetail": "return"
2426
}

0 commit comments

Comments
 (0)