+per #13815 akka-persistence-tck based on @krasserm's work
Original here: https://github.com/krasserm/akka-persistence-testkit New features: * merged martin's tests * usable from java (junit 4) * simple bench test, which helps checking if ordering is perserved under bigger workloads and simple perf checking * does NOT include tests for already deprecated features (deleteMessages) * docs Resolves #13815 Conflicts: project/AkkaBuild.scala
This commit is contained in:
parent
7ca3a9699e
commit
90bc347607
22 changed files with 965 additions and 186 deletions
|
|
@ -5,20 +5,18 @@
|
|||
package docs.persistence
|
||||
|
||||
//#plugin-imports
|
||||
import scala.concurrent.Future
|
||||
import scala.collection.immutable.Seq
|
||||
//#plugin-imports
|
||||
|
||||
import com.typesafe.config._
|
||||
import org.scalatest.WordSpec
|
||||
import scala.concurrent.duration._
|
||||
import akka.testkit.TestKit
|
||||
|
||||
import akka.actor.ActorSystem
|
||||
//#plugin-imports
|
||||
import akka.persistence._
|
||||
import akka.persistence.journal._
|
||||
import akka.persistence.snapshot._
|
||||
import akka.testkit.TestKit
|
||||
import com.typesafe.config._
|
||||
import org.scalatest.WordSpec
|
||||
|
||||
import scala.collection.immutable.Seq
|
||||
import scala.concurrent.Future
|
||||
import scala.concurrent.duration._
|
||||
//#plugin-imports
|
||||
|
||||
object PersistencePluginDocSpec {
|
||||
|
|
@ -115,7 +113,6 @@ trait SharedLeveldbPluginDocSpec {
|
|||
|
||||
new AnyRef {
|
||||
import akka.actor._
|
||||
//#shared-store-creation
|
||||
import akka.persistence.journal.leveldb.SharedLeveldbStore
|
||||
|
||||
val store = system.actorOf(Props[SharedLeveldbStore], "store")
|
||||
|
|
@ -139,3 +136,60 @@ class MySnapshotStore extends SnapshotStore {
|
|||
def delete(metadata: SnapshotMetadata): Unit = ???
|
||||
def delete(persistenceId: String, criteria: SnapshotSelectionCriteria): Unit = ???
|
||||
}
|
||||
|
||||
object PersistenceTCKDoc {
|
||||
new AnyRef {
|
||||
import akka.persistence.journal.JournalSpec
|
||||
|
||||
//#journal-tck-scala
|
||||
class MyJournalSpec extends JournalSpec {
|
||||
override val config = ConfigFactory.parseString(
|
||||
"""
|
||||
|akka.persistence.journal.plugin = "my.journal.plugin"
|
||||
""".stripMargin)
|
||||
}
|
||||
//#journal-tck-scala
|
||||
}
|
||||
new AnyRef {
|
||||
import akka.persistence.snapshot.SnapshotStoreSpec
|
||||
|
||||
//#snapshot-store-tck-scala
|
||||
class MySnapshotStoreSpec extends SnapshotStoreSpec {
|
||||
override val config = ConfigFactory.parseString(
|
||||
"""
|
||||
|akka.persistence.snapshot-store.plugin = "my.snapshot-store.plugin"
|
||||
""".stripMargin)
|
||||
}
|
||||
//#snapshot-store-tck-scala
|
||||
}
|
||||
new AnyRef {
|
||||
import java.io.File
|
||||
|
||||
import akka.persistence.journal.JournalSpec
|
||||
import org.iq80.leveldb.util.FileUtils
|
||||
|
||||
//#journal-tck-before-after-scala
|
||||
class MyJournalSpec extends JournalSpec {
|
||||
override val config = ConfigFactory.parseString(
|
||||
"""
|
||||
|akka.persistence.journal.plugin = "my.journal.plugin"
|
||||
""".stripMargin)
|
||||
|
||||
val storageLocations = List(
|
||||
new File(system.settings.config.getString("akka.persistence.journal.leveldb.dir")),
|
||||
new File(config.getString("akka.persistence.snapshot-store.local.dir")))
|
||||
|
||||
override def beforeAll() {
|
||||
super.beforeAll()
|
||||
storageLocations foreach FileUtils.deleteRecursively
|
||||
}
|
||||
|
||||
override def afterAll() {
|
||||
storageLocations foreach FileUtils.deleteRecursively
|
||||
super.afterAll()
|
||||
}
|
||||
|
||||
}
|
||||
//#journal-tck-before-after-scala
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue