use of de.codecentric.boot.admin.event.ClientApplicationDeregisteredEvent 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.ClientApplicationDeregisteredEvent 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.ClientApplicationDeregisteredEvent 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.ClientApplicationDeregisteredEvent in project spring-boot-admin by codecentric.
the class ApplicationRegistry method deregister.
/**
* Remove a specific application from registry
*
* @param id the applications id to unregister
* @return the unregistered Application
*/
public Application deregister(String id) {
Application app = store.delete(id);
if (app != null) {
LOGGER.info("Application {} unregistered ", app);
publisher.publishEvent(new ClientApplicationDeregisteredEvent(app));
}
return app;
}
Aggregations