public virtual void TestCodecPoolCompressorReinit() { Configuration conf = new Configuration(); conf.SetBoolean(CommonConfigurationKeys.IoNativeLibAvailableKey, true); if (ZlibFactory.IsNativeZlibLoaded(conf)) { GzipCodec gzc = ReflectionUtils.NewInstance <GzipCodec>(conf); GzipReinitTest(conf, gzc); } else { Log.Warn("testCodecPoolCompressorReinit skipped: native libs not loaded"); } conf.SetBoolean(CommonConfigurationKeys.IoNativeLibAvailableKey, false); DefaultCodec dfc = ReflectionUtils.NewInstance <DefaultCodec>(conf); GzipReinitTest(conf, dfc); }
public virtual void TestCodecPoolGzipReuse() { Configuration conf = new Configuration(); conf.SetBoolean(CommonConfigurationKeys.IoNativeLibAvailableKey, true); if (!ZlibFactory.IsNativeZlibLoaded(conf)) { Log.Warn("testCodecPoolGzipReuse skipped: native libs not loaded"); return; } GzipCodec gzc = ReflectionUtils.NewInstance <GzipCodec>(conf); DefaultCodec dfc = ReflectionUtils.NewInstance <DefaultCodec>(conf); Compressor c1 = CodecPool.GetCompressor(gzc); Compressor c2 = CodecPool.GetCompressor(dfc); CodecPool.ReturnCompressor(c1); CodecPool.ReturnCompressor(c2); Assert.True("Got mismatched ZlibCompressor", c2 != CodecPool.GetCompressor (gzc)); }