Search in sources :

Example 6 with ClientApplicationEvent

use of de.codecentric.boot.admin.event.ClientApplicationEvent in project spring-boot-admin by codecentric.

the class MailNotifierTest method test_onApplicationEvent_throw_doesnt_propagate.

@Test
public void test_onApplicationEvent_throw_doesnt_propagate() {
    Notifier notifier = new AbstractStatusChangeNotifier() {

        @Override
        protected void doNotify(ClientApplicationEvent event) throws Exception {
            throw new IllegalStateException("test");
        }
    };
    notifier.notify(new ClientApplicationStatusChangedEvent(Application.create("App").withId("-id-").withHealthUrl("http://health").build(), StatusInfo.ofOffline(), StatusInfo.ofUp()));
}
Also used : ClientApplicationStatusChangedEvent(de.codecentric.boot.admin.event.ClientApplicationStatusChangedEvent) ClientApplicationEvent(de.codecentric.boot.admin.event.ClientApplicationEvent) Test(org.junit.Test)

Example 7 with ClientApplicationEvent

use of de.codecentric.boot.admin.event.ClientApplicationEvent in project spring-boot-admin by codecentric.

the class HazelcastJournaledEventStoreTest method setup.

@Before
public void setup() {
    HazelcastInstance hazelcast = HazelcastInstanceFactory.newHazelcastInstance(new Config());
    store = new HazelcastJournaledEventStore(hazelcast.<ClientApplicationEvent>getList("testList"));
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) ClientApplicationEvent(de.codecentric.boot.admin.event.ClientApplicationEvent) Before(org.junit.Before)

Example 8 with ClientApplicationEvent

use of de.codecentric.boot.admin.event.ClientApplicationEvent in project spring-boot-admin by codecentric.

the class JournalControllerTest method test_getJournal.

@Test
public void test_getJournal() throws Exception {
    ClientApplicationEvent emittedEvent = new ClientApplicationRegisteredEvent(Application.create("foo").withId("bar").withHealthUrl("http://health").build());
    journal.onClientApplicationEvent(emittedEvent);
    mvc.perform(get("/api/journal").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(jsonPath("$[0].type").value("REGISTRATION"));
    mvc.perform(get("/api/journal").accept(MediaType.parseMediaType("text/event-stream"))).andExpect(status().isOk());
}
Also used : ClientApplicationRegisteredEvent(de.codecentric.boot.admin.event.ClientApplicationRegisteredEvent) ClientApplicationEvent(de.codecentric.boot.admin.event.ClientApplicationEvent) Test(org.junit.Test)

Aggregations

ClientApplicationEvent (de.codecentric.boot.admin.event.ClientApplicationEvent)8 Test (org.junit.Test)7 ClientApplicationRegisteredEvent (de.codecentric.boot.admin.event.ClientApplicationRegisteredEvent)5 ClientApplicationDeregisteredEvent (de.codecentric.boot.admin.event.ClientApplicationDeregisteredEvent)3 Application (de.codecentric.boot.admin.model.Application)3 Collection (java.util.Collection)3 Config (com.hazelcast.config.Config)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 ClientApplicationStatusChangedEvent (de.codecentric.boot.admin.event.ClientApplicationStatusChangedEvent)1 TestNotifier (de.codecentric.boot.admin.notify.TestNotifier)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1