+per #16541 allow using javadsl implemented journals as-if scaladsl

This commit is contained in:
Patrik Nordwall & Konrad Malawski 2015-06-08 12:26:19 +02:00 committed by Konrad Malawski
parent 893578a8af
commit 3b94108e0c
8 changed files with 123 additions and 35 deletions

View file

@ -10,12 +10,11 @@ import akka.actor.ActorSystem
import akka.persistence.journal.{ EventAdapter, EventSeq }
import com.typesafe.config.ConfigFactory
import org.scalatest.{ BeforeAndAfterAll, Matchers, WordSpecLike }
import org.scalautils.ConversionCheckedTripleEquals
import scala.concurrent.Await
import scala.concurrent.duration._
class PersistenceQuerySpec extends WordSpecLike with Matchers with BeforeAndAfterAll with ConversionCheckedTripleEquals {
class PersistenceQuerySpec extends WordSpecLike with Matchers with BeforeAndAfterAll {
val anything: Query[String, _] = null
@ -42,12 +41,24 @@ class PersistenceQuerySpec extends WordSpecLike with Matchers with BeforeAndAfte
}.getMessage should include("missing persistence read journal")
}
}
"expose scaladsl implemented journal as javadsl.ReadJournal" in {
withActorSystem() { system
val j: javadsl.ReadJournal = PersistenceQuery.get(system).getReadJournalFor(MockReadJournal.Identifier)
}
}
"expose javadsl implemented journal as scaladsl.ReadJournal" in {
withActorSystem() { system
val j: scaladsl.ReadJournal = PersistenceQuery.get(system).readJournalFor(MockJavaReadJournal.Identifier)
}
}
}
private val systemCounter = new AtomicInteger()
private def withActorSystem(conf: String = "")(block: ActorSystem Unit): Unit = {
val config =
MockReadJournal.config
.withFallback(MockJavaReadJournal.config)
.withFallback(ConfigFactory.parseString(conf))
.withFallback(ConfigFactory.parseString(eventAdaptersConfig))
.withFallback(ConfigFactory.load())