WeightedFairQueueByteDistributorTest Class — netty Architecture
Architecture documentation for the WeightedFairQueueByteDistributorTest class in WeightedFairQueueByteDistributorTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 67b7550d_3bc6_4a2b_6b2f_618af35d6df8["WeightedFairQueueByteDistributorTest"] 86a4498c_3129_f915_a013_8a857227b014["WeightedFairQueueByteDistributorTest.java"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|defined in| 86a4498c_3129_f915_a013_8a857227b014 6b170cb0_108f_fa9f_939c_f8840388f53b["setup()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| 6b170cb0_108f_fa9f_939c_f8840388f53b 29e725a2_b72b_804f_d9ab_387652d77c78["writeWithNonActiveStreamShouldNotDobuleAddToPriorityQueue()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| 29e725a2_b72b_804f_d9ab_387652d77c78 40441c50_9c54_2893_0d78_c8c93f59d67e["bytesUnassignedAfterProcessing()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| 40441c50_9c54_2893_0d78_c8c93f59d67e b66c2bd8_676d_86a4_cc77_2d4d4d56c82b["connectionErrorForWriterException()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| b66c2bd8_676d_86a4_cc77_2d4d4d56c82b 9910f283_ee16_3c47_92af_fc5bf8c8409e["minChunkShouldBeAllocatedPerStream()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| 9910f283_ee16_3c47_92af_fc5bf8c8409e d1dd16e2_e80e_b19e_3d99_1befd2d9385f["emptyFrameAtHeadIsWritten()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| d1dd16e2_e80e_b19e_3d99_1befd2d9385f 89331c2b_8632_f9c3_a5a4_5c708a3c3295["blockedStreamNoDataShouldSpreadDataToChildren()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| 89331c2b_8632_f9c3_a5a4_5c708a3c3295 4d688891_004c_3973_4287_29ae85b7526d["blockedStreamWithDataAndNotAllowedToSendShouldSpreadDataToChildren()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| 4d688891_004c_3973_4287_29ae85b7526d e5c7c421_6012_fcf0_bbfc_0ea799957567["streamWithZeroFlowControlWindowAndDataShouldWriteOnlyOnce()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| e5c7c421_6012_fcf0_bbfc_0ea799957567 d35333b0_3394_a15a_9e69_55c84468da13["blockedStreamShouldSpreadDataToChildren()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| d35333b0_3394_a15a_9e69_55c84468da13 9d277346_e513_d5ae_06bb_cfc9fd8b51e1["childrenShouldNotSendDataUntilParentBlocked()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| 9d277346_e513_d5ae_06bb_cfc9fd8b51e1 d8a105a0_e49b_7590_ed21_f71981347a7e["parentShouldWaterFallDataToChildren()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| d8a105a0_e49b_7590_ed21_f71981347a7e 5b33686d_4c7c_df6e_abe3_78558c65b662["reprioritizeShouldAdjustOutboundFlow()"] 67b7550d_3bc6_4a2b_6b2f_618af35d6df8 -->|method| 5b33686d_4c7c_df6e_abe3_78558c65b662
Relationship Graph
Source Code
codec-http2/src/test/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributorTest.java lines 43–964
public class WeightedFairQueueByteDistributorTest extends AbstractWeightedFairQueueByteDistributorDependencyTest {
private static final int STREAM_A = 1;
private static final int STREAM_B = 3;
private static final int STREAM_C = 5;
private static final int STREAM_D = 7;
private static final int STREAM_E = 9;
private static final int ALLOCATION_QUANTUM = 100;
@BeforeEach
public void setup() throws Http2Exception {
MockitoAnnotations.initMocks(this);
// Assume we always write all the allocated bytes.
doAnswer(writeAnswer(false)).when(writer).write(any(Http2Stream.class), anyInt());
setup(-1);
}
private void setup(int maxStateOnlySize) throws Http2Exception {
connection = new DefaultHttp2Connection(false);
distributor = maxStateOnlySize >= 0 ? new WeightedFairQueueByteDistributor(connection, maxStateOnlySize)
: new WeightedFairQueueByteDistributor(connection);
distributor.allocationQuantum(ALLOCATION_QUANTUM);
connection.local().createStream(STREAM_A, false);
connection.local().createStream(STREAM_B, false);
Http2Stream streamC = connection.local().createStream(STREAM_C, false);
Http2Stream streamD = connection.local().createStream(STREAM_D, false);
setPriority(streamC.id(), STREAM_A, DEFAULT_PRIORITY_WEIGHT, false);
setPriority(streamD.id(), STREAM_A, DEFAULT_PRIORITY_WEIGHT, false);
}
/**
* In this test, we block B such that it has no frames. We distribute enough bytes for all streams and stream B
* should be preserved in the priority queue structure until it has no "active" children, but it should not be
* doubly added to stream 0.
*
* <pre>
* 0
* |
* A
* |
* [B]
* |
* C
* |
* D
* </pre>
*
* After the write:
* <pre>
* 0
* </pre>
*/
@Test
public void writeWithNonActiveStreamShouldNotDobuleAddToPriorityQueue() throws Http2Exception {
initState(STREAM_A, 400, true);
initState(STREAM_B, 500, true);
initState(STREAM_C, 600, true);
initState(STREAM_D, 700, true);
setPriority(STREAM_B, STREAM_A, DEFAULT_PRIORITY_WEIGHT, true);
setPriority(STREAM_D, STREAM_C, DEFAULT_PRIORITY_WEIGHT, true);
// Block B, but it should still remain in the queue/tree structure.
initState(STREAM_B, 0, false);
// Get the streams before the write, because they may be closed.
Http2Stream streamA = stream(STREAM_A);
Http2Stream streamB = stream(STREAM_B);
Http2Stream streamC = stream(STREAM_C);
Http2Stream streamD = stream(STREAM_D);
reset(writer);
doAnswer(writeAnswer(true)).when(writer).write(any(Http2Stream.class), anyInt());
assertFalse(write(400 + 600 + 700));
assertEquals(400, captureWrites(streamA));
verifyNeverWrite(streamB);
assertEquals(600, captureWrites(streamC));
assertEquals(700, captureWrites(streamD));
Defined In
Source
Frequently Asked Questions
What is the WeightedFairQueueByteDistributorTest class?
WeightedFairQueueByteDistributorTest is a class in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributorTest.java.
Where is WeightedFairQueueByteDistributorTest defined?
WeightedFairQueueByteDistributorTest is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributorTest.java at line 43.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free