StompCommandDecodeTest Class — netty Architecture
Architecture documentation for the StompCommandDecodeTest class in StompCommandDecodeTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 7eef5b97_771d_0d5a_9790_1b825883d794["StompCommandDecodeTest"] 6e0bb518_6e6e_1aa1_3080_c1e215e4cd63["StompCommandDecodeTest.java"] 7eef5b97_771d_0d5a_9790_1b825883d794 -->|defined in| 6e0bb518_6e6e_1aa1_3080_c1e215e4cd63 38ccf741_e743_70be_428e_054290ceff56["setUp()"] 7eef5b97_771d_0d5a_9790_1b825883d794 -->|method| 38ccf741_e743_70be_428e_054290ceff56 e0b74c68_8666_c638_8f02_db8b6398d359["tearDown()"] 7eef5b97_771d_0d5a_9790_1b825883d794 -->|method| e0b74c68_8666_c638_8f02_db8b6398d359 be4ba3fc_8679_585f_74d6_d0be3be07e1b["testDecodeCommand()"] 7eef5b97_771d_0d5a_9790_1b825883d794 -->|method| be4ba3fc_8679_585f_74d6_d0be3be07e1b 0f5da8e9_036d_3bcb_8b96_d8b9bad735a8["stompCommands()"] 7eef5b97_771d_0d5a_9790_1b825883d794 -->|method| 0f5da8e9_036d_3bcb_8b96_d8b9bad735a8
Relationship Graph
Source Code
codec-stomp/src/test/java/io/netty/handler/codec/stomp/StompCommandDecodeTest.java lines 36–93
public class StompCommandDecodeTest {
private EmbeddedChannel channel;
@BeforeEach
public void setUp() {
channel = new EmbeddedChannel(new StompSubframeDecoder(true));
}
@AfterEach
public void tearDown() {
assertFalse(channel.finish());
}
@ParameterizedTest(name = "{index}: testDecodeCommand({0}) = {1}")
@MethodSource("stompCommands")
public void testDecodeCommand(String rawCommand, StompCommand expectedCommand, Boolean valid) {
byte[] frameContent = String.format("%s\n\n\0", rawCommand).getBytes(UTF_8);
ByteBuf incoming = Unpooled.wrappedBuffer(frameContent);
assertTrue(channel.writeInbound(incoming));
StompHeadersSubframe frame = channel.readInbound();
assertNotNull(frame);
assertEquals(expectedCommand, frame.command());
if (valid) {
assertTrue(frame.decoderResult().isSuccess());
StompContentSubframe content = channel.readInbound();
assertSame(LastStompContentSubframe.EMPTY_LAST_CONTENT, content);
content.release();
} else {
assertTrue(frame.decoderResult().isFailure());
assertNull(channel.readInbound());
}
}
public static Collection<Object[]> stompCommands() {
return Arrays.asList(new Object[][] {
{ "STOMP", StompCommand.STOMP, true },
{ "CONNECT", StompCommand.CONNECT, true },
{ "SEND", StompCommand.SEND, true },
{ "SUBSCRIBE", StompCommand.SUBSCRIBE, true },
{ "UNSUBSCRIBE", StompCommand.UNSUBSCRIBE, true },
{ "ACK", StompCommand.ACK, true },
{ "NACK", StompCommand.NACK, true },
{ "BEGIN", StompCommand.BEGIN, true },
{ "ABORT", StompCommand.ABORT, true },
{ "COMMIT", StompCommand.COMMIT, true },
{ "DISCONNECT", StompCommand.DISCONNECT, true },
// invalid commands
{ "INVALID", StompCommand.UNKNOWN, false },
{ "disconnect", StompCommand.UNKNOWN , false }
});
}
}
Source
Frequently Asked Questions
What is the StompCommandDecodeTest class?
StompCommandDecodeTest is a class in the netty codebase, defined in codec-stomp/src/test/java/io/netty/handler/codec/stomp/StompCommandDecodeTest.java.
Where is StompCommandDecodeTest defined?
StompCommandDecodeTest is defined in codec-stomp/src/test/java/io/netty/handler/codec/stomp/StompCommandDecodeTest.java at line 36.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free