use of de.codecentric.boot.admin.server.domain.events.InstanceRegisteredEvent in project spring-boot-admin by codecentric.
the class StatusUpdateTriggerTest method should_not_update_when_stopped.
@Test
public void should_not_update_when_stopped() {
// when registered event is emitted but the trigger has been stopped
this.trigger.stop();
clearInvocations(this.updater);
this.events.next(new InstanceRegisteredEvent(this.instance.getId(), this.instance.getVersion(), this.instance.getRegistration()));
// then should not update
verify(this.updater, never()).updateStatus(this.instance.getId());
}
use of de.codecentric.boot.admin.server.domain.events.InstanceRegisteredEvent in project spring-boot-admin by codecentric.
the class EndpointDetectionTriggerTest method should_not_detect_on_trigger_stopped.
@Test
public void should_not_detect_on_trigger_stopped() {
// when registered event is emitted but the trigger has been stopped
this.trigger.stop();
clearInvocations(this.detector);
this.events.next(new InstanceRegisteredEvent(this.instance.getId(), this.instance.getVersion(), this.instance.getRegistration()));
// then should not update
verify(this.detector, never()).detectEndpoints(this.instance.getId());
}
use of de.codecentric.boot.admin.server.domain.events.InstanceRegisteredEvent in project spring-boot-admin by codecentric.
the class EndpointDetectionTriggerTest method should_not_detect_on_non_relevant_event.
@Test
public void should_not_detect_on_non_relevant_event() {
// when some non-status-change event is emitted
this.events.next(new InstanceRegisteredEvent(this.instance.getId(), this.instance.getVersion(), this.instance.getRegistration()));
// then should not update
verify(this.detector, never()).detectEndpoints(this.instance.getId());
}
use of de.codecentric.boot.admin.server.domain.events.InstanceRegisteredEvent in project spring-boot-admin by codecentric.
the class MicrosoftTeamsNotifierTest method test_shouldNotifyWithRegisteredEventReturns_true.
@Test
void test_shouldNotifyWithRegisteredEventReturns_true() {
InstanceRegisteredEvent event = new InstanceRegisteredEvent(instance.getId(), 1L, instance.getRegistration());
assertThat(notifier.shouldNotify(event, instance)).isTrue();
}
use of de.codecentric.boot.admin.server.domain.events.InstanceRegisteredEvent in project spring-boot-admin by codecentric.
the class InstanceNameNotificationFilterTest method test_filterByName.
@Test
public void test_filterByName() {
NotificationFilter filter = new ApplicationNameNotificationFilter("foo", null);
Instance filteredInstance = Instance.create(InstanceId.of("-")).register(Registration.create("foo", "http://health").build());
InstanceRegisteredEvent filteredEvent = new InstanceRegisteredEvent(filteredInstance.getId(), filteredInstance.getVersion(), filteredInstance.getRegistration());
assertThat(filter.filter(filteredEvent, filteredInstance)).isTrue();
Instance ignoredInstance = Instance.create(InstanceId.of("-")).register(Registration.create("bar", "http://health").build());
InstanceRegisteredEvent ignoredEvent = new InstanceRegisteredEvent(ignoredInstance.getId(), ignoredInstance.getVersion(), ignoredInstance.getRegistration());
assertThat(filter.filter(ignoredEvent, ignoredInstance)).isFalse();
}
Aggregations