Package akka.persistence.testkit.javadsl
Class SnapshotTestKit
- java.lang.Object
- 
- akka.persistence.testkit.javadsl.SnapshotTestKit
 
- 
 public class SnapshotTestKit extends java.lang.ObjectClass for testing persisted snapshots in persistent actors.
- 
- 
Constructor SummaryConstructors Constructor Description SnapshotTestKit(ActorSystem system)SnapshotTestKit(SnapshotTestKit scalaTestkit)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAll()Clear all data from storage.voidclearByPersistenceId(java.lang.String persistenceId)Clear all data from storage for particular persistence id.static SnapshotTestKitcreate(ActorSystem system)static SnapshotTestKitcreate(ActorSystem<?> system)<A> AexpectNextPersisted(java.lang.String persistenceId, A snapshot)Check thatsnapshothas been saved in the storage.<A> AexpectNextPersisted(java.lang.String persistenceId, A snapshot, java.time.Duration max)Check formaxtime thatsnapshothas been saved in the storage.<A> AexpectNextPersistedClass(java.lang.String persistenceId, java.lang.Class<A> cla)Check that next persisted in storage for particular persistence id snapshot has expected type.<A> AexpectNextPersistedClass(java.lang.String persistenceId, java.lang.Class<A> cla, java.time.Duration max)Check formaxtime that next persisted in storage for particular persistence id snapshot has expected type.voidexpectNothingPersisted(java.lang.String persistenceId)Check that nothing has been saved in the storage.voidexpectNothingPersisted(java.lang.String persistenceId, java.time.Duration max)Check formaxtime that nothing has been saved in the storage.voidfailNextDelete()Fail next delete from storage attempt with default exception for any persistence id.voidfailNextDelete(java.lang.String persistenceId)Fail next delete from storage attempt with default exception for particular persistence id.voidfailNextDelete(java.lang.String persistenceId, java.lang.Throwable cause)Fail next delete from storage attempt withcauseexception for particular persistence id.voidfailNextDelete(java.lang.Throwable cause)Fail next delete from storage attempt withcauseexception for any persistence id.voidfailNextNDeletes(int n)Fail next n delete from storage attempts with default exception for any persistence id.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)Fail next n delete from storage attempts with default exception for particular 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.voidfailNextNOps(int n)Fail n following journal operations regardless of their type.voidfailNextNOps(int n, java.lang.Throwable cause)Failnfollowing journal operations depending on the conditioncond.voidfailNextNOpsCond(java.util.function.BiFunction<java.lang.String,SnapshotOperation,java.lang.Object> cond, int n)Failnfollowing journal operations depending on the conditioncond.voidfailNextNOpsCond(java.util.function.BiFunction<java.lang.String,SnapshotOperation,java.lang.Object> cond, int n, java.lang.Throwable cause)Failnfollowing journal operations depending on the conditioncond.voidfailNextNPersisted(int n)Fail nextnwrite operations with default exception for any 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)Fail nextnwrite operations for particular 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)Fail next n read from storage (recovery) attempts with default exception for any 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)Fail next n read from storage (recovery) attempts with default exception for particular 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.voidfailNextPersisted()Fail next write operations with default exception for any persistence id.voidfailNextPersisted(java.lang.String persistenceId)Fail next write operations with default exception for particular persistence id.voidfailNextPersisted(java.lang.String persistenceId, java.lang.Throwable cause)Fail next write operations withcauseexception for particular persistence id.voidfailNextPersisted(java.lang.Throwable cause)Fail next write operations withcauseexception for any persistence id.voidfailNextRead()Fail next read from storage (recovery) attempt with default exception for any persistence id.voidfailNextRead(java.lang.String persistenceId)Fail next read from storage (recovery) attempt with default exception for any persistence id.voidfailNextRead(java.lang.String persistenceId, java.lang.Throwable cause)Fail next read from storage (recovery) attempt withcauseexception for particular persistence id.voidfailNextRead(java.lang.Throwable cause)Fail next read from storage (recovery) attempt withcauseexception for any persistence id.java.util.List<Pair<SnapshotMeta,java.lang.Object>>persistedInStorage(java.lang.String persistenceId)Retrieve all snapshots and their metadata saved in storage by persistence id.voidpersistForRecovery(java.lang.String persistenceId, java.util.List<Pair<SnapshotMeta,java.lang.Object>> snapshots)Persistsnapshotswith metadata into storage in order.<A> java.util.List<A>receivePersisted(java.lang.String persistenceId, int n, java.lang.Class<A> cla)Receive nextnsnapshots that have been persisted in the storage.<A> java.util.List<A>receivePersisted(java.lang.String persistenceId, int n, java.lang.Class<A> cla, java.time.Duration max)Receive formaxtime nextnsnapshots that have been persisted in the storage.voidresetPolicy()Returns default policy if it was changed by {@link SnapshotTestKit.withPolicy()}.SnapshotTestKitwithPolicy(ProcessingPolicy<SnapshotOperation> policy)Set new processing policy for journal operations.
 
- 
- 
- 
Constructor Detail- 
SnapshotTestKitpublic SnapshotTestKit(SnapshotTestKit scalaTestkit) 
 - 
SnapshotTestKitpublic SnapshotTestKit(ActorSystem system) 
 
- 
 - 
Method Detail- 
createpublic static SnapshotTestKit create(ActorSystem system) 
 - 
createpublic static SnapshotTestKit create(ActorSystem<?> system) 
 - 
expectNothingPersistedpublic void expectNothingPersisted(java.lang.String persistenceId) Check that nothing has been saved in the storage.
 - 
expectNothingPersistedpublic void expectNothingPersisted(java.lang.String persistenceId, java.time.Duration max)Check formaxtime that nothing has been saved in the storage.
 - 
expectNextPersistedpublic <A> A expectNextPersisted(java.lang.String persistenceId, A snapshot)Check thatsnapshothas been saved in the storage.
 - 
expectNextPersistedpublic <A> A expectNextPersisted(java.lang.String persistenceId, A snapshot, java.time.Duration max)Check formaxtime thatsnapshothas been saved in the storage.
 - 
expectNextPersistedClasspublic <A> A expectNextPersistedClass(java.lang.String persistenceId, java.lang.Class<A> cla)Check that next persisted in storage for particular persistence id snapshot has expected type.
 - 
expectNextPersistedClasspublic <A> A expectNextPersistedClass(java.lang.String persistenceId, java.lang.Class<A> cla, java.time.Duration max)Check formaxtime that next persisted in storage for particular persistence id snapshot has expected type.
 - 
failNextNPersistedpublic void failNextNPersisted(java.lang.String persistenceId, int n, java.lang.Throwable cause)Fail nextnwrite operations with thecauseexception for particular persistence id.
 - 
failNextNPersistedpublic void failNextNPersisted(java.lang.String persistenceId, int n)Fail nextnwrite operations for particular persistence id.
 - 
failNextNPersistedpublic void failNextNPersisted(int n, java.lang.Throwable cause)Fail nextnwrite operations with thecauseexception for any persistence id.
 - 
failNextNPersistedpublic void failNextNPersisted(int n) Fail nextnwrite operations with default exception for any persistence id.
 - 
failNextPersistedpublic void failNextPersisted(java.lang.String persistenceId, java.lang.Throwable cause)Fail next write operations withcauseexception for particular persistence id.
 - 
failNextPersistedpublic void failNextPersisted(java.lang.String persistenceId) Fail next write operations with default exception for particular persistence id.
 - 
failNextPersistedpublic void failNextPersisted(java.lang.Throwable cause) Fail next write operations withcauseexception for any persistence id.
 - 
failNextPersistedpublic void failNextPersisted() Fail next write operations with default exception for any persistence id.
 - 
failNextReadpublic void failNextRead(java.lang.Throwable cause) Fail next read from storage (recovery) attempt withcauseexception for any persistence id.
 - 
failNextReadpublic void failNextRead() Fail next read from storage (recovery) attempt with default exception for any persistence id.
 - 
failNextReadpublic void failNextRead(java.lang.String persistenceId, java.lang.Throwable cause)Fail next read from storage (recovery) attempt withcauseexception for particular persistence id.
 - 
failNextReadpublic void failNextRead(java.lang.String persistenceId) Fail next read from storage (recovery) attempt with default exception for any persistence id.
 - 
failNextNReadspublic void failNextNReads(int n, java.lang.Throwable cause)Fail next n read from storage (recovery) attempts withcauseexception for any persistence id.
 - 
failNextNReadspublic void failNextNReads(int n) Fail next n read from storage (recovery) attempts with default exception for any persistence id.
 - 
failNextNReadspublic void failNextNReads(java.lang.String persistenceId, int n, java.lang.Throwable cause)Fail next n read from storage (recovery) attempts withcauseexception for particular persistence id.
 - 
failNextNReadspublic void failNextNReads(java.lang.String persistenceId, int n)Fail next n read from storage (recovery) attempts with default exception for particular persistence id.
 - 
failNextDeletepublic void failNextDelete(java.lang.Throwable cause) Fail next delete from storage attempt withcauseexception for any persistence id.
 - 
failNextDeletepublic void failNextDelete() Fail next delete from storage attempt with default exception for any persistence id.
 - 
failNextDeletepublic void failNextDelete(java.lang.String persistenceId, java.lang.Throwable cause)Fail next delete from storage attempt withcauseexception for particular persistence id.
 - 
failNextDeletepublic void failNextDelete(java.lang.String persistenceId) Fail next delete from storage attempt with default exception for particular persistence id.
 - 
failNextNDeletespublic void failNextNDeletes(int n, java.lang.Throwable cause)Fail next n delete from storage attempts withcauseexception for any persistence id.
 - 
failNextNDeletespublic void failNextNDeletes(int n) Fail next n delete from storage attempts with default exception for any persistence id.
 - 
failNextNDeletespublic void failNextNDeletes(java.lang.String persistenceId, int n, java.lang.Throwable cause)Fail next n delete from storage attempts withcauseexception for particular persistence id.
 - 
failNextNDeletespublic void failNextNDeletes(java.lang.String persistenceId, int n)Fail next n delete from storage attempts with default exception for particular persistence id.
 - 
receivePersistedpublic <A> java.util.List<A> receivePersisted(java.lang.String persistenceId, int n, java.lang.Class<A> cla)Receive nextnsnapshots that have been persisted in the storage.
 - 
receivePersistedpublic <A> java.util.List<A> receivePersisted(java.lang.String persistenceId, int n, java.lang.Class<A> cla, java.time.Duration max)Receive formaxtime nextnsnapshots that have been persisted in the storage.
 - 
persistForRecoverypublic void persistForRecovery(java.lang.String persistenceId, java.util.List<Pair<SnapshotMeta,java.lang.Object>> snapshots)Persistsnapshotswith metadata into storage in order.
 - 
persistedInStoragepublic java.util.List<Pair<SnapshotMeta,java.lang.Object>> persistedInStorage(java.lang.String persistenceId) Retrieve all snapshots and their metadata saved in storage by persistence id.
 - 
clearAllpublic void clearAll() Clear all data from storage.
 - 
clearByPersistenceIdpublic void clearByPersistenceId(java.lang.String persistenceId) Clear all data from storage for particular persistence id.
 - 
failNextNOpsCondpublic void failNextNOpsCond(java.util.function.BiFunction<java.lang.String,SnapshotOperation,java.lang.Object> cond, int n) Failnfollowing journal operations depending on the conditioncond. Failure triggers, whencondreturns true. Fails operations with defaultExpectedFailureexception.
 - 
failNextNOpsCondpublic void failNextNOpsCond(java.util.function.BiFunction<java.lang.String,SnapshotOperation,java.lang.Object> cond, int n, java.lang.Throwable cause) Failnfollowing journal operations depending on the conditioncond. Failure triggers, whencondreturns true. Fails operations with thecauseexception.
 - 
failNextNOpspublic void failNextNOps(int n) Fail n following journal operations regardless of their type. Fails operations with defaultExpectedFailureexception.
 - 
failNextNOpspublic void failNextNOps(int n, java.lang.Throwable cause)Failnfollowing journal operations depending on the conditioncond. Failure triggers, whencondreturns true. Fails operations with thecauseexception.
 - 
withPolicypublic SnapshotTestKit withPolicy(ProcessingPolicy<SnapshotOperation> policy) Set new processing policy for journal operations. NOTE! Overrides previously invokedfailNext...orrejectNext...
 - 
resetPolicypublic void resetPolicy() Returns default policy if it was changed by {@link SnapshotTestKit.withPolicy()}.
 
- 
 
-