Build akka persistence typed with scala3 (#30772)

This commit is contained in:
Arnout Engelen 2021-10-12 08:22:12 +02:00 committed by GitHub
parent f637e1f72f
commit 7742f1ded3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 21 additions and 19 deletions

View file

@ -23,7 +23,7 @@ jobs:
- akka-bench-jmh/test
- akka-cluster/Test/compile akka-cluster-tools/test akka-cluster-typed/test akka-distributed-data/test akka-cluster-metrics/Test/compile akka-cluster-sharding/Test/compile akka-cluster-sharding-typed/compile
- akka-discovery/test akka-coordination/test
- akka-persistence/test akka-persistence-shared/test akka-persistence-query/test
- akka-persistence/test akka-persistence-shared/test akka-persistence-query/test akka-persistence-typed/test akka-persistence-testkit/test
- akka-pki/test akka-slf4j/test
- akka-serialization-jackson/test
- akka-stream/test akka-stream-testkit/test akka-stream-tests/test

View file

@ -21,7 +21,7 @@ jobs:
- akka-bench-jmh/Test/compile
- akka-cluster/Test/compile akka-cluster-tools/Test/compile akka-cluster-typed/Test/compile akka-distributed-data/Test/compile akka-cluster-metrics/Test/compile akka-cluster-sharding/Test/compile akka-cluster-sharding-typed/compile
- akka-discovery/Test/compile akka-coordination/Test/compile
- akka-persistence/Test/compile akka-persistence-shared/Test/compile akka-persistence-query/Test/compile
- akka-persistence/Test/compile akka-persistence-shared/Test/compile akka-persistence-query/Test/compile akka-persistence-typed/Test/compile akka-persistence-testkit/Test/compile
- akka-pki/Test/compile akka-slf4j/Test/compile
- akka-serialization-jackson/Test/compile
- akka-stream/Test/compile akka-stream-testkit/Test/compile akka-stream-tests/Test/compile

View file

@ -442,7 +442,8 @@ class PersistenceTestKit(system: ActorSystem)
import PersistenceTestKit._
override protected val storage = InMemStorageExtension(system).storageFor(PersistenceTestKitPlugin.PluginId)
override protected val storage: EventStorage =
InMemStorageExtension(system).storageFor(PersistenceTestKitPlugin.PluginId)
private final lazy val settings = Settings(system)

View file

@ -56,7 +56,7 @@ private[testkit] trait RejectSupport[U] {
}
private[testkit] trait PolicyOpsTestKit[P] extends {
private[testkit] trait PolicyOpsTestKit[P] {
this: HasStorage[P, _] =>
private[testkit] val Policies: DefaultPolicies[P]

View file

@ -31,7 +31,7 @@ class PersistenceTestKitDurableStateStore[A](val system: ExtendedActorSystem)
extends DurableStateUpdateStore[A]
with DurableStateStoreQuery[A] {
private implicit val sys = system
private implicit val sys: ExtendedActorSystem = system
private var store = Map.empty[String, Record[A]]
private val (publisher, changesSource) =
@ -76,7 +76,7 @@ class PersistenceTestKitDurableStateStore[A](val system: ExtendedActorSystem)
.statefulMapConcat { () =>
var globalOffsetSeen = EarliestOffset
{ record: Record[A] =>
{ (record: Record[A]) =>
if (record.globalOffset > globalOffsetSeen) {
globalOffsetSeen = record.globalOffset
record :: Nil

View file

@ -16,7 +16,7 @@ import akka.util.ccompat.JavaConverters._
trait CommonSnapshotTests extends JavaDslUtils {
lazy val testKit = new SnapshotTestKit(system)
final lazy val testKit = new SnapshotTestKit(system)
import testKit._
def specificTests(): Unit

View file

@ -15,7 +15,7 @@ import akka.util.ccompat.JavaConverters._
trait CommonTestKitTests extends JavaDslUtils {
lazy val testKit = new PersistenceTestKit(system)
final lazy val testKit = new PersistenceTestKit(system)
import testKit._
def specificTests(): Unit

View file

@ -21,7 +21,7 @@ class CurrentEventsByTagSpec
with LogCapturing
with AnyWordSpecLike {
implicit val classic = system.classicSystem
implicit val classic: akka.actor.ActorSystem = system.classicSystem
val queries =
PersistenceQuery(system).readJournalFor[PersistenceTestKitReadJournal](PersistenceTestKitReadJournal.Identifier)

View file

@ -48,7 +48,7 @@ class EventsByPersistenceIdSpec
with AnyWordSpecLike {
import EventsByPersistenceIdSpec._
implicit val classic = system.classicSystem
implicit val classic: akka.actor.ActorSystem = system.classicSystem
val queries =
PersistenceQuery(system).readJournalFor[PersistenceTestKitReadJournal](PersistenceTestKitReadJournal.Identifier)

View file

@ -15,7 +15,7 @@ import akka.testkit.EventFilter
trait CommonSnapshotTests extends ScalaDslUtils {
lazy val testKit = new SnapshotTestKit(system)
final lazy val testKit = new SnapshotTestKit(system)
import testKit._
def specificTests(): Unit
@ -71,7 +71,7 @@ trait CommonSnapshotTests extends ScalaDslUtils {
expectNextPersistedType[Int](pid) should be(2)
assertThrows[AssertionError] {
expectNextPersistedType(pid)
expectNextPersistedType[Any](pid)
}
}

View file

@ -14,7 +14,7 @@ import akka.testkit.EventFilter
trait CommonTestKitTests extends ScalaDslUtils {
lazy val testKit = new PersistenceTestKit(system)
final lazy val testKit: PersistenceTestKit = new PersistenceTestKit(system)
import testKit._
def specificTests(): Unit

View file

@ -53,10 +53,10 @@ object EventSourcedBehaviorTestKitSpec {
case object NotSerializableCommand extends Command
final case class IncrementWithNotSerializableReply(replyTo: ActorRef[NotSerializableReply.type])
final case class IncrementWithNotSerializableReply(replyTo: ActorRef[NotSerializableReply])
extends Command
with CborSerializable
object NotSerializableReply
class NotSerializableReply
def apply(persistenceId: PersistenceId): Behavior[Command] =
apply(persistenceId, RealState(0, Vector.empty))
@ -100,7 +100,7 @@ object EventSourcedBehaviorTestKitSpec {
Effect.persist(IncrementedWithNotSerializableState(1)).thenNoReply()
case IncrementWithNotSerializableReply(replyTo) =>
Effect.persist(Incremented(1)).thenReply(replyTo)(_ => NotSerializableReply)
Effect.persist(Incremented(1)).thenReply(replyTo)(_ => new NotSerializableReply)
case NotSerializableCommand =>
Effect.noReply
@ -277,7 +277,7 @@ class EventSourcedBehaviorTestKitSpec
val eventSourcedTestKit = createTestKit()
val exc = intercept[IllegalArgumentException] {
eventSourcedTestKit.runCommand(TestCounter.IncrementWithNotSerializableReply)
eventSourcedTestKit.runCommand(replyTo => TestCounter.IncrementWithNotSerializableReply(replyTo))
}
(exc.getMessage should include).regex("Reply.*isn't serializable")
exc.getCause.getClass should ===(classOf[NotSerializableException])

View file

@ -32,7 +32,7 @@ class PersistenceTestKitDurableStateStoreSpec
import PersistenceTestKitDurableStateStoreSpec._
implicit val classic = system.classicSystem
implicit val classic: akka.actor.ActorSystem = system.classicSystem
"Persistent test kit state store changes query" must {

View file

@ -30,7 +30,8 @@ object Dependencies {
val scala212Version = "2.12.15"
val scala213Version = "2.13.6"
// To get the fix for https://github.com/lampepfl/dotty/issues/13106
val scala3Version = "3.1.1-RC1-bin-20210915-ea871c2-NIGHTLY"
// and restored static forwarders
val scala3Version = "3.1.1-RC1-bin-20211007-c041327-NIGHTLY"
val reactiveStreamsVersion = "1.0.3"