Home / Function/ testDecrementAll() — netty Function Reference

testDecrementAll() — netty Function Reference

Architecture documentation for the testDecrementAll() function in AbstractCoalescingBufferQueueTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  be0c57a7_d648_f65b_e025_0b3541757811["testDecrementAll()"]
  04c5cf5a_e41c_5ef0_e696_3df84d28c281["AbstractCoalescingBufferQueueTest"]
  be0c57a7_d648_f65b_e025_0b3541757811 -->|defined in| 04c5cf5a_e41c_5ef0_e696_3df84d28c281
  78ff0ed8_02d0_884e_e9c4_964df406255c["testDecrementAllWhenWriteAndRemoveAll()"]
  78ff0ed8_02d0_884e_e9c4_964df406255c -->|calls| be0c57a7_d648_f65b_e025_0b3541757811
  4ed2dac9_51df_9755_cfc8_964a9f46f877["testDecrementAllWhenReleaseAndFailAll()"]
  4ed2dac9_51df_9755_cfc8_964a9f46f877 -->|calls| be0c57a7_d648_f65b_e025_0b3541757811
  style be0c57a7_d648_f65b_e025_0b3541757811 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/test/java/io/netty/channel/AbstractCoalescingBufferQueueTest.java lines 49–91

    private static void testDecrementAll(boolean write) {
        EmbeddedChannel channel = new EmbeddedChannel(new ChannelOutboundHandlerAdapter() {
            @Override
            public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
                ReferenceCountUtil.release(msg);
                promise.setSuccess();
            }
        }, new ChannelHandlerAdapter() { });
        final AbstractCoalescingBufferQueue queue = new AbstractCoalescingBufferQueue(channel, 128) {
            @Override
            protected ByteBuf compose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) {
                return composeIntoComposite(alloc, cumulation, next);
            }

            @Override
            protected ByteBuf removeEmptyValue() {
                return Unpooled.EMPTY_BUFFER;
            }
        };

        final byte[] bytes = new byte[128];
        queue.add(Unpooled.wrappedBuffer(bytes), future -> {
            queue.add(Unpooled.wrappedBuffer(bytes));
            assertEquals(bytes.length, queue.readableBytes());
        });

        assertEquals(bytes.length, queue.readableBytes());

        ChannelHandlerContext ctx = channel.pipeline().lastContext();
        if (write) {
            queue.writeAndRemoveAll(ctx);
        } else {
            queue.releaseAndFailAll(ctx, new ClosedChannelException());
        }
        ByteBuf buffer = queue.remove(channel.alloc(), 128, channel.newPromise());
        assertFalse(buffer.isReadable());
        buffer.release();

        assertTrue(queue.isEmpty());
        assertEquals(0, queue.readableBytes());

        assertFalse(channel.finish());
    }

Domain

Subdomains

Frequently Asked Questions

What does testDecrementAll() do?
testDecrementAll() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/AbstractCoalescingBufferQueueTest.java.
Where is testDecrementAll() defined?
testDecrementAll() is defined in transport/src/test/java/io/netty/channel/AbstractCoalescingBufferQueueTest.java at line 49.
What calls testDecrementAll()?
testDecrementAll() is called by 2 function(s): testDecrementAllWhenReleaseAndFailAll, testDecrementAllWhenWriteAndRemoveAll.

Analyze Your Own Codebase

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

Try Supermodel Free