-
-
Save ifesdjeen/4caf84423fa321ceca79d9b8c041fe0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CompactionIteratorTest | |
{ | |
@Test | |
public void transformTest() | |
{ | |
UnfilteredRowsGenerator generator = new UnfilteredRowsGenerator(metadata.comparator, false); | |
List<List<Unfiltered>> inputLists = parse(new String[] {"10[100] 11[100] 12[100]"}, generator); | |
List<List<Unfiltered>> tombstoneLists = parse(new String[] {}, generator); | |
List<Iterable<UnfilteredRowIterator>> content = ImmutableList.copyOf(Iterables.transform(inputLists, list -> ImmutableList.of(listToIterator(list, kk)))); | |
Map<DecoratedKey, Iterable<UnfilteredRowIterator>> transformedSources = new TreeMap<>(); | |
transformedSources.put(kk, Iterables.transform(tombstoneLists, list -> listToIterator(list, kk))); | |
try (CompactionController controller = new Controller(Keyspace.openAndGetStore(metadata), transformedSources, GC_BEFORE); | |
CompactionIterator iter = new CompactionIterator(OperationType.COMPACTION, | |
Lists.transform(content, x -> new Scanner(x)), | |
controller, NOW, null)) | |
{ | |
assertTrue(iter.hasNext()); | |
UnfilteredRowIterator rows = iter.next(); | |
assertTrue(rows.hasNext()); | |
assertNotNull(rows.next()); | |
iter.stop(); | |
try | |
{ | |
// Will call Transformation#applyToRow | |
rows.hasNext(); | |
fail("Should have thrown CompactionInterruptedException"); | |
} | |
catch (CompactionInterruptedException e) | |
{ | |
// ignore | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment