Home / Class/ BaseChannelTest Class — netty Architecture

BaseChannelTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  0c01051c_ac6b_ebe9_9da3_cd5809a96ff6["BaseChannelTest"]
  2d6bf25b_d2c7_72e6_06f9_272b7d3879f0["BaseChannelTest.java"]
  0c01051c_ac6b_ebe9_9da3_cd5809a96ff6 -->|defined in| 2d6bf25b_d2c7_72e6_06f9_272b7d3879f0
  016e12f8_ab31_c16e_cecc_6596dd7190e7["BaseChannelTest()"]
  0c01051c_ac6b_ebe9_9da3_cd5809a96ff6 -->|method| 016e12f8_ab31_c16e_cecc_6596dd7190e7
  729cac52_96b1_046c_2ffc_fc2da8ef2924["ServerBootstrap()"]
  0c01051c_ac6b_ebe9_9da3_cd5809a96ff6 -->|method| 729cac52_96b1_046c_2ffc_fc2da8ef2924
  305d6579_e558_2f88_ed6d_c3b7d8072056["Bootstrap()"]
  0c01051c_ac6b_ebe9_9da3_cd5809a96ff6 -->|method| 305d6579_e558_2f88_ed6d_c3b7d8072056
  43e1381b_862c_468b_eb06_f18b892b8781["ByteBuf()"]
  0c01051c_ac6b_ebe9_9da3_cd5809a96ff6 -->|method| 43e1381b_862c_468b_eb06_f18b892b8781
  042e60b4_5646_bd75_8cdf_b21f27a8ecfd["assertLog()"]
  0c01051c_ac6b_ebe9_9da3_cd5809a96ff6 -->|method| 042e60b4_5646_bd75_8cdf_b21f27a8ecfd
  e8f16303_306f_53f6_1f94_0f851d58db5f["clearLog()"]
  0c01051c_ac6b_ebe9_9da3_cd5809a96ff6 -->|method| e8f16303_306f_53f6_1f94_0f851d58db5f
  13e2455e_d5e5_5d64_d517_73921748c781["setInterest()"]
  0c01051c_ac6b_ebe9_9da3_cd5809a96ff6 -->|method| 13e2455e_d5e5_5d64_d517_73921748c781

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/BaseChannelTest.java lines 28–90

class BaseChannelTest {

    private final LoggingHandler loggingHandler;

    BaseChannelTest() {
        loggingHandler = new LoggingHandler();
    }

    ServerBootstrap getLocalServerBootstrap() {
        EventLoopGroup serverGroup = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory());
        ServerBootstrap sb = new ServerBootstrap();
        sb.group(serverGroup);
        sb.channel(LocalServerChannel.class);
        sb.childHandler(new ChannelInitializer<LocalChannel>() {
            @Override
            public void initChannel(LocalChannel ch) throws Exception {
            }
        });

        return sb;
    }

    Bootstrap getLocalClientBootstrap() {
        EventLoopGroup clientGroup = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory());
        Bootstrap cb = new Bootstrap();
        cb.channel(LocalChannel.class);
        cb.group(clientGroup);

        cb.handler(loggingHandler);

        return cb;
    }

    static ByteBuf createTestBuf(int len) {
        ByteBuf buf = Unpooled.buffer(len, len);
        buf.setIndex(0, len);
        return buf;
    }

    void assertLog(String firstExpected, String... otherExpected) {
        String actual = loggingHandler.getLog();
        if (firstExpected.equals(actual)) {
            return;
        }
        for (String e: otherExpected) {
            if (e.equals(actual)) {
                return;
            }
        }

        // Let the comparison fail with the first expectation.
        assertEquals(firstExpected, actual);
    }

    void clearLog() {
        loggingHandler.clear();
    }

    void setInterest(LoggingHandler.Event... events) {
        loggingHandler.setInterest(events);
    }

}

Frequently Asked Questions

What is the BaseChannelTest class?
BaseChannelTest is a class in the netty codebase, defined in transport/src/test/java/io/netty/channel/BaseChannelTest.java.
Where is BaseChannelTest defined?
BaseChannelTest is defined in transport/src/test/java/io/netty/channel/BaseChannelTest.java at line 28.

Analyze Your Own Codebase

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

Try Supermodel Free