PersistedStores { public static CloseableIterable<Store> list(final Connector c, Authorizations auths, String metadataTable) throws TableNotFoundException { checkNotNull(c); checkNotNull(auths); checkNotNull(metadataTable); BatchScanner bs = c.createBatchScanner(metadataTable, auths, 10); bs.setRanges(Collections.singleton(new Range())); bs.fetchColumnFamily(SERIALIZED_STORE_COLFAM); return CloseableIterable.transform(bs, new Function<Entry<Key,Value>,Store>() { @Override public Store apply(Entry<Key,Value> input) { try { return deserialize(c, input.getValue()); } catch (InvalidProtocolBufferException e) { throw new RuntimeException(e); } } }, NullTracer.instance(), "List Stores", new Stopwatch()); }  static State getState(Store id); static void setState(Store id, State state); static void remove(Store id); static State deserializeState(Value v); static CloseableIterable<Column> columns(Store id, String description, Stopwatch sw); static CloseableIterable<Store> list(final Connector c, Authorizations auths, String metadataTable); static void store(Store id); static Store retrieve(Connector connector, String metadataTable, Authorizations auths, String uuid); static Value serialize(Store id); static Store deserialize(Connector connector, Value value); static final Text EMPTY_TEXT; static final Text STATE_COLFAM; static final Text COLUMN_COLFAM; static final Text SERIALIZED_STORE_COLFAM; }
@Test public void testEmptyListOfStores() throws Exception { Authorizations auths = new Authorizations(); CloseableIterable<Store> storesIter = PersistedStores.list(mockConnector, auths, Defaults.METADATA_TABLE); Assert.assertEquals(0, Iterables.size(storesIter)); }