From f0a57594a58a843da0c0aad4dabebd1e0c24fca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Andr=C3=A9n?= Date: Mon, 27 May 2024 11:15:53 +0200 Subject: [PATCH] chore: Fix Scala 3 migration tests compilation (#577) --- .../r2dbc/migration/MigrationChangeHandler.scala | 4 +++- .../persistence/r2dbc/migration/MigrationToolSpec.scala | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/migration-tests/src/test/scala/akka/persistence/r2dbc/migration/MigrationChangeHandler.scala b/migration-tests/src/test/scala/akka/persistence/r2dbc/migration/MigrationChangeHandler.scala index e1fcd50e..0cf69bdc 100644 --- a/migration-tests/src/test/scala/akka/persistence/r2dbc/migration/MigrationChangeHandler.scala +++ b/migration-tests/src/test/scala/akka/persistence/r2dbc/migration/MigrationChangeHandler.scala @@ -6,7 +6,6 @@ package akka.persistence.r2dbc.migration import scala.concurrent.ExecutionContext import scala.concurrent.Future - import akka.Done import akka.actor.typed.ActorSystem import akka.persistence.Persistence @@ -15,6 +14,8 @@ import akka.persistence.query.UpdatedDurableState import akka.persistence.r2dbc.session.scaladsl.R2dbcSession import akka.persistence.r2dbc.state.scaladsl.ChangeHandler +import scala.annotation.nowarn + class MigrationChangeHandler(system: ActorSystem[_]) extends ChangeHandler[Any] { private val incrementSql = @@ -25,6 +26,7 @@ class MigrationChangeHandler(system: ActorSystem[_]) extends ChangeHandler[Any] println(incrementSql) + @nowarn("msg=exhaustive") override def process(session: R2dbcSession, change: DurableStateChange[Any]): Future[Done] = { println("process changer") change match { diff --git a/migration-tests/src/test/scala/akka/persistence/r2dbc/migration/MigrationToolSpec.scala b/migration-tests/src/test/scala/akka/persistence/r2dbc/migration/MigrationToolSpec.scala index d465cead..e0edcfb5 100644 --- a/migration-tests/src/test/scala/akka/persistence/r2dbc/migration/MigrationToolSpec.scala +++ b/migration-tests/src/test/scala/akka/persistence/r2dbc/migration/MigrationToolSpec.scala @@ -496,7 +496,9 @@ class MigrationToolSpec "migrate durable state of one persistenceId with change handler" in { if (hasChangeHandler) { import akka.persistence.r2dbc.internal.Sql.InterpolationWithAdapter - import r2dbcSettings.codecSettings.DurableStateImplicits._ + // Scala 3 needs the extra step here + val durableStateImplicits = r2dbcSettings.codecSettings.DurableStateImplicits + import durableStateImplicits._ val pid = PersistenceId.ofUniqueId(nextPid()) val slice = persistenceExt.sliceForPersistenceId(pid.id) @@ -524,7 +526,9 @@ class MigrationToolSpec "migrate durable state of one persistenceId with additional column" in { if (hasAdditionalColumn) { import akka.persistence.r2dbc.internal.Sql.InterpolationWithAdapter - import r2dbcSettings.codecSettings.DurableStateImplicits._ + // Scala 3 needs the extra step here + val durableStateImplicits = r2dbcSettings.codecSettings.DurableStateImplicits + import durableStateImplicits._ val pid = PersistenceId.ofUniqueId(nextPid()) persistDurableState(pid, "s-column") migration.migrateDurableState(pid.id).futureValue shouldBe 1L