Search in sources :

Example 1 with TableCellVal

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();
}
Also used : Expectations(org.jmock.Expectations) TableCell(com.palantir.atlasdb.api.TableCell) TableCellVal(com.palantir.atlasdb.api.TableCellVal) Test(org.junit.Test)

Example 2 with TableCellVal

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);
}
Also used : TableCell(com.palantir.atlasdb.api.TableCell) TableCellVal(com.palantir.atlasdb.api.TableCellVal)

Example 3 with TableCellVal

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);
}
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 4 with TableCellVal

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());
}
Also used : TransactionToken(com.palantir.atlasdb.api.TransactionToken) TableCellVal(com.palantir.atlasdb.api.TableCellVal) RangeToken(com.palantir.atlasdb.api.RangeToken) TableRange(com.palantir.atlasdb.api.TableRange) Test(org.junit.Test)

Example 5 with TableCellVal

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

Aggregations

TableCellVal (com.palantir.atlasdb.api.TableCellVal)12 TransactionToken (com.palantir.atlasdb.api.TransactionToken)7 Test (org.junit.Test)7 TableCell (com.palantir.atlasdb.api.TableCell)5 Cell (com.palantir.atlasdb.keyvalue.api.Cell)3 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 TableMetadata (com.palantir.atlasdb.table.description.TableMetadata)1