Home / Class/ SnappyIntegrationTest Class — netty Architecture

SnappyIntegrationTest Class — netty Architecture

Architecture documentation for the SnappyIntegrationTest class in SnappyIntegrationTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  cef83d83_2017_bca6_9ccd_d4bdc8b547d8["SnappyIntegrationTest"]
  9f851973_a26d_e31c_7f63_dd863b172bbb["SnappyIntegrationTest.java"]
  cef83d83_2017_bca6_9ccd_d4bdc8b547d8 -->|defined in| 9f851973_a26d_e31c_7f63_dd863b172bbb
  06a511fc_383e_1479_6fbc_50d2deb22988["EmbeddedChannel()"]
  cef83d83_2017_bca6_9ccd_d4bdc8b547d8 -->|method| 06a511fc_383e_1479_6fbc_50d2deb22988
  67db6a4a_efb0_de74_64f6_2ce7efe321f9["test1002()"]
  cef83d83_2017_bca6_9ccd_d4bdc8b547d8 -->|method| 67db6a4a_efb0_de74_64f6_2ce7efe321f9
  862b5cd6_cd15_ea74_90dd_ae1e30adc99e["test5323211032315942961()"]
  cef83d83_2017_bca6_9ccd_d4bdc8b547d8 -->|method| 862b5cd6_cd15_ea74_90dd_ae1e30adc99e
  762ff09e_575f_0a9b_d9d4_7a2f9eba6ebf["test7088170877360183401()"]
  cef83d83_2017_bca6_9ccd_d4bdc8b547d8 -->|method| 762ff09e_575f_0a9b_d9d4_7a2f9eba6ebf
  7dd8e131_e55e_3e47_5adc_685c69be3e54["testRandom()"]
  cef83d83_2017_bca6_9ccd_d4bdc8b547d8 -->|method| 7dd8e131_e55e_3e47_5adc_685c69be3e54
  69db0777_bef7_278b_e09b_dc0bee82f08e["testWithSeed()"]
  cef83d83_2017_bca6_9ccd_d4bdc8b547d8 -->|method| 69db0777_bef7_278b_e09b_dc0bee82f08e
  12c4d996_4802_8473_a6c8_f5be8f6a8edd["printSeedAsTest()"]
  cef83d83_2017_bca6_9ccd_d4bdc8b547d8 -->|method| 12c4d996_4802_8473_a6c8_f5be8f6a8edd

Relationship Graph

Source Code

codec-compression/src/test/java/io/netty/handler/codec/compression/SnappyIntegrationTest.java lines 23–117

public class SnappyIntegrationTest extends AbstractIntegrationTest {

    /**
     * The number of random regression tests run by testRandom() runs.  Whenever testRandom() finds the case that
     * the snappy codec can't encode/decode, it will print the generated source code of the offending test case.
     * You can always reproduce the problem using it rather than relying on testRandom().
     *
     * The default is 1, but you can increase it to increase the chance of finding any unusual cases.
     **/
    private static final int RANDOM_RUNS = 1;

    @Override
    protected EmbeddedChannel createEncoder() {
        return new EmbeddedChannel(new SnappyFrameEncoder());
    }

    @Override
    protected EmbeddedChannel createDecoder() {
        return new EmbeddedChannel(new SnappyFrameDecoder());
    }

    @Test
    public void test1002() throws Throwable {
        // Data from https://github.com/netty/netty/issues/1002
        final byte[] data = {
                11,    0,    0,    0,    0,    0,   16,   65,   96,  119,  -22,   79,  -43,   76,  -75,  -93,
                11,  104,   96,  -99,  126,  -98,   27,  -36,   40,  117,  -65,   -3,  -57,  -83,  -58,    7,
                114,  -14,   68, -122,  124,   88,  118,   54,   45,  -26,  117,   13,  -45,   -9,   60,  -73,
                -53,  -44,   53,   68,  -77,  -71,  109,   43,  -38,   59,  100,  -12,  -87,   44, -106,  123,
                -107,   38,   13, -117,  -23,  -49,   29,   21,   26,   66,    1,   -1,   -1,   -1,   -1,   -1,
                -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
                -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
                -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
                -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   66,    0, -104,  -49,
                16, -120,   22,    8,  -52,  -54, -102,  -52, -119, -124,  -92,  -71,  101, -120,  -52,  -48,
                45,  -26,  -24,   26,   41,  -13,   36,   64,  -47,   15, -124,   -7,  -16,   91,   96,    0,
                -93,  -42,  101,   20,  -74,   39, -124,   35,   43,  -49,  -21,  -92,  -20,  -41,   79,   41,
                110, -105,   42,  -96,   90,   -9, -100,  -22,  -62,   91,    2,   35,  113,  117,  -71,   66,
                1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
                -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
                -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
                -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
                -1,   -1
        };
        testIdentity(data, true);
    }

    // These tests were found using testRandom() with large RANDOM_RUNS.

    // Tests that copies do not attempt to overrun into a previous frame chunk
    @Test
    public void test5323211032315942961() {
        testWithSeed(5323211032315942961L);
    }

    // Tests that when generating the hash lookup table for finding copies, we
    // do not exceed the length of the input when there are no copies
    @Test
    public void test7088170877360183401() {
        testWithSeed(7088170877360183401L);
    }

    @Test
    public void testRandom() throws Throwable {
        for (int i = 0; i < RANDOM_RUNS; i++) {
            long seed = rand.nextLong();
            if (seed < 0) {
                // Use only positive seed to get prettier test name. :-)
                continue;
            }

            try {
                testWithSeed(seed);
            } catch (Throwable t) {
                System.out.println("Failed with random seed " + seed + ". Here is a test for it:\n");
                printSeedAsTest(seed);
                throw t;
            }
        }
    }

Frequently Asked Questions

What is the SnappyIntegrationTest class?
SnappyIntegrationTest is a class in the netty codebase, defined in codec-compression/src/test/java/io/netty/handler/codec/compression/SnappyIntegrationTest.java.
Where is SnappyIntegrationTest defined?
SnappyIntegrationTest is defined in codec-compression/src/test/java/io/netty/handler/codec/compression/SnappyIntegrationTest.java at line 23.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free