Search in sources :

Example 6 with Message

use of de.codecentric.boot.admin.server.notify.MicrosoftTeamsNotifier.Message in project spring-boot-admin by codecentric.

the class MicrosoftTeamsNotifierTest method test_getDeregisteredMessageForAppReturns_correctContent.

@Test
void test_getDeregisteredMessageForAppReturns_correctContent() {
    Message message = notifier.getDeregisteredMessage(instance, notifier.createEvaluationContext(new InstanceDeregisteredEvent(instance.getId(), 1L), instance));
    assertMessage(message, notifier.getDeRegisteredTitle(), notifier.getMessageSummary(), "Test App with id TestAppId has de-registered from Spring Boot Admin", BLUE);
}
Also used : Message(de.codecentric.boot.admin.server.notify.MicrosoftTeamsNotifier.Message) InstanceDeregisteredEvent(de.codecentric.boot.admin.server.domain.events.InstanceDeregisteredEvent) Test(org.junit.jupiter.api.Test)

Example 7 with Message

use of de.codecentric.boot.admin.server.notify.MicrosoftTeamsNotifier.Message in project spring-boot-admin by codecentric.

the class MicrosoftTeamsNotifierTest method test_getStatusChangedMessage_parsesThemeColorFromSpelExpression.

@Test
void test_getStatusChangedMessage_parsesThemeColorFromSpelExpression() {
    notifier.setThemeColor("#{event.type == 'STATUS_CHANGED' ? (event.statusInfo.status=='UP' ? 'green' : 'red') : 'blue'}");
    Message message = notifier.getStatusChangedMessage(instance, notifier.createEvaluationContext(new InstanceStatusChangedEvent(instance.getId(), 1L, StatusInfo.ofUp()), instance));
    assertThat(message.getThemeColor()).isEqualTo("green");
}
Also used : Message(de.codecentric.boot.admin.server.notify.MicrosoftTeamsNotifier.Message) InstanceStatusChangedEvent(de.codecentric.boot.admin.server.domain.events.InstanceStatusChangedEvent) Test(org.junit.jupiter.api.Test)

Example 8 with Message

use of de.codecentric.boot.admin.server.notify.MicrosoftTeamsNotifier.Message in project spring-boot-admin by codecentric.

the class MicrosoftTeamsNotifierTest method test_getRegisteredMessageForAppReturns_correctContent.

@Test
void test_getRegisteredMessageForAppReturns_correctContent() {
    Message message = notifier.getRegisteredMessage(instance, notifier.createEvaluationContext(new InstanceDeregisteredEvent(instance.getId(), 1L), instance));
    assertMessage(message, notifier.getRegisteredTitle(), notifier.getMessageSummary(), "Test App with id TestAppId has registered with Spring Boot Admin", BLUE);
}
Also used : Message(de.codecentric.boot.admin.server.notify.MicrosoftTeamsNotifier.Message) InstanceDeregisteredEvent(de.codecentric.boot.admin.server.domain.events.InstanceDeregisteredEvent) Test(org.junit.jupiter.api.Test)

Aggregations

Message (de.codecentric.boot.admin.server.notify.MicrosoftTeamsNotifier.Message)8 Test (org.junit.jupiter.api.Test)8 InstanceDeregisteredEvent (de.codecentric.boot.admin.server.domain.events.InstanceDeregisteredEvent)5 InstanceStatusChangedEvent (de.codecentric.boot.admin.server.domain.events.InstanceStatusChangedEvent)3