@Test public void findAll() { CassandraInstance instance1 = instance(); CassandraInstance instance2 = instance(); expect(rings.containsKey(RING_NAME)).andStubReturn(true); expect(rings.get(RING_NAME)).andStubReturn(ImmutableMap.of(1, instance1, 2, instance2)); replayAll(); assertEquals(ImmutableSet.of(instance1, instance2), dao.findAll(RING_NAME)); }
@Override public ImmutableSet<CassandraInstance> findAll(String ring) { ImmutableSet<CassandraInstance> instances = ImmutableSet.of(); if (rings.containsKey(ring)) { instances = ImmutableSet.copyOf(rings.get(ring).values()); } LOG.info("Returning instances: {}", instances); return instances; }
MemoryCassandraInstanceDao implements CassandraInstanceDao { @Override public ImmutableSet<CassandraInstance> findAll(String ring) { ImmutableSet<CassandraInstance> instances = ImmutableSet.of(); if (rings.containsKey(ring)) { instances = ImmutableSet.copyOf(rings.get(ring).values()); } LOG.info("Returning instances: {}", instances); return instances; } }
MemoryCassandraInstanceDao implements CassandraInstanceDao { @Override public ImmutableSet<CassandraInstance> findAll(String ring) { ImmutableSet<CassandraInstance> instances = ImmutableSet.of(); if (rings.containsKey(ring)) { instances = ImmutableSet.copyOf(rings.get(ring).values()); } LOG.info("Returning instances: {}", instances); return instances; } MemoryCassandraInstanceDao(); @VisibleForTesting  MemoryCassandraInstanceDao(
      ConcurrentMap<String, Map<Integer, CassandraInstance>> rings); }
MemoryCassandraInstanceDao implements CassandraInstanceDao { @Override public ImmutableSet<CassandraInstance> findAll(String ring) { ImmutableSet<CassandraInstance> instances = ImmutableSet.of(); if (rings.containsKey(ring)) { instances = ImmutableSet.copyOf(rings.get(ring).values()); } LOG.info("Returning instances: {}", instances); return instances; } MemoryCassandraInstanceDao(); @VisibleForTesting  MemoryCassandraInstanceDao(
      ConcurrentMap<String, Map<Integer, CassandraInstance>> rings); @Override ImmutableSet<CassandraInstance> findAll(String ring); @Override @Nullable CassandraInstance findById(String ring, int id); @Override void save(String ringName, CassandraInstance instance); @Override void delete(String ringName, CassandraInstance instance); }
MemoryCassandraInstanceDao implements CassandraInstanceDao { @Override public ImmutableSet<CassandraInstance> findAll(String ring) { ImmutableSet<CassandraInstance> instances = ImmutableSet.of(); if (rings.containsKey(ring)) { instances = ImmutableSet.copyOf(rings.get(ring).values()); } LOG.info("Returning instances: {}", instances); return instances; } MemoryCassandraInstanceDao(); @VisibleForTesting  MemoryCassandraInstanceDao(
      ConcurrentMap<String, Map<Integer, CassandraInstance>> rings); @Override ImmutableSet<CassandraInstance> findAll(String ring); @Override @Nullable CassandraInstance findById(String ring, int id); @Override void save(String ringName, CassandraInstance instance); @Override void delete(String ringName, CassandraInstance instance);  }