@Test public void testRead() throws Exception { TypeLayer tl = new TypeLayer(new StringEncoder()); MockSnapshot ms = new MockSnapshot("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,20", "13,9:19,20", "13,9:20,20", "r3,cf3:cq3,28.195", "r4,cf4:cq4,true"); TypedSnapshot tts = tl.wrap(ms); Assert.assertEquals("v1", tts.get().row("r1").fam("cf1").qual("cq1").toString()); Assert.assertEquals("v1", tts.get().row("r1").fam("cf1").qual("cq1").toString("b")); Assert.assertEquals("13", tts.get().row("r2").fam("cf2").qual("8").toString()); Assert.assertEquals("13", tts.get().row("r2").fam("cf2").qual("8").toString("b")); Assert.assertEquals("28.195", tts.get().row("r3").fam("cf3").qual("cq3").toString()); Assert.assertEquals("28.195", tts.get().row("r3").fam("cf3").qual("cq3").toString("b")); Assert.assertEquals("true", tts.get().row("r4").fam("cf4").qual("cq4").toString()); Assert.assertEquals("true", tts.get().row("r4").fam("cf4").qual("cq4").toString("b")); Assert.assertEquals("13", tts.get().row("r2").fam("cf2").qual(8).toString()); Assert.assertEquals("13", tts.get().row("r2").fam("cf2").qual(8).toString("b")); Assert.assertEquals((Integer) 13, tts.get().row("r2").fam("cf2").qual(8).toInteger()); Assert.assertEquals(13, tts.get().row("r2").fam("cf2").qual(8).toInteger(14)); Assert.assertEquals((Long) 13l, tts.get().row("r2").fam("cf2").qual(8).toLong()); Assert.assertEquals(13l, tts.get().row("r2").fam("cf2").qual(8).toLong(14l)); Assert.assertEquals("13", new String(tts.get().row("r2").fam("cf2").qual(8).toBytes())); Assert.assertEquals("13", new String(tts.get().row("r2").fam("cf2").qual(8).toBytes("14".getBytes()))); Assert.assertEquals("13", new String(tts.get().row("r2").col(new Column("cf2", "8")).toBytes())); Assert.assertEquals("13", new String(tts.get().row("r2").col(new Column("cf2", "8")).toBytes("14".getBytes()))); Assert.assertEquals("13", Bytes.of(tts.get().row("r2").col(new Column("cf2", "8")).toByteBuffer()).toString()); Assert.assertEquals("13", Bytes.of(tts.get().row("r2").col(new Column("cf2", "8")) .toByteBuffer(ByteBuffer.wrap("14".getBytes()))).toString()); Assert.assertNull(tts.get().row("r2").fam("cf3").qual(8).toInteger()); Assert.assertEquals(14, tts.get().row("r2").fam("cf3").qual(8).toInteger(14)); Assert.assertNull(tts.get().row("r2").fam("cf3").qual(8).toLong()); Assert.assertEquals(14l, tts.get().row("r2").fam("cf3").qual(8).toLong(14l)); Assert.assertNull(tts.get().row("r2").fam("cf3").qual(8).toString()); Assert.assertEquals("14", tts.get().row("r2").fam("cf3").qual(8).toString("14")); Assert.assertNull(tts.get().row("r2").fam("cf3").qual(8).toBytes()); Assert.assertEquals("14", new String(tts.get().row("r2").fam("cf3").qual(8).toBytes("14".getBytes()))); Assert.assertNull(tts.get().row("r2").col(new Column("cf3", "8")).toBytes()); Assert.assertEquals("14", new String(tts.get().row("r2").col(new Column("cf3", "8")).toBytes("14".getBytes()))); Assert.assertNull(tts.get().row("r2").col(new Column("cf3", "8")).toByteBuffer()); Assert.assertEquals("14", Bytes.of(tts.get().row("r2").col(new Column("cf3", "8")) .toByteBuffer(ByteBuffer.wrap("14".getBytes()))).toString()); Assert.assertEquals((Float) 28.195f, tts.get().row("r3").fam("cf3").qual("cq3").toFloat()); Assert.assertEquals(28.195f, tts.get().row("r3").fam("cf3").qual("cq3").toFloat(39.383f), 0.0); Assert.assertEquals((Double) 28.195d, tts.get().row("r3").fam("cf3").qual("cq3").toDouble()); Assert.assertEquals(28.195d, tts.get().row("r3").fam("cf3").qual("cq3").toDouble(39.383d), 0.0); Assert.assertEquals(true, tts.get().row("r4").fam("cf4").qual("cq4").toBoolean()); Assert.assertEquals(true, tts.get().row("r4").fam("cf4").qual("cq4").toBoolean()); Assert.assertEquals(true, tts.get().row("r4").fam("cf4").qual("cq4").toBoolean(false)); Assert.assertEquals(true, tts.get().row("r4").fam("cf4").qual("cq4").toBoolean(false)); Assert.assertEquals("20", tts.get().row(13).fam("9").qual("17").toString()); Assert.assertEquals("20", tts.get().row(13l).fam("9").qual("17").toString()); Assert.assertEquals("20", tts.get().row("13").fam("9").qual("17").toString()); Assert.assertEquals("20", tts.get().row("13".getBytes()).fam("9").qual("17").toString()); Assert.assertEquals("20", tts.get().row(ByteBuffer.wrap("13".getBytes())).fam("9").qual("17").toString()); Assert.assertEquals("20", tts.get().row("13").fam(9).qual("17").toString()); Assert.assertEquals("20", tts.get().row("13").fam(9l).qual("17").toString()); Assert.assertEquals("20", tts.get().row("13").fam("9").qual("17").toString()); Assert.assertEquals("20", tts.get().row("13").fam("9".getBytes()).qual("17").toString()); Assert.assertEquals("20", tts.get().row("13").fam(ByteBuffer.wrap("9".getBytes())).qual("17").toString()); Assert.assertEquals("20", tts.get().row("13").fam("9").qual("17").toString()); Assert.assertEquals("20", tts.get().row("13").fam("9").qual(17l).toString()); Assert.assertEquals("20", tts.get().row("13").fam("9").qual(17).toString()); Assert.assertEquals("20", tts.get().row("13").fam("9").qual("17".getBytes()).toString()); Assert.assertEquals("20", tts.get().row("13").fam("9").qual(ByteBuffer.wrap("17".getBytes())).toString()); ms.close(); tts.close(); }
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);  }