use of org.apache.ignite.raft.jraft.option.NodeOptions in project ignite-3 by apache.
the class IgniteRpcTest method createServer.
/**
* {@inheritDoc}
*/
@Override
public RpcServer<?> createServer(Endpoint endpoint) {
ClusterService service = ClusterServiceTestUtils.clusterService(testInfo, endpoint.getPort(), new StaticNodeFinder(Collections.emptyList()), new TestScaleCubeClusterServiceFactory());
NodeOptions nodeOptions = new NodeOptions();
requestExecutor = JRaftUtils.createRequestExecutor(nodeOptions);
var server = new TestIgniteRpcServer(service, new NodeManager(), nodeOptions, requestExecutor) {
@Override
public void shutdown() {
super.shutdown();
service.stop();
}
};
service.start();
return server;
}
use of org.apache.ignite.raft.jraft.option.NodeOptions in project ignite-3 by apache.
the class AbstractCliRequestProcessorTest method testHandleRequest.
@Test
public void testHandleRequest() {
this.mockNodes(3);
Mockito.when(this.node.getGroupId()).thenReturn(this.groupId);
PeerId peerId = new PeerId();
peerId.parse(this.peerIdStr);
Mockito.when(this.node.getOptions()).thenReturn(new NodeOptions());
Mockito.when(this.node.getNodeId()).thenReturn(new NodeId("test", peerId));
if (asyncContext != null)
asyncContext.getNodeManager().add(node);
BaseCliRequestProcessor<T> processor = newProcessor();
processor.handleRequest(this.asyncContext, createRequest(this.groupId, peerId));
ArgumentCaptor<Closure> doneArg = ArgumentCaptor.forClass(Closure.class);
verify(processor.interest(), this.node, doneArg);
}
use of org.apache.ignite.raft.jraft.option.NodeOptions in project ignite-3 by apache.
the class BaseCliRequestProcessorTest method mockNode.
private Node mockNode(boolean disableCli) {
Node node = Mockito.mock(Node.class);
Mockito.when(node.getGroupId()).thenReturn("test");
Mockito.when(node.getNodeId()).thenReturn(new NodeId("test", this.peer.copy()));
NodeOptions opts = new NodeOptions();
opts.setDisableCli(disableCli);
Mockito.when(node.getOptions()).thenReturn(opts);
this.asyncContext.getNodeManager().add(node);
return node;
}
use of org.apache.ignite.raft.jraft.option.NodeOptions in project ignite-3 by apache.
the class BallotBoxTest method setup.
@BeforeEach
public void setup() {
BallotBoxOptions opts = new BallotBoxOptions();
NodeOptions options = new NodeOptions();
executor = JRaftUtils.createExecutor("test-executor-", Utils.cpus());
options.setCommonExecutor(executor);
this.closureQueue = new ClosureQueueImpl(options);
opts.setClosureQueue(this.closureQueue);
opts.setWaiter(this.waiter);
box = new BallotBox();
assertTrue(box.init(opts));
}
Aggregations