Search in sources :

Example 1 with Version

use of com.hotels.styx.Version in project styx by ExpediaGroup.

the class DashboardDataTest method unsubscribesFromEventBus.

@Test
public void unsubscribesFromEventBus() {
    EventBus eventBus = mock(EventBus.class);
    MemoryBackedRegistry<BackendService> backendServicesRegistry = new MemoryBackedRegistry<>();
    backendServicesRegistry.add(application("app", origin("app-01", "localhost", 9090)));
    backendServicesRegistry.add(application("test", origin("test-01", "localhost", 9090)));
    DashboardData dashbaord = new DashboardData(metricRegistry, backendServicesRegistry, "styx-prod1-presentation-01", new Version("releaseTag"), eventBus);
    // Twice for each backend. One during backend construction, another from BackendServicesRegistry listener callback.
    verify(eventBus, times(4)).register(any(DashboardData.Origin.class));
    dashbaord.unregister();
    verify(eventBus, times(4)).unregister(any(DashboardData.Origin.class));
}
Also used : Origin(com.hotels.styx.api.extension.Origin) BackendService(com.hotels.styx.api.extension.service.BackendService) Version(com.hotels.styx.Version) MemoryBackedRegistry(com.hotels.styx.infrastructure.MemoryBackedRegistry) EventBus(com.google.common.eventbus.EventBus) Test(org.junit.jupiter.api.Test)

Aggregations

EventBus (com.google.common.eventbus.EventBus)1 Version (com.hotels.styx.Version)1 Origin (com.hotels.styx.api.extension.Origin)1 BackendService (com.hotels.styx.api.extension.service.BackendService)1 MemoryBackedRegistry (com.hotels.styx.infrastructure.MemoryBackedRegistry)1 Test (org.junit.jupiter.api.Test)1