use of ru.fix.commons.profiler.Profiler in project completable-reactor by ru-fix.
the class GlProfilingTest method trace_payload_if_payload_contain_special_id.
@Test
public void trace_payload_if_payload_contain_special_id() throws Exception {
Profiler profiler = mock(Profiler.class);
ProfiledCall profiledCall = mock(ProfiledCall.class);
when(profiler.profiledCall(any())).thenReturn(profiledCall);
when(profiledCall.start()).thenReturn(profiledCall);
final CompletableReactor completableReactor = new CompletableReactor(profiler);
SimpleGraph graph = new SimpleGraph();
completableReactor.registerGraph(graph);
for (int num = 0; num < 10; num++) {
completableReactor.submit(new TracablePayload().setNumber(num));
}
completableReactor.close();
verify(profiler, times(80)).profiledCall(any());
verify(profiler, times(10)).profiledCall(prefix(ProfilerNames.PAYLOAD));
verify(profiler, times(10)).profiledCall(prefix(ProfilerNames.EXECUTION));
verify(profiler, times(10)).profiledCall(prefix(ProfilerNames.HANDLE) + ".processor1");
verify(profiler, times(10)).profiledCall(prefix(ProfilerNames.HANDLE) + ".processor2");
verify(profiler, times(10)).profiledCall(prefix(ProfilerNames.HANDLE) + ".processor3");
verify(profiler, times(10)).profiledCall(prefix(ProfilerNames.MERGE) + ".processor1");
verify(profiler, times(10)).profiledCall(prefix(ProfilerNames.MERGE) + ".processor2");
verify(profiler, times(10)).profiledCall(prefix(ProfilerNames.MERGE) + ".processor3");
}
Aggregations