Search in sources :

Example 1 with DefaultCommandLatencyCollector

use of io.lettuce.core.metrics.DefaultCommandLatencyCollector in project lettuce-core by lettuce-io.

the class PubSubCommandHandlerUnitTests method before.

@SuppressWarnings("unchecked")
@BeforeEach
void before() {
    when(channel.config()).thenReturn(channelConfig);
    when(context.alloc()).thenReturn(ByteBufAllocator.DEFAULT);
    when(context.channel()).thenReturn(channel);
    when(channel.pipeline()).thenReturn(pipeline);
    when(channel.eventLoop()).thenReturn(eventLoop);
    when(eventLoop.submit(any(Runnable.class))).thenAnswer(invocation -> {
        Runnable r = (Runnable) invocation.getArguments()[0];
        r.run();
        return null;
    });
    when(clientResources.commandLatencyRecorder()).thenReturn(new DefaultCommandLatencyCollector(DefaultCommandLatencyCollectorOptions.create()));
    when(clientResources.tracing()).thenReturn(Tracing.disabled());
    sut = new PubSubCommandHandler<>(ClientOptions.create(), clientResources, StringCodec.UTF8, endpoint);
    stack = (Queue) ReflectionTestUtils.getField(sut, "stack");
}
Also used : DefaultCommandLatencyCollector(io.lettuce.core.metrics.DefaultCommandLatencyCollector) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

DefaultCommandLatencyCollector (io.lettuce.core.metrics.DefaultCommandLatencyCollector)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1