Search in sources :

Example 1 with SchemaApiTestTable

use of com.palantir.atlasdb.table.description.generated.SchemaApiTestTable in project atlasdb by palantir.

the class SchemaApiTestImpl method deleteFirstColumn.

@Override
protected void deleteFirstColumn(Transaction transaction, String rowKey) {
    SchemaApiTestTable table = tableFactory.getSchemaApiTestTable(transaction);
    table.deleteColumn1(SchemaApiTestRow.of(rowKey));
}
Also used : SchemaApiTestTable(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable)

Example 2 with SchemaApiTestTable

use of com.palantir.atlasdb.table.description.generated.SchemaApiTestTable in project atlasdb by palantir.

the class SchemaApiTestImpl method deleteWholeRow.

@Override
protected void deleteWholeRow(Transaction transaction, String rowKey) {
    SchemaApiTestTable table = tableFactory.getSchemaApiTestTable(transaction);
    table.delete(SchemaApiTestRow.of(rowKey));
}
Also used : SchemaApiTestTable(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable)

Example 3 with SchemaApiTestTable

use of com.palantir.atlasdb.table.description.generated.SchemaApiTestTable in project atlasdb by palantir.

the class SchemaApiTestImpl method getRangeSecondColumnOnlyFirstTwoResults.

@Override
protected Map<String, StringValue> getRangeSecondColumnOnlyFirstTwoResults(Transaction transaction, String startRowKey, String endRowKey) {
    SchemaApiTestTable table = tableFactory.getSchemaApiTestTable(transaction);
    ColumnSelection secondColSelection = SchemaApiTestTable.getColumnSelection(SchemaApiTestTable.SchemaApiTestNamedColumn.COLUMN2);
    RangeRequest rangeRequest = RangeRequest.builder().startRowInclusive(SchemaApiTestRow.of(startRowKey).persistToBytes()).endRowExclusive(SchemaApiTestRow.of(endRowKey).persistToBytes()).retainColumns(secondColSelection).batchHint(2).build();
    BatchingVisitableView<SchemaApiTestRowResult> rangeRequestResult = table.getRange(rangeRequest);
    return BatchingVisitables.take(rangeRequestResult, 2).stream().collect(Collectors.toMap(entry -> entry.getRowName().getComponent1(), SchemaApiTestTable.SchemaApiTestRowResult::getColumn2));
}
Also used : StringValue(com.palantir.atlasdb.table.description.test.StringValue) EncodingUtils(com.palantir.atlasdb.ptobject.EncodingUtils) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) HashComponentsTestTable(com.palantir.atlasdb.table.description.generated.HashComponentsTestTable) ApiTestTableFactory(com.palantir.atlasdb.table.description.generated.ApiTestTableFactory) Test(org.junit.Test) Hashing(com.google.common.hash.Hashing) Collectors(java.util.stream.Collectors) PtBytes(com.palantir.atlasdb.encoding.PtBytes) ColumnSelection(com.palantir.atlasdb.keyvalue.api.ColumnSelection) RangeRequest(com.palantir.atlasdb.keyvalue.api.RangeRequest) SchemaApiTestRow(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable.SchemaApiTestRow) List(java.util.List) Transaction(com.palantir.atlasdb.transaction.api.Transaction) Map(java.util.Map) SchemaApiTestRowResult(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable.SchemaApiTestRowResult) BatchingVisitableView(com.palantir.common.base.BatchingVisitableView) Optional(java.util.Optional) SchemaApiTestTable(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable) BatchingVisitables(com.palantir.common.base.BatchingVisitables) ColumnSelection(com.palantir.atlasdb.keyvalue.api.ColumnSelection) RangeRequest(com.palantir.atlasdb.keyvalue.api.RangeRequest) SchemaApiTestTable(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable) SchemaApiTestRowResult(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable.SchemaApiTestRowResult)

Example 4 with SchemaApiTestTable

use of com.palantir.atlasdb.table.description.generated.SchemaApiTestTable in project atlasdb by palantir.

the class SchemaApiTestImpl method getSingleRowFirstColumn.

@Override
protected Long getSingleRowFirstColumn(Transaction transaction, String rowKey) {
    SchemaApiTestTable table = tableFactory.getSchemaApiTestTable(transaction);
    ColumnSelection firstColSelection = SchemaApiTestTable.getColumnSelection(SchemaApiTestTable.SchemaApiTestNamedColumn.COLUMN1);
    Optional<SchemaApiTestRowResult> result = table.getRow(SchemaApiTestRow.of(rowKey), firstColSelection);
    return result.get().getColumn1();
}
Also used : ColumnSelection(com.palantir.atlasdb.keyvalue.api.ColumnSelection) SchemaApiTestTable(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable) SchemaApiTestRowResult(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable.SchemaApiTestRowResult)

Example 5 with SchemaApiTestTable

use of com.palantir.atlasdb.table.description.generated.SchemaApiTestTable in project atlasdb by palantir.

the class SchemaApiTestImpl method getRangeSecondColumn.

@Override
protected Map<String, StringValue> getRangeSecondColumn(Transaction transaction, String startRowKey, String endRowKey) {
    SchemaApiTestTable table = tableFactory.getSchemaApiTestTable(transaction);
    ColumnSelection secondColSelection = SchemaApiTestTable.getColumnSelection(SchemaApiTestTable.SchemaApiTestNamedColumn.COLUMN2);
    RangeRequest rangeRequest = RangeRequest.builder().startRowInclusive(SchemaApiTestRow.of(startRowKey).persistToBytes()).endRowExclusive(SchemaApiTestRow.of(endRowKey).persistToBytes()).retainColumns(secondColSelection).build();
    BatchingVisitableView<SchemaApiTestRowResult> rangeRequestResult = table.getRange(rangeRequest);
    return rangeRequestResult.immutableCopy().stream().collect(Collectors.toMap(entry -> entry.getRowName().getComponent1(), SchemaApiTestTable.SchemaApiTestRowResult::getColumn2));
}
Also used : StringValue(com.palantir.atlasdb.table.description.test.StringValue) EncodingUtils(com.palantir.atlasdb.ptobject.EncodingUtils) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) HashComponentsTestTable(com.palantir.atlasdb.table.description.generated.HashComponentsTestTable) ApiTestTableFactory(com.palantir.atlasdb.table.description.generated.ApiTestTableFactory) Test(org.junit.Test) Hashing(com.google.common.hash.Hashing) Collectors(java.util.stream.Collectors) PtBytes(com.palantir.atlasdb.encoding.PtBytes) ColumnSelection(com.palantir.atlasdb.keyvalue.api.ColumnSelection) RangeRequest(com.palantir.atlasdb.keyvalue.api.RangeRequest) SchemaApiTestRow(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable.SchemaApiTestRow) List(java.util.List) Transaction(com.palantir.atlasdb.transaction.api.Transaction) Map(java.util.Map) SchemaApiTestRowResult(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable.SchemaApiTestRowResult) BatchingVisitableView(com.palantir.common.base.BatchingVisitableView) Optional(java.util.Optional) SchemaApiTestTable(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable) BatchingVisitables(com.palantir.common.base.BatchingVisitables) ColumnSelection(com.palantir.atlasdb.keyvalue.api.ColumnSelection) RangeRequest(com.palantir.atlasdb.keyvalue.api.RangeRequest) SchemaApiTestTable(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable) SchemaApiTestRowResult(com.palantir.atlasdb.table.description.generated.SchemaApiTestTable.SchemaApiTestRowResult)

Aggregations

SchemaApiTestTable (com.palantir.atlasdb.table.description.generated.SchemaApiTestTable)7 ColumnSelection (com.palantir.atlasdb.keyvalue.api.ColumnSelection)4 SchemaApiTestRowResult (com.palantir.atlasdb.table.description.generated.SchemaApiTestTable.SchemaApiTestRowResult)4 Hashing (com.google.common.hash.Hashing)3 PtBytes (com.palantir.atlasdb.encoding.PtBytes)3 RangeRequest (com.palantir.atlasdb.keyvalue.api.RangeRequest)3 EncodingUtils (com.palantir.atlasdb.ptobject.EncodingUtils)3 ApiTestTableFactory (com.palantir.atlasdb.table.description.generated.ApiTestTableFactory)3 HashComponentsTestTable (com.palantir.atlasdb.table.description.generated.HashComponentsTestTable)3 SchemaApiTestRow (com.palantir.atlasdb.table.description.generated.SchemaApiTestTable.SchemaApiTestRow)3 StringValue (com.palantir.atlasdb.table.description.test.StringValue)3 Transaction (com.palantir.atlasdb.transaction.api.Transaction)3 BatchingVisitableView (com.palantir.common.base.BatchingVisitableView)3 BatchingVisitables (com.palantir.common.base.BatchingVisitables)3 List (java.util.List)3 Map (java.util.Map)3 Optional (java.util.Optional)3 Collectors (java.util.stream.Collectors)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 Test (org.junit.Test)3