33import core .framework .inject .Inject ;
44import core .framework .kafka .Message ;
55import core .framework .log .message .ActionLogMessage ;
6+ import core .framework .log .message .PerformanceStatMessage ;
67import core .framework .util .Files ;
78import core .log .IntegrationTest ;
89import core .log .domain .ActionLogSchema ;
2021 * @author neo
2122 */
2223class ActionLogMessageHandlerTest extends IntegrationTest {
23- private ActionLogMessageHandler handler ;
2424 @ Inject
2525 ActionLogSchema schema ;
26+ private ActionLogMessageHandler handler ;
2627
2728 @ BeforeEach
2829 void createActionLogMessageHandler () {
@@ -48,9 +49,19 @@ void handle() throws IOException {
4849 message .host = "host" ;
4950 message .elapsed = 1000L ;
5051 message .context = Map .of ("key" , List .of ("value1" , "value2" ));
51- message .performanceStats = Map .of ();
52+ message .performanceStats = Map .of ("kafka" , perfStats (1 , 1000L , 10 , 5 ),
53+ "http" , perfStats (1 , 2000L , null , null ));
5254 message .traceLog = "trace" ;
5355 handler .handle (List .of (new Message <>("key" , message )));
5456 handler .handle (List .of (new Message <>("key" , message )));
5557 }
58+
59+ private PerformanceStatMessage perfStats (int count , long totalElapsed , Integer readEntries , Integer writeEntries ) {
60+ final PerformanceStatMessage stats = new PerformanceStatMessage ();
61+ stats .count = count ;
62+ stats .totalElapsed = totalElapsed ;
63+ stats .readEntries = readEntries ;
64+ stats .writeEntries = writeEntries ;
65+ return stats ;
66+ }
5667}
0 commit comments