private void prefixRowTests(Filter filter) throws Exception { prefixRowTests(filter, false); }
private void prefixRowTests(Filter filter, boolean lastFilterAllRemaining) throws Exception { for (char c = FIRST_CHAR; c <= LAST_CHAR; c++) { byte [] t = createRow(c); assertFalse("Failed with character " + c, filter.filterRowKey(KeyValueUtil.createFirstOnRow(t))); assertFalse(filter.filterAllRemaining()); } String yahooSite = "com.yahoo.www"; byte [] yahooSiteBytes = Bytes.toBytes(yahooSite); assertTrue("Failed with character " + yahooSite, filter.filterRowKey(KeyValueUtil.createFirstOnRow(yahooSiteBytes))); assertEquals(filter.filterAllRemaining(), lastFilterAllRemaining); }
private void prefixRowTests(Filter filter, boolean lastFilterAllRemaining) throws Exception { for (char c = FIRST_CHAR; c <= LAST_CHAR; c++) { byte [] t = createRow(c); assertFalse("Failed with character " + c, filter.filterRowKey(KeyValueUtil.createFirstOnRow(t))); assertFalse(filter.filterAllRemaining()); } String yahooSite = "com.yahoo.www"; byte [] yahooSiteBytes = Bytes.toBytes(yahooSite); assertTrue("Failed with character " + yahooSite, filter.filterRowKey(KeyValueUtil.createFirstOnRow(yahooSiteBytes))); assertEquals(filter.filterAllRemaining(), lastFilterAllRemaining); }
@Test public void testPrefixOnRow() throws Exception { prefixRowTests(mainFilter); }
@Test public void testPrefixOnRowInsideWhileMatchRow() throws Exception { prefixRowTests(new WhileMatchFilter(this.mainFilter), true); }
@Test public void testSerialization() throws Exception { // Decompose mainFilter to bytes. byte[] buffer = mainFilter.toByteArray(); // Recompose filter. Filter newFilter = PrefixFilter.parseFrom(buffer); // Ensure the serialization preserved the filter by running all test. prefixRowTests(newFilter); }
private void prefixRowTests(Filter filter) throws Exception { prefixRowTests(filter, false); }
@Test public void testPrefixOnRow() throws Exception { prefixRowTests(mainFilter); }
@Test public void testPrefixOnRowInsideWhileMatchRow() throws Exception { prefixRowTests(new WhileMatchFilter(this.mainFilter), true); }
@Test public void testSerialization() throws Exception { // Decompose mainFilter to bytes. byte[] buffer = mainFilter.toByteArray(); // Recompose filter. Filter newFilter = PrefixFilter.parseFrom(buffer); // Ensure the serialization preserved the filter by running all test. prefixRowTests(newFilter); }