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 class
PersistenceTestKit.Settings
static class
PersistenceTestKit.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 PersistenceTestKit
apply(ClassicActorSystemProvider system)
void
failNextNDeletes(int n, java.lang.Throwable cause)
Fail next n delete from storage attempts withcause
exception for any persistence id.void
failNextNDeletes(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Fail next n delete from storage attempts withcause
exception for particular persistence id.void
failNextNPersisted(int n, java.lang.Throwable cause)
Fail nextn
write operations with thecause
exception for any persistence id.void
failNextNPersisted(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Fail nextn
write operations with thecause
exception for particular persistence id.void
failNextNReads(int n, java.lang.Throwable cause)
Fail next n read from storage (recovery) attempts withcause
exception for any persistence id.void
failNextNReads(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Fail next n read from storage (recovery) attempts withcause
exception 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.void
persistForRecovery(java.lang.String persistenceId, scala.collection.immutable.Seq<java.lang.Object> events)
Persistsnapshots
into storage in order.void
rejectNextNDeletes(int n, java.lang.Throwable cause)
Reject next n delete from storage operations for any persistence id withcause
exception.void
rejectNextNDeletes(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Reject next n delete from storage operations for particular persistence id withcause
exception.void
rejectNextNPersisted(int n, java.lang.Throwable cause)
Reject next n save in storage operations for any persistence id withcause
exception.void
rejectNextNPersisted(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Reject next n save in storage operations for particular persistence id withcause
exception.void
rejectNextNReads(int n, java.lang.Throwable cause)
Reject next n read from storage operations for any persistence id withcause
exception.void
rejectNextNReads(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Reject next n read from storage operations for particular persistence id withcause
exception.protected EventStorage
storage()
-
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:
storage
in interfaceHasStorage<JournalOperation,PersistentRepr>
-
rejectNextNPersisted
public void rejectNextNPersisted(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Description copied from interface:PersistenceTestKitOps
Reject next n save in storage operations for particular persistence id withcause
exception.- Specified by:
rejectNextNPersisted
in interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNPersisted
public void rejectNextNPersisted(int n, java.lang.Throwable cause)
Description copied from interface:PersistenceTestKitOps
Reject next n save in storage operations for any persistence id withcause
exception.- Specified by:
rejectNextNPersisted
in interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNReads
public void rejectNextNReads(int n, java.lang.Throwable cause)
Description copied from interface:PersistenceTestKitOps
Reject next n read from storage operations for any persistence id withcause
exception.- Specified by:
rejectNextNReads
in interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNReads
public void rejectNextNReads(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Description copied from interface:PersistenceTestKitOps
Reject next n read from storage operations for particular persistence id withcause
exception.- Specified by:
rejectNextNReads
in interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNDeletes
public void rejectNextNDeletes(int n, java.lang.Throwable cause)
Description copied from interface:PersistenceTestKitOps
Reject next n delete from storage operations for any persistence id withcause
exception.- Specified by:
rejectNextNDeletes
in interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
rejectNextNDeletes
public void rejectNextNDeletes(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Description copied from interface:PersistenceTestKitOps
Reject next n delete from storage operations for particular persistence id withcause
exception.- Specified by:
rejectNextNDeletes
in interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
failNextNPersisted
public void failNextNPersisted(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Description copied from interface:CommonTestKitOps
Fail nextn
write operations with thecause
exception for particular persistence id.- Specified by:
failNextNPersisted
in interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNPersisted
public void failNextNPersisted(int n, java.lang.Throwable cause)
Description copied from interface:CommonTestKitOps
Fail nextn
write operations with thecause
exception for any persistence id.- Specified by:
failNextNPersisted
in interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNReads
public void failNextNReads(int n, java.lang.Throwable cause)
Description copied from interface:CommonTestKitOps
Fail next n read from storage (recovery) attempts withcause
exception for any persistence id.- Specified by:
failNextNReads
in interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNReads
public void failNextNReads(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Description copied from interface:CommonTestKitOps
Fail next n read from storage (recovery) attempts withcause
exception for particular persistence id.- Specified by:
failNextNReads
in interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNDeletes
public void failNextNDeletes(int n, java.lang.Throwable cause)
Description copied from interface:CommonTestKitOps
Fail next n delete from storage attempts withcause
exception for any persistence id.- Specified by:
failNextNDeletes
in interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
failNextNDeletes
public void failNextNDeletes(java.lang.String persistenceId, int n, java.lang.Throwable cause)
Description copied from interface:CommonTestKitOps
Fail next n delete from storage attempts withcause
exception for particular persistence id.- Specified by:
failNextNDeletes
in interfaceCommonTestKitOps<PersistentRepr,JournalOperation>
-
persistForRecovery
public void persistForRecovery(java.lang.String persistenceId, scala.collection.immutable.Seq<java.lang.Object> events)
Description copied from interface:PersistenceTestKitOps
Persistsnapshots
into storage in order.- Specified by:
persistForRecovery
in interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
persistedInStorage
public scala.collection.immutable.Seq<java.lang.Object> persistedInStorage(java.lang.String persistenceId)
Description copied from interface:PersistenceTestKitOps
Retrieve all snapshots saved in storage by persistence id.- Specified by:
persistedInStorage
in interfacePersistenceTestKitOps<PersistentRepr,JournalOperation>
-
-