use of com.alipay.sofa.jraft.entity.LeaderChangeContext in project sofa-jraft by sofastack.
the class FSMCallerTest method testOnStartStopFollowing.
@Test
public void testOnStartStopFollowing() throws Exception {
final LeaderChangeContext ctx = new LeaderChangeContext(null, 11, Status.OK());
this.fsmCaller.onStartFollowing(ctx);
this.fsmCaller.flush();
Mockito.verify(this.fsm).onStartFollowing(ctx);
this.fsmCaller.onStopFollowing(ctx);
this.fsmCaller.flush();
Mockito.verify(this.fsm).onStopFollowing(ctx);
}
use of com.alipay.sofa.jraft.entity.LeaderChangeContext in project sofa-jraft by sofastack.
the class FSMCallerImpl method onStartFollowing.
@Override
public boolean onStartFollowing(final LeaderChangeContext ctx) {
return enqueueTask((task, sequence) -> {
task.type = TaskType.START_FOLLOWING;
task.leaderChangeCtx = new LeaderChangeContext(ctx.getLeaderId(), ctx.getTerm(), ctx.getStatus());
});
}
use of com.alipay.sofa.jraft.entity.LeaderChangeContext in project sofa-jraft by sofastack.
the class FSMCallerImpl method onStopFollowing.
@Override
public boolean onStopFollowing(final LeaderChangeContext ctx) {
return enqueueTask((task, sequence) -> {
task.type = TaskType.STOP_FOLLOWING;
task.leaderChangeCtx = new LeaderChangeContext(ctx.getLeaderId(), ctx.getTerm(), ctx.getStatus());
});
}
Aggregations