@Test public void addsResources() { BackendService landing = backendService("landing", 9091); BackendService shopping = backendService("shopping", 9090); MemoryBackedRegistry<BackendService> registry = new MemoryBackedRegistry<>(); registry.add(landing); registry.addListener(listener); registry.add(shopping); assertThat(registry.get(), containsInAnyOrder(landing, shopping)); verify(listener).onChange(eq(added(shopping))); }
public void add(T t) { resources.put(t.id(), t); if (autoReload) { reload(); } }
MemoryBackedRegistry extends AbstractRegistry<T> { public void add(T t) { resources.put(t.id(), t); if (autoReload) { reload(); } } }
MemoryBackedRegistry extends AbstractRegistry<T> { public void add(T t) { resources.put(t.id(), t); if (autoReload) { reload(); } } MemoryBackedRegistry(); private  MemoryBackedRegistry(boolean autoReload); }
MemoryBackedRegistry extends AbstractRegistry<T> { public void add(T t) { resources.put(t.id(), t); if (autoReload) { reload(); } } MemoryBackedRegistry(); private  MemoryBackedRegistry(boolean autoReload); void add(T t); void removeById(Id id); void reset(); @Override CompletableFuture<ReloadResult> reload(); }
MemoryBackedRegistry extends AbstractRegistry<T> { public void add(T t) { resources.put(t.id(), t); if (autoReload) { reload(); } } MemoryBackedRegistry(); private  MemoryBackedRegistry(boolean autoReload); void add(T t); void removeById(Id id); void reset(); @Override CompletableFuture<ReloadResult> reload();  }