use of org.apache.ignite.raft.jraft.rpc.RpcRequests.ErrorResponse in project ignite-3 by apache.
the class RpcResponseFactoryTest method testNewResponseWithErrorStatus.
@Test
public void testNewResponseWithErrorStatus() {
ErrorResponse response = (ErrorResponse) RaftRpcFactory.DEFAULT.newResponse(msgFactory, new Status(300, "test"));
assertEquals(300, response.errorCode());
assertEquals("test", response.errorMsg());
}
use of org.apache.ignite.raft.jraft.rpc.RpcRequests.ErrorResponse in project ignite-3 by apache.
the class RpcResponseFactoryTest method testNewResponseWithArgs.
@Test
public void testNewResponseWithArgs() {
ErrorResponse response = (ErrorResponse) RaftRpcFactory.DEFAULT.newResponse(msgFactory, 300, "hello world");
assertEquals(300, response.errorCode());
assertEquals("hello world", response.errorMsg());
}
use of org.apache.ignite.raft.jraft.rpc.RpcRequests.ErrorResponse in project ignite-3 by apache.
the class RpcResponseFactoryTest method testNewResponseWithRaftError.
@Test
public void testNewResponseWithRaftError() {
ErrorResponse response = (ErrorResponse) RaftRpcFactory.DEFAULT.newResponse(msgFactory, RaftError.EAGAIN, "hello world");
assertEquals(response.errorCode(), RaftError.EAGAIN.getNumber());
assertEquals("hello world", response.errorMsg());
}
use of org.apache.ignite.raft.jraft.rpc.RpcRequests.ErrorResponse in project ignite-3 by apache.
the class RpcResponseFactoryTest method testNewResponseWithVaridicArgs.
@Test
public void testNewResponseWithVaridicArgs() {
ErrorResponse response = (ErrorResponse) RaftRpcFactory.DEFAULT.newResponse(msgFactory, 300, "hello %s %d", "world", 99);
assertEquals(300, response.errorCode());
assertEquals("hello world 99", response.errorMsg());
}
use of org.apache.ignite.raft.jraft.rpc.RpcRequests.ErrorResponse in project ignite-3 by apache.
the class PingRequestProcessorTest method testHandlePing.
@Test
public void testHandlePing() throws Exception {
PingRequestProcessor processor = new PingRequestProcessor(null, new RaftMessagesFactory());
MockAsyncContext ctx = new MockAsyncContext();
processor.handleRequest(ctx, TestUtils.createPingRequest());
ErrorResponse response = (ErrorResponse) ctx.getResponseObject();
assertEquals(0, response.errorCode());
}
Aggregations