use of com.orbitz.consul.model.EventResponse in project camel by apache.
the class ConsulEventTest method testFireEvent.
@Test
public void testFireEvent() throws Exception {
String key = generateRandomString();
String val = generateRandomString();
MockEndpoint mock = getMockEndpoint("mock:event");
mock.expectedMinimumMessageCount(1);
mock.expectedHeaderReceived(ConsulConstants.CONSUL_RESULT, true);
fluentTemplate().withHeader(ConsulConstants.CONSUL_ACTION, ConsulEventActions.FIRE).withHeader(ConsulConstants.CONSUL_KEY, key).withBody(val).to("direct:event").send();
mock.assertIsSatisfied();
EventResponse response = getConsul().eventClient().listEvents(key);
List<Event> events = response.getEvents();
assertFalse(events.isEmpty());
assertTrue(events.get(0).getPayload().isPresent());
assertEquals(val, events.get(0).getPayload().get());
}
Aggregations