Search in sources :

Example 41 with LogId

use of org.apache.ignite.raft.jraft.entity.LogId in project ignite-3 by apache.

the class FSMCallerTest method setup.

@BeforeEach
public void setup() {
    this.fsmCaller = new FSMCallerImpl();
    NodeOptions options = new NodeOptions();
    executor = JRaftUtils.createExecutor("test-executor-", Utils.cpus());
    options.setCommonExecutor(executor);
    this.closureQueue = new ClosureQueueImpl(options);
    opts = new FSMCallerOptions();
    Mockito.when(this.node.getNodeMetrics()).thenReturn(new NodeMetrics(false));
    Mockito.when(this.node.getOptions()).thenReturn(options);
    opts.setNode(this.node);
    opts.setFsm(this.fsm);
    opts.setLogManager(this.logManager);
    opts.setBootstrapId(new LogId(10, 1));
    opts.setClosureQueue(this.closureQueue);
    opts.setRaftMessagesFactory(new RaftMessagesFactory());
    opts.setGroupId("TestSrv");
    opts.setfSMCallerExecutorDisruptor(disruptor = new StripedDisruptor<>("TestFSMDisruptor", 1024, () -> new FSMCallerImpl.ApplyTask(), 1));
    assertTrue(this.fsmCaller.init(opts));
}
Also used : FSMCallerOptions(org.apache.ignite.raft.jraft.option.FSMCallerOptions) ClosureQueueImpl(org.apache.ignite.raft.jraft.closure.ClosureQueueImpl) RaftMessagesFactory(org.apache.ignite.raft.jraft.RaftMessagesFactory) NodeOptions(org.apache.ignite.raft.jraft.option.NodeOptions) LogId(org.apache.ignite.raft.jraft.entity.LogId) StripedDisruptor(org.apache.ignite.raft.jraft.disruptor.StripedDisruptor) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

LogId (org.apache.ignite.raft.jraft.entity.LogId)41 LogEntry (org.apache.ignite.raft.jraft.entity.LogEntry)24 Test (org.junit.jupiter.api.Test)15 PeerId (org.apache.ignite.raft.jraft.entity.PeerId)14 ArrayList (java.util.ArrayList)10 Status (org.apache.ignite.raft.jraft.Status)10 BaseStorageTest (org.apache.ignite.raft.jraft.storage.BaseStorageTest)9 ConfigurationEntry (org.apache.ignite.raft.jraft.conf.ConfigurationEntry)7 Configuration (org.apache.ignite.raft.jraft.conf.Configuration)5 ByteBuffer (java.nio.ByteBuffer)4 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)4 CountDownLatch (java.util.concurrent.CountDownLatch)4 LogManager (org.apache.ignite.raft.jraft.storage.LogManager)4 ConfigurationManager (org.apache.ignite.raft.jraft.conf.ConfigurationManager)3 StripedDisruptor (org.apache.ignite.raft.jraft.disruptor.StripedDisruptor)2 EntryType (org.apache.ignite.raft.jraft.entity.EnumOutter.EntryType)2 RaftException (org.apache.ignite.raft.jraft.error.RaftException)2 LogStorageOptions (org.apache.ignite.raft.jraft.option.LogStorageOptions)2 NodeOptions (org.apache.ignite.raft.jraft.option.NodeOptions)2 RaftOptions (org.apache.ignite.raft.jraft.option.RaftOptions)2