Class PersistenceTestKit
java.lang.Object
org.apache.pekko.persistence.testkit.scaladsl.PersistenceTestKit
- All Implemented Interfaces:
ClearOps,ClearPreservingSeqNums,CommonTestKitOps<PersistentRepr,,JournalOperation> ExpectOps<PersistentRepr>,HasStorage<JournalOperation,,PersistentRepr> PersistenceTestKitOps<PersistentRepr,,JournalOperation> PolicyOpsTestKit<JournalOperation>,RejectSupport<JournalOperation>
public class PersistenceTestKit
extends Object
implements PersistenceTestKitOps<PersistentRepr,JournalOperation>, ExpectOps<PersistentRepr>, HasStorage<JournalOperation,PersistentRepr>
Class for testing events of persistent actors.
NOTE! ActorSystem must be configured with PersistenceTestKitPlugin.
The configuration can be retrieved with PersistenceTestKitPlugin.config.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PersistenceTestKitapply(ClassicActorSystemProvider system) voidfailNextNDeletes(int n, Throwable cause) Fail next n delete from storage attempts withcauseexception for any persistence id.voidfailNextNDeletes(String persistenceId, int n, Throwable cause) Fail next n delete from storage attempts withcauseexception for particular persistence id.voidfailNextNPersisted(int n, Throwable cause) Fail nextnwrite operations with thecauseexception for any persistence id.voidfailNextNPersisted(String persistenceId, int n, Throwable cause) Fail nextnwrite operations with thecauseexception for particular persistence id.voidfailNextNReads(int n, Throwable cause) Fail next n read from storage (recovery) attempts withcauseexception for any persistence id.voidfailNextNReads(String persistenceId, int n, Throwable cause) Fail next n read from storage (recovery) attempts withcauseexception for particular persistence id.scala.collection.immutable.Seq<Object>persistedInStorage(String persistenceId) Retrieve all snapshots saved in storage by persistence id.voidpersistForRecovery(String persistenceId, scala.collection.immutable.Seq<Object> events) Persistsnapshotsinto storage in order.voidrejectNextNDeletes(int n, Throwable cause) Reject next n delete from storage operations for any persistence id withcauseexception.voidrejectNextNDeletes(String persistenceId, int n, Throwable cause) Reject next n delete from storage operations for particular persistence id withcauseexception.voidrejectNextNPersisted(int n, Throwable cause) Reject next n save in storage operations for any persistence id withcauseexception.voidrejectNextNPersisted(String persistenceId, int n, Throwable cause) Reject next n save in storage operations for particular persistence id withcauseexception.voidrejectNextNReads(int n, Throwable cause) Reject next n read from storage operations for any persistence id withcauseexception.voidrejectNextNReads(String persistenceId, int n, Throwable cause) Reject next n read from storage operations for particular persistence id withcauseexception.protected EventStoragestorage()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.pekko.persistence.testkit.scaladsl.ClearOps
clearAll, clearByPersistenceIdMethods inherited from interface org.apache.pekko.persistence.testkit.scaladsl.ClearPreservingSeqNums
clearAllPreservingSeqNumbers, clearByIdPreservingSeqNumbersMethods inherited from interface org.apache.pekko.persistence.testkit.scaladsl.CommonTestKitOps
expectNextPersisted, expectNextPersisted, expectNothingPersisted, expectNothingPersisted, failNextDelete, failNextDelete, failNextDelete, failNextDelete, failNextNDeletes, failNextNDeletes, failNextNPersisted, failNextNPersisted, failNextNReads, failNextNReads, failNextPersisted, failNextPersisted, failNextPersisted, failNextPersisted, failNextRead, failNextRead, failNextRead, failNextReadMethods inherited from interface org.apache.pekko.persistence.testkit.scaladsl.ExpectOps
expectNextPersisted, expectNextPersisted, expectNextPersistedClass, expectNextPersistedClass, expectNextPersistedType, expectNextPersistedType, expectNothingPersisted, expectNothingPersisted, getItem, receivePersisted, receivePersisted, receivePersisted, receivePersistedMethods inherited from interface org.apache.pekko.persistence.testkit.scaladsl.HasStorage
addToIndex, clearIndexStorage, nextIndex, nextIndexByPersistenceId_$eq, removeLastIndex, setIndexMethods inherited from interface org.apache.pekko.persistence.testkit.scaladsl.PersistenceTestKitOps
rejectNextDelete, rejectNextDelete, rejectNextDelete, rejectNextDelete, rejectNextNDeletes, rejectNextNDeletes, rejectNextNPersisted, rejectNextNPersisted, rejectNextNReads, rejectNextNReads, rejectNextPersisted, rejectNextPersisted, rejectNextPersisted, rejectNextPersisted, rejectNextRead, rejectNextRead, rejectNextRead, rejectNextReadMethods inherited from interface org.apache.pekko.persistence.testkit.scaladsl.PolicyOpsTestKit
failNextNOps, failNextNOps, failNextNOpsCond, failNextNOpsCond, resetPolicy, withPolicyMethods inherited from interface org.apache.pekko.persistence.testkit.scaladsl.RejectSupport
rejectNextNOps, rejectNextNOps, rejectNextNOpsCond, rejectNextNOpsCond
-
Constructor Details
-
PersistenceTestKit
-
-
Method Details
-
apply
-
storage
- Specified by:
storagein interfaceHasStorage<JournalOperation,PersistentRepr>
-
rejectNextNPersisted
Description copied from interface:PersistenceTestKitOpsReject next n save in storage operations for particular persistence id withcauseexception.- Specified by:
rejectNextNPersistedin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNPersisted
Description copied from interface:PersistenceTestKitOpsReject next n save in storage operations for any persistence id withcauseexception.- Specified by:
rejectNextNPersistedin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNReads
Description copied from interface:PersistenceTestKitOpsReject next n read from storage operations for any persistence id withcauseexception.- Specified by:
rejectNextNReadsin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNReads
Description copied from interface:PersistenceTestKitOpsReject next n read from storage operations for particular persistence id withcauseexception.- Specified by:
rejectNextNReadsin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNDeletes
Description copied from interface:PersistenceTestKitOpsReject next n delete from storage operations for any persistence id withcauseexception.- Specified by:
rejectNextNDeletesin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNDeletes
Description copied from interface:PersistenceTestKitOpsReject next n delete from storage operations for particular persistence id withcauseexception.- Specified by:
rejectNextNDeletesin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
failNextNPersisted
Description copied from interface:CommonTestKitOpsFail nextnwrite operations with thecauseexception for particular persistence id.- Specified by:
failNextNPersistedin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNPersisted
Description copied from interface:CommonTestKitOpsFail nextnwrite operations with thecauseexception for any persistence id.- Specified by:
failNextNPersistedin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNReads
Description copied from interface:CommonTestKitOpsFail next n read from storage (recovery) attempts withcauseexception for any persistence id.- Specified by:
failNextNReadsin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNReads
Description copied from interface:CommonTestKitOpsFail next n read from storage (recovery) attempts withcauseexception for particular persistence id.- Specified by:
failNextNReadsin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNDeletes
Description copied from interface:CommonTestKitOpsFail next n delete from storage attempts withcauseexception for any persistence id.- Specified by:
failNextNDeletesin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNDeletes
Description copied from interface:CommonTestKitOpsFail next n delete from storage attempts withcauseexception for particular persistence id.- Specified by:
failNextNDeletesin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
persistForRecovery
Description copied from interface:PersistenceTestKitOpsPersistsnapshotsinto storage in order.- Specified by:
persistForRecoveryin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
persistedInStorage
Description copied from interface:PersistenceTestKitOpsRetrieve all snapshots saved in storage by persistence id.- Specified by:
persistedInStoragein interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-