diff --git a/core/src/test/java/akka/persistence/jdbc/state/JavadslSnippets.java b/core/src/test/java/akka/persistence/jdbc/state/JavadslSnippets.java index c27a18d54..1267444cf 100644 --- a/core/src/test/java/akka/persistence/jdbc/state/JavadslSnippets.java +++ b/core/src/test/java/akka/persistence/jdbc/state/JavadslSnippets.java @@ -59,7 +59,8 @@ void durableStatePlugin() { @SuppressWarnings("unchecked") JdbcDurableStateStore store = DurableStateStoreRegistry.get(system) - .getDurableStateStoreFor(JdbcDurableStateStore.class, "akka.persistence.state.jdbc"); + .getDurableStateStoreFor( + JdbcDurableStateStore.class, JdbcDurableStateStore.Identifier()); // #jdbc-durable-state-store } @@ -71,7 +72,8 @@ void getObject() { @SuppressWarnings("unchecked") JdbcDurableStateStore store = DurableStateStoreRegistry.get(system) - .getDurableStateStoreFor(JdbcDurableStateStore.class, "akka.persistence.state.jdbc"); + .getDurableStateStoreFor( + JdbcDurableStateStore.class, JdbcDurableStateStore.Identifier()); CompletionStage> futureResult = store.getObject("InvalidPersistenceId"); try { @@ -91,7 +93,8 @@ void upsertAndGetObject() { @SuppressWarnings("unchecked") JdbcDurableStateStore store = DurableStateStoreRegistry.get(system) - .getDurableStateStoreFor(JdbcDurableStateStore.class, "akka.persistence.state.jdbc"); + .getDurableStateStoreFor( + JdbcDurableStateStore.class, JdbcDurableStateStore.Identifier()); CompletionStage> r = store @@ -116,7 +119,8 @@ void deleteObject() { @SuppressWarnings("unchecked") JdbcDurableStateStore store = DurableStateStoreRegistry.get(system) - .getDurableStateStoreFor(JdbcDurableStateStore.class, "akka.persistence.state.jdbc"); + .getDurableStateStoreFor( + JdbcDurableStateStore.class, JdbcDurableStateStore.Identifier()); CompletionStage futureResult = store.deleteObject("p123"); try { @@ -135,7 +139,8 @@ void currentChanges() { @SuppressWarnings("unchecked") JdbcDurableStateStore store = DurableStateStoreRegistry.get(system) - .getDurableStateStoreFor(JdbcDurableStateStore.class, "akka.persistence.state.jdbc"); + .getDurableStateStoreFor( + JdbcDurableStateStore.class, JdbcDurableStateStore.Identifier()); Source, NotUsed> willCompleteTheStream = store.currentChanges("tag-1", NoOffset.getInstance()); @@ -150,7 +155,8 @@ void changes() { @SuppressWarnings("unchecked") JdbcDurableStateStore store = DurableStateStoreRegistry.get(system) - .getDurableStateStoreFor(JdbcDurableStateStore.class, "akka.persistence.state.jdbc"); + .getDurableStateStoreFor( + JdbcDurableStateStore.class, JdbcDurableStateStore.Identifier()); Source, NotUsed> willNotCompleteTheStream = store.changes("tag-1", NoOffset.getInstance()); diff --git a/core/src/test/scala/akka/persistence/jdbc/state/ScaladslSnippets.scala b/core/src/test/scala/akka/persistence/jdbc/state/ScaladslSnippets.scala index 5ab0e4548..4537d661a 100644 --- a/core/src/test/scala/akka/persistence/jdbc/state/ScaladslSnippets.scala +++ b/core/src/test/scala/akka/persistence/jdbc/state/ScaladslSnippets.scala @@ -25,7 +25,7 @@ object ScaladslSnippets extends ScalaFutures with Matchers { import akka.persistence.jdbc.state.scaladsl.JdbcDurableStateStore val store = DurableStateStoreRegistry .get(system) - .durableStateStoreFor[JdbcDurableStateStore[String]]("akka.persistence.state.jdbc") + .durableStateStoreFor[JdbcDurableStateStore[String]](JdbcDurableStateStore.Identifier) // #jdbc-durable-state-store } @@ -39,7 +39,7 @@ object ScaladslSnippets extends ScalaFutures with Matchers { val store = DurableStateStoreRegistry .get(system) - .durableStateStoreFor[JdbcDurableStateStore[String]]("akka.persistence.state.jdbc") + .durableStateStoreFor[JdbcDurableStateStore[String]](JdbcDurableStateStore.Identifier) val futureResult: Future[GetObjectResult[String]] = store.getObject("InvalidPersistenceId") futureResult.futureValue.value shouldBe None @@ -57,7 +57,7 @@ object ScaladslSnippets extends ScalaFutures with Matchers { val store = DurableStateStoreRegistry .get(system) - .durableStateStoreFor[JdbcDurableStateStore[String]]("akka.persistence.state.jdbc") + .durableStateStoreFor[JdbcDurableStateStore[String]](JdbcDurableStateStore.Identifier) val v: Future[GetObjectResult[String]] = for { @@ -83,7 +83,7 @@ object ScaladslSnippets extends ScalaFutures with Matchers { val store = DurableStateStoreRegistry .get(system) - .durableStateStoreFor[JdbcDurableStateStore[String]]("akka.persistence.state.jdbc") + .durableStateStoreFor[JdbcDurableStateStore[String]](JdbcDurableStateStore.Identifier) store.deleteObject("p123").futureValue shouldBe Done store.getObject("p123").futureValue.value shouldBe None @@ -102,7 +102,7 @@ object ScaladslSnippets extends ScalaFutures with Matchers { val store = DurableStateStoreRegistry .get(system) - .durableStateStoreFor[JdbcDurableStateStore[String]]("akka.persistence.state.jdbc") + .durableStateStoreFor[JdbcDurableStateStore[String]](JdbcDurableStateStore.Identifier) val willCompleteTheStream: Source[DurableStateChange[String], NotUsed] = store.currentChanges("tag-1", NoOffset) @@ -121,7 +121,7 @@ object ScaladslSnippets extends ScalaFutures with Matchers { val store = DurableStateStoreRegistry .get(system) - .durableStateStoreFor[JdbcDurableStateStore[String]]("akka.persistence.state.jdbc") + .durableStateStoreFor[JdbcDurableStateStore[String]](JdbcDurableStateStore.Identifier) val willNotCompleteTheStream: Source[DurableStateChange[String], NotUsed] = store.changes("tag-1", NoOffset) diff --git a/core/src/test/scala/akka/persistence/jdbc/state/scaladsl/DurableStateStorePluginSpec.scala b/core/src/test/scala/akka/persistence/jdbc/state/scaladsl/DurableStateStorePluginSpec.scala index d287b20b0..da999b91b 100644 --- a/core/src/test/scala/akka/persistence/jdbc/state/scaladsl/DurableStateStorePluginSpec.scala +++ b/core/src/test/scala/akka/persistence/jdbc/state/scaladsl/DurableStateStorePluginSpec.scala @@ -16,24 +16,17 @@ abstract class DurableStateStorePluginSpec(config: Config, profile: JdbcProfile) with Matchers with ScalaFutures { - val pluginConf: Config = ConfigFactory.parseString(s""" - akka.loglevel = INFO - akka.persistence.state.plugin = "akka.persistence.state.jdbc" - akka.persistence.state.jdbc { - class = "akka.persistence.jdbc.state.JdbcDurableStateStoreProvider" - } - """) - implicit lazy val system: ExtendedActorSystem = - ActorSystem("test", config.withFallback(pluginConf)).asInstanceOf[ExtendedActorSystem] + ActorSystem("test", config).asInstanceOf[ExtendedActorSystem] "A durable state store plugin" must { "instantiate a JdbcDurableDataStore successfully" in { val store = DurableStateStoreRegistry .get(system) - .durableStateStoreFor[JdbcDurableStateStore[String]]("akka.persistence.state.jdbc") + .durableStateStoreFor[JdbcDurableStateStore[String]](JdbcDurableStateStore.Identifier) store shouldBe a[JdbcDurableStateStore[_]] + store.system.settings.config shouldBe system.settings.config store.profile shouldBe profile } }