Class JournalSpec

java.lang.Object
org.apache.pekko.persistence.PluginSpec
org.apache.pekko.persistence.journal.JournalSpec
All Implemented Interfaces:
Serializable, CapabilityFlags, JournalCapabilityFlags, 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:
JavaJournalSpec, JournalPerfSpec

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

In case your journal 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.journal.JavaJournalSpec.

See Also:
  • pekko.persistence.journal.JournalPerfSpec
  • pekko.persistence.japi.journal.JavaJournalPerfSpec
  • Serialized Form
  • Constructor Details

    • JournalSpec

      public JournalSpec(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
    • supportsSerialization

      protected CapabilityFlag supportsSerialization()
      Description copied from interface: JournalCapabilityFlags
      When true enables tests which check if the Journal properly serialize and deserialize events.
      Specified by:
      supportsSerialization in interface JournalCapabilityFlags
    • supportsMetadata

      protected CapabilityFlag supportsMetadata()
      Description copied from interface: JournalCapabilityFlags
      When true enables tests which check if the Journal stores and returns metadata for an event
      Specified by:
      supportsMetadata in interface JournalCapabilityFlags
    • 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 populating the journal for the next test case. pid is the persistenceId that will be used in the test. This method may be needed to clean pre-existing events from the log.
    • supportsAtomicPersistAllOfSeveralEvents

      public boolean supportsAtomicPersistAllOfSeveralEvents()
      Implementation may override and return false if it does not support atomic writes of several events, as emitted by persistAll.
    • journal

      public ActorRef journal()
    • replayedMessage

      public JournalProtocol.ReplayedMessage replayedMessage(long snr, boolean deleted)
    • replayedMessage$default$2

      public boolean replayedMessage$default$2()
    • writeMessages

      public void writeMessages(int fromSnr, int toSnr, String pid, ActorRef sender, String writerUuid)