Home / Class/ AbstractCompatibleMarshallingDecoderTest Class — netty Architecture

AbstractCompatibleMarshallingDecoderTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  62eb7f35_69a6_94a1_2fa1_27bfbab3c2c9["AbstractCompatibleMarshallingDecoderTest"]
  1c928a47_ae16_f5b6_be58_412abb0bbbbd["AbstractCompatibleMarshallingDecoderTest.java"]
  62eb7f35_69a6_94a1_2fa1_27bfbab3c2c9 -->|defined in| 1c928a47_ae16_f5b6_be58_412abb0bbbbd
  cb8b6f64_fcf0_8672_e2dc_3b2d8386330c["testSimpleUnmarshalling()"]
  62eb7f35_69a6_94a1_2fa1_27bfbab3c2c9 -->|method| cb8b6f64_fcf0_8672_e2dc_3b2d8386330c
  010f72e5_7798_d7fd_63b5_9f7c828ebe19["ByteBuf()"]
  62eb7f35_69a6_94a1_2fa1_27bfbab3c2c9 -->|method| 010f72e5_7798_d7fd_63b5_9f7c828ebe19
  b8970f44_701a_7f73_4a85_fd7d13f41ee6["testFragmentedUnmarshalling()"]
  62eb7f35_69a6_94a1_2fa1_27bfbab3c2c9 -->|method| b8970f44_701a_7f73_4a85_fd7d13f41ee6
  ccb53cf1_9d9a_3b6f_75f0_e0889ec6f2c9["testTooBigObject()"]
  62eb7f35_69a6_94a1_2fa1_27bfbab3c2c9 -->|method| ccb53cf1_9d9a_3b6f_75f0_e0889ec6f2c9
  272636d5_0068_2a89_c17f_03249350d5c7["onTooBigFrame()"]
  62eb7f35_69a6_94a1_2fa1_27bfbab3c2c9 -->|method| 272636d5_0068_2a89_c17f_03249350d5c7
  eb3d2c60_fe5a_8583_ea54_800b249c2f4a["ChannelHandler()"]
  62eb7f35_69a6_94a1_2fa1_27bfbab3c2c9 -->|method| eb3d2c60_fe5a_8583_ea54_800b249c2f4a
  ef55281c_74fa_4ccf_04cf_ba268199f7a5["UnmarshallerProvider()"]
  62eb7f35_69a6_94a1_2fa1_27bfbab3c2c9 -->|method| ef55281c_74fa_4ccf_04cf_ba268199f7a5
  37986f6d_83a5_b2ae_48a5_27b93858c988["MarshallerFactory()"]
  62eb7f35_69a6_94a1_2fa1_27bfbab3c2c9 -->|method| 37986f6d_83a5_b2ae_48a5_27b93858c988
  46978871_c8da_2efc_af88_ebe073eaf358["MarshallingConfiguration()"]
  62eb7f35_69a6_94a1_2fa1_27bfbab3c2c9 -->|method| 46978871_c8da_2efc_af88_ebe073eaf358

Relationship Graph

Source Code

codec-marshalling/src/test/java/io/netty/handler/codec/marshalling/AbstractCompatibleMarshallingDecoderTest.java lines 36–136

public abstract class AbstractCompatibleMarshallingDecoderTest extends AbstractMarshallingTest {
    @SuppressWarnings("RedundantStringConstructorCall")
    private final String testObject = new String("test");

    @Test
    public void testSimpleUnmarshalling() throws IOException {
        MarshallerFactory marshallerFactory = createMarshallerFactory();
        MarshallingConfiguration configuration = createMarshallingConfig();

        EmbeddedChannel ch = new EmbeddedChannel(createDecoder(Integer.MAX_VALUE));

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
        marshaller.start(Marshalling.createByteOutput(bout));
        marshaller.writeObject(testObject);
        marshaller.finish();
        marshaller.close();

        byte[] testBytes = bout.toByteArray();

        ch.writeInbound(input(testBytes));
        assertTrue(ch.finish());

        String unmarshalled = ch.readInbound();

        assertEquals(testObject, unmarshalled);

        assertNull(ch.readInbound());
    }

    protected ByteBuf input(byte[] input) {
        return Unpooled.wrappedBuffer(input);
    }

    @Test
    public void testFragmentedUnmarshalling() throws IOException {
        MarshallerFactory marshallerFactory = createMarshallerFactory();
        MarshallingConfiguration configuration = createMarshallingConfig();

        EmbeddedChannel ch = new EmbeddedChannel(createDecoder(Integer.MAX_VALUE));

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
        marshaller.start(Marshalling.createByteOutput(bout));
        marshaller.writeObject(testObject);
        marshaller.finish();
        marshaller.close();

        byte[] testBytes = bout.toByteArray();

        ByteBuf buffer = input(testBytes);
        ByteBuf slice = buffer.readRetainedSlice(2);

        ch.writeInbound(slice);
        ch.writeInbound(buffer);
        assertTrue(ch.finish());

        String unmarshalled = ch.readInbound();

        assertEquals(testObject, unmarshalled);

        assertNull(ch.readInbound());
    }

    @Test
    public void testTooBigObject() throws IOException {
        MarshallerFactory marshallerFactory = createMarshallerFactory();
        MarshallingConfiguration configuration = createMarshallingConfig();

        ChannelHandler mDecoder = createDecoder(4);
        EmbeddedChannel ch = new EmbeddedChannel(mDecoder);

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
        marshaller.start(Marshalling.createByteOutput(bout));
        marshaller.writeObject(testObject);
        marshaller.finish();
        marshaller.close();

        byte[] testBytes = bout.toByteArray();
        onTooBigFrame(ch, input(testBytes));

Frequently Asked Questions

What is the AbstractCompatibleMarshallingDecoderTest class?
AbstractCompatibleMarshallingDecoderTest is a class in the netty codebase, defined in codec-marshalling/src/test/java/io/netty/handler/codec/marshalling/AbstractCompatibleMarshallingDecoderTest.java.
Where is AbstractCompatibleMarshallingDecoderTest defined?
AbstractCompatibleMarshallingDecoderTest is defined in codec-marshalling/src/test/java/io/netty/handler/codec/marshalling/AbstractCompatibleMarshallingDecoderTest.java at line 36.

Analyze Your Own Codebase

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

Try Supermodel Free