Home / Function/ cleanRequestHttpDataShouldIdentifiesRequestsByTheirIdentities() — netty Function Reference

cleanRequestHttpDataShouldIdentifiesRequestsByTheirIdentities() — netty Function Reference

Architecture documentation for the cleanRequestHttpDataShouldIdentifiesRequestsByTheirIdentities() function in DefaultHttpDataFactoryTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  243b0f70_4565_86e5_51cb_ed39ca113085["cleanRequestHttpDataShouldIdentifiesRequestsByTheirIdentities()"]
  1a20c5f5_1b82_e72a_f3bd_2eeffc52e856["DefaultHttpDataFactoryTest"]
  243b0f70_4565_86e5_51cb_ed39ca113085 -->|defined in| 1a20c5f5_1b82_e72a_f3bd_2eeffc52e856
  style 243b0f70_4565_86e5_51cb_ed39ca113085 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/multipart/DefaultHttpDataFactoryTest.java lines 75–115

    @Test
    public void cleanRequestHttpDataShouldIdentifiesRequestsByTheirIdentities() throws Exception {
        // Create some data belonging to req1 and req2
        Attribute attribute1 = factory.createAttribute(req1, "attribute1", "value1");
        Attribute attribute2 = factory.createAttribute(req2, "attribute2", "value2");
        FileUpload file1 = factory.createFileUpload(
                req1, "file1", "file1.txt",
                DEFAULT_TEXT_CONTENT_TYPE, IDENTITY.toString(), UTF_8, 123
        );
        FileUpload file2 = factory.createFileUpload(
                req2, "file2", "file2.txt",
                DEFAULT_TEXT_CONTENT_TYPE, IDENTITY.toString(), UTF_8, 123
        );
        file1.setContent(Unpooled.copiedBuffer("file1 content", UTF_8));
        file2.setContent(Unpooled.copiedBuffer("file2 content", UTF_8));

        // Assert that they are not deleted
        assertNotNull(attribute1.getByteBuf());
        assertNotNull(attribute2.getByteBuf());
        assertNotNull(file1.getByteBuf());
        assertNotNull(file2.getByteBuf());
        assertEquals(1, attribute1.refCnt());
        assertEquals(1, attribute2.refCnt());
        assertEquals(1, file1.refCnt());
        assertEquals(1, file2.refCnt());

        // Clean up by req1
        factory.cleanRequestHttpData(req1);

        // Assert that data belonging to req1 has been cleaned up
        assertNull(attribute1.getByteBuf());
        assertNull(file1.getByteBuf());
        assertEquals(0, attribute1.refCnt());
        assertEquals(0, file1.refCnt());

        // But not req2
        assertNotNull(attribute2.getByteBuf());
        assertNotNull(file2.getByteBuf());
        assertEquals(1, attribute2.refCnt());
        assertEquals(1, file2.refCnt());
    }

Domain

Subdomains

Frequently Asked Questions

What does cleanRequestHttpDataShouldIdentifiesRequestsByTheirIdentities() do?
cleanRequestHttpDataShouldIdentifiesRequestsByTheirIdentities() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/DefaultHttpDataFactoryTest.java.
Where is cleanRequestHttpDataShouldIdentifiesRequestsByTheirIdentities() defined?
cleanRequestHttpDataShouldIdentifiesRequestsByTheirIdentities() is defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/DefaultHttpDataFactoryTest.java at line 75.

Analyze Your Own Codebase

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

Try Supermodel Free