use of de.codecentric.boot.admin.event.ClientApplicationEvent in project spring-boot-admin by codecentric.
the class ApplicationEventJournalTest method test_registration.
@Test
public void test_registration() {
ClientApplicationEvent emittedEvent = new ClientApplicationRegisteredEvent(Application.create("foo").withId("bar").withHealthUrl("http://health").build());
journal.onClientApplicationEvent(emittedEvent);
Collection<ClientApplicationEvent> events = journal.getEvents();
assertThat(events.size(), is(1));
ClientApplicationEvent event = events.iterator().next();
assertThat(event, sameInstance(emittedEvent));
}
use of de.codecentric.boot.admin.event.ClientApplicationEvent in project spring-boot-admin by codecentric.
the class HazelcastJournaledEventStoreTest method test_store.
@Test
public void test_store() {
Application application = Application.create("foo").withId("bar").withHealthUrl("http://health").build();
List<ClientApplicationEvent> events = Arrays.asList(new ClientApplicationRegisteredEvent(application), new ClientApplicationDeregisteredEvent(application));
for (ClientApplicationEvent event : events) {
store.store(event);
}
// Items are stored in reverse order
List<ClientApplicationEvent> reversed = new ArrayList<>(events);
Collections.reverse(reversed);
assertThat(store.findAll(), is((Collection<ClientApplicationEvent>) reversed));
}
use of de.codecentric.boot.admin.event.ClientApplicationEvent in project spring-boot-admin by codecentric.
the class SimpleJournaledEventStoreTest method test_store.
@Test
public void test_store() {
SimpleJournaledEventStore store = new SimpleJournaledEventStore();
Application application = Application.create("foo").withId("bar").withHealthUrl("http://health").build();
List<ClientApplicationEvent> events = Arrays.asList(new ClientApplicationRegisteredEvent(application), new ClientApplicationDeregisteredEvent(application));
for (ClientApplicationEvent event : events) {
store.store(event);
}
assertThat(store.findAll(), is((Collection<ClientApplicationEvent>) Arrays.asList(events.get(1), events.get(0))));
}
use of de.codecentric.boot.admin.event.ClientApplicationEvent in project spring-boot-admin by codecentric.
the class SimpleJournaledEventStoreTest method test_store_capacity.
@Test
public void test_store_capacity() {
SimpleJournaledEventStore store = new SimpleJournaledEventStore();
store.setCapacity(2);
Application application = Application.create("foo").withId("bar").withHealthUrl("http://health").build();
List<ClientApplicationEvent> events = Arrays.asList(new ClientApplicationRegisteredEvent(application), new ClientApplicationDeregisteredEvent(application), new ClientApplicationDeregisteredEvent(application));
for (ClientApplicationEvent event : events) {
store.store(event);
}
assertThat(store.findAll(), is((Collection<ClientApplicationEvent>) Arrays.asList(events.get(2), events.get(1))));
}
use of de.codecentric.boot.admin.event.ClientApplicationEvent in project spring-boot-admin by codecentric.
the class FilteringNotifierTest method test_filter.
@Test
public void test_filter() {
TestNotifier delegate = new TestNotifier();
FilteringNotifier notifier = new FilteringNotifier(delegate);
String idTrue = notifier.addFilter(new NotificationFilter() {
@Override
public boolean filter(ClientApplicationEvent event) {
return true;
}
});
notifier.notify(EVENT);
assertThat(delegate.getEvents(), not(hasItem(EVENT)));
notifier.removeFilter(idTrue);
notifier.notify(EVENT);
assertThat(delegate.getEvents(), hasItem(EVENT));
}
Aggregations