当前位置: 首页>>代码示例>>Java>>正文


Java CompressionTestStrategy类代码示例

本文整理汇总了Java中org.apache.hadoop.io.compress.CompressDecompressTester.CompressionTestStrategy的典型用法代码示例。如果您正苦于以下问题:Java CompressionTestStrategy类的具体用法?Java CompressionTestStrategy怎么用?Java CompressionTestStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CompressionTestStrategy类属于org.apache.hadoop.io.compress.CompressDecompressTester包,在下文中一共展示了CompressionTestStrategy类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCompressorDecompressor

import org.apache.hadoop.io.compress.CompressDecompressTester.CompressionTestStrategy; //导入依赖的package包/类
@Test
public void testCompressorDecompressor() {
  // no more for this data
  int SIZE = 44 * 1024;
  
  byte[] rawData = generate(SIZE);
  try {
    CompressDecompressTester.of(rawData)
        .withCompressDecompressPair(new SnappyCompressor(), new SnappyDecompressor())
        .withCompressDecompressPair(new Lz4Compressor(), new Lz4Decompressor())
        .withCompressDecompressPair(new BuiltInZlibDeflater(), new BuiltInZlibInflater())
        .withTestCases(ImmutableSet.of(CompressionTestStrategy.COMPRESS_DECOMPRESS_SINGLE_BLOCK,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_BLOCK,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_ERRORS,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_WITH_EMPTY_STREAM))
        .test();

  } catch (Exception ex) {
    GenericTestUtils.assertExceptionContains(
        "testCompressorDecompressor error !!!", ex);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:23,代码来源:TestCompressorDecompressor.java

示例2: testCompressorDecompressorWithExeedBufferLimit

import org.apache.hadoop.io.compress.CompressDecompressTester.CompressionTestStrategy; //导入依赖的package包/类
@Test
public void testCompressorDecompressorWithExeedBufferLimit() {
  int BYTE_SIZE = 100 * 1024;
  byte[] rawData = generate(BYTE_SIZE);
  try {
    CompressDecompressTester.of(rawData)
        .withCompressDecompressPair(
            new SnappyCompressor(BYTE_SIZE + BYTE_SIZE / 2),
            new SnappyDecompressor(BYTE_SIZE + BYTE_SIZE / 2))
        .withCompressDecompressPair(new Lz4Compressor(BYTE_SIZE),
            new Lz4Decompressor(BYTE_SIZE))
        .withTestCases(ImmutableSet.of(CompressionTestStrategy.COMPRESS_DECOMPRESS_SINGLE_BLOCK,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_BLOCK,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_ERRORS,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_WITH_EMPTY_STREAM))
        .test();

  } catch (Exception ex) {
    GenericTestUtils.assertExceptionContains(
        "testCompressorDecompressorWithExeedBufferLimit error !!!", ex);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:23,代码来源:TestCompressorDecompressor.java

示例3: testZlibCompressorDecompressor

import org.apache.hadoop.io.compress.CompressDecompressTester.CompressionTestStrategy; //导入依赖的package包/类
@Test
public void testZlibCompressorDecompressor() {
  try {
    int SIZE = 44 * 1024;
    byte[] rawData = generate(SIZE);
    
    CompressDecompressTester.of(rawData)
      .withCompressDecompressPair(new ZlibCompressor(), new ZlibDecompressor())
      .withTestCases(ImmutableSet.of(CompressionTestStrategy.COMPRESS_DECOMPRESS_SINGLE_BLOCK,
         CompressionTestStrategy.COMPRESS_DECOMPRESS_BLOCK,
         CompressionTestStrategy.COMPRESS_DECOMPRESS_ERRORS,
         CompressionTestStrategy.COMPRESS_DECOMPRESS_WITH_EMPTY_STREAM))
       .test();
  } catch (Exception ex) {
    fail("testCompressorDecompressor error !!!" + ex);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:18,代码来源:TestZlibCompressorDecompressor.java

示例4: testCompressorDecompressorWithExeedBufferLimit

import org.apache.hadoop.io.compress.CompressDecompressTester.CompressionTestStrategy; //导入依赖的package包/类
@Test
public void testCompressorDecompressorWithExeedBufferLimit() {
  int BYTE_SIZE = 100 * 1024;
  byte[] rawData = generate(BYTE_SIZE);
  try {
    CompressDecompressTester.of(rawData)
    .withCompressDecompressPair(
      new ZlibCompressor(
          org.apache.hadoop.io.compress.zlib.ZlibCompressor.CompressionLevel.BEST_COMPRESSION,
          CompressionStrategy.DEFAULT_STRATEGY,
          org.apache.hadoop.io.compress.zlib.ZlibCompressor.CompressionHeader.DEFAULT_HEADER,
          BYTE_SIZE),
       new ZlibDecompressor(
          org.apache.hadoop.io.compress.zlib.ZlibDecompressor.CompressionHeader.DEFAULT_HEADER,
          BYTE_SIZE))
       .withTestCases(ImmutableSet.of(CompressionTestStrategy.COMPRESS_DECOMPRESS_SINGLE_BLOCK,
          CompressionTestStrategy.COMPRESS_DECOMPRESS_BLOCK,
          CompressionTestStrategy.COMPRESS_DECOMPRESS_ERRORS,
          CompressionTestStrategy.COMPRESS_DECOMPRESS_WITH_EMPTY_STREAM))
        .test();
  } catch (Exception ex) {
    fail("testCompressorDecompressorWithExeedBufferLimit error !!!" + ex);
  } 
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:25,代码来源:TestZlibCompressorDecompressor.java

示例5: testCompressorDecompressor

import org.apache.hadoop.io.compress.CompressDecompressTester.CompressionTestStrategy; //导入依赖的package包/类
@Test
public void testCompressorDecompressor() {
  // no more for this data
  int SIZE = 44 * 1024;
  
  byte[] rawData = generate(SIZE);
  try {
    CompressDecompressTester.of(rawData)
        .withCompressDecompressPair(new SnappyCompressor(), new SnappyDecompressor())
        .withCompressDecompressPair(new Lz4Compressor(), new Lz4Decompressor())
        .withCompressDecompressPair(new BuiltInZlibDeflater(), new BuiltInZlibInflater())
        .withTestCases(ImmutableSet.of(CompressionTestStrategy.COMPRESS_DECOMPRESS_SINGLE_BLOCK,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_BLOCK,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_ERRORS,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_WITH_EMPTY_STREAM))
        .test();

  } catch (Exception ex) {
    fail("testCompressorDecompressor error !!!" + ex);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestCompressorDecompressor.java

示例6: testCompressorDecompressorWithExeedBufferLimit

import org.apache.hadoop.io.compress.CompressDecompressTester.CompressionTestStrategy; //导入依赖的package包/类
@Test
public void testCompressorDecompressorWithExeedBufferLimit() {
  int BYTE_SIZE = 100 * 1024;
  byte[] rawData = generate(BYTE_SIZE);
  try {
    CompressDecompressTester.of(rawData)
        .withCompressDecompressPair(
            new SnappyCompressor(BYTE_SIZE + BYTE_SIZE / 2),
            new SnappyDecompressor(BYTE_SIZE + BYTE_SIZE / 2))
        .withCompressDecompressPair(new Lz4Compressor(BYTE_SIZE),
            new Lz4Decompressor(BYTE_SIZE))
        .withTestCases(ImmutableSet.of(CompressionTestStrategy.COMPRESS_DECOMPRESS_SINGLE_BLOCK,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_BLOCK,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_ERRORS,
                    CompressionTestStrategy.COMPRESS_DECOMPRESS_WITH_EMPTY_STREAM))
        .test();

  } catch (Exception ex) {
    fail("testCompressorDecompressorWithExeedBufferLimit error !!!" + ex);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestCompressorDecompressor.java


注:本文中的org.apache.hadoop.io.compress.CompressDecompressTester.CompressionTestStrategy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。