RaftActorServerConfigurationSupport { private boolean onApplyState(final ApplyState applyState) { Payload data = applyState.getReplicatedLogEntry().getData(); if (data instanceof ServerConfigurationPayload) { currentOperationState.onApplyState(applyState); return true; } return false; } RaftActorServerConfigurationSupport(final RaftActor raftActor);   }
@Test public void testOnApplyState() { LOG.info("testOnApplyState starting"); DefaultConfigParamsImpl configParams = new DefaultConfigParamsImpl(); configParams.setHeartBeatInterval(new FiniteDuration(1, TimeUnit.DAYS)); TestActorRef<MockRaftActor> noLeaderActor = actorFactory.createTestActor( MockRaftActor.builder().id(LEADER_ID).peerAddresses(ImmutableMap.of(FOLLOWER_ID, followerActor.path().toString())).config(configParams).persistent(Optional.of(false)) .props().withDispatcher(Dispatchers.DefaultDispatcherId()), actorFactory.generateActorId(LEADER_ID)); RaftActorServerConfigurationSupport support = new RaftActorServerConfigurationSupport( noLeaderActor.underlyingActor()); ReplicatedLogEntry serverConfigEntry = new SimpleReplicatedLogEntry(1, 1, new ServerConfigurationPayload(Collections.<ServerInfo>emptyList())); boolean handled = support.handleMessage(new ApplyState(null, null, serverConfigEntry), ActorRef.noSender()); assertEquals("Message handled", true, handled); ReplicatedLogEntry nonServerConfigEntry = new SimpleReplicatedLogEntry(1, 1, new MockRaftActorContext.MockPayload("1")); handled = support.handleMessage(new ApplyState(null, null, nonServerConfigEntry), ActorRef.noSender()); assertEquals("Message handled", false, handled); LOG.info("testOnApplyState ending"); }