use of com.hotels.styx.api.extension.service.BackendService in project styx by ExpediaGroup.
the class MemoryBackedRegistryTest method updatesResources.
@Test
public void updatesResources() {
BackendService landing = backendService("landing", 9091);
MemoryBackedRegistry<BackendService> registry = new MemoryBackedRegistry<>();
registry.add(backendService("shopping", 9090));
registry.add(landing);
registry.addListener(listener);
BackendService shopping = backendService("shopping", 9091);
registry.add(shopping);
assertThat(registry.get(), containsInAnyOrder(landing, shopping));
verify(listener).onChange(eq(updated(shopping)));
}
use of com.hotels.styx.api.extension.service.BackendService in project styx by ExpediaGroup.
the class MemoryBackedRegistryTest method removesResources.
@Test
public void removesResources() {
BackendService shopping = backendService("shopping", 9090);
BackendService landing = backendService("landing", 9091);
MemoryBackedRegistry<BackendService> registry = new MemoryBackedRegistry<>();
registry.add(shopping);
registry.add(landing);
registry.addListener(listener);
registry.removeById(id("shopping"));
assertThat(registry.get(), contains(landing));
verify(listener).onChange(eq(removed(shopping)));
}
Aggregations