Search in sources :

Example 1 with DataStreamMap

use of org.apache.ratis.server.DataStreamMap in project incubator-ratis by apache.

the class TestNettyDataStreamWithMock method mockDivision.

RaftServer.Division mockDivision(RaftServer server, RaftClient client) {
    final RaftServer.Division division = mock(RaftServer.Division.class);
    when(division.getRaftServer()).thenReturn(server);
    when(division.getRaftClient()).thenReturn(client);
    when(division.getRaftConf()).thenAnswer(i -> getRaftConf());
    final MultiDataStreamStateMachine stateMachine = new MultiDataStreamStateMachine();
    when(division.getStateMachine()).thenReturn(stateMachine);
    final DataStreamMap streamMap = RaftServerTestUtil.newDataStreamMap(server.getId());
    when(division.getDataStreamMap()).thenReturn(streamMap);
    return division;
}
Also used : RaftServer(org.apache.ratis.server.RaftServer) MultiDataStreamStateMachine(org.apache.ratis.datastream.DataStreamTestUtils.MultiDataStreamStateMachine) DataStreamMap(org.apache.ratis.server.DataStreamMap)

Aggregations

MultiDataStreamStateMachine (org.apache.ratis.datastream.DataStreamTestUtils.MultiDataStreamStateMachine)1 DataStreamMap (org.apache.ratis.server.DataStreamMap)1 RaftServer (org.apache.ratis.server.RaftServer)1