@Test public void testApplyState() { String persistenceId = factory.generateActorId("leader-"); DefaultConfigParamsImpl config = new DefaultConfigParamsImpl(); config.setHeartBeatInterval(new FiniteDuration(1, TimeUnit.DAYS)); DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class); TestActorRef<MockRaftActor> mockActorRef = factory.createTestActor(MockRaftActor.props(persistenceId, Collections.<String, String>emptyMap(), config, dataPersistenceProvider), persistenceId); MockRaftActor mockRaftActor = mockActorRef.underlyingActor(); mockRaftActor.waitForInitializeBehaviorComplete(); ReplicatedLogEntry entry = new SimpleReplicatedLogEntry(5, 1, new MockRaftActorContext.MockPayload("F")); final Identifier id = new MockIdentifier("apply-state"); mockRaftActor.getRaftActorContext().getApplyStateConsumer().accept(new ApplyState(mockActorRef, id, entry)); verify(mockRaftActor.actorDelegate).applyState(eq(mockActorRef), eq(id), any()); }
protected abstract void applyState(ActorRef clientActor, Identifier identifier, Object data);
RaftActor extends AbstractUntypedPersistentActor { protected abstract void applyState(ActorRef clientActor, Identifier identifier, Object data); }
RaftActor extends AbstractUntypedPersistentActor { protected abstract void applyState(ActorRef clientActor, Identifier identifier, Object data); protected  RaftActor(final String id, final Map<String, String> peerAddresses,
         final Optional<ConfigParams> configParams, final short payloadVersion); }
RaftActor extends AbstractUntypedPersistentActor { protected abstract void applyState(ActorRef clientActor, Identifier identifier, Object data); protected  RaftActor(final String id, final Map<String, String> peerAddresses,
         final Optional<ConfigParams> configParams, final short payloadVersion); @Override void preStart(); @Override void postStop(); @Override long snapshotSequenceNr(); ActorSelection getLeader(); final DataPersistenceProvider persistence(); void setPersistence(final DataPersistenceProvider provider); }
RaftActor extends AbstractUntypedPersistentActor { protected abstract void applyState(ActorRef clientActor, Identifier identifier, Object data); protected  RaftActor(final String id, final Map<String, String> peerAddresses,
         final Optional<ConfigParams> configParams, final short payloadVersion); @Override void preStart(); @Override void postStop(); @Override long snapshotSequenceNr(); ActorSelection getLeader(); final DataPersistenceProvider persistence(); void setPersistence(final DataPersistenceProvider provider);  }