use of com.palantir.atlasdb.api.TableCellVal in project atlasdb by palantir.
the class AtlasConsoleServiceTest method testGetCells.
@Test
public void testGetCells() throws IOException {
final TableCell input = context.mock(TableCell.class);
final TableCellVal output = context.mock(TableCellVal.class);
context.checking(fromJson(input, TableCell.class));
context.checking(new Expectations() {
{
oneOf(delegate).getCells(token, input);
will(returnValue(output));
}
});
context.checking(toJson(output, TableCellVal.class));
assertEquals(service.getCells(token, QUERY), RESULT);
context.assertIsSatisfied();
}
use of com.palantir.atlasdb.api.TableCellVal in project atlasdb by palantir.
the class AtlasConsoleServiceImpl method getCells.
@Override
public String getCells(TransactionToken token, String data) throws IOException {
TableCell cells = fromJson(data, TableCell.class);
TableCellVal result = service.getCells(token, cells);
return toJson(result, TableCellVal.class);
}
use of com.palantir.atlasdb.api.TableCellVal 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.TableCellVal in project atlasdb by palantir.
the class TransactionRemotingTest method testAbort.
@Test
public void testAbort() {
TransactionToken txId = service.startTransaction();
service.put(txId, new TableCellVal("sweep.priority", getSweepPriorityTableContents("foo")));
service.abort(txId);
service.commit(txId);
txId = TransactionToken.autoCommit();
RangeToken range = service.getRange(txId, new TableRange("sweep.priority", new byte[0], new byte[0], ImmutableList.<byte[]>of(), 10));
Assert.assertTrue(Iterables.isEmpty(range.getResults().getResults()));
Assert.assertNull(range.getNextRange());
}
use of com.palantir.atlasdb.api.TableCellVal in project atlasdb by palantir.
the class TransactionRemotingTest method testRaw.
@Test
public void testRaw() throws JsonProcessingException {
String tableName = "ns.my_table";
service.createTable(tableName);
TransactionToken txId = service.startTransaction();
TableCellVal putArg = new TableCellVal(tableName, getSweepPriorityTableContents("foo"));
String str = mapper.writeValueAsString(putArg);
System.out.println(str);
service.put(txId, putArg);
}
Aggregations