3
3
import core .framework .inject .Inject ;
4
4
import core .framework .kafka .Message ;
5
5
import core .framework .log .message .ActionLogMessage ;
6
+ import core .framework .log .message .PerformanceStatMessage ;
6
7
import core .framework .util .Files ;
7
8
import core .log .IntegrationTest ;
8
9
import core .log .domain .ActionLogSchema ;
20
21
* @author neo
21
22
*/
22
23
class ActionLogMessageHandlerTest extends IntegrationTest {
23
- private ActionLogMessageHandler handler ;
24
24
@ Inject
25
25
ActionLogSchema schema ;
26
+ private ActionLogMessageHandler handler ;
26
27
27
28
@ BeforeEach
28
29
void createActionLogMessageHandler () {
@@ -48,9 +49,19 @@ void handle() throws IOException {
48
49
message .host = "host" ;
49
50
message .elapsed = 1000L ;
50
51
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 ));
52
54
message .traceLog = "trace" ;
53
55
handler .handle (List .of (new Message <>("key" , message )));
54
56
handler .handle (List .of (new Message <>("key" , message )));
55
57
}
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
+ }
56
67
}
0 commit comments