@Test public void testMultiRow() throws Exception { TypeLayer tl = new TypeLayer(new StringEncoder()); MockTransactionBase tt = new MockTransactionBase("11,cf1:cq1,1", "11,cf1:cq2,2", "12,cf1:cq1,3", "12,cf1:cq2,4", "13,cf1:cq1,5", "13,cf1:cq2,6"); TypedTransactionBase ttx = tl.wrap(tt); Bytes br1 = Bytes.of("11"); Bytes br2 = Bytes.of("12"); Bytes br3 = Bytes.of("13"); Column c1 = new Column("cf1", "cq1"); Column c2 = new Column("cf1", "cq2"); Map<Bytes, Map<Column, Value>> map1 = ttx.get().rows(Arrays.asList(br1, br2)).columns(c1).toBytesMap(); Assert.assertEquals(map1, ttx.get().rows(br1, br2).columns(c1).toBytesMap()); Assert.assertEquals("1", map1.get(br1).get(c1).toString()); Assert.assertEquals("1", map1.get(br1).get(c1).toString("5")); Assert.assertEquals((Long) (1l), map1.get(br1).get(c1).toLong()); Assert.assertEquals(1l, map1.get(br1).get(c1).toLong(5)); Assert.assertEquals((Integer) (1), map1.get(br1).get(c1).toInteger()); Assert.assertEquals(1, map1.get(br1).get(c1).toInteger(5)); Assert.assertEquals("5", map1.get(br3).get(c1).toString("5")); Assert.assertNull(map1.get(br3).get(c1).toString()); Assert.assertEquals(5l, map1.get(br3).get(c1).toLong(5l)); Assert.assertNull(map1.get(br3).get(c1).toLong()); Assert.assertEquals(5, map1.get(br1).get(c2).toInteger(5)); Assert.assertNull(map1.get(br1).get(c2).toInteger()); Assert.assertEquals(2, map1.size()); Assert.assertEquals(1, map1.get(br1).size()); Assert.assertEquals(1, map1.get(br2).size()); Assert.assertEquals("3", map1.get(br2).get(c1).toString()); Map<String, Map<Column, Value>> map2 = ttx.get().rowsString(Arrays.asList("11", "13")).columns(c1).toStringMap(); Assert.assertEquals(map2, ttx.get().rowsString("11", "13").columns(c1).toStringMap()); Assert.assertEquals(2, map2.size()); Assert.assertEquals(1, map2.get("11").size()); Assert.assertEquals(1, map2.get("13").size()); Assert.assertEquals((Long) (1l), map2.get("11").get(c1).toLong()); Assert.assertEquals(5l, map2.get("13").get(c1).toLong(6)); Map<Long, Map<Column, Value>> map3 = ttx.get().rowsLong(Arrays.asList(11l, 13l)).columns(c1).toLongMap(); Assert.assertEquals(map3, ttx.get().rowsLong(11l, 13l).columns(c1).toLongMap()); Assert.assertEquals(2, map3.size()); Assert.assertEquals(1, map3.get(11l).size()); Assert.assertEquals(1, map3.get(13l).size()); Assert.assertEquals((Long) (1l), map3.get(11l).get(c1).toLong()); Assert.assertEquals(5l, map3.get(13l).get(c1).toLong(6)); Map<Integer, Map<Column, Value>> map4 = ttx.get().rowsInteger(Arrays.asList(11, 13)).columns(c1).toIntegerMap(); Assert.assertEquals(map4, ttx.get().rowsInteger(11, 13).columns(c1).toIntegerMap()); Assert.assertEquals(2, map4.size()); Assert.assertEquals(1, map4.get(11).size()); Assert.assertEquals(1, map4.get(13).size()); Assert.assertEquals((Long) (1l), map4.get(11).get(c1).toLong()); Assert.assertEquals(5l, map4.get(13).get(c1).toLong(6)); Map<Integer, Map<Column, Value>> map5 = ttx.get() .rowsBytes(Arrays.asList("11".getBytes(), "13".getBytes())).columns(c1).toIntegerMap(); Assert.assertEquals(map5, ttx.get().rowsBytes("11".getBytes(), "13".getBytes()).columns(c1).toIntegerMap()); Assert.assertEquals(2, map5.size()); Assert.assertEquals(1, map5.get(11).size()); Assert.assertEquals(1, map5.get(13).size()); Assert.assertEquals((Long) (1l), map5.get(11).get(c1).toLong()); Assert.assertEquals(5l, map5.get(13).get(c1).toLong(6)); Map<Integer, Map<Column, Value>> map6 = ttx.get() .rowsByteBuffers( Arrays.asList(ByteBuffer.wrap("11".getBytes()), ByteBuffer.wrap("13".getBytes()))) .columns(c1).toIntegerMap(); Assert.assertEquals(map6, ttx.get() .rowsByteBuffers(ByteBuffer.wrap("11".getBytes()), ByteBuffer.wrap("13".getBytes())) .columns(c1).toIntegerMap()); Assert.assertEquals(2, map6.size()); Assert.assertEquals(1, map6.get(11).size()); Assert.assertEquals(1, map6.get(13).size()); Assert.assertEquals((Long) (1l), map6.get(11).get(c1).toLong()); Assert.assertEquals(5l, map6.get(13).get(c1).toLong(6)); }
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);  }