@Test public void testGet() throws Exception{ byte[] row = "row".getBytes(); byte[] fam = "fam".getBytes(); byte[] qf1 = "qf1".getBytes(); long ts = System.currentTimeMillis(); int maxVersions = 2; long lockid = 5; RowLock rowLock = new RowLock(lockid); Get get = new Get(row, rowLock); get.addColumn(fam, qf1); get.setTimeRange(ts, ts+1); get.setMaxVersions(maxVersions); byte[] sb = Writables.getBytes(get); Get desGet = (Get)Writables.getWritable(sb, new Get()); assertTrue(Bytes.equals(get.getRow(), desGet.getRow())); Set<byte[]> set = null; Set<byte[]> desSet = null; for(Map.Entry<byte[], NavigableSet<byte[]>> entry : get.getFamilyMap().entrySet()){ assertTrue(desGet.getFamilyMap().containsKey(entry.getKey())); set = entry.getValue(); desSet = desGet.getFamilyMap().get(entry.getKey()); for(byte [] qualifier : set){ assertTrue(desSet.contains(qualifier)); } } assertEquals(get.getLockId(), desGet.getLockId()); assertEquals(get.getMaxVersions(), desGet.getMaxVersions()); TimeRange tr = get.getTimeRange(); TimeRange desTr = desGet.getTimeRange(); assertEquals(tr.getMax(), desTr.getMax()); assertEquals(tr.getMin(), desTr.getMin()); }
/** * @deprecated */ public RowLock lockRow(String tableName, byte[] paramArrayOfByte) throws IOException { checkOpen(); try { HTableInterface table = getTable(tableName); return table.lockRow(paramArrayOfByte); } catch (IOException e) { handleException(e); } return null; }
/** * @deprecated */ public void unlockRow(String tableName, RowLock paramRowLock) throws IOException { checkOpen(); try { HTableInterface table = getTable(tableName); table.unlockRow(paramRowLock); } catch (IOException e) { handleException(e); } }
@Test public void testGet() throws Exception{ byte[] row = "row".getBytes(); byte[] fam = "fam".getBytes(); byte[] qf1 = "qf1".getBytes(); long ts = System.currentTimeMillis(); int maxVersions = 2; long lockid = 5; RowLock rowLock = new RowLock(lockid); Get get = new Get(row, rowLock); get.addColumn(fam, qf1); get.setTimeRange(ts, ts+1); get.setMaxVersions(maxVersions); ClientProtos.Get getProto = ProtobufUtil.toGet(get); Get desGet = ProtobufUtil.toGet(getProto); assertTrue(Bytes.equals(get.getRow(), desGet.getRow())); Set<byte[]> set = null; Set<byte[]> desSet = null; for(Map.Entry<byte[], NavigableSet<byte[]>> entry : get.getFamilyMap().entrySet()){ assertTrue(desGet.getFamilyMap().containsKey(entry.getKey())); set = entry.getValue(); desSet = desGet.getFamilyMap().get(entry.getKey()); for(byte [] qualifier : set){ assertTrue(desSet.contains(qualifier)); } } assertEquals(get.getLockId(), desGet.getLockId()); assertEquals(get.getMaxVersions(), desGet.getMaxVersions()); TimeRange tr = get.getTimeRange(); TimeRange desTr = desGet.getTimeRange(); assertEquals(tr.getMax(), desTr.getMax()); assertEquals(tr.getMin(), desTr.getMin()); }
/** * @deprecated {@link RowLock} and associated operations are deprecated */ public RowLock lockRow(byte[] row) throws IOException { throw new IOException("lockRow not implemented"); }
/** * @deprecated {@link RowLock} and associated operations are deprecated */ public void unlockRow(RowLock rl) throws IOException { throw new IOException("unlockRow not implemented"); }
/** * @deprecated {@link RowLock} and associated operations are deprecated. */ public RowLock lockRow(byte[] row) throws IOException { throw new RuntimeException( "row locking is not allowed within the coprocessor environment"); }
/** * @deprecated {@link RowLock} and associated operations are deprecated. */ public void unlockRow(RowLock rl) throws IOException { throw new RuntimeException( "row locking is not allowed within the coprocessor environment"); }
@Override public RowLock lockRow(byte[] row) throws IOException { return null; }
@Override public void unlockRow(RowLock rl) throws IOException { }
/** @deprecated */ public RowLock lockRow(String tableName, byte[] paramArrayOfByte) throws IOException { return poolableHConnection.lockRow(tableName, paramArrayOfByte); }
/** @deprecated */ public void unlockRow(String tableName, RowLock paramRowLock) throws IOException { poolableHConnection.unlockRow(tableName, paramRowLock); }
/** @deprecated */ public RowLock lockRow(byte[] row) throws IOException { return this.delegate.lockRow(row); }
/** @deprecated */ public void unlockRow(RowLock rl) throws IOException { this.delegate.unlockRow(rl); }
/** @deprecated */ RowLock lockRow(String tableName, byte[] paramArrayOfByte) throws IOException;
/** @deprecated */ void unlockRow(String tableName, RowLock paramRowLock) throws IOException;
public RowLock lockRow(byte[] row) throws IOException { throw new IOException("lockRow not implemented"); }
public void unlockRow(RowLock rl) throws IOException { throw new IOException("unlockRow not implemented"); }
@Override public RowLock lockRow(byte[] row) throws IOException { return getTable().lockRow(row); }
@Override public void unlockRow(RowLock rl) throws IOException { getTable().unlockRow(rl); }