Search in sources :

Example 1 with Message

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

the class MicrosoftTeamsNotifierTest method test_getStatusChangedMessageWithExtraFormatArgumentReturns_activitySubtitlePatternWithAppName.

@Test
void test_getStatusChangedMessageWithExtraFormatArgumentReturns_activitySubtitlePatternWithAppName() {
    notifier.setStatusActivitySubtitle("STATUS_ACTIVITY_PATTERN_#{instance.registration.name}");
    Message message = notifier.getStatusChangedMessage(instance, notifier.createEvaluationContext(new InstanceDeregisteredEvent(instance.getId(), 1L), instance));
    assertThat(message.getSections().get(0).getActivitySubtitle()).isEqualTo("STATUS_ACTIVITY_PATTERN_" + appName);
}
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 2 with Message

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

the class MicrosoftTeamsNotifierTest method test_getStatusChangedMessageForAppReturns_correctContent.

@Test
void test_getStatusChangedMessageForAppReturns_correctContent() {
    Message message = notifier.getStatusChangedMessage(instance, notifier.createEvaluationContext(new InstanceStatusChangedEvent(instance.getId(), 1L, StatusInfo.ofDown()), instance));
    assertMessage(message, notifier.getStatusChangedTitle(), notifier.getMessageSummary(), "Test App with id TestAppId changed status from UNKNOWN to DOWN", RED);
}
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 3 with Message

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

the class MicrosoftTeamsNotifierTest method test_getDeRegisterMessageWithExtraFormatArgumentReturns_activitySubtitlePatternWithAppName.

@Test
void test_getDeRegisterMessageWithExtraFormatArgumentReturns_activitySubtitlePatternWithAppName() {
    notifier.setDeregisterActivitySubtitle("DEREGISTER_ACTIVITY_PATTERN_#{instance.registration.name}");
    Message message = notifier.getDeregisteredMessage(instance, notifier.createEvaluationContext(new InstanceDeregisteredEvent(instance.getId(), 1L), instance));
    assertThat(message.getSections().get(0).getActivitySubtitle()).isEqualTo("DEREGISTER_ACTIVITY_PATTERN_" + appName);
}
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 4 with Message

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

the class MicrosoftTeamsNotifierTest method test_getStatusChangedMessageForAppReturns_UP_to_DOWN.

@Test
void test_getStatusChangedMessageForAppReturns_UP_to_DOWN() {
    notifier.updateLastStatus(new InstanceStatusChangedEvent(instance.getId(), 1L, StatusInfo.ofUp()));
    Message message = notifier.getStatusChangedMessage(instance, notifier.createEvaluationContext(new InstanceStatusChangedEvent(instance.getId(), 1L, StatusInfo.ofDown()), instance));
    assertMessage(message, notifier.getStatusChangedTitle(), notifier.getMessageSummary(), "Test App with id TestAppId changed status from UP to DOWN", RED);
}
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 5 with Message

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

the class MicrosoftTeamsNotifierTest method test_getRegisterMessageWithExtraFormatArgumentReturns_activitySubtitlePatternWithAppName.

@Test
void test_getRegisterMessageWithExtraFormatArgumentReturns_activitySubtitlePatternWithAppName() {
    notifier.setRegisterActivitySubtitle("REGISTER_ACTIVITY_PATTERN_#{instance.registration.name}");
    Message message = notifier.getRegisteredMessage(instance, notifier.createEvaluationContext(new InstanceDeregisteredEvent(instance.getId(), 1L), instance));
    assertThat(message.getSections().get(0).getActivitySubtitle()).isEqualTo("REGISTER_ACTIVITY_PATTERN_" + appName);
}
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