Home / Class/ AbstractCompatibleMarshallingEncoderTest Class — netty Architecture

AbstractCompatibleMarshallingEncoderTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  80b1b53d_459c_7b14_8fbb_123d40300ab8["AbstractCompatibleMarshallingEncoderTest"]
  1accc9bb_50bb_646b_4696_0359ed96fdf7["AbstractCompatibleMarshallingEncoderTest.java"]
  80b1b53d_459c_7b14_8fbb_123d40300ab8 -->|defined in| 1accc9bb_50bb_646b_4696_0359ed96fdf7
  d08b0f04_f3c6_d80d_0ca4_8a2a59388ce1["testMarshalling()"]
  80b1b53d_459c_7b14_8fbb_123d40300ab8 -->|method| d08b0f04_f3c6_d80d_0ca4_8a2a59388ce1
  56e881e4_62c8_97ba_aea6_d487498f31c3["ByteBuf()"]
  80b1b53d_459c_7b14_8fbb_123d40300ab8 -->|method| 56e881e4_62c8_97ba_aea6_d487498f31c3
  ec96f9f0_a88c_38f4_b293_b70bee2d186d["ChannelHandler()"]
  80b1b53d_459c_7b14_8fbb_123d40300ab8 -->|method| ec96f9f0_a88c_38f4_b293_b70bee2d186d
  972f9660_10f4_1516_c606_9909d60ba08a["MarshallerProvider()"]
  80b1b53d_459c_7b14_8fbb_123d40300ab8 -->|method| 972f9660_10f4_1516_c606_9909d60ba08a
  c7ef8596_d17b_b3d8_9177_5bf7a6bb93cf["MarshallerFactory()"]
  80b1b53d_459c_7b14_8fbb_123d40300ab8 -->|method| c7ef8596_d17b_b3d8_9177_5bf7a6bb93cf
  e1daf9bf_df23_9826_64c7_41374aa98767["MarshallingConfiguration()"]
  80b1b53d_459c_7b14_8fbb_123d40300ab8 -->|method| e1daf9bf_df23_9826_64c7_41374aa98767

Relationship Graph

Source Code

codec-marshalling/src/test/java/io/netty/handler/codec/marshalling/AbstractCompatibleMarshallingEncoderTest.java lines 31–78

public abstract class AbstractCompatibleMarshallingEncoderTest extends AbstractMarshallingTest {

    @Test
    public void testMarshalling() throws Exception {
        @SuppressWarnings("RedundantStringConstructorCall")
        String testObject = new String("test");

        final MarshallerFactory marshallerFactory = createMarshallerFactory();
        final MarshallingConfiguration configuration = createMarshallingConfig();

        EmbeddedChannel ch = new EmbeddedChannel(createEncoder());

        ch.writeOutbound(testObject);
        assertTrue(ch.finish());

        ByteBuf buffer = ch.readOutbound();

        Unmarshaller unmarshaller = marshallerFactory.createUnmarshaller(configuration);
        unmarshaller.start(Marshalling.createByteInput(truncate(buffer).nioBuffer()));
        String read = (String) unmarshaller.readObject();
        assertEquals(testObject, read);

        assertEquals(-1, unmarshaller.read());

        assertNull(ch.readOutbound());

        unmarshaller.finish();
        unmarshaller.close();
        buffer.release();
    }

    protected ByteBuf truncate(ByteBuf buf) {
        return buf;
    }

    protected ChannelHandler createEncoder() {
        return new CompatibleMarshallingEncoder(createProvider());
    }

    protected MarshallerProvider createProvider() {
        return new DefaultMarshallerProvider(createMarshallerFactory(), createMarshallingConfig());
    }

    protected abstract MarshallerFactory createMarshallerFactory();

    protected abstract MarshallingConfiguration createMarshallingConfig();

}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free