@Test public void testUrisToWriterListenerException() { final AtomicInteger failureBatchCount = new AtomicInteger(); StringWriter badWriter = new StringWriter() { public void write(String str) { throw new InternalError(errorMessage); } }; testListenerException( new UrisToWriterListener(badWriter) .onBatchFailure( (batch, throwable) -> failureBatchCount.incrementAndGet() ) ); // there should be one failure sent to the UrisToWriterListener // onBatchFailure listener since the writer is invalid assertEquals(1, failureBatchCount.get()); }
.withThreadCount(5) .withBatchSize(100) .onUrisReady( new UrisToWriterListener(writer) ) .onUrisReady(batch -> successDocs1.addAndGet(batch.getItems().length)) .onQueryFailure( throwable -> {
QueryBatcher getUris = dataMovementManager.newQueryBatcher(query) .withBatchSize(5000) .onUrisReady( new UrisToWriterListener(writer) ) .onQueryFailure(exception -> exception.printStackTrace()); JobTicket getUrisTicket = dataMovementManager.startJob(getUris);