use of gnu.trove.list.array.TLongArrayList in project atlasdb by palantir.
the class SweepableCellFilterTest method conservative_getTimestampsToSweep_twoEntriesBelowSweepTimestamp_returnsLowerOne.
@Test
public void conservative_getTimestampsToSweep_twoEntriesBelowSweepTimestamp_returnsLowerOne() {
long sweepTimestampHigherThanCommitTimestamp = HIGH_COMMIT_TS + 1;
List<CandidateCellForSweeping> candidates = twoCommittedTimestampsForSingleCell();
SweepableCellFilter filter = new SweepableCellFilter(mockTransactionService, Sweeper.CONSERVATIVE, sweepTimestampHigherThanCommitTimestamp);
List<CellToSweep> cells = filter.getCellsToSweep(candidates).cells();
assertThat(cells.size()).isEqualTo(1);
assertThat(Iterables.getOnlyElement(cells).sortedTimestamps()).isEqualTo(new TLongArrayList(new long[] { LOW_START_TS }));
}
use of gnu.trove.list.array.TLongArrayList in project atlasdb by palantir.
the class SweepableCellFilterTest method getTimestampsToSweep_onlyTransactionUncommitted_returnsIt.
@Test
public void getTimestampsToSweep_onlyTransactionUncommitted_returnsIt() {
List<CandidateCellForSweeping> candidate = ImmutableList.of(ImmutableCandidateCellForSweeping.builder().cell(SINGLE_CELL).sortedTimestamps(ImmutableList.of(LOW_START_TS)).isLatestValueEmpty(false).build());
when(mockTransactionService.get(anyCollection())).thenReturn(ImmutableMap.of(LOW_START_TS, TransactionConstants.FAILED_COMMIT_TS));
SweepableCellFilter filter = new SweepableCellFilter(mockTransactionService, Sweeper.CONSERVATIVE, HIGH_START_TS);
List<CellToSweep> cells = filter.getCellsToSweep(candidate).cells();
assertThat(cells.size()).isEqualTo(1);
assertThat(Iterables.getOnlyElement(cells).sortedTimestamps()).isEqualTo(new TLongArrayList(new long[] { LOW_START_TS }));
}
use of gnu.trove.list.array.TLongArrayList in project mixcr by milaboratory.
the class RandomAccessVDJCAReaderTest method test1.
@Test
public void test1() throws Exception {
RunMiXCR.RunMiXCRAnalysis params = new RunMiXCR.RunMiXCRAnalysis(RunMiXCR.class.getResource("/sequences/test_R1.fastq").getFile(), RunMiXCR.class.getResource("/sequences/test_R2.fastq").getFile());
RunMiXCR.AlignResult align = RunMiXCR.align(params);
File file = TempFileManager.getTempFile();
try (VDJCAlignmentsWriter writer = new VDJCAlignmentsWriter(file)) {
writer.header(align.aligner);
for (VDJCAlignments alignment : align.alignments) writer.write(alignment);
}
TLongArrayList index = new TLongArrayList();
try (VDJCAlignmentsReader reader = new VDJCAlignmentsReader(file)) {
reader.setIndexer(index);
int i = 0;
VDJCAlignments alignments;
while ((alignments = reader.take()) != null) Assert.assertEquals(align.alignments.get(i++), alignments);
}
try (RandomAccessVDJCAReader reader = new RandomAccessVDJCAReader(file, index.toArray())) {
Assert.assertEquals(align.parameters.alignerParameters, reader.getParameters());
for (int i = 0; i < 1000; i++) {
int ind = ThreadLocalRandom.current().nextInt(align.alignments.size());
VDJCAlignments alignment = reader.get(ind);
Assert.assertEquals(alignment, align.alignments.get(ind));
}
}
}
Aggregations