Home / Function/ testMap() — netty Function Reference

testMap() — netty Function Reference

Architecture documentation for the testMap() function in AbstractChannelPoolMapTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e54e4551_d02a_92b8_dbdb_49ad06e0d485["testMap()"]
  a8999ca8_1527_5b77_88b4_2e7aa504b5f4["AbstractChannelPoolMapTest"]
  e54e4551_d02a_92b8_dbdb_49ad06e0d485 -->|defined in| a8999ca8_1527_5b77_88b4_2e7aa504b5f4
  style e54e4551_d02a_92b8_dbdb_49ad06e0d485 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/pool/AbstractChannelPoolMapTest.java lines 44–84

    @Test
    public void testMap() throws Exception {
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory());
        LocalAddress addr = new LocalAddress(getLocalAddrId());
        final Bootstrap cb = new Bootstrap();
        cb.remoteAddress(addr);
        cb.group(group)
          .channel(LocalChannel.class);

        AbstractChannelPoolMap<EventLoop, SimpleChannelPool> poolMap =
                new AbstractChannelPoolMap<EventLoop, SimpleChannelPool>() {
            @Override
            protected SimpleChannelPool newPool(EventLoop key) {
                return new SimpleChannelPool(cb.clone(key), new TestChannelPoolHandler());
            }
        };

        EventLoop loop = group.next();

        assertFalse(poolMap.iterator().hasNext());
        assertEquals(0, poolMap.size());

        final SimpleChannelPool pool = poolMap.get(loop);
        assertEquals(1, poolMap.size());
        assertTrue(poolMap.iterator().hasNext());

        assertSame(pool, poolMap.get(loop));
        assertTrue(poolMap.remove(loop));
        assertFalse(poolMap.remove(loop));

        assertFalse(poolMap.iterator().hasNext());
        assertEquals(0, poolMap.size());

        assertThrows(ConnectException.class, new Executable() {
            @Override
            public void execute() throws Throwable {
                pool.acquire().syncUninterruptibly();
            }
        });
        poolMap.close();
    }

Domain

Subdomains

Frequently Asked Questions

What does testMap() do?
testMap() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/pool/AbstractChannelPoolMapTest.java.
Where is testMap() defined?
testMap() is defined in transport/src/test/java/io/netty/channel/pool/AbstractChannelPoolMapTest.java at line 44.

Analyze Your Own Codebase

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

Try Supermodel Free