use of io.lettuce.core.protocol.RedisCommand in project lettuce-core by lettuce-io.
the class CommandSegmentCommandFactory method createCommand.
@Override
public RedisCommand<Object, Object, Object> createCommand(Object[] parameters) {
MethodParametersAccessor parametersAccessor = new CodecAwareMethodParametersAccessor(new DefaultMethodParametersAccessor(commandMethod.getParameters(), parameters), typeContext);
CommandArgs<Object, Object> args = new CommandArgs<>(redisCodec);
CommandOutput<Object, Object, ?> output = outputFactory.create(redisCodec);
Command<Object, Object, ?> command = new Command<>(this.segments.getCommandType(), output, args);
parameterBinder.bind(args, redisCodec, segments, parametersAccessor);
return (Command) command;
}
use of io.lettuce.core.protocol.RedisCommand in project lettuce-core by lettuce-io.
the class ReactiveBackpressurePropagationUnitTests method before.
@BeforeEach
void before() {
when(clientResources.commandLatencyRecorder()).thenReturn(latencyCollector);
when(clientResources.tracing()).thenReturn(Tracing.disabled());
when(statefulConnection.dispatch(any(RedisCommand.class))).thenAnswer(invocation -> {
RedisCommand command = (RedisCommand) invocation.getArguments()[0];
embeddedChannel.writeOutbound(command);
return command;
});
commandHandler = new CommandHandler(ClientOptions.create(), clientResources, endpoint);
embeddedChannel = new EmbeddedChannel(commandHandler);
embeddedChannel.connect(new LocalAddress("remote"));
}
use of io.lettuce.core.protocol.RedisCommand in project lettuce-core by lettuce-io.
the class MasterReplicaTopologyRefreshUnitTests method before.
@BeforeEach
void before() {
executorService = new ScheduledThreadPoolExecutor(1, new DefaultThreadFactory(getClass().getSimpleName(), true));
when(connection.closeAsync()).thenReturn(CompletableFuture.completedFuture(null));
when(connection.async()).thenReturn(async);
when(connection.dispatch(any(RedisCommand.class))).then(invocation -> {
RedisCommand command = invocation.getArgument(0);
command.complete();
return null;
});
provider = () -> Arrays.asList(UPSTREAM, REPLICA);
}
Aggregations