Shard extends RaftActor { protected void onDatastoreContext(final DatastoreContext context) { datastoreContext = context; setTransactionCommitTimeout(); setPersistence(datastoreContext.isPersistent()); updateConfigParams(datastoreContext.getShardRaftConfig()); } protected  Shard(final AbstractBuilder<?, ?> builder); @Override void postStop(); int getPendingTxCommitQueueSize(); int getCohortCacheSize(); @Override @VisibleForTesting RaftActorSnapshotCohort getRaftActorSnapshotCohort(); Collection<?> convertPendingTransactionsToMessages(); @Override String persistenceId(); DatastoreContext getDatastoreContext(); @VisibleForTesting ShardDataTree getDataStore(); static Builder builder(); static final String DEFAULT_NAME; }
@Test public void testOnDatastoreContext() { dataStoreContextBuilder.persistent(true); final TestActorRef<Shard> shard = actorFactory.createTestActor(newShardProps(), "testOnDatastoreContext"); assertTrue("isRecoveryApplicable", shard.underlyingActor().persistence().isRecoveryApplicable()); ShardTestKit.waitUntilLeader(shard); shard.tell(dataStoreContextBuilder.persistent(false).build(), ActorRef.noSender()); assertFalse("isRecoveryApplicable", shard.underlyingActor().persistence().isRecoveryApplicable()); shard.tell(dataStoreContextBuilder.persistent(true).build(), ActorRef.noSender()); assertTrue("isRecoveryApplicable", shard.underlyingActor().persistence().isRecoveryApplicable()); }