Home / Function/ testRatio() — netty Function Reference

testRatio() — netty Function Reference

Architecture documentation for the testRatio() function in DefaultHttp2LocalFlowControllerTest.java from the netty codebase.

Function java Buffer Allocators calls 5 called by 2

Entity Profile

Dependency Diagram

graph TD
  fd272f17_5355_f858_66ce_9589707e9fbd["testRatio()"]
  99976e08_de48_4e06_40e5_5ee3655f2651["DefaultHttp2LocalFlowControllerTest"]
  fd272f17_5355_f858_66ce_9589707e9fbd -->|defined in| 99976e08_de48_4e06_40e5_5ee3655f2651
  c98dd60c_ab10_2673_9f67_14a764444aa3["globalRatioShouldImpactStreams()"]
  c98dd60c_ab10_2673_9f67_14a764444aa3 -->|calls| fd272f17_5355_f858_66ce_9589707e9fbd
  8beb3781_006a_2793_625d_172365ac46b6["streamlRatioShouldImpactStreams()"]
  8beb3781_006a_2793_625d_172365ac46b6 -->|calls| fd272f17_5355_f858_66ce_9589707e9fbd
  62113048_84a9_1cf9_75f0_0ef0f3788315["receiveFlowControlledFrame()"]
  fd272f17_5355_f858_66ce_9589707e9fbd -->|calls| 62113048_84a9_1cf9_75f0_0ef0f3788315
  0704ea53_57a1_5305_109e_c7f112548050["verifyWindowUpdateNotSent()"]
  fd272f17_5355_f858_66ce_9589707e9fbd -->|calls| 0704ea53_57a1_5305_109e_c7f112548050
  7909b4ee_a611_4e8b_f2d5_96e89a175713["window()"]
  fd272f17_5355_f858_66ce_9589707e9fbd -->|calls| 7909b4ee_a611_4e8b_f2d5_96e89a175713
  5afc6fae_8360_072c_1a3a_5b5aa174554d["consumeBytes()"]
  fd272f17_5355_f858_66ce_9589707e9fbd -->|calls| 5afc6fae_8360_072c_1a3a_5b5aa174554d
  edb012e8_f760_5fb6_314e_77a6bfaf20b0["verifyWindowUpdateSent()"]
  fd272f17_5355_f858_66ce_9589707e9fbd -->|calls| edb012e8_f760_5fb6_314e_77a6bfaf20b0
  style fd272f17_5355_f858_66ce_9589707e9fbd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2LocalFlowControllerTest.java lines 367–399

    private void testRatio(float ratio, int newDefaultWindowSize, int newStreamId, boolean setStreamRatio)
            throws Http2Exception {
        int delta = newDefaultWindowSize - DEFAULT_WINDOW_SIZE;
        controller.incrementWindowSize(stream(0), delta);
        Http2Stream stream = connection.local().createStream(newStreamId, false);
        if (setStreamRatio) {
            controller.windowUpdateRatio(stream, ratio);
        }
        controller.incrementWindowSize(stream, delta);
        reset(frameWriter);
        try {
            int data1 = (int) (newDefaultWindowSize * ratio) + 1;
            int data2 = (int) (DEFAULT_WINDOW_SIZE * DEFAULT_WINDOW_UPDATE_RATIO) >> 1;
            receiveFlowControlledFrame(STREAM_ID, data2, 0, false);
            receiveFlowControlledFrame(newStreamId, data1, 0, false);
            verifyWindowUpdateNotSent(STREAM_ID);
            verifyWindowUpdateNotSent(newStreamId);
            verifyWindowUpdateNotSent(CONNECTION_STREAM_ID);
            assertEquals(DEFAULT_WINDOW_SIZE - data2, window(STREAM_ID));
            assertEquals(newDefaultWindowSize - data1, window(newStreamId));
            assertEquals(newDefaultWindowSize - data2 - data1, window(CONNECTION_STREAM_ID));
            assertFalse(consumeBytes(STREAM_ID, data2));
            assertTrue(consumeBytes(newStreamId, data1));
            verifyWindowUpdateNotSent(STREAM_ID);
            verifyWindowUpdateSent(newStreamId, data1);
            verifyWindowUpdateSent(CONNECTION_STREAM_ID, data1 + data2);
            assertEquals(DEFAULT_WINDOW_SIZE - data2, window(STREAM_ID));
            assertEquals(newDefaultWindowSize, window(newStreamId));
            assertEquals(newDefaultWindowSize, window(CONNECTION_STREAM_ID));
        } finally {
            connection.stream(newStreamId).close();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testRatio() do?
testRatio() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2LocalFlowControllerTest.java.
Where is testRatio() defined?
testRatio() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2LocalFlowControllerTest.java at line 367.
What does testRatio() call?
testRatio() calls 5 function(s): consumeBytes, receiveFlowControlledFrame, verifyWindowUpdateNotSent, verifyWindowUpdateSent, window.
What calls testRatio()?
testRatio() is called by 2 function(s): globalRatioShouldImpactStreams, streamlRatioShouldImpactStreams.

Analyze Your Own Codebase

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

Try Supermodel Free