use of org.apache.phoenix.util.ReadOnlyProps in project phoenix by apache.
the class PMetaDataImplTest method shouldAlwaysKeepOneEntryIfMaxSizeIsZero.
@Test
public void shouldAlwaysKeepOneEntryIfMaxSizeIsZero() throws Exception {
TestTimeKeeper timeKeeper = new TestTimeKeeper();
Map<String, String> props = Maps.newHashMapWithExpectedSize(2);
props.put(QueryServices.MAX_CLIENT_METADATA_CACHE_SIZE_ATTRIB, "0");
props.put(QueryServices.CLIENT_CACHE_ENCODING, "object");
PMetaData metaData = new PMetaDataImpl(5, timeKeeper, new ReadOnlyProps(props));
addToTable(metaData, "a", 1, timeKeeper);
assertEquals(1, metaData.size());
addToTable(metaData, "b", 1, timeKeeper);
assertEquals(1, metaData.size());
addToTable(metaData, "c", 5, timeKeeper);
assertEquals(1, metaData.size());
addToTable(metaData, "d", 20, timeKeeper);
assertEquals(1, metaData.size());
assertNames(metaData, "d");
addToTable(metaData, "e", 1, timeKeeper);
assertEquals(1, metaData.size());
addToTable(metaData, "f", 2, timeKeeper);
assertEquals(1, metaData.size());
assertNames(metaData, "f");
}
Aggregations