use of com.palantir.atlasdb.api.TransactionToken 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.TransactionToken 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);
}
use of com.palantir.atlasdb.api.TransactionToken in project atlasdb by palantir.
the class TransactionRemotingTest method testRaw2.
@Test
public void testRaw2() throws JsonProcessingException {
String tableName = "ns.my_table";
service.createTable(tableName);
TransactionToken txId = service.startTransaction();
Cell rawCell = Cell.create(new byte[] { 0, 1, 2 }, new byte[] { 3, 4, 5 });
TableCellVal putArg = new TableCellVal(tableName, ImmutableMap.of(rawCell, new byte[] { 40, 0 }));
service.put(txId, putArg);
TableCell tableCell = new TableCell(tableName, ImmutableList.of(rawCell));
service.getCells(txId, tableCell);
}
use of com.palantir.atlasdb.api.TransactionToken in project atlasdb by palantir.
the class AtlasDbServiceImpl method startTransaction.
@Override
public TransactionToken startTransaction() {
String id = UUID.randomUUID().toString();
TransactionToken token = new TransactionToken(id);
RawTransaction tx = txManager.setupRunTaskWithConditionThrowOnConflict(PreCommitConditions.NO_OP);
transactions.put(token, tx);
return token;
}
use of com.palantir.atlasdb.api.TransactionToken in project atlasdb by palantir.
the class TransactionRemotingTest method testGetRangeNone.
@Test
public void testGetRangeNone() {
setupFooStatus1("sweep.priority");
TransactionToken token = TransactionToken.autoCommit();
RangeToken range = service.getRange(token, new TableRange("sweep.priority", new byte[1], new byte[2], ImmutableList.<byte[]>of(), 10));
Assert.assertTrue(Iterables.isEmpty(range.getResults().getResults()));
Assert.assertNull(range.getNextRange());
}
Aggregations