AdaptiveRecvByteBufAllocatorTest.java — netty Source File
Architecture documentation for AdaptiveRecvByteBufAllocatorTest.java, a java file in the netty codebase.
Entity Profile
Relationship Graph
Source Code
/*
* Copyright 2017 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.channel;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
import org.mockito.Mock;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class AdaptiveRecvByteBufAllocatorTest {
@Mock
private ChannelConfig config;
private final ByteBufAllocator alloc = UnpooledByteBufAllocator.DEFAULT;
private RecvByteBufAllocator.ExtendedHandle handle;
@BeforeEach
public void setup() {
config = mock(ChannelConfig.class);
when(config.isAutoRead()).thenReturn(true);
AdaptiveRecvByteBufAllocator recvByteBufAllocator = new AdaptiveRecvByteBufAllocator(64, 512, 1024 * 1024 * 10);
handle = (RecvByteBufAllocator.ExtendedHandle) recvByteBufAllocator.newHandle();
handle.reset(config);
}
@Test
public void rampUpBeforeReadCompleteWhenLargeDataPending() {
// Simulate that there is always more data when we attempt to read so we should always ramp up.
allocReadExpected(handle, alloc, 512);
allocReadExpected(handle, alloc, 8192);
allocReadExpected(handle, alloc, 131072);
allocReadExpected(handle, alloc, 2097152);
handle.readComplete();
handle.reset(config);
allocReadExpected(handle, alloc, 8388608);
}
@Test
public void memoryAllocationIntervalsTest() {
// ... (109 more lines)
Domain
Subdomains
Classes
Source
Frequently Asked Questions
What does AdaptiveRecvByteBufAllocatorTest.java do?
AdaptiveRecvByteBufAllocatorTest.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Search subdomain.
Where is AdaptiveRecvByteBufAllocatorTest.java in the architecture?
AdaptiveRecvByteBufAllocatorTest.java is located at transport/src/test/java/io/netty/channel/AdaptiveRecvByteBufAllocatorTest.java (domain: Buffer, subdomain: Search, directory: transport/src/test/java/io/netty/channel).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free