@Test public void findById() throws Exception { expect(zergConnector.getHosts()).andReturn(HOSTS); replayAll(); Iterator<CassandraInstance> iterator = BIG_RING_INSTANCES.iterator(); iterator.next(); assertEquals(iterator.next(), dao.findById(BIG_RING, 1026494710)); }
@Override public @Nullable CassandraInstance findById(String ring, int id) throws BackingStoreException { for (ZergHost host : getHosts(ring).toSet()) { if (id == host.getId()) { return ZergHosts.toCassandraInstance(host); } } return null; }
ZergCassandraInstanceDao implements CassandraInstanceDao { @Override public @Nullable CassandraInstance findById(String ring, int id) throws BackingStoreException { for (ZergHost host : getHosts(ring).toSet()) { if (id == host.getId()) { return ZergHosts.toCassandraInstance(host); } } return null; } }
ZergCassandraInstanceDao implements CassandraInstanceDao { @Override public @Nullable CassandraInstance findById(String ring, int id) throws BackingStoreException { for (ZergHost host : getHosts(ring).toSet()) { if (id == host.getId()) { return ZergHosts.toCassandraInstance(host); } } return null; } @Inject  ZergCassandraInstanceDao(ZergConnector zergConnector,
      @Named(ZergDaoModule.ZERG_REGION_PROPERTY) String currentRegion,
      @Named(ZergDaoModule.ZERG_CASSANDRA_RING_SCOPES) Map<String, String> ringScopes); }
ZergCassandraInstanceDao implements CassandraInstanceDao { @Override public @Nullable CassandraInstance findById(String ring, int id) throws BackingStoreException { for (ZergHost host : getHosts(ring).toSet()) { if (id == host.getId()) { return ZergHosts.toCassandraInstance(host); } } return null; } @Inject  ZergCassandraInstanceDao(ZergConnector zergConnector,
      @Named(ZergDaoModule.ZERG_REGION_PROPERTY) String currentRegion,
      @Named(ZergDaoModule.ZERG_CASSANDRA_RING_SCOPES) Map<String, String> ringScopes); @Override ImmutableSet<CassandraInstance> findAll(String ring); @Override @Nullable CassandraInstance findById(String ring, int id); @Override void save(String ring, CassandraInstance instance); @Override void delete(String ring, CassandraInstance instance); }
ZergCassandraInstanceDao implements CassandraInstanceDao { @Override public @Nullable CassandraInstance findById(String ring, int id) throws BackingStoreException { for (ZergHost host : getHosts(ring).toSet()) { if (id == host.getId()) { return ZergHosts.toCassandraInstance(host); } } return null; } @Inject  ZergCassandraInstanceDao(ZergConnector zergConnector,
      @Named(ZergDaoModule.ZERG_REGION_PROPERTY) String currentRegion,
      @Named(ZergDaoModule.ZERG_CASSANDRA_RING_SCOPES) Map<String, String> ringScopes); @Override ImmutableSet<CassandraInstance> findAll(String ring); @Override @Nullable CassandraInstance findById(String ring, int id); @Override void save(String ring, CassandraInstance instance); @Override void delete(String ring, CassandraInstance instance);  }