use of io.atomix.protocols.raft.impl.RaftContext in project atomix by atomix.
the class RaftSessionsTest method createSession.
private RaftSession createSession(long sessionId) {
RaftServiceContext context = mock(RaftServiceContext.class);
when(context.serviceType()).thenReturn(new TestPrimitiveType());
when(context.serviceName()).thenReturn("test");
when(context.serviceId()).thenReturn(PrimitiveId.from(1));
RaftContext server = mock(RaftContext.class);
when(server.getProtocol()).thenReturn(mock(RaftServerProtocol.class));
RaftServiceManager manager = mock(RaftServiceManager.class);
when(manager.executor()).thenReturn(mock(ThreadContext.class));
when(server.getServiceManager()).thenReturn(manager);
return new RaftSession(SessionId.from(sessionId), NodeId.from("1"), "test", new TestPrimitiveType(), ReadConsistency.LINEARIZABLE, 100, 5000, System.currentTimeMillis(), context, server, mock(ThreadContextFactory.class));
}
use of io.atomix.protocols.raft.impl.RaftContext in project atomix by atomix.
the class RaftSessionRegistryTest method createSession.
private RaftSession createSession(long sessionId) {
RaftServiceContext context = mock(RaftServiceContext.class);
when(context.serviceType()).thenReturn(new TestPrimitiveType());
when(context.serviceName()).thenReturn("test");
when(context.serviceId()).thenReturn(PrimitiveId.from(1));
RaftContext server = mock(RaftContext.class);
when(server.getProtocol()).thenReturn(mock(RaftServerProtocol.class));
RaftServiceManager manager = mock(RaftServiceManager.class);
when(manager.executor()).thenReturn(mock(ThreadContext.class));
when(server.getServiceManager()).thenReturn(manager);
return new RaftSession(SessionId.from(sessionId), NodeId.from("1"), "test", new TestPrimitiveType(), ReadConsistency.LINEARIZABLE, 100, 5000, System.currentTimeMillis(), context, server, mock(ThreadContextFactory.class));
}
Aggregations