ThemisRead extends ThemisRequest { public static void checkContainingPreservedColumns(Map<byte[], NavigableSet<byte[]>> familyMap) throws IOException { for (Entry<byte[], NavigableSet<byte []>> entry : familyMap.entrySet()) { byte[] family = entry.getKey(); if (entry.getValue() != null) { for (byte[] qualifier : entry.getValue()) { checkContainingPreservedColumn(family, qualifier); } } } }  abstract Map<byte [], NavigableSet<byte []>> getFamilyMap(); abstract ThemisRead addColumn(byte [] family, byte [] qualifier); abstract ThemisRead addFamily(byte[] family); abstract void setCacheBlocks(boolean cacheBlocks); abstract boolean getCacheBlocks(); ThemisRead setFilter(Filter filter); abstract Filter getFilter(); static void checkContainingPreservedColumns(Map<byte[], NavigableSet<byte[]>> familyMap);  }
@Test public void testCheckContainingPreservedColumns() { useCommitFamily(CommitFamily.SAME_WITH_DATA_FAMILY); Map<byte[], NavigableSet<byte[]>> familyMap = new HashMap<byte[], NavigableSet<byte[]>>(); familyMap.put(FAMILY, new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR)); familyMap.get(FAMILY).add(QUALIFIER); familyMap.put(ANOTHER_FAMILY, null); try { ThemisRead.checkContainingPreservedColumns(familyMap); } catch (IOException e) { Assert.fail(); } familyMap.get(FAMILY).add(ColumnUtil.getPutColumn(new Column(FAMILY, QUALIFIER)).getQualifier()); try { ThemisRead.checkContainingPreservedColumns(familyMap); Assert.fail(); } catch (IOException e) { } }
@Test public void testCheckContainingPreservedColumnsForCommitToDifferentFamily() { useCommitFamily(CommitFamily.DIFFERNT_FAMILY); Map<byte[], NavigableSet<byte[]>> familyMap = new HashMap<byte[], NavigableSet<byte[]>>(); familyMap.put(FAMILY, new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR)); familyMap.get(FAMILY).add(QUALIFIER); familyMap.put(ANOTHER_FAMILY, null); try { ThemisRead.checkContainingPreservedColumns(familyMap); } catch (IOException e) { Assert.fail(); } Column putColumn = ColumnUtil.getPutColumn(new Column(FAMILY, QUALIFIER)); familyMap.put(putColumn.getFamily(), new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR)); familyMap.get(putColumn.getFamily()).add(QUALIFIER); try { ThemisRead.checkContainingPreservedColumns(familyMap); Assert.fail(); } catch (IOException e) { } }