Search in sources :

Example 1 with DisableOrigin

use of com.hotels.styx.client.origincommands.DisableOrigin in project styx by ExpediaGroup.

the class OriginsInventoryTest method willNotEnableOriginsNotBelongingToTheApp.

@Test
public void willNotEnableOriginsNotBelongingToTheApp() {
    inventory.setOrigins(ORIGIN_1);
    inventory.onCommand(new DisableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    inventory.onCommand(new EnableOrigin(id("some-other-app"), ORIGIN_1.id()));
    assertThat(inventory.originCount(ACTIVE), is(0));
    verify(eventBus, times(2)).post(any(OriginsSnapshot.class));
}
Also used : DisableOrigin(com.hotels.styx.client.origincommands.DisableOrigin) EnableOrigin(com.hotels.styx.client.origincommands.EnableOrigin) OriginsSnapshot(com.hotels.styx.api.extension.OriginsSnapshot) Test(org.junit.jupiter.api.Test)

Example 2 with DisableOrigin

use of com.hotels.styx.client.origincommands.DisableOrigin in project styx by ExpediaGroup.

the class OriginsInventoryTest method logsMessageWhenOriginIsDisabled.

@Test
public void logsMessageWhenOriginIsDisabled() {
    inventory.setOrigins(ORIGIN_1);
    inventory.onCommand(new DisableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    assertThat(logger.lastMessage(), is(loggingEvent(INFO, "Origin state change: origin=\"generic-app=app-01\", change=\"ACTIVE->DISABLED\"")));
}
Also used : DisableOrigin(com.hotels.styx.client.origincommands.DisableOrigin) Test(org.junit.jupiter.api.Test)

Example 3 with DisableOrigin

use of com.hotels.styx.client.origincommands.DisableOrigin in project styx by ExpediaGroup.

the class OriginsInventoryTest method enablingAnOriginWillReInitiateHealthCheckMonitoring.

@Test
public void enablingAnOriginWillReInitiateHealthCheckMonitoring() {
    inventory.setOrigins(ORIGIN_1);
    inventory.onCommand(new DisableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    inventory.onCommand(new EnableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    verify(monitor, times(2)).monitor(singleton(ORIGIN_1));
    assertThat(gaugeValue("generic-app", "app-01"), isValue(0.0));
    verify(eventBus, times(3)).post(any(OriginsSnapshot.class));
}
Also used : DisableOrigin(com.hotels.styx.client.origincommands.DisableOrigin) EnableOrigin(com.hotels.styx.client.origincommands.EnableOrigin) OriginsSnapshot(com.hotels.styx.api.extension.OriginsSnapshot) Test(org.junit.jupiter.api.Test)

Example 4 with DisableOrigin

use of com.hotels.styx.client.origincommands.DisableOrigin in project styx by ExpediaGroup.

the class OriginsInventoryTest method logsMessageWhenDisabledOriginWithHealthChecksIsEnabled.

@Test
public void logsMessageWhenDisabledOriginWithHealthChecksIsEnabled() {
    inventory.setOrigins(ORIGIN_1);
    inventory.onCommand(new DisableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    inventory.onCommand(new EnableOrigin(ORIGIN_1.applicationId(), ORIGIN_1.id()));
    assertThat(logger.lastMessage(), is(loggingEvent(INFO, "Origin state change: origin=\"generic-app=app-01\", change=\"DISABLED->INACTIVE\"")));
}
Also used : DisableOrigin(com.hotels.styx.client.origincommands.DisableOrigin) EnableOrigin(com.hotels.styx.client.origincommands.EnableOrigin) Test(org.junit.jupiter.api.Test)

Example 5 with DisableOrigin

use of com.hotels.styx.client.origincommands.DisableOrigin in project styx by ExpediaGroup.

the class OriginsInventoryTest method willNotDisableOriginsNotBelongingToTheApp.

@Test
public void willNotDisableOriginsNotBelongingToTheApp() {
    inventory.setOrigins(ORIGIN_1);
    verify(eventBus).post(any(OriginsSnapshot.class));
    inventory.onCommand(new DisableOrigin(id("some-other-app"), ORIGIN_1.id()));
    assertThat(inventory.originCount(ACTIVE), is(1));
    verify(eventBus).post(any(OriginsSnapshot.class));
}
Also used : DisableOrigin(com.hotels.styx.client.origincommands.DisableOrigin) OriginsSnapshot(com.hotels.styx.api.extension.OriginsSnapshot) Test(org.junit.jupiter.api.Test)

Aggregations

DisableOrigin (com.hotels.styx.client.origincommands.DisableOrigin)7 Test (org.junit.jupiter.api.Test)7 OriginsSnapshot (com.hotels.styx.api.extension.OriginsSnapshot)5 EnableOrigin (com.hotels.styx.client.origincommands.EnableOrigin)3