use of org.mule.test.heisenberg.extension.model.PersonalInfo in project mule by mulesoft.
the class ExtensionNotificationsTestCase method sourceFiresNotificationsOnError.
@Test
public void sourceFiresNotificationsOnError() throws Exception {
CountDownLatch latch = new CountDownLatch(4);
setUpListener(notification -> latch.countDown());
Flow flow = (Flow) getFlowConstruct("sourceNotificationsError");
flow.start();
latch.await(4000, MILLISECONDS);
assertThat(listener.getNotifications(), hasSize(4));
ExtensionNotification notification1 = listener.getNotifications().get(0);
verifyNewBatch(notification1, 1);
String correlationId = notification1.getEvent().getCorrelationId();
ExtensionNotification notification2 = listener.getNotifications().get(1);
verifyNextBatch(notification2, 100000L);
assertThat(notification2.getEvent().getCorrelationId(), is(correlationId));
ExtensionNotification notification3 = listener.getNotifications().get(2);
assertThat(notification3.getAction().getNamespace(), is(HEISENBERG));
assertThat(notification3.getAction().getIdentifier(), is("BATCH_DELIVERY_FAILED"));
assertThat(notification3.getData().getValue(), instanceOf(PersonalInfo.class));
assertThat(((PersonalInfo) notification3.getData().getValue()).getAge(), is(27));
assertThat(notification3.getEvent().getCorrelationId(), is(correlationId));
ExtensionNotification notification4 = listener.getNotifications().get(3);
verifyBatchTerminated(notification4, 1);
assertThat(notification4.getEvent().getCorrelationId(), is(correlationId));
}
Aggregations