@Test public void testMoveRowkeyFiltersForWriteColumnGet() throws IOException { Get sourceGet = new Get(ROW); Get dstGet = new Get(ROW); ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet); Assert.assertNull(sourceGet.getFilter()); Assert.assertNull(dstGet.getFilter()); dstGet.setFilter(null); Filter expected = new SingleColumnValueFilter(); sourceGet.setFilter(expected); ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet); Assert.assertEquals(expected, sourceGet.getFilter()); Assert.assertNull(dstGet.getFilter()); dstGet.setFilter(null); FilterList filters = new FilterList(Operator.MUST_PASS_ONE); filters.addFilter(new SingleColumnValueFilter()); filters.addFilter(new PrefixFilter()); sourceGet.setFilter(filters); ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet); Assert.assertEquals(filters, sourceGet.getFilter()); Assert.assertNull(dstGet.getFilter()); dstGet.setFilter(null); expected = new PrefixFilter(); sourceGet.setFilter(expected); ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet); Assert.assertEquals(0, ((FilterList)sourceGet.getFilter()).getFilters().size()); Assert.assertEquals(1, ((FilterList)dstGet.getFilter()).getFilters().size()); Assert.assertEquals(expected, ((FilterList)dstGet.getFilter()).getFilters().get(0)); dstGet.setFilter(null); filters = new FilterList(); filters.addFilter(new SingleColumnValueFilter()); filters.addFilter(new PrefixFilter()); sourceGet.setFilter(filters); ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet); FilterList sourceFilter = (FilterList)sourceGet.getFilter(); FilterList dstFilter = (FilterList)dstGet.getFilter(); Assert.assertEquals(1, sourceFilter.getFilters().size()); Assert.assertTrue(sourceFilter.getFilters().get(0) instanceof SingleColumnValueFilter); Assert.assertEquals(1, dstFilter.getFilters().size()); Assert.assertTrue(dstFilter.getFilters().get(0) instanceof PrefixFilter); dstGet.setFilter(null); filters = new FilterList(); filters.addFilter(new SingleColumnValueFilter()); filters.addFilter(new PrefixFilter()); filters.addFilter(new CustomerRowkeyFilter(ROW)); filters.addFilter(new CustomerColumnFilter(QUALIFIER)); sourceGet.setFilter(filters); ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet); sourceFilter = (FilterList)sourceGet.getFilter(); dstFilter = (FilterList)dstGet.getFilter(); Assert.assertEquals(2, sourceFilter.getFilters().size()); for (Filter filter : sourceFilter.getFilters()) { Assert.assertFalse(filter instanceof PrefixFilter); Assert.assertFalse(filter instanceof CustomerRowkeyFilter); } Assert.assertEquals(2, dstFilter.getFilters().size()); for (Filter filter : dstFilter.getFilters()) { Assert.assertFalse(filter instanceof SingleColumnValueFilter); Assert.assertFalse(filter instanceof CustomerColumnFilter); } dstGet.setFilter(null); filters = new FilterList(); filters.addFilter(new SingleColumnValueFilter()); filters.addFilter(new PrefixFilter()); sourceGet.setFilter(filters); dstGet.setFilter(new ExcludeDataColumnFilter()); ThemisCpUtil.moveRowkeyFiltersForWriteGet(sourceGet, dstGet); sourceFilter = (FilterList)sourceGet.getFilter(); dstFilter = (FilterList)dstGet.getFilter(); Assert.assertEquals(2, dstFilter.getFilters().size()); Assert.assertTrue((dstFilter.getFilters().get(0) instanceof ExcludeDataColumnFilter) || (dstFilter.getFilters().get(1) instanceof ExcludeDataColumnFilter)); dstGet.setFilter(null); }
public static void moveRowkeyFiltersForWriteGet(Get sourceGet, Get destGet) throws IOException { ClassifiedFilters classifyFilters = new ClassifiedFilters(); if (sourceGet.getFilter() != null) { processFilters(sourceGet.getFilter(), classifyFilters); } if (classifyFilters.allMustPassOperator) { if (classifyFilters.rowkeyFilters.getFilters().size() != 0) { if (destGet.getFilter() != null) { FilterList filter = new FilterList(); filter.addFilter(destGet.getFilter()); filter.addFilter(classifyFilters.rowkeyFilters); destGet.setFilter(filter); } else { destGet.setFilter(classifyFilters.rowkeyFilters); } sourceGet.setFilter(classifyFilters.noRowkeyFilters); } } }
ThemisCpUtil { public static void moveRowkeyFiltersForWriteGet(Get sourceGet, Get destGet) throws IOException { ClassifiedFilters classifyFilters = new ClassifiedFilters(); if (sourceGet.getFilter() != null) { processFilters(sourceGet.getFilter(), classifyFilters); } if (classifyFilters.allMustPassOperator) { if (classifyFilters.rowkeyFilters.getFilters().size() != 0) { if (destGet.getFilter() != null) { FilterList filter = new FilterList(); filter.addFilter(destGet.getFilter()); filter.addFilter(classifyFilters.rowkeyFilters); destGet.setFilter(filter); } else { destGet.setFilter(classifyFilters.rowkeyFilters); } sourceGet.setFilter(classifyFilters.noRowkeyFilters); } } } }
ThemisCpUtil { public static void moveRowkeyFiltersForWriteGet(Get sourceGet, Get destGet) throws IOException { ClassifiedFilters classifyFilters = new ClassifiedFilters(); if (sourceGet.getFilter() != null) { processFilters(sourceGet.getFilter(), classifyFilters); } if (classifyFilters.allMustPassOperator) { if (classifyFilters.rowkeyFilters.getFilters().size() != 0) { if (destGet.getFilter() != null) { FilterList filter = new FilterList(); filter.addFilter(destGet.getFilter()); filter.addFilter(classifyFilters.rowkeyFilters); destGet.setFilter(filter); } else { destGet.setFilter(classifyFilters.rowkeyFilters); } sourceGet.setFilter(classifyFilters.noRowkeyFilters); } } }  }
ThemisCpUtil { public static void moveRowkeyFiltersForWriteGet(Get sourceGet, Get destGet) throws IOException { ClassifiedFilters classifyFilters = new ClassifiedFilters(); if (sourceGet.getFilter() != null) { processFilters(sourceGet.getFilter(), classifyFilters); } if (classifyFilters.allMustPassOperator) { if (classifyFilters.rowkeyFilters.getFilters().size() != 0) { if (destGet.getFilter() != null) { FilterList filter = new FilterList(); filter.addFilter(destGet.getFilter()); filter.addFilter(classifyFilters.rowkeyFilters); destGet.setFilter(filter); } else { destGet.setFilter(classifyFilters.rowkeyFilters); } sourceGet.setFilter(classifyFilters.noRowkeyFilters); } } }  static String getDisallowedFilterClassNameString(); static void processFilters(Filter filter, FilterCallable callable); static void moveRowkeyFiltersForWriteGet(Get sourceGet, Get destGet); static void moveRowkeyFiltersForWriteScan(Scan sourceScan, Scan destScan); static void addLockAndWriteColumnToGet(Get userGet, Get internalGet, long startTs); static Result removeNotRequiredLockColumns(Map<byte[], NavigableSet<byte[]>> familyMap,
      Result result); static Get constructLockAndWriteGet(Get userGet, long startTs); static void prepareGet(Get get, Collection<HColumnDescriptor> families); static void prepareScan(Scan scan, Collection<HColumnDescriptor> families); static Scan constructLockAndWriteScan(Scan userScan, long startTs); static void addLockAndWriteColumnToScan(Column column, Scan scan); static Get constructDataGetByPutKvs(List<KeyValue> putKvs, Filter filter); static void addWriteColumnToGet(Column column, Get get); static boolean isLockResult(Result result); static Pair<List<KeyValue>, List<KeyValue>> seperateLockAndWriteKvs(List<KeyValue> kvs); }
ThemisCpUtil { public static void moveRowkeyFiltersForWriteGet(Get sourceGet, Get destGet) throws IOException { ClassifiedFilters classifyFilters = new ClassifiedFilters(); if (sourceGet.getFilter() != null) { processFilters(sourceGet.getFilter(), classifyFilters); } if (classifyFilters.allMustPassOperator) { if (classifyFilters.rowkeyFilters.getFilters().size() != 0) { if (destGet.getFilter() != null) { FilterList filter = new FilterList(); filter.addFilter(destGet.getFilter()); filter.addFilter(classifyFilters.rowkeyFilters); destGet.setFilter(filter); } else { destGet.setFilter(classifyFilters.rowkeyFilters); } sourceGet.setFilter(classifyFilters.noRowkeyFilters); } } }  static String getDisallowedFilterClassNameString(); static void processFilters(Filter filter, FilterCallable callable); static void moveRowkeyFiltersForWriteGet(Get sourceGet, Get destGet); static void moveRowkeyFiltersForWriteScan(Scan sourceScan, Scan destScan); static void addLockAndWriteColumnToGet(Get userGet, Get internalGet, long startTs); static Result removeNotRequiredLockColumns(Map<byte[], NavigableSet<byte[]>> familyMap,
      Result result); static Get constructLockAndWriteGet(Get userGet, long startTs); static void prepareGet(Get get, Collection<HColumnDescriptor> families); static void prepareScan(Scan scan, Collection<HColumnDescriptor> families); static Scan constructLockAndWriteScan(Scan userScan, long startTs); static void addLockAndWriteColumnToScan(Column column, Scan scan); static Get constructDataGetByPutKvs(List<KeyValue> putKvs, Filter filter); static void addWriteColumnToGet(Column column, Get get); static boolean isLockResult(Result result); static Pair<List<KeyValue>, List<KeyValue>> seperateLockAndWriteKvs(List<KeyValue> kvs); static Set<Class<? extends Filter>> ALLOWED_ROWKEY_FILTER_CLASSES; static Set<Class<? extends Filter>> DISALLOWD_FILTERS; }