Class PersistenceTestKit
- java.lang.Object
-
- akka.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 java.lang.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 withPersistenceTestKitPlugin.config.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPersistenceTestKit.Settingsstatic classPersistenceTestKit.Settings$
-
Constructor Summary
Constructors Constructor Description PersistenceTestKit(ActorSystem system)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PersistenceTestKitapply(ClassicActorSystemProvider system)voidfailNextNDeletes(int n, java.lang.Throwable cause)Fail next n delete from storage attempts withcauseexception for any persistence id.voidfailNextNDeletes(java.lang.String persistenceId, int n, java.lang.Throwable cause)Fail next n delete from storage attempts withcauseexception for particular persistence id.voidfailNextNPersisted(int n, java.lang.Throwable cause)Fail nextnwrite operations with thecauseexception for any persistence id.voidfailNextNPersisted(java.lang.String persistenceId, int n, java.lang.Throwable cause)Fail nextnwrite operations with thecauseexception for particular persistence id.voidfailNextNReads(int n, java.lang.Throwable cause)Fail next n read from storage (recovery) attempts withcauseexception for any persistence id.voidfailNextNReads(java.lang.String persistenceId, int n, java.lang.Throwable cause)Fail next n read from storage (recovery) attempts withcauseexception for particular persistence id.scala.collection.immutable.Seq<java.lang.Object>persistedInStorage(java.lang.String persistenceId)Retrieve all snapshots saved in storage by persistence id.voidpersistForRecovery(java.lang.String persistenceId, scala.collection.immutable.Seq<java.lang.Object> events)Persistsnapshotsinto storage in order.voidrejectNextNDeletes(int n, java.lang.Throwable cause)Reject next n delete from storage operations for any persistence id withcauseexception.voidrejectNextNDeletes(java.lang.String persistenceId, int n, java.lang.Throwable cause)Reject next n delete from storage operations for particular persistence id withcauseexception.voidrejectNextNPersisted(int n, java.lang.Throwable cause)Reject next n save in storage operations for any persistence id withcauseexception.voidrejectNextNPersisted(java.lang.String persistenceId, int n, java.lang.Throwable cause)Reject next n save in storage operations for particular persistence id withcauseexception.voidrejectNextNReads(int n, java.lang.Throwable cause)Reject next n read from storage operations for any persistence id withcauseexception.voidrejectNextNReads(java.lang.String persistenceId, int n, java.lang.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, wait
-
Methods inherited from interface akka.persistence.testkit.scaladsl.ClearOps
clearAll, clearByPersistenceId
-
Methods inherited from interface akka.persistence.testkit.scaladsl.ClearPreservingSeqNums
clearAllPreservingSeqNumbers, clearByIdPreservingSeqNumbers
-
Methods inherited from interface akka.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, failNextRead
-
Methods inherited from interface akka.persistence.testkit.scaladsl.ExpectOps
expectNextPersisted, expectNextPersisted, expectNextPersistedClass, expectNextPersistedClass, expectNextPersistedType, expectNextPersistedType, expectNothingPersisted, expectNothingPersisted, getItem, receivePersisted, receivePersisted, receivePersisted, receivePersisted
-
Methods inherited from interface akka.persistence.testkit.scaladsl.HasStorage
addToIndex, clearIndexStorage, nextIndex, nextIndexByPersistenceId_$eq, removeLastIndex, setIndex
-
Methods inherited from interface akka.persistence.testkit.scaladsl.PersistenceTestKitOps
rejectNextDelete, rejectNextDelete, rejectNextDelete, rejectNextDelete, rejectNextNDeletes, rejectNextNDeletes, rejectNextNPersisted, rejectNextNPersisted, rejectNextNReads, rejectNextNReads, rejectNextPersisted, rejectNextPersisted, rejectNextPersisted, rejectNextPersisted, rejectNextRead, rejectNextRead, rejectNextRead, rejectNextRead
-
Methods inherited from interface akka.persistence.testkit.scaladsl.PolicyOpsTestKit
failNextNOps, failNextNOps, failNextNOpsCond, failNextNOpsCond, resetPolicy, withPolicy
-
Methods inherited from interface akka.persistence.testkit.scaladsl.RejectSupport
rejectNextNOps, rejectNextNOps, rejectNextNOpsCond, rejectNextNOpsCond
-
-
-
-
Constructor Detail
-
PersistenceTestKit
public PersistenceTestKit(ActorSystem system)
-
-
Method Detail
-
apply
public static PersistenceTestKit apply(ClassicActorSystemProvider system)
-
storage
protected EventStorage storage()
- Specified by:
storagein interfaceHasStorage<JournalOperation,PersistentRepr>
-
rejectNextNPersisted
public void rejectNextNPersisted(java.lang.String persistenceId, int n, java.lang.Throwable cause)Description copied from interface:PersistenceTestKitOpsReject next n save in storage operations for particular persistence id withcauseexception.- Specified by:
rejectNextNPersistedin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNPersisted
public void rejectNextNPersisted(int n, java.lang.Throwable cause)Description copied from interface:PersistenceTestKitOpsReject next n save in storage operations for any persistence id withcauseexception.- Specified by:
rejectNextNPersistedin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNReads
public void rejectNextNReads(int n, java.lang.Throwable cause)Description copied from interface:PersistenceTestKitOpsReject next n read from storage operations for any persistence id withcauseexception.- Specified by:
rejectNextNReadsin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNReads
public void rejectNextNReads(java.lang.String persistenceId, int n, java.lang.Throwable cause)Description copied from interface:PersistenceTestKitOpsReject next n read from storage operations for particular persistence id withcauseexception.- Specified by:
rejectNextNReadsin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNDeletes
public void rejectNextNDeletes(int n, java.lang.Throwable cause)Description copied from interface:PersistenceTestKitOpsReject next n delete from storage operations for any persistence id withcauseexception.- Specified by:
rejectNextNDeletesin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNDeletes
public void rejectNextNDeletes(java.lang.String persistenceId, int n, java.lang.Throwable cause)Description copied from interface:PersistenceTestKitOpsReject next n delete from storage operations for particular persistence id withcauseexception.- Specified by:
rejectNextNDeletesin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
failNextNPersisted
public void failNextNPersisted(java.lang.String persistenceId, int n, java.lang.Throwable cause)Description copied from interface:CommonTestKitOpsFail nextnwrite operations with thecauseexception for particular persistence id.- Specified by:
failNextNPersistedin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNPersisted
public void failNextNPersisted(int n, java.lang.Throwable cause)Description copied from interface:CommonTestKitOpsFail nextnwrite operations with thecauseexception for any persistence id.- Specified by:
failNextNPersistedin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNReads
public void failNextNReads(int n, java.lang.Throwable cause)Description copied from interface:CommonTestKitOpsFail next n read from storage (recovery) attempts withcauseexception for any persistence id.- Specified by:
failNextNReadsin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNReads
public void failNextNReads(java.lang.String persistenceId, int n, java.lang.Throwable cause)Description copied from interface:CommonTestKitOpsFail next n read from storage (recovery) attempts withcauseexception for particular persistence id.- Specified by:
failNextNReadsin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNDeletes
public void failNextNDeletes(int n, java.lang.Throwable cause)Description copied from interface:CommonTestKitOpsFail next n delete from storage attempts withcauseexception for any persistence id.- Specified by:
failNextNDeletesin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNDeletes
public void failNextNDeletes(java.lang.String persistenceId, int n, java.lang.Throwable cause)Description copied from interface:CommonTestKitOpsFail next n delete from storage attempts withcauseexception for particular persistence id.- Specified by:
failNextNDeletesin interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
persistForRecovery
public void persistForRecovery(java.lang.String persistenceId, scala.collection.immutable.Seq<java.lang.Object> events)Description copied from interface:PersistenceTestKitOpsPersistsnapshotsinto storage in order.- Specified by:
persistForRecoveryin interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
persistedInStorage
public scala.collection.immutable.Seq<java.lang.Object> persistedInStorage(java.lang.String persistenceId)
Description copied from interface:PersistenceTestKitOpsRetrieve all snapshots saved in storage by persistence id.- Specified by:
persistedInStoragein interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
-