@Test public void testMissingType() { try { opts.remove(BasicCompactionStrategy.LARGE_FILE_COMPRESSION_TYPE); ttcs.init(opts); fail("IllegalArgumentException should have been thrown."); } catch (IllegalArgumentException iae) {} catch (Throwable t) { fail("IllegalArgumentException should have been thrown."); } }
@Override public void init(Map<String,String> options) { String limitVal = options.get(SIZE_LIMIT_OPT); if (limitVal != null) { filterSize = ConfigurationTypeHelper.getFixedMemoryAsBytes(limitVal); } String largeThresh = options.get(LARGE_FILE_COMPRESSION_THRESHOLD); String largeCompress = options.get(LARGE_FILE_COMPRESSION_TYPE); if (largeThresh != null && largeCompress != null) { this.largeThresh = ConfigurationTypeHelper.getFixedMemoryAsBytes(largeThresh); this.largeCompress = largeCompress; } else if (largeThresh != null ^ largeCompress != null) { throw new IllegalArgumentException("Must set both of " + Property.TABLE_COMPACTION_STRATEGY_PREFIX + " (" + LARGE_FILE_COMPRESSION_TYPE + " and " + LARGE_FILE_COMPRESSION_THRESHOLD + ") or neither for " + this.getClass().getName()); } }
BasicCompactionStrategy extends DefaultCompactionStrategy { @Override public void init(Map<String,String> options) { String limitVal = options.get(SIZE_LIMIT_OPT); if (limitVal != null) { filterSize = ConfigurationTypeHelper.getFixedMemoryAsBytes(limitVal); } String largeThresh = options.get(LARGE_FILE_COMPRESSION_THRESHOLD); String largeCompress = options.get(LARGE_FILE_COMPRESSION_TYPE); if (largeThresh != null && largeCompress != null) { this.largeThresh = ConfigurationTypeHelper.getFixedMemoryAsBytes(largeThresh); this.largeCompress = largeCompress; } else if (largeThresh != null ^ largeCompress != null) { throw new IllegalArgumentException("Must set both of " + Property.TABLE_COMPACTION_STRATEGY_PREFIX + " (" + LARGE_FILE_COMPRESSION_TYPE + " and " + LARGE_FILE_COMPRESSION_THRESHOLD + ") or neither for " + this.getClass().getName()); } } }
BasicCompactionStrategy extends DefaultCompactionStrategy { @Override public void init(Map<String,String> options) { String limitVal = options.get(SIZE_LIMIT_OPT); if (limitVal != null) { filterSize = ConfigurationTypeHelper.getFixedMemoryAsBytes(limitVal); } String largeThresh = options.get(LARGE_FILE_COMPRESSION_THRESHOLD); String largeCompress = options.get(LARGE_FILE_COMPRESSION_TYPE); if (largeThresh != null && largeCompress != null) { this.largeThresh = ConfigurationTypeHelper.getFixedMemoryAsBytes(largeThresh); this.largeCompress = largeCompress; } else if (largeThresh != null ^ largeCompress != null) { throw new IllegalArgumentException("Must set both of " + Property.TABLE_COMPACTION_STRATEGY_PREFIX + " (" + LARGE_FILE_COMPRESSION_TYPE + " and " + LARGE_FILE_COMPRESSION_THRESHOLD + ") or neither for " + this.getClass().getName()); } }  }
BasicCompactionStrategy extends DefaultCompactionStrategy { @Override public void init(Map<String,String> options) { String limitVal = options.get(SIZE_LIMIT_OPT); if (limitVal != null) { filterSize = ConfigurationTypeHelper.getFixedMemoryAsBytes(limitVal); } String largeThresh = options.get(LARGE_FILE_COMPRESSION_THRESHOLD); String largeCompress = options.get(LARGE_FILE_COMPRESSION_TYPE); if (largeThresh != null && largeCompress != null) { this.largeThresh = ConfigurationTypeHelper.getFixedMemoryAsBytes(largeThresh); this.largeCompress = largeCompress; } else if (largeThresh != null ^ largeCompress != null) { throw new IllegalArgumentException("Must set both of " + Property.TABLE_COMPACTION_STRATEGY_PREFIX + " (" + LARGE_FILE_COMPRESSION_TYPE + " and " + LARGE_FILE_COMPRESSION_THRESHOLD + ") or neither for " + this.getClass().getName()); } }  @Override void init(Map<String,String> options); @Override boolean shouldCompact(MajorCompactionRequest request); @Override void gatherInformation(MajorCompactionRequest request); @Override CompactionPlan getCompactionPlan(MajorCompactionRequest request); }
BasicCompactionStrategy extends DefaultCompactionStrategy { @Override public void init(Map<String,String> options) { String limitVal = options.get(SIZE_LIMIT_OPT); if (limitVal != null) { filterSize = ConfigurationTypeHelper.getFixedMemoryAsBytes(limitVal); } String largeThresh = options.get(LARGE_FILE_COMPRESSION_THRESHOLD); String largeCompress = options.get(LARGE_FILE_COMPRESSION_TYPE); if (largeThresh != null && largeCompress != null) { this.largeThresh = ConfigurationTypeHelper.getFixedMemoryAsBytes(largeThresh); this.largeCompress = largeCompress; } else if (largeThresh != null ^ largeCompress != null) { throw new IllegalArgumentException("Must set both of " + Property.TABLE_COMPACTION_STRATEGY_PREFIX + " (" + LARGE_FILE_COMPRESSION_TYPE + " and " + LARGE_FILE_COMPRESSION_THRESHOLD + ") or neither for " + this.getClass().getName()); } }  @Override void init(Map<String,String> options); @Override boolean shouldCompact(MajorCompactionRequest request); @Override void gatherInformation(MajorCompactionRequest request); @Override CompactionPlan getCompactionPlan(MajorCompactionRequest request); static final String SIZE_LIMIT_OPT; static final String LARGE_FILE_COMPRESSION_THRESHOLD; static final String LARGE_FILE_COMPRESSION_TYPE; }