TieredCompactionStrategy extends CompactionStrategy { @Override public void gatherInformation(MajorCompactionRequest request) throws IOException { for (TieredCompactorSupplier compactor : compactors) { CompactionStrategy strategy = compactor.get(request.getTableProperties()); strategy.gatherInformation(request); } } TieredCompactionStrategy(); Collection<TieredCompactorSupplier> getCompactors(); @Override void init(Map<String, String> config); @Override void gatherInformation(MajorCompactionRequest request); @Override boolean shouldCompact(MajorCompactionRequest request); @Override CompactionPlan getCompactionPlan(MajorCompactionRequest request); static final String TIERED_PREFIX; static final String TIERED_CLASS; static final String TIERED_OPTS; }
@Test public void gatherInformationAcrossTiers() throws IOException { CompactionStrategy c1 = EasyMock.createMock(CompactionStrategy.class); CompactionStrategy c2 = EasyMock.createMock(CompactionStrategy.class); c1.gatherInformation(EasyMock.anyObject()); EasyMock.expectLastCall(); c2.gatherInformation(EasyMock.anyObject()); EasyMock.expectLastCall(); EasyMock.replay(c1, c2); TieredCompactionStrategy strategy = newStrategy(c1, c2); CompactionRequestBuilder builder = new CompactionRequestBuilder(); MajorCompactionRequest request = builder.build(); strategy.gatherInformation(request); EasyMock.verify(c1, c2); }