@Override public Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> e, Increment increment) throws IOException { // If authorization is not enabled, we don't care about reserved tags if (!authorizationEnabled) { return null; } for (CellScanner cellScanner = increment.cellScanner(); cellScanner.advance();) { if (!checkForReservedVisibilityTagPresence(cellScanner.current())) { throw new FailedSanityCheckException("Increment contains cell with reserved type tag"); } } return null; }
@Test public void testIncrementIteration() throws IOException { Increment increment = new Increment(ROW); for (int i = 0; i < COUNT; i++) { byte [] bytes = Bytes.toBytes(i); increment.addColumn(bytes, bytes, i); } int index = 0; for (CellScanner cellScanner = increment.cellScanner(); cellScanner.advance();) { Cell cell = cellScanner.current(); int value = index; byte [] bytes = Bytes.toBytes(index++); KeyValue kv = (KeyValue)cell; assertTrue(Bytes.equals(CellUtil.cloneFamily(kv), bytes)); long a = Bytes.toLong(CellUtil.cloneValue(kv)); assertEquals(value, a); } assertEquals(COUNT, index); }
@Override public Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> e, Increment increment) throws IOException { // If authorization is not enabled, we don't care about reserved tags if (!authorizationEnabled) { return null; } for (CellScanner cellScanner = increment.cellScanner(); cellScanner.advance();) { if (!checkForReservedVisibilityTagPresence(cellScanner.current())) { throw new FailedSanityCheckException("Increment contains cell with reserved type tag"); } } return null; }
@Test public void testIncrementIteration() throws IOException { Increment increment = new Increment(ROW); for (int i = 0; i < COUNT; i++) { byte [] bytes = Bytes.toBytes(i); increment.addColumn(bytes, bytes, i); } int index = 0; for (CellScanner cellScanner = increment.cellScanner(); cellScanner.advance();) { Cell cell = cellScanner.current(); int value = index; byte [] bytes = Bytes.toBytes(index++); KeyValue kv = (KeyValue)cell; assertTrue(Bytes.equals(CellUtil.cloneFamily(kv), bytes)); long a = Bytes.toLong(CellUtil.cloneValue(kv)); assertEquals(value, a); } assertEquals(COUNT, index); }