use of com.hazelcast.jet.pipeline.test.AssertionCompletedException in project hazelcast by hazelcast.
the class OrderedStreamProcessingTest method when_source_is_non_partitioned.
@Test
public void when_source_is_non_partitioned() {
int validatedItemCount = ITEM_COUNT;
int itemsPerSecond = 5 * ITEM_COUNT;
List<Long> sequence = LongStream.range(0, validatedItemCount).boxed().collect(toList());
StreamStage<Long> srcStage = p.readFrom(TestSources.itemStream(itemsPerSecond, (ts, seq) -> seq)).withIngestionTimestamps();
StreamStage<Long> applied = srcStage.apply(transform);
applied.writeTo(AssertionSinks.assertCollectedEventually(60, list -> Assert.assertArrayEquals(list.toArray(), sequence.toArray())));
Job job = jet.newJob(p);
try {
job.join();
fail("Job should have completed with an AssertionCompletedException, but completed normally");
} catch (CompletionException e) {
String errorMsg = e.getCause().getMessage();
assertTrue("Job was expected to complete with AssertionCompletedException, but completed with: " + e.getCause(), errorMsg.contains(AssertionCompletedException.class.getName()));
}
}
Aggregations