Class SnapshotTestKit
- java.lang.Object
-
- akka.persistence.testkit.scaladsl.SnapshotTestKit
-
- All Implemented Interfaces:
ClearOps,CommonTestKitOps<scala.Tuple2<SnapshotMetadata,java.lang.Object>,SnapshotOperation>,ExpectOps<scala.Tuple2<SnapshotMetadata,java.lang.Object>>,HasStorage<SnapshotOperation,scala.Tuple2<SnapshotMetadata,java.lang.Object>>,PolicyOpsTestKit<SnapshotOperation>
public class SnapshotTestKit extends java.lang.Object implements CommonTestKitOps<scala.Tuple2<SnapshotMetadata,java.lang.Object>,SnapshotOperation>, PolicyOpsTestKit<SnapshotOperation>, ExpectOps<scala.Tuple2<SnapshotMetadata,java.lang.Object>>, HasStorage<SnapshotOperation,scala.Tuple2<SnapshotMetadata,java.lang.Object>>
Class for testing snapshots of persistent actors.NOTE! ActorSystem must be configured with
PersistenceTestKitSnapshotPlugin. The configuration can be retrieved withPersistenceTestKitSnapshotPlugin.config.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSnapshotTestKit.Settingsstatic classSnapshotTestKit.Settings$
-
Constructor Summary
Constructors Constructor Description SnapshotTestKit(ActorSystem system)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SnapshotTestKitapply(ActorSystem system)static SnapshotTestKitapply(ActorSystem<?> system)<A> AexpectNextPersisted(java.lang.String persistenceId, A event)Check thateventhas been saved in the storage.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.Option<java.lang.Object>getItem(java.lang.String persistenceId, int nextInd)scala.collection.immutable.Seq<scala.Tuple2<SnapshotMeta,java.lang.Object>>persistedInStorage(java.lang.String persistenceId)Retrieve snapshots and their metadata from storage by persistence id.voidpersistForRecovery(java.lang.String persistenceId, scala.collection.immutable.Seq<scala.Tuple2<SnapshotMeta,java.lang.Object>> elems)Persistelemspairs of (snapshot metadata, snapshot payload) into storage.voidpersistForRecovery(java.lang.String persistenceId, scala.Tuple2<SnapshotMeta,java.lang.Object> elem)Persist a pair of (snapshot metadata, snapshot payload) into storage.protected SnapshotStoragestorage()-
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.CommonTestKitOps
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, expectNextPersistedClass, expectNextPersistedClass, expectNextPersistedType, expectNextPersistedType, expectNothingPersisted, expectNothingPersisted, 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.PolicyOpsTestKit
failNextNOps, failNextNOps, failNextNOpsCond, failNextNOpsCond, resetPolicy, withPolicy
-
-
-
-
Constructor Detail
-
SnapshotTestKit
public SnapshotTestKit(ActorSystem system)
-
-
Method Detail
-
apply
public static SnapshotTestKit apply(ActorSystem system)
-
apply
public static SnapshotTestKit apply(ActorSystem<?> system)
-
storage
protected SnapshotStorage storage()
- Specified by:
storagein interfaceHasStorage<SnapshotOperation,scala.Tuple2<SnapshotMetadata,java.lang.Object>>
-
getItem
public scala.Option<java.lang.Object> getItem(java.lang.String persistenceId, int nextInd)- Specified by:
getItemin interfaceExpectOps<scala.Tuple2<SnapshotMetadata,java.lang.Object>>
-
expectNextPersisted
public <A> A expectNextPersisted(java.lang.String persistenceId, A event)Description copied from interface:CommonTestKitOpsCheck thateventhas been saved in the storage.- Specified by:
expectNextPersistedin interfaceCommonTestKitOps<scala.Tuple2<SnapshotMetadata,java.lang.Object>,SnapshotOperation>- Specified by:
expectNextPersistedin interfaceExpectOps<scala.Tuple2<SnapshotMetadata,java.lang.Object>>
-
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<scala.Tuple2<SnapshotMetadata,java.lang.Object>,SnapshotOperation>
-
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<scala.Tuple2<SnapshotMetadata,java.lang.Object>,SnapshotOperation>
-
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<scala.Tuple2<SnapshotMetadata,java.lang.Object>,SnapshotOperation>
-
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<scala.Tuple2<SnapshotMetadata,java.lang.Object>,SnapshotOperation>
-
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<scala.Tuple2<SnapshotMetadata,java.lang.Object>,SnapshotOperation>
-
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<scala.Tuple2<SnapshotMetadata,java.lang.Object>,SnapshotOperation>
-
persistForRecovery
public void persistForRecovery(java.lang.String persistenceId, scala.collection.immutable.Seq<scala.Tuple2<SnapshotMeta,java.lang.Object>> elems)Persistelemspairs of (snapshot metadata, snapshot payload) into storage.
-
persistForRecovery
public void persistForRecovery(java.lang.String persistenceId, scala.Tuple2<SnapshotMeta,java.lang.Object> elem)Persist a pair of (snapshot metadata, snapshot payload) into storage.
-
persistedInStorage
public scala.collection.immutable.Seq<scala.Tuple2<SnapshotMeta,java.lang.Object>> persistedInStorage(java.lang.String persistenceId)
Retrieve snapshots and their metadata from storage by persistence id.
-
-