protected WALCellCodec getCodec(Configuration conf, String cellCodecClsName, CompressionContext compressionContext) throws IOException { return WALCellCodec.create(conf, cellCodecClsName, compressionContext); }
private WALCellCodec getCodec(Configuration conf, CompressionContext compressionContext) throws IOException { return WALCellCodec.create(conf, null, compressionContext); }
/** * Test that a custom {@link WALCellCodec} will fail if provided an invalid * code class. */ @Test(expected = RuntimeException.class) public void testCreatePreparesCodecInvalidClass() throws Exception { Configuration conf = new Configuration(false); conf.setStrings(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, "org.apache.hbase.wal.NoSuchClass"); WALCellCodec.create(conf, null, null); } }
/** * Test that a custom {@link WALCellCodec} will be completely setup when it is instantiated via * {@link WALCellCodec} * @throws Exception on failure */ @Test public void testCreatePreparesCodec() throws Exception { Configuration conf = new Configuration(false); conf.setClass(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, CustomWALCellCodec.class, WALCellCodec.class); CustomWALCellCodec codec = (CustomWALCellCodec) WALCellCodec.create(conf, null, null); assertEquals("Custom codec didn't get initialized with the right configuration!", conf, codec.conf); assertEquals("Custom codec didn't get initialized with the right compression context!", null, codec.context); }
Path testFile) throws IOException { WALCellCodec codec = WALCellCodec.create(UTIL.getConfiguration(), compressionContext);
protected WALCellCodec getCodec(Configuration conf, CompressionContext compressionContext) throws IOException { return WALCellCodec.create(conf, null, compressionContext); }
protected WALCellCodec getCodec(Configuration conf, String cellCodecClsName, CompressionContext compressionContext) throws IOException { return WALCellCodec.create(conf, cellCodecClsName, compressionContext); }
/** * Test that a custom {@link WALCellCodec} will fail if provided an invalid * code class. */ @Test(expected = RuntimeException.class) public void testCreatePreparesCodecInvalidClass() throws Exception { Configuration conf = new Configuration(false); conf.setStrings(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, "org.apache.hbase.wal.NoSuchClass"); WALCellCodec.create(conf, null, null); } }
/** * Test that a custom {@link WALCellCodec} will be completely setup when it is instantiated via * {@link WALCellCodec} * @throws Exception on failure */ @Test public void testCreatePreparesCodec() throws Exception { Configuration conf = new Configuration(false); conf.setClass(WALCellCodec.WAL_CELL_CODEC_CLASS_KEY, CustomWALCellCodec.class, WALCellCodec.class); CustomWALCellCodec codec = (CustomWALCellCodec) WALCellCodec.create(conf, null, null); assertEquals("Custom codec didn't get initialized with the right configuration!", conf, codec.conf); assertEquals("Custom codec didn't get initialized with the right compression context!", null, codec.context); }