Home / Function/ testChannelsIterator() — netty Function Reference

testChannelsIterator() — netty Function Reference

Architecture documentation for the testChannelsIterator() function in AbstractSingleThreadEventLoopTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b755284f_722b_7273_735c_350c2bc74ed2["testChannelsIterator()"]
  eb487d77_b896_e5c3_20f1_2b7144dc7cf5["AbstractSingleThreadEventLoopTest"]
  b755284f_722b_7273_735c_350c2bc74ed2 -->|defined in| eb487d77_b896_e5c3_20f1_2b7144dc7cf5
  a8dce879_7ee0_7010_3c52_39fbd72cc186["supportsChannelIteration()"]
  b755284f_722b_7273_735c_350c2bc74ed2 -->|calls| a8dce879_7ee0_7010_3c52_39fbd72cc186
  8e4c2417_e591_227d_d30d_62c23430fd6d["registeredChannels()"]
  b755284f_722b_7273_735c_350c2bc74ed2 -->|calls| 8e4c2417_e591_227d_d30d_62c23430fd6d
  d4cc6fcd_803a_7c6c_adf8_d25d73af7b63["runBlockingOn()"]
  b755284f_722b_7273_735c_350c2bc74ed2 -->|calls| d4cc6fcd_803a_7c6c_adf8_d25d73af7b63
  style b755284f_722b_7273_735c_350c2bc74ed2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java lines 215–260

    @Test
    @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
    public void testChannelsIterator() throws Exception {
        assumeTrue(supportsChannelIteration());
        EventLoopGroup group = newEventLoopGroup();
        final SingleThreadEventLoop loop = (SingleThreadEventLoop) group.next();
        try {
            final Channel ch1 = newChannel();
            final Channel ch2 = newChannel();
            loop.register(ch1).syncUninterruptibly();
            loop.register(ch2).syncUninterruptibly();
            assertEquals(2, registeredChannels(loop));

            runBlockingOn(loop, new Runnable() {
                @Override
                public void run() {
                    final Iterator<Channel> iterator = loop.registeredChannelsIterator();

                    assertTrue(iterator.hasNext());
                    Channel actualCh1 = iterator.next();
                    assertNotNull(actualCh1);

                    assertTrue(iterator.hasNext());
                    Channel actualCh2 = iterator.next();
                    assertNotNull(actualCh2);

                    Set<Channel> expected = new HashSet<Channel>(4);
                    expected.add(ch1);
                    expected.add(ch2);
                    expected.remove(actualCh1);
                    expected.remove(actualCh2);
                    assertTrue(expected.isEmpty());

                    assertFalse(iterator.hasNext());
                    assertThrows(NoSuchElementException.class, new Executable() {
                        @Override
                        public void execute() {
                            iterator.next();
                        }
                    });
                }
            });
        } finally {
            group.shutdownGracefully();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testChannelsIterator() do?
testChannelsIterator() is a function in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java.
Where is testChannelsIterator() defined?
testChannelsIterator() is defined in testsuite/src/main/java/io/netty/testsuite/transport/AbstractSingleThreadEventLoopTest.java at line 215.
What does testChannelsIterator() call?
testChannelsIterator() calls 3 function(s): registeredChannels, runBlockingOn, supportsChannelIteration.

Analyze Your Own Codebase

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

Try Supermodel Free