Search in sources :

Example 1 with RSRawEncoder

use of org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoder in project hadoop by apache.

the class TestCodecRawCoderMapping method testRSDefaultRawCoder.

@Test
public void testRSDefaultRawCoder() {
    ErasureCoderOptions coderOptions = new ErasureCoderOptions(numDataUnit, numParityUnit);
    // should return default raw coder of rs codec
    RawErasureEncoder encoder = CodecUtil.createRawEncoder(conf, ErasureCodeConstants.RS_CODEC_NAME, coderOptions);
    Assert.assertTrue(encoder instanceof RSRawEncoder);
    RawErasureDecoder decoder = CodecUtil.createRawDecoder(conf, ErasureCodeConstants.RS_CODEC_NAME, coderOptions);
    Assert.assertTrue(decoder instanceof RSRawDecoder);
    // should return default raw coder of rs-legacy codec
    encoder = CodecUtil.createRawEncoder(conf, ErasureCodeConstants.RS_LEGACY_CODEC_NAME, coderOptions);
    Assert.assertTrue(encoder instanceof RSRawEncoderLegacy);
    decoder = CodecUtil.createRawDecoder(conf, ErasureCodeConstants.RS_LEGACY_CODEC_NAME, coderOptions);
    Assert.assertTrue(decoder instanceof RSRawDecoderLegacy);
}
Also used : RSRawDecoderLegacy(org.apache.hadoop.io.erasurecode.rawcoder.RSRawDecoderLegacy) RSRawEncoder(org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoder) RawErasureDecoder(org.apache.hadoop.io.erasurecode.rawcoder.RawErasureDecoder) RSRawEncoderLegacy(org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoderLegacy) RawErasureEncoder(org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder) RSRawDecoder(org.apache.hadoop.io.erasurecode.rawcoder.RSRawDecoder) Test(org.junit.Test)

Example 2 with RSRawEncoder

use of org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoder in project hadoop by apache.

the class TestCodecRawCoderMapping method testDedicatedRawCoderKey.

@Test
public void testDedicatedRawCoderKey() {
    ErasureCoderOptions coderOptions = new ErasureCoderOptions(numDataUnit, numParityUnit);
    String dummyFactName = "DummyNoneExistingFactory";
    // set the dummy factory to rs-legacy and create a raw coder
    // with rs, which is OK as the raw coder key is not used
    conf.set(CodecUtil.IO_ERASURECODE_CODEC_RS_LEGACY_RAWCODER_KEY, dummyFactName);
    RawErasureEncoder encoder = CodecUtil.createRawEncoder(conf, ErasureCodeConstants.RS_CODEC_NAME, coderOptions);
    Assert.assertTrue(encoder instanceof RSRawEncoder);
    // now create the raw coder with rs-legacy, which should throw exception
    try {
        CodecUtil.createRawEncoder(conf, ErasureCodeConstants.RS_LEGACY_CODEC_NAME, coderOptions);
        Assert.fail();
    } catch (Exception e) {
        GenericTestUtils.assertExceptionContains("Failed to create raw coder", e);
    }
}
Also used : RSRawEncoder(org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoder) RawErasureEncoder(org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder) Test(org.junit.Test)

Aggregations

RSRawEncoder (org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoder)2 RawErasureEncoder (org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder)2 Test (org.junit.Test)2 RSRawDecoder (org.apache.hadoop.io.erasurecode.rawcoder.RSRawDecoder)1 RSRawDecoderLegacy (org.apache.hadoop.io.erasurecode.rawcoder.RSRawDecoderLegacy)1 RSRawEncoderLegacy (org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoderLegacy)1 RawErasureDecoder (org.apache.hadoop.io.erasurecode.rawcoder.RawErasureDecoder)1