public TIncrement deepCopy() { return new TIncrement(this); }
public static TIncrement incrementFromHBase(Increment in) throws IOException { TIncrement out = new TIncrement(); out.setRow(in.getRow());
@Test public void testIncrementWithReadOnly() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testIncrement"); ByteBuffer table = wrap(tableAname); List<TColumnIncrement> incrementColumns = new ArrayList<>(1); incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname))); TIncrement increment = new TIncrement(wrap(rowName), incrementColumns); boolean exceptionCaught = false; try { handler.increment(table, increment); } catch (TIOError e) { exceptionCaught = true; assertTrue(e.getCause() instanceof DoNotRetryIOException); assertEquals("Thrift Server is in Read-only mode.", e.getMessage()); } finally { assertTrue(exceptionCaught); } }
@Test public void testIncrement() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testIncrement"); ByteBuffer table = wrap(tableAname); List<TColumnValue> columnValues = new ArrayList<>(1); columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(Bytes.toBytes(1L)))); TPut put = new TPut(wrap(rowName), columnValues); put.setColumnValues(columnValues); handler.put(table, put); List<TColumnIncrement> incrementColumns = new ArrayList<>(1); incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname))); TIncrement increment = new TIncrement(wrap(rowName), incrementColumns); handler.increment(table, increment); TGet get = new TGet(wrap(rowName)); TResult result = handler.get(table, get); assertArrayEquals(rowName, result.getRow()); assertEquals(1, result.getColumnValuesSize()); TColumnValue columnValue = result.getColumnValues().get(0); assertArrayEquals(Bytes.toBytes(2L), columnValue.getValue()); }
@Test public void testIncrementWithTagsWithNotMatchLabels() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testIncrementWithTagsWithNotMatchLabels"); ByteBuffer table = wrap(tableAname); List<TColumnValue> columnValues = new ArrayList<>(1); columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(Bytes.toBytes(1L)))); TPut put = new TPut(wrap(rowName), columnValues); put.setColumnValues(columnValues); put.setCellVisibility(new TCellVisibility().setExpression(PRIVATE)); handler.put(table, put); List<TColumnIncrement> incrementColumns = new ArrayList<>(1); incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname))); TIncrement increment = new TIncrement(wrap(rowName), incrementColumns); increment.setCellVisibility(new TCellVisibility().setExpression(SECRET)); handler.increment(table, increment); TGet get = new TGet(wrap(rowName)); TAuthorization tauth = new TAuthorization(); List<String> labels = new ArrayList<>(1); labels.add(PUBLIC); tauth.setLabels(labels); get.setAuthorizations(tauth); TResult result = handler.get(table, get); assertNull(result.getRow()); }
public TIncrement deepCopy() { return new TIncrement(this); }
public TIncrement deepCopy() { return new TIncrement(this); }
@Test public void testIncrementWithTags() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testIncrementWithTags"); ByteBuffer table = wrap(tableAname); List<TColumnValue> columnValues = new ArrayList<>(1); columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(Bytes.toBytes(1L)))); TPut put = new TPut(wrap(rowName), columnValues); put.setColumnValues(columnValues); put.setCellVisibility(new TCellVisibility().setExpression(PRIVATE)); handler.put(table, put); List<TColumnIncrement> incrementColumns = new ArrayList<>(1); incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname))); TIncrement increment = new TIncrement(wrap(rowName), incrementColumns); increment.setCellVisibility(new TCellVisibility().setExpression(SECRET)); handler.increment(table, increment); TGet get = new TGet(wrap(rowName)); TAuthorization tauth = new TAuthorization(); List<String> labels = new ArrayList<>(1); labels.add(SECRET); tauth.setLabels(labels); get.setAuthorizations(tauth); TResult result = handler.get(table, get); assertArrayEquals(rowName, result.getRow()); assertEquals(1, result.getColumnValuesSize()); TColumnValue columnValue = result.getColumnValues().get(0); assertArrayEquals(Bytes.toBytes(2L), columnValue.getValue()); }
TIncrement tIncrement = new TIncrement(wrap(rowName), incrementColumns); tIncrement.setAttributes(attributes); Increment increment = incrementFromThrift(tIncrement);
assertEquals(Durability.FSYNC_WAL, put.getDurability()); TIncrement tIncrement = new TIncrement(wrap(rowName), incrementColumns);
/** * Performs a deep copy on <i>other</i>. */ public increment_args(increment_args other) { if (other.isSetTable()) { this.table = org.apache.thrift.TBaseHelper.copyBinary(other.table); } if (other.isSetIncrement()) { this.increment = new TIncrement(other.increment); } }
/** * Performs a deep copy on <i>other</i>. */ public increment_args(increment_args other) { if (other.isSetTable()) { this.table = org.apache.thrift.TBaseHelper.copyBinary(other.table); } if (other.isSetIncrement()) { this.increment = new TIncrement(other.increment); } }
case 2: // INCREMENT if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.increment = new TIncrement(); struct.increment.read(iprot); struct.setIncrementIsSet(true);
case 2: // INCREMENT if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.increment = new TIncrement(); struct.increment.read(iprot); struct.setIncrementIsSet(true);
@Override public void read(org.apache.thrift.protocol.TProtocol prot, increment_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.table = iprot.readBinary(); struct.setTableIsSet(true); struct.increment = new TIncrement(); struct.increment.read(iprot); struct.setIncrementIsSet(true); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, increment_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.table = iprot.readBinary(); struct.setTableIsSet(true); struct.increment = new TIncrement(); struct.increment.read(iprot); struct.setIncrementIsSet(true); } }
/** * Performs a deep copy on <i>other</i>. */ public increment_args(increment_args other) { if (other.isSetTable()) { this.table = org.apache.thrift.TBaseHelper.copyBinary(other.table); ; } if (other.isSetIncrement()) { this.increment = new TIncrement(other.increment); } }
/** * Performs a deep copy on <i>other</i>. */ public increment_args(increment_args other) { if (other.isSetTable()) { this.table = org.apache.thrift.TBaseHelper.copyBinary(other.table); } if (other.isSetTincrement()) { this.tincrement = new TIncrement(other.tincrement); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, increment_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.table = iprot.readBinary(); struct.setTableIsSet(true); struct.increment = new TIncrement(); struct.increment.read(iprot); struct.setIncrementIsSet(true); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, increment_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.table = iprot.readBinary(); struct.setTableIsSet(true); struct.tincrement = new TIncrement(); struct.tincrement.read(iprot); struct.setTincrementIsSet(true); } }