use of com.palantir.atlasdb.api.TransactionToken in project atlasdb by palantir.
the class TransactionRemotingTest method testGetCellsSome.
@Test
public void testGetCellsSome() {
setupFooStatus1("sweep.priority");
TransactionToken txId = service.startTransaction();
Map<Cell, byte[]> contents = getSweepPriorityTableContents("foo");
TableCellVal goodCells = service.getCells(txId, new TableCell("sweep.priority", contents.keySet()));
Assert.assertEquals(contents.keySet(), goodCells.getResults().keySet());
Assert.assertArrayEquals(Iterables.getOnlyElement(contents.values()), Iterables.getOnlyElement(goodCells.getResults().values()));
service.commit(txId);
}
use of com.palantir.atlasdb.api.TransactionToken in project atlasdb by palantir.
the class TransactionRemotingTest method testGetRangeSome.
@Test
public void testGetRangeSome() {
setupFooStatus1("sweep.priority");
TransactionToken token = TransactionToken.autoCommit();
RangeToken range = service.getRange(token, new TableRange("sweep.priority", new byte[0], new byte[0], ImmutableList.<byte[]>of(), 10));
SweepPriorityRowResult result = SweepPriorityRowResult.of(Iterables.getOnlyElement(range.getResults().getResults()));
Assert.assertEquals(1L, result.getCellsExamined().longValue());
Assert.assertNull(range.getNextRange());
}
use of com.palantir.atlasdb.api.TransactionToken in project atlasdb by palantir.
the class TransactionRemotingTest method testGetRowsNone.
@Test
public void testGetRowsNone() {
setupFooStatus1("sweep.priority");
TransactionToken txId = TransactionToken.autoCommit();
TableRowResult badResults = service.getRows(txId, new TableRowSelection("sweep.priority", ImmutableList.of(new byte[1]), ColumnSelection.all()));
Assert.assertTrue(Iterables.isEmpty(badResults.getResults()));
}
use of com.palantir.atlasdb.api.TransactionToken in project atlasdb by palantir.
the class TransactionRemotingTest method testGetRowsSome.
@Test
public void testGetRowsSome() {
setupFooStatus1("sweep.priority");
TransactionToken txId = TransactionToken.autoCommit();
TableRowResult goodResults = service.getRows(txId, new TableRowSelection("sweep.priority", ImmutableList.of(SweepPriorityRow.of("foo").persistToBytes()), ColumnSelection.all()));
SweepPriorityRowResult result = SweepPriorityRowResult.of(Iterables.getOnlyElement(goodResults.getResults()));
Assert.assertEquals(1L, result.getCellsExamined().longValue());
}
use of com.palantir.atlasdb.api.TransactionToken in project atlasdb by palantir.
the class TransactionRemotingTest method testGetRangeMultipleBatchesWithColSelection.
@Test
public void testGetRangeMultipleBatchesWithColSelection() {
setupMultipleValues();
TransactionToken token = TransactionToken.autoCommit();
RangeToken range = service.getRange(token, new TableRange("sweep.priority", new byte[0], new byte[0], ImmutableList.<byte[]>of("e".getBytes()), 2));
Assert.assertEquals(2, Iterables.size(range.getResults().getResults()));
Assert.assertNotNull(range.getNextRange());
// get second range
RangeToken range2 = service.getRange(token, range.getNextRange());
Assert.assertEquals(1, Iterables.size(range2.getResults().getResults()));
Assert.assertNull(range2.getNextRange());
}
Aggregations