### Question:
IndexManagementUtil { public static void ensureMutableIndexingCorrectlyConfigured(Configuration conf) throws IllegalStateException { if (isWALEditCodecSet(conf)) { return; } String codecClass = INDEX_WAL_EDIT_CODEC_CLASS_NAME; String indexLogReaderName = INDEX_HLOG_READER_CLASS_NAME; try { Class.forName(indexLogReaderName); } catch (ClassNotFoundException e) { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } if (indexLogReaderName.equals(conf.get(HLOG_READER_IMPL_KEY, indexLogReaderName))) { if (conf.getBoolean(HConstants.ENABLE_WAL_COMPRESSION, false)) { throw new IllegalStateException( "WAL Compression is only supported with " + codecClass + ". You can install in hbase-site.xml, under " + WALCellCodec.WAL_CELL_CODEC_CLASS_KEY); } } else { throw new IllegalStateException(codecClass + " is not installed, but " + indexLogReaderName + " hasn't been installed in hbase-site.xml under " + HLOG_READER_IMPL_KEY); } } private  IndexManagementUtil(); static boolean isWALEditCodecSet(Configuration conf); static void ensureMutableIndexingCorrectlyConfigured(Configuration conf); static ValueGetter createGetterFromScanner(CoveredDeleteScanner scanner, byte[] currentRow); static boolean updateMatchesColumns(Collection<KeyValue> update, List<ColumnReference> columns); static boolean columnMatchesUpdate(List<ColumnReference> columns, Collection<KeyValue> update); static Scan newLocalStateScan(List<? extends Iterable<? extends ColumnReference>> refsArray); static Scan newLocalStateScan(Scan scan, List<? extends Iterable<? extends ColumnReference>> refsArray); static void rethrowIndexingException(Throwable e); static void setIfNotSet(Configuration conf, String key, int value); static void createTimestampBatchesFromKeyValues(Collection<KeyValue> kvs, Map<Long, Batch> batches); static Collection<Batch> createTimestampBatchesFromMutation(Mutation m); static Collection<? extends Mutation> flattenMutationsByTimestamp(Collection<? extends Mutation> mutations); static final String INDEX_WAL_EDIT_CODEC_CLASS_NAME; static final String HLOG_READER_IMPL_KEY; static final String WAL_EDIT_CODEC_CLASS_KEY; }### Answer:
@Test public void testUncompressedWal() throws Exception { Configuration conf = new Configuration(false); conf.set(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName()); IndexManagementUtil.ensureMutableIndexingCorrectlyConfigured(conf); conf = new Configuration(false); conf.set(IndexManagementUtil.HLOG_READER_IMPL_KEY, IndexedHLogReader.class.getName()); IndexManagementUtil.ensureMutableIndexingCorrectlyConfigured(conf); }
@Test public void testCompressedWALWithCodec() throws Exception { Configuration conf = new Configuration(false); conf.setBoolean(HConstants.ENABLE_WAL_COMPRESSION, true); conf.set(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, IndexedWALEditCodec.class.getName()); IndexManagementUtil.ensureMutableIndexingCorrectlyConfigured(conf); }
@Test(expected = IllegalStateException.class) public void testCompressedWALWithHLogReader() throws Exception { Configuration conf = new Configuration(false); conf.setBoolean(HConstants.ENABLE_WAL_COMPRESSION, true); conf.set(IndexManagementUtil.HLOG_READER_IMPL_KEY, IndexedHLogReader.class.getName()); IndexManagementUtil.ensureMutableIndexingCorrectlyConfigured(conf); }