Search in sources :

Example 6 with TableCell

use of com.palantir.atlasdb.api.TableCell 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);
}
Also used : TableCell(com.palantir.atlasdb.api.TableCell) TransactionToken(com.palantir.atlasdb.api.TransactionToken) TableCellVal(com.palantir.atlasdb.api.TableCellVal) Cell(com.palantir.atlasdb.keyvalue.api.Cell) TableCell(com.palantir.atlasdb.api.TableCell) Test(org.junit.Test)

Example 7 with TableCell

use of com.palantir.atlasdb.api.TableCell 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);
}
Also used : TableCell(com.palantir.atlasdb.api.TableCell) TransactionToken(com.palantir.atlasdb.api.TransactionToken) TableCellVal(com.palantir.atlasdb.api.TableCellVal) Cell(com.palantir.atlasdb.keyvalue.api.Cell) TableCell(com.palantir.atlasdb.api.TableCell) Test(org.junit.Test)

Example 8 with TableCell

use of com.palantir.atlasdb.api.TableCell in project atlasdb by palantir.

the class AtlasConsoleServiceImpl method delete.

@Override
public void delete(TransactionToken token, String data) throws IOException {
    TableCell cells = fromJson(data, TableCell.class);
    service.delete(token, cells);
}
Also used : TableCell(com.palantir.atlasdb.api.TableCell)

Example 9 with TableCell

use of com.palantir.atlasdb.api.TableCell in project atlasdb by palantir.

the class TransactionRemotingTest method testGetCellsNone.

@Test
public void testGetCellsNone() {
    setupFooStatus1("sweep.priority");
    TransactionToken txId = service.startTransaction();
    TableCellVal badCells = service.getCells(txId, new TableCell("sweep.priority", ImmutableList.of(Cell.create(new byte[1], SweepPriorityTable.SweepPriorityNamedColumn.CELLS_EXAMINED.getShortName()))));
    Assert.assertTrue(badCells.getResults().isEmpty());
}
Also used : TableCell(com.palantir.atlasdb.api.TableCell) TransactionToken(com.palantir.atlasdb.api.TransactionToken) TableCellVal(com.palantir.atlasdb.api.TableCellVal) Test(org.junit.Test)

Example 10 with TableCell

use of com.palantir.atlasdb.api.TableCell in project atlasdb by palantir.

the class TransactionRemotingTest method testDelete.

@Test
public void testDelete() {
    setupFooStatus1("sweep.priority");
    Map<Cell, byte[]> contents = getSweepPriorityTableContents("foo");
    TransactionToken token = TransactionToken.autoCommit();
    service.delete(token, new TableCell("sweep.priority", contents.keySet()));
    RangeToken range = service.getRange(token, 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());
}
Also used : TableCell(com.palantir.atlasdb.api.TableCell) TransactionToken(com.palantir.atlasdb.api.TransactionToken) RangeToken(com.palantir.atlasdb.api.RangeToken) TableRange(com.palantir.atlasdb.api.TableRange) Cell(com.palantir.atlasdb.keyvalue.api.Cell) TableCell(com.palantir.atlasdb.api.TableCell) Test(org.junit.Test)

Aggregations

TableCell (com.palantir.atlasdb.api.TableCell)10 Test (org.junit.Test)6 TableCellVal (com.palantir.atlasdb.api.TableCellVal)5 Cell (com.palantir.atlasdb.keyvalue.api.Cell)5 TransactionToken (com.palantir.atlasdb.api.TransactionToken)4 TableMetadata (com.palantir.atlasdb.table.description.TableMetadata)2 Expectations (org.jmock.Expectations)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 RangeToken (com.palantir.atlasdb.api.RangeToken)1 TableRange (com.palantir.atlasdb.api.TableRange)1