Search in sources :

Example 11 with ErrorResponse

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());
}
Also used : Status(org.apache.ignite.raft.jraft.Status) ErrorResponse(org.apache.ignite.raft.jraft.rpc.RpcRequests.ErrorResponse) Test(org.junit.jupiter.api.Test)

Example 12 with ErrorResponse

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());
}
Also used : ErrorResponse(org.apache.ignite.raft.jraft.rpc.RpcRequests.ErrorResponse) Test(org.junit.jupiter.api.Test)

Example 13 with ErrorResponse

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());
}
Also used : ErrorResponse(org.apache.ignite.raft.jraft.rpc.RpcRequests.ErrorResponse) Test(org.junit.jupiter.api.Test)

Example 14 with ErrorResponse

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());
}
Also used : ErrorResponse(org.apache.ignite.raft.jraft.rpc.RpcRequests.ErrorResponse) Test(org.junit.jupiter.api.Test)

Example 15 with ErrorResponse

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());
}
Also used : MockAsyncContext(org.apache.ignite.raft.jraft.test.MockAsyncContext) RaftMessagesFactory(org.apache.ignite.raft.jraft.RaftMessagesFactory) ErrorResponse(org.apache.ignite.raft.jraft.rpc.RpcRequests.ErrorResponse) Test(org.junit.jupiter.api.Test)

Aggregations

ErrorResponse (org.apache.ignite.raft.jraft.rpc.RpcRequests.ErrorResponse)24 Test (org.junit.jupiter.api.Test)20 Status (org.apache.ignite.raft.jraft.Status)5 Node (org.apache.ignite.raft.jraft.Node)4 PeerId (org.apache.ignite.raft.jraft.entity.PeerId)4 Message (org.apache.ignite.raft.jraft.rpc.Message)4 PingRequest (org.apache.ignite.raft.jraft.rpc.RpcRequests.PingRequest)3 NodeId (org.apache.ignite.raft.jraft.entity.NodeId)2 InvokeTimeoutException (org.apache.ignite.raft.jraft.error.InvokeTimeoutException)2 JRaftException (org.apache.ignite.raft.jraft.error.JRaftException)2 RemotingException (org.apache.ignite.raft.jraft.error.RemotingException)2 RpcClient (org.apache.ignite.raft.jraft.rpc.RpcClient)2 ConnectException (java.net.ConnectException)1 ArrayList (java.util.ArrayList)1 Executor (java.util.concurrent.Executor)1 RaftMessagesFactory (org.apache.ignite.raft.jraft.RaftMessagesFactory)1 GetLeaderRequest (org.apache.ignite.raft.jraft.rpc.CliRequests.GetLeaderRequest)1 GetLeaderResponse (org.apache.ignite.raft.jraft.rpc.CliRequests.GetLeaderResponse)1 GetPeersRequest (org.apache.ignite.raft.jraft.rpc.CliRequests.GetPeersRequest)1 GetPeersResponse (org.apache.ignite.raft.jraft.rpc.CliRequests.GetPeersResponse)1