CodecRegistry { public RawErasureCoderFactory getCoderByName( String codecName, String coderName) { List<RawErasureCoderFactory> coders = getCoders(codecName); for (RawErasureCoderFactory coder : coders) { if (coder.getCoderName().equals(coderName)) { return coder; } } return null; } private  CodecRegistry(); static CodecRegistry getInstance(); String[] getCoderNames(String codecName); List<RawErasureCoderFactory> getCoders(String codecName); Set<String> getCodecNames(); RawErasureCoderFactory getCoderByName(
      String codecName, String coderName); Map<String, String> getCodec2CoderCompactMap();  }
@Test public void testGetCoderByName() { RawErasureCoderFactory coder = CodecRegistry.getInstance(). getCoderByName(ErasureCodeConstants.RS_CODEC_NAME, RSRawErasureCoderFactory.CODER_NAME); assertTrue(coder instanceof RSRawErasureCoderFactory); coder = CodecRegistry.getInstance().getCoderByName( ErasureCodeConstants.RS_CODEC_NAME, NativeRSRawErasureCoderFactory.CODER_NAME); assertTrue(coder instanceof NativeRSRawErasureCoderFactory); coder = CodecRegistry.getInstance().getCoderByName( ErasureCodeConstants.RS_LEGACY_CODEC_NAME, RSLegacyRawErasureCoderFactory.CODER_NAME); assertTrue(coder instanceof RSLegacyRawErasureCoderFactory); coder = CodecRegistry.getInstance().getCoderByName( ErasureCodeConstants.XOR_CODEC_NAME, XORRawErasureCoderFactory.CODER_NAME); assertTrue(coder instanceof XORRawErasureCoderFactory); coder = CodecRegistry.getInstance().getCoderByName( ErasureCodeConstants.XOR_CODEC_NAME, NativeXORRawErasureCoderFactory.CODER_NAME); assertTrue(coder instanceof NativeXORRawErasureCoderFactory); }