@Test public void testCompactionContextForceSelect() throws Exception { Configuration conf = HBaseConfiguration.create(); int targetCount = 2; conf.setInt(StripeStoreConfig.INITIAL_STRIPE_COUNT_KEY, targetCount); conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 2); conf.set(StoreEngine.STORE_ENGINE_CLASS_KEY, TestStoreEngine.class.getName()); TestStoreEngine se = createEngine(conf); StripeCompactor mockCompactor = mock(StripeCompactor.class); se.setCompactorOverride(mockCompactor); when(mockCompactor.compact(any(CompactionRequest.class), anyInt(), anyLong(), any(byte[].class), any(byte[].class), any(byte[].class), any(byte[].class))) .thenReturn(new ArrayList<Path>()); StoreFile sf = createFile(); ArrayList<StoreFile> compactUs = al(sf, createFile(), createFile()); se.getStoreFileManager().loadFiles(compactUs); CompactionContext compaction = se.createCompaction(); compaction.select(al(), false, false, false); assertEquals(3, compaction.getRequest().getFiles().size()); compactUs.remove(sf); CompactionRequest req = new CompactionRequest(compactUs); compaction.forceSelect(req); assertEquals(2, compaction.getRequest().getFiles().size()); assertFalse(compaction.getRequest().getFiles().contains(sf)); compaction.compact(); verify(mockCompactor, times(1)).compact(compaction.getRequest(), targetCount, 0L, StripeStoreFileManager.OPEN_KEY, StripeStoreFileManager.OPEN_KEY, null, null); }
@Override public CompactionContext createCompaction() { return new StripeCompaction(); }
StripeStoreEngine extends StoreEngine<StripeStoreFlusher,
  StripeCompactionPolicy, StripeCompactor, StripeStoreFileManager> { @Override public CompactionContext createCompaction() { return new StripeCompaction(); } }
StripeStoreEngine extends StoreEngine<StripeStoreFlusher,
  StripeCompactionPolicy, StripeCompactor, StripeStoreFileManager> { @Override public CompactionContext createCompaction() { return new StripeCompaction(); }  }
StripeStoreEngine extends StoreEngine<StripeStoreFlusher,
  StripeCompactionPolicy, StripeCompactor, StripeStoreFileManager> { @Override public CompactionContext createCompaction() { return new StripeCompaction(); }  @Override boolean needsCompaction(List<StoreFile> filesCompacting); @Override CompactionContext createCompaction(); }
StripeStoreEngine extends StoreEngine<StripeStoreFlusher,
  StripeCompactionPolicy, StripeCompactor, StripeStoreFileManager> { @Override public CompactionContext createCompaction() { return new StripeCompaction(); }  @Override boolean needsCompaction(List<StoreFile> filesCompacting); @Override CompactionContext createCompaction();  }