@Test public void testWrite() throws Exception { TypeLayer tl = new TypeLayer(new StringEncoder()); MockTransactionBase tt = new MockTransactionBase("r1,cf1:cq1,v1", "r1,cf1:cq2,v2", "r1,cf1:cq3,9", "r2,cf2:7,12", "r2,cf2:8,13", "13,9:17,20", "13,9:18,30", "13,9:19,40", "13,9:20,50"); TypedTransactionBase ttx = tl.wrap(tt); Assert.assertEquals(20, ttx.mutate().row("13").fam("9").qual("17").increment(1)); Assert.assertEquals(30, ttx.mutate().row("13").fam("9").qual(18).increment(2)); Assert.assertEquals(40, ttx.mutate().row("13").fam("9").qual(19l).increment(3)); Assert.assertEquals(50, ttx.mutate().row("13").fam("9").qual("20".getBytes()).increment(4)); Assert.assertEquals(0, ttx.mutate().row("13").fam("9").qual(Bytes.of("21")).increment(5)); Assert.assertEquals(0, ttx.mutate().row("13").col(new Column("9", "22")).increment(6)); Assert.assertEquals(0, ttx.mutate().row("13").fam("9").qual(ByteBuffer.wrap("23".getBytes())).increment(7)); Assert.assertEquals(MockTransactionBase.toRCVM("13,9:17,21", "13,9:18,32", "13,9:19,43", "13,9:20,54", "13,9:21,5", "13,9:22,6", "13,9:23,7"), tt.setData); tt.setData.clear(); Assert.assertEquals(20l, ttx.mutate().row("13").fam("9").qual("17").increment(1l)); Assert.assertEquals(30l, ttx.mutate().row("13").fam("9").qual(18).increment(2l)); Assert.assertEquals(40l, ttx.mutate().row("13").fam("9").qual(19l).increment(3l)); Assert.assertEquals(50l, ttx.mutate().row("13").fam("9").qual("20".getBytes()).increment(4l)); Assert.assertEquals(0l, ttx.mutate().row("13").fam("9").qual(Bytes.of("21")).increment(5l)); Assert.assertEquals(0l, ttx.mutate().row("13").col(new Column("9", "22")).increment(6l)); Assert.assertEquals(0l, ttx.mutate().row("13").fam("9").qual(ByteBuffer.wrap("23".getBytes())).increment(7l)); Assert.assertEquals(MockTransactionBase.toRCVM("13,9:17,21", "13,9:18,32", "13,9:19,43", "13,9:20,54", "13,9:21,5", "13,9:22,6", "13,9:23,7"), tt.setData); tt.setData.clear(); ttx.mutate().row("13").fam("9").qual("16").set(); ttx.mutate().row("13").fam("9").qual("17").set(3); ttx.mutate().row("13").fam("9").qual(18).set(4l); ttx.mutate().row("13").fam("9").qual(19l).set("5"); ttx.mutate().row("13").fam("9").qual("20".getBytes()).set("6".getBytes()); ttx.mutate().row("13").col(new Column("9", "21")).set("7".getBytes()); ttx.mutate().row("13").fam("9").qual(ByteBuffer.wrap("22".getBytes())) .set(ByteBuffer.wrap("8".getBytes())); ttx.mutate().row("13").fam("9").qual("23").set(2.54f); ttx.mutate().row("13").fam("9").qual("24").set(-6.135d); ttx.mutate().row("13").fam("9").qual("25").set(false); Assert.assertEquals( MockTransactionBase.toRCVM("13,9:16,", "13,9:17,3", "13,9:18,4", "13,9:19,5", "13,9:20,6", "13,9:21,7", "13,9:22,8", "13,9:23,2.54", "13,9:24,-6.135", "13,9:25,false"), tt.setData); tt.setData.clear(); ttx.mutate().row("13").fam("9").qual("17").delete(); ttx.mutate().row("13").fam("9").qual(18).delete(); ttx.mutate().row("13").fam("9").qual(19l).delete(); ttx.mutate().row("13").fam("9").qual("20".getBytes()).delete(); ttx.mutate().row("13").col(new Column("9", "21")).delete(); ttx.mutate().row("13").fam("9").qual(ByteBuffer.wrap("22".getBytes())).delete(); Assert.assertEquals( MockTransactionBase.toRCM("13,9:17", "13,9:18", "13,9:19", "13,9:20", "13,9:21", "13,9:22"), tt.deletes); tt.deletes.clear(); Assert.assertEquals(0, tt.setData.size()); Assert.assertEquals(0, tt.weakNotifications.size()); ttx.mutate().row("13").fam("9").qual("17").weaklyNotify(); ttx.mutate().row("13").fam("9").qual(18).weaklyNotify(); ttx.mutate().row("13").fam("9").qual(19l).weaklyNotify(); ttx.mutate().row("13").fam("9").qual("20".getBytes()).weaklyNotify(); ttx.mutate().row("13").col(new Column("9", "21")).weaklyNotify(); ttx.mutate().row("13").fam("9").qual(ByteBuffer.wrap("22".getBytes())).weaklyNotify(); Assert.assertEquals( MockTransactionBase.toRCM("13,9:17", "13,9:18", "13,9:19", "13,9:20", "13,9:21", "13,9:22"), tt.weakNotifications); tt.weakNotifications.clear(); Assert.assertEquals(0, tt.setData.size()); Assert.assertEquals(0, tt.deletes.size()); }
public TypedSnapshot wrap(Snapshot snap) { return new TypedSnapshot(snap, encoder, this); }
TypeLayer { public TypedSnapshot wrap(Snapshot snap) { return new TypedSnapshot(snap, encoder, this); } }
TypeLayer { public TypedSnapshot wrap(Snapshot snap) { return new TypedSnapshot(snap, encoder, this); } TypeLayer(Encoder encoder); }
TypeLayer { public TypedSnapshot wrap(Snapshot snap) { return new TypedSnapshot(snap, encoder, this); } TypeLayer(Encoder encoder); CFB bc(); TypedSnapshot wrap(Snapshot snap); TypedTransactionBase wrap(TransactionBase tx); TypedTransaction wrap(Transaction tx); }
TypeLayer { public TypedSnapshot wrap(Snapshot snap) { return new TypedSnapshot(snap, encoder, this); } TypeLayer(Encoder encoder); CFB bc(); TypedSnapshot wrap(Snapshot snap); TypedTransactionBase wrap(TransactionBase tx); TypedTransaction wrap(Transaction tx);  }