XmlDecoderTest Class — netty Architecture
Architecture documentation for the XmlDecoderTest class in XmlDecoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 71eec9e7_c739_c052_076b_29d3db70b0ba["XmlDecoderTest"] d5820525_7620_a4b0_17a0_bb30d9358db3["XmlDecoderTest.java"] 71eec9e7_c739_c052_076b_29d3db70b0ba -->|defined in| d5820525_7620_a4b0_17a0_bb30d9358db3 3866d973_d8ad_194c_58f9_c3b05fc4cbf5["setup()"] 71eec9e7_c739_c052_076b_29d3db70b0ba -->|method| 3866d973_d8ad_194c_58f9_c3b05fc4cbf5 afc7cbfc_386a_fbe5_6895_d33c1ce001b1["teardown()"] 71eec9e7_c739_c052_076b_29d3db70b0ba -->|method| afc7cbfc_386a_fbe5_6895_d33c1ce001b1 3ecf4d63_ddf8_eb13_f06c_45dc5a335c62["shouldDecodeRequestWithSimpleXml()"] 71eec9e7_c739_c052_076b_29d3db70b0ba -->|method| 3ecf4d63_ddf8_eb13_f06c_45dc5a335c62 14a4f974_f52a_836b_a6fc_21f8a0a5b690["shouldDecodeXmlHeader()"] 71eec9e7_c739_c052_076b_29d3db70b0ba -->|method| 14a4f974_f52a_836b_a6fc_21f8a0a5b690 fbaf90be_e82f_9da2_b0a4_c1860c9f2f1f["shouldDecodeWithoutHeader()"] 71eec9e7_c739_c052_076b_29d3db70b0ba -->|method| fbaf90be_e82f_9da2_b0a4_c1860c9f2f1f 5d218799_ef8a_7b9b_ae2d_2b4c7274a9db["write()"] 71eec9e7_c739_c052_076b_29d3db70b0ba -->|method| 5d218799_ef8a_7b9b_ae2d_2b4c7274a9db
Relationship Graph
Source Code
codec-xml/src/test/java/io/netty/handler/codec/xml/XmlDecoderTest.java lines 37–301
public class XmlDecoderTest {
private static final String XML1 = "<?xml version=\"1.0\"?>" +
"<!DOCTYPE employee SYSTEM \"employee.dtd\">" +
"<?xml-stylesheet type=\"text/css\" href=\"netty.css\"?>" +
"<?xml-test ?>" +
"<employee xmlns:nettya=\"https://netty.io/netty/a\">" +
"<nettya:id>±1</nettya:id>\n" +
"<name ";
private static final String XML2 = "type=\"given\">Alba</name><![CDATA[ <some data >/> ]]>" +
" <!-- namespaced --><nettyb:salary xmlns:nettyb=\"https://netty.io/netty/b\" nettyb:period=\"weekly\">" +
"100</nettyb:salary><last/></employee>";
private static final String XML3 = "<?xml version=\"1.1\" encoding=\"UTf-8\" standalone=\"yes\"?><netty></netty>";
private static final String XML4 = "<netty></netty>";
private EmbeddedChannel channel;
@BeforeEach
public void setup() throws Exception {
channel = new EmbeddedChannel(new XmlDecoder());
}
@AfterEach
public void teardown() throws Exception {
channel.finish();
}
/**
* This test feeds basic XML and verifies the resulting messages
*/
@Test
public void shouldDecodeRequestWithSimpleXml() {
Object temp;
write(XML1);
temp = channel.readInbound();
assertInstanceOf(XmlDocumentStart.class, temp);
assertEquals("1.0", ((XmlDocumentStart) temp).version());
assertEquals("UTF-8", ((XmlDocumentStart) temp).encoding());
assertFalse(((XmlDocumentStart) temp).standalone());
assertNull(((XmlDocumentStart) temp).encodingScheme());
temp = channel.readInbound();
assertInstanceOf(XmlDTD.class, temp);
assertEquals("employee.dtd", ((XmlDTD) temp).text());
temp = channel.readInbound();
assertInstanceOf(XmlProcessingInstruction.class, temp);
assertEquals("xml-stylesheet", ((XmlProcessingInstruction) temp).target());
assertEquals("type=\"text/css\" href=\"netty.css\"", ((XmlProcessingInstruction) temp).data());
temp = channel.readInbound();
assertInstanceOf(XmlProcessingInstruction.class, temp);
assertEquals("xml-test", ((XmlProcessingInstruction) temp).target());
assertEquals("", ((XmlProcessingInstruction) temp).data());
temp = channel.readInbound();
assertInstanceOf(XmlElementStart.class, temp);
assertEquals("employee", ((XmlElementStart) temp).name());
assertEquals("", ((XmlElementStart) temp).prefix());
assertEquals("", ((XmlElementStart) temp).namespace());
assertEquals(0, ((XmlElementStart) temp).attributes().size());
assertEquals(1, ((XmlElementStart) temp).namespaces().size());
assertEquals("nettya", ((XmlElementStart) temp).namespaces().get(0).prefix());
assertEquals("https://netty.io/netty/a", ((XmlElementStart) temp).namespaces().get(0).uri());
temp = channel.readInbound();
assertInstanceOf(XmlElementStart.class, temp);
assertEquals("id", ((XmlElementStart) temp).name());
assertEquals("nettya", ((XmlElementStart) temp).prefix());
assertEquals("https://netty.io/netty/a", ((XmlElementStart) temp).namespace());
assertEquals(0, ((XmlElementStart) temp).attributes().size());
assertEquals(0, ((XmlElementStart) temp).namespaces().size());
temp = channel.readInbound();
assertInstanceOf(XmlEntityReference.class, temp);
assertEquals("plusmn", ((XmlEntityReference) temp).name());
Source
Frequently Asked Questions
What is the XmlDecoderTest class?
XmlDecoderTest is a class in the netty codebase, defined in codec-xml/src/test/java/io/netty/handler/codec/xml/XmlDecoderTest.java.
Where is XmlDecoderTest defined?
XmlDecoderTest is defined in codec-xml/src/test/java/io/netty/handler/codec/xml/XmlDecoderTest.java at line 37.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free