use of org.mule.test.heisenberg.extension.model.SimpleKnockeableDoor in project mule by mulesoft.
the class HeisenbergOperations method knock.
@MediaType(TEXT_PLAIN)
@Fires(KnockNotificationProvider.class)
public String knock(KnockeableDoor knockedDoor, NotificationEmitter notificationEmitter) {
TypedValue<SimpleKnockeableDoor> door = of(new SimpleKnockeableDoor(knockedDoor));
notificationEmitter.fire(KNOCKING_DOOR, door);
String knock = knockedDoor.knock();
notificationEmitter.fire(KNOCKED_DOOR, door);
return knock;
}
use of org.mule.test.heisenberg.extension.model.SimpleKnockeableDoor in project mule by mulesoft.
the class ExtensionNotificationsTestCase method operationFiresNotificationsWithCustomData.
@Test
public void operationFiresNotificationsWithCustomData() throws Exception {
CountDownLatch latch = new CountDownLatch(2);
setUpListener(notification -> latch.countDown());
String correlationId = flowRunner("operationNotification").run().getCorrelationId();
latch.await(2000, MILLISECONDS);
assertThat(listener.getNotifications(), hasSize(2));
ExtensionNotification notification1 = listener.getNotifications().get(0);
assertThat(notification1.getAction().getNamespace(), is(HEISENBERG));
assertThat(notification1.getAction().getIdentifier(), is("KNOCKING_DOOR"));
assertThat(notification1.getData().getValue(), instanceOf(SimpleKnockeableDoor.class));
assertThat(((SimpleKnockeableDoor) notification1.getData().getValue()).getSimpleName(), is("Top Level Skyler @ 308 Negra Arroyo Lane"));
assertThat(notification1.getEvent().getCorrelationId(), is(correlationId));
ExtensionNotification notification2 = listener.getNotifications().get(1);
assertThat(notification2.getAction().getNamespace(), is(HEISENBERG));
assertThat(notification2.getAction().getIdentifier(), is("KNOCKED_DOOR"));
assertThat(notification2.getData().getValue(), instanceOf(SimpleKnockeableDoor.class));
assertThat(((SimpleKnockeableDoor) notification2.getData().getValue()).getSimpleName(), is("Top Level Skyler @ 308 Negra Arroyo Lane"));
assertThat(notification2.getEvent().getCorrelationId(), is(correlationId));
}
Aggregations