Class DurableStateStoreSpec

java.lang.Object
org.apache.pekko.persistence.PluginSpec
org.apache.pekko.persistence.state.DurableStateStoreSpec
All Implemented Interfaces:
Serializable, CapabilityFlags, DurableStateStoreCapabilityFlags, MayVerb, OptionalTests, TestKitBase, org.scalactic.Explicitly, org.scalactic.Tolerance, org.scalactic.TripleEquals, org.scalactic.TripleEqualsSupport, org.scalatest.Alerting, org.scalatest.Assertions, org.scalatest.BeforeAndAfterAll, org.scalatest.BeforeAndAfterEach, org.scalatest.Documenting, org.scalatest.Informing, org.scalatest.matchers.dsl.MatcherWords, org.scalatest.matchers.should.Matchers, org.scalatest.Notifying, org.scalatest.Suite, org.scalatest.SuiteMixin, org.scalatest.TestRegistration, org.scalatest.TestSuite, org.scalatest.verbs.CanVerb, org.scalatest.verbs.MustVerb, org.scalatest.verbs.ShouldVerb, org.scalatest.wordspec.AnyWordSpecLike
Direct Known Subclasses:
JavaDurableStateStoreSpec

public abstract class DurableStateStoreSpec extends PluginSpec implements MayVerb, OptionalTests, DurableStateStoreCapabilityFlags
This spec aims to verify custom pekko-persistence DurableStateStore implementations. Plugin authors are highly encouraged to include it in their plugin's test suites.

In case your durable state store plugin needs some kind of setup or teardown, override the beforeAll or afterAll methods (don't forget to call super in your overridden methods).

For a Java and JUnit consumable version of the TCK please refer to pekko.persistence.japi.state.JavaDurableStateStoreSpec.

See Also:
  • Constructor Details

    • DurableStateStoreSpec

      public DurableStateStoreSpec(com.typesafe.config.Config config)
  • Method Details

    • config

      public static com.typesafe.config.Config config()
    • system

      public ActorSystem system()
      Specified by:
      system in interface TestKitBase
    • supportsDeleteWithRevisionCheck

      protected CapabilityFlag supportsDeleteWithRevisionCheck()
      Description copied from interface: DurableStateStoreCapabilityFlags
      When true enables tests which check if the durable state store properly rejects a deleteObject call when the revision does not match the stored revision.
      Specified by:
      supportsDeleteWithRevisionCheck in interface DurableStateStoreCapabilityFlags
    • supportsUpsertWithRevisionCheck

      protected CapabilityFlag supportsUpsertWithRevisionCheck()
      Description copied from interface: DurableStateStoreCapabilityFlags
      When true enables tests which check if the durable state store properly rejects an upsertObject call when the revision is stale (does not match the expected next revision). This is the optimistic concurrency check on writes.
      Specified by:
      supportsUpsertWithRevisionCheck in interface DurableStateStoreCapabilityFlags
    • supportsSerialization

      protected CapabilityFlag supportsSerialization()
      Description copied from interface: DurableStateStoreCapabilityFlags
      When true enables tests which check if the durable state store properly serializes and deserializes values via the configured Pekko serializer infrastructure.
      Specified by:
      supportsSerialization in interface DurableStateStoreCapabilityFlags
    • supportsSoftDelete

      protected CapabilityFlag supportsSoftDelete()
      Description copied from interface: DurableStateStoreCapabilityFlags
      When true enables tests which check the deprecated single-argument deleteObject(persistenceId) overload, which deletes regardless of the current revision.
      Specified by:
      supportsSoftDelete in interface DurableStateStoreCapabilityFlags
    • beforeEach

      protected void beforeEach()
      Specified by:
      beforeEach in interface org.scalatest.BeforeAndAfterEach
      Overrides:
      beforeEach in class PluginSpec
    • preparePersistenceId

      public void preparePersistenceId(String pid)
      Overridable hook that is called before each test case. pid is the persistenceId that will be used in the test. This method may be needed to clean any pre-existing state from the store, for example when running against a shared external database.
    • durableStateStore

      public DurableStateUpdateStore<Object> durableStateStore()
      Returns the DurableStateUpdateStore under test. By default, this uses the plugin configured under pekko.persistence.state.plugin in the provided config.
    • timeout

      protected scala.concurrent.duration.FiniteDuration timeout()