BrowsableRecord extends Record<L, K, V> { public Map<K, Set<V>> browse() { read.lock(); try { Map<K, Set<V>> data = Maps.newLinkedHashMap(); for (K key : describe()) { data.put(key, get(key)); } return data; } finally { read.unlock(); } } protected  BrowsableRecord(L locator, K key); Map<K, Set<V>> browse(); Map<K, Set<V>> browse(long timestamp);  }
@Test public void testBrowse() { Multimap<K, V> expected = HashMultimap.create(); L locator = getLocator(); record = getRecord(locator); for (int i = 0; i < TestData.getScaleCount(); i++) { K key = getKey(); Set<V> values = populateRecord(record, locator, key); expected.putAll(key, values); } Assert.assertEquals(expected.asMap(), ((BrowsableRecord<L, K, V>) record).browse()); }
@Test public void testBrowseWithTime() { Multimap<K, V> expected = HashMultimap.create(); L locator = Variables.register("locator", getLocator()); record = Variables.register("record", getRecord(locator)); for (int i = 0; i < TestData.getScaleCount(); i++) { K key = Variables.register("key", getKey()); Set<V> values = populateRecord(record, locator, key); Variables.register("values", values); expected.putAll(key, values); } long timestamp = Time.now(); for (int i = 0; i < TestData.getScaleCount(); i++) { K key = getKey(); populateRecord(record, locator, key); } Assert.assertEquals(expected.asMap(), ((BrowsableRecord<L, K, V>) record).browse(timestamp)); }