Class SnapshotTestKit
java.lang.Object
org.apache.pekko.persistence.testkit.scaladsl.SnapshotTestKit
- All Implemented Interfaces:
ClearOps,CommonTestKitOps<scala.Tuple2<SnapshotMetadata,,Object>, SnapshotOperation> ExpectOps<scala.Tuple2<SnapshotMetadata,,Object>> HasStorage<SnapshotOperation,,scala.Tuple2<SnapshotMetadata, Object>> PolicyOpsTestKit<SnapshotOperation>
public class SnapshotTestKit
extends Object
implements CommonTestKitOps<scala.Tuple2<SnapshotMetadata,Object>,SnapshotOperation>, PolicyOpsTestKit<SnapshotOperation>, ExpectOps<scala.Tuple2<SnapshotMetadata,Object>>, HasStorage<SnapshotOperation,scala.Tuple2<SnapshotMetadata,Object>>
Class for testing snapshots of persistent actors.
NOTE! ActorSystem must be configured with PersistenceTestKitSnapshotPlugin.
The configuration can be retrieved with PersistenceTestKitSnapshotPlugin.config.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SnapshotTestKitapply(ActorSystem system) static SnapshotTestKitapply(ActorSystem<?> system) <A> AexpectNextPersisted(String persistenceId, A event) Check thateventhas been saved in the storage.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.Option<Object>scala.collection.immutable.Seq<scala.Tuple2<SnapshotMeta,Object>> persistedInStorage(String persistenceId) Retrieve snapshots and their metadata from storage by persistence id.voidpersistForRecovery(String persistenceId, scala.collection.immutable.Seq<scala.Tuple2<SnapshotMeta, Object>> elems) Persistelemspairs of (snapshot metadata, snapshot payload) into storage.voidpersistForRecovery(String persistenceId, scala.Tuple2<SnapshotMeta, 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, waitMethods inherited from interface org.apache.pekko.persistence.testkit.scaladsl.ClearOps
clearAll, clearByPersistenceIdMethods inherited from interface org.apache.pekko.persistence.testkit.scaladsl.CommonTestKitOps
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, expectNextPersistedClass, expectNextPersistedClass, expectNextPersistedType, expectNextPersistedType, expectNothingPersisted, expectNothingPersisted, 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.PolicyOpsTestKit
failNextNOps, failNextNOps, failNextNOpsCond, failNextNOpsCond, resetPolicy, withPolicy
-
Constructor Details
-
SnapshotTestKit
-
-
Method Details
-
apply
-
apply
-
storage
- Specified by:
storagein interfaceHasStorage<SnapshotOperation,scala.Tuple2<SnapshotMetadata, Object>>
-
getItem
- Specified by:
getItemin interfaceExpectOps<scala.Tuple2<SnapshotMetadata,Object>>
-
expectNextPersisted
Description copied from interface:CommonTestKitOpsCheck thateventhas been saved in the storage.- Specified by:
expectNextPersistedin interfaceCommonTestKitOps<scala.Tuple2<SnapshotMetadata,Object>, SnapshotOperation> - Specified by:
expectNextPersistedin interfaceExpectOps<scala.Tuple2<SnapshotMetadata,Object>>
-
failNextNPersisted
Description copied from interface:CommonTestKitOpsFail nextnwrite operations with thecauseexception for particular persistence id.- Specified by:
failNextNPersistedin interfaceCommonTestKitOps<scala.Tuple2<SnapshotMetadata,Object>, SnapshotOperation>
-
failNextNPersisted
Description copied from interface:CommonTestKitOpsFail nextnwrite operations with thecauseexception for any persistence id.- Specified by:
failNextNPersistedin interfaceCommonTestKitOps<scala.Tuple2<SnapshotMetadata,Object>, SnapshotOperation>
-
failNextNReads
Description copied from interface:CommonTestKitOpsFail next n read from storage (recovery) attempts withcauseexception for any persistence id.- Specified by:
failNextNReadsin interfaceCommonTestKitOps<scala.Tuple2<SnapshotMetadata,Object>, SnapshotOperation>
-
failNextNReads
Description copied from interface:CommonTestKitOpsFail next n read from storage (recovery) attempts withcauseexception for particular persistence id.- Specified by:
failNextNReadsin interfaceCommonTestKitOps<scala.Tuple2<SnapshotMetadata,Object>, SnapshotOperation>
-
failNextNDeletes
Description copied from interface:CommonTestKitOpsFail next n delete from storage attempts withcauseexception for any persistence id.- Specified by:
failNextNDeletesin interfaceCommonTestKitOps<scala.Tuple2<SnapshotMetadata,Object>, SnapshotOperation>
-
failNextNDeletes
Description copied from interface:CommonTestKitOpsFail next n delete from storage attempts withcauseexception for particular persistence id.- Specified by:
failNextNDeletesin interfaceCommonTestKitOps<scala.Tuple2<SnapshotMetadata,Object>, SnapshotOperation>
-
persistForRecovery
public void persistForRecovery(String persistenceId, scala.collection.immutable.Seq<scala.Tuple2<SnapshotMeta, Object>> elems) Persistelemspairs of (snapshot metadata, snapshot payload) into storage. -
persistForRecovery
Persist a pair of (snapshot metadata, snapshot payload) into storage. -
persistedInStorage
public scala.collection.immutable.Seq<scala.Tuple2<SnapshotMeta,Object>> persistedInStorage(String persistenceId) Retrieve snapshots and their metadata from storage by persistence id.
-