Search in sources :

Example 1 with Pair

use of com.palantir.util.Pair in project atlasdb by palantir.

the class AbstractSweepTaskRunnerTest method runSweep.

@SuppressWarnings("unchecked")
private Pair<List<List<Cell>>, SweepResults> runSweep(CellsSweeper cellsSweeper, SweepTaskRunner spiedSweepRunner, int maxCellTsPairsToExamine, int candidateBatchSize, int deleteBatchSize) {
    sweepTimestamp.set(Long.MAX_VALUE);
    List<List<Cell>> sweptCells = Lists.newArrayList();
    doAnswer((invocationOnMock) -> {
        Object[] arguments = invocationOnMock.getArguments();
        Collection<Cell> sentinelsToAdd = (Collection<Cell>) arguments[2];
        sweptCells.add(new ArrayList(sentinelsToAdd));
        return null;
    }).when(cellsSweeper).sweepCells(eq(TABLE_NAME), any(), any());
    SweepResults sweepResults = spiedSweepRunner.run(TABLE_NAME, ImmutableSweepBatchConfig.builder().maxCellTsPairsToExamine(maxCellTsPairsToExamine).candidateBatchSize(candidateBatchSize).deleteBatchSize(deleteBatchSize).build(), PtBytes.EMPTY_BYTE_ARRAY);
    return new Pair(sweptCells, sweepResults);
}
Also used : SweepResults(com.palantir.atlasdb.keyvalue.api.SweepResults) ImmutableSweepResults(com.palantir.atlasdb.keyvalue.api.ImmutableSweepResults) ArrayList(java.util.ArrayList) Collection(java.util.Collection) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) Cell(com.palantir.atlasdb.keyvalue.api.Cell) Pair(com.palantir.util.Pair)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 Cell (com.palantir.atlasdb.keyvalue.api.Cell)1 ImmutableSweepResults (com.palantir.atlasdb.keyvalue.api.ImmutableSweepResults)1 SweepResults (com.palantir.atlasdb.keyvalue.api.SweepResults)1 Pair (com.palantir.util.Pair)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1