Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecated annotation to untyped APIs #96

Merged
merged 7 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ClusterReplication private (system: ExtendedActorSystem) extends Extension
private[this] lazy val guardian: ActorRef =
system.systemActorOf(ClusterReplicationGuardian.props(), "clusterReplicationGuardian")

@deprecated(message = "Use typed.ClusterReplication.init() instead", since = "2.0.0")
tksugimoto marked this conversation as resolved.
Show resolved Hide resolved
def start(
typeName: String,
entityProps: Props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ private[entityreplication] object ReplicationActor {
private def generateInstanceId(): EntityInstanceId = EntityInstanceId(instanceIdCounter.getAndIncrement())
}

@deprecated(message = "Use typed.ReplicatedEntityBehavior instead", since = "2.0.0")
trait ReplicationActor[StateData] extends Actor with Stash with akka.lerna.StashFactory {
import context.dispatcher

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import lerna.akka.entityreplication.ReplicationActor
/**
* The [[TestReplicationActorProps]] allows to test [[ReplicationActor]] like a normal Actor.
*/
@deprecated(message = "Use typed.testkit.ReplicatedEntityBehaviorTestKit instead", since = "2.0.0")
object TestReplicationActorProps {

def apply(replicationActorProps: Props): Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import akka.remote.testconductor.RoleName
import akka.remote.testkit.MultiNodeConfig
import com.typesafe.config.ConfigFactory

import scala.annotation.nowarn

object ConsistencyTestBase {

object ConsistencyTestBaseConfig extends MultiNodeConfig {
Expand Down Expand Up @@ -71,6 +73,7 @@ object ConsistencyTestBase {
}
}

@nowarn("msg=Use typed.ReplicatedEntityBehavior instead")
class ConsistencyTestReplicationActor() extends ReplicationActor[Int] {

import ConsistencyTestReplicationActor._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package lerna.akka.entityreplication

import java.util.concurrent.atomic.AtomicInteger

import akka.actor.{ ActorRef, Props }
import akka.remote.testkit.MultiNodeSpec
import lerna.akka.entityreplication.ConsistencyTestBase.{ ConsistencyTestBaseConfig, ConsistencyTestReplicationActor }
import org.scalatest.Inside

import scala.annotation.nowarn
import scala.concurrent.duration._

class ConsistencyTestNormalMultiJvmNode1 extends ConsistencyTestNormal
Expand All @@ -14,6 +15,7 @@ class ConsistencyTestNormalMultiJvmNode3 extends ConsistencyTestNormal
class ConsistencyTestNormalMultiJvmNode4 extends ConsistencyTestNormal
class ConsistencyTestNormalMultiJvmNode5 extends ConsistencyTestNormal

@nowarn("msg=method start in class ClusterReplication is deprecated")
class ConsistencyTestNormal extends MultiNodeSpec(ConsistencyTestBaseConfig) with STMultiNodeSpec with Inside {

import ConsistencyTestBaseConfig._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import lerna.akka.entityreplication.RaftActorCompactionSpec.DummyReplicationActo
import lerna.akka.entityreplication.raft.protocol.SnapshotOffer

import java.util.concurrent.atomic.AtomicInteger
import scala.annotation.nowarn
import scala.concurrent.duration._

object RaftActorCompactionSpecConfig extends MultiNodeConfig {
Expand All @@ -23,9 +24,9 @@ object RaftActorCompactionSpecConfig extends MultiNodeConfig {
.withFallback(ConfigFactory.parseString("""
akka.actor.provider = cluster
akka.test.single-expect-default = 15s

lerna.akka.entityreplication.raft.multi-raft-roles = ["replica-group-1", "replica-group-2", "replica-group-3"]

// triggers compaction each event replications
lerna.akka.entityreplication.raft.compaction.log-size-threshold = 2
lerna.akka.entityreplication.raft.compaction.preserve-log-size = 1
Expand Down Expand Up @@ -79,6 +80,7 @@ object RaftActorCompactionSpec {

import DummyReplicationActor._

@nowarn("msg=Use typed.ReplicatedEntityBehavior instead")
class DummyReplicationActor extends ReplicationActor[State] {

private[this] var state: State = State(0)
Expand Down Expand Up @@ -207,6 +209,7 @@ class RaftActorCompactionSpec extends MultiNodeSpec(RaftActorCompactionSpecConfi
}
}

@nowarn("msg=method start in class ClusterReplication is deprecated")
def createReplication(typeName: String): ActorRef =
planAutoKill {
ClusterReplication(system).start(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.typesafe.config.ConfigFactory
import lerna.akka.entityreplication.raft.protocol.SnapshotOffer

import java.util.concurrent.atomic.AtomicInteger
import scala.annotation.nowarn

object RaftEventSourcedSpecConfig extends MultiNodeConfig {
val node1: RoleName = role("node1")
Expand All @@ -24,7 +25,7 @@ object RaftEventSourcedSpecConfig extends MultiNodeConfig {
akka.test.single-expect-default = 15s
lerna.akka.entityreplication.raft.multi-raft-roles = ["member-1", "member-2", "member-3"]
lerna.akka.entityreplication.recovery-entity-timeout = 1s

inmemory-journal {
event-adapters {
dummy-event-adapter = "lerna.akka.entityreplication.RaftEventSourcedSpec$DummyEventAdapter"
Expand Down Expand Up @@ -91,6 +92,7 @@ object RaftEventSourcedSpec {

import DummyReplicationActor._

@nowarn("msg=Use typed.ReplicatedEntityBehavior instead")
class DummyReplicationActor extends ReplicationActor[State] {

private[this] var state: State = State(count = 0, knownRequestId = Set.empty)
Expand Down Expand Up @@ -150,6 +152,7 @@ object RaftEventSourcedSpec {
}
}

@nowarn("msg=method start in class ClusterReplication is deprecated")
class RaftEventSourcedSpec extends MultiNodeSpec(RaftEventSourcedSpecConfig) with STMultiNodeSpec {

import RaftEventSourcedSpec._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package lerna.akka.entityreplication

import java.util.concurrent.atomic.AtomicInteger

import akka.{ Done, NotUsed }
import akka.actor.{ ActorRef, PoisonPill, Props }
import akka.cluster.Cluster
Expand All @@ -13,6 +12,7 @@ import com.typesafe.config.ConfigFactory
import lerna.akka.entityreplication.raft.protocol.SnapshotOffer
import lerna.akka.entityreplication.raft.routing.MemberIndex

import scala.annotation.nowarn
import scala.concurrent.duration._
import scala.collection.Set

Expand Down Expand Up @@ -71,6 +71,7 @@ object ReplicationActorMultiNodeSpec {
}
}

@nowarn("msg=Use typed.ReplicatedEntityBehavior instead")
class PingPongReplicationActor extends ReplicationActor[Int] {

import PingPongReplicationActor._
Expand Down Expand Up @@ -124,6 +125,7 @@ object ReplicationActorMultiNodeSpec {
}
}

@nowarn("msg=Use typed.ReplicatedEntityBehavior instead")
class LockReplicationActor extends ReplicationActor[NotUsed] {
import LockReplicationActor._

Expand Down Expand Up @@ -183,6 +185,7 @@ object ReplicationActorMultiNodeSpec {
}
}

@nowarn("msg=Use typed.ReplicatedEntityBehavior instead")
class EphemeralReplicationActor extends ReplicationActor[Int] {

import EphemeralReplicationActor._
Expand Down Expand Up @@ -220,6 +223,7 @@ class ReplicationActorMultiNodeSpecMultiJvmNode1 extends ReplicationActorMultiNo
class ReplicationActorMultiNodeSpecMultiJvmNode2 extends ReplicationActorMultiNodeSpec
class ReplicationActorMultiNodeSpecMultiJvmNode3 extends ReplicationActorMultiNodeSpec

@nowarn("msg=method start in class ClusterReplication is deprecated")
class ReplicationActorMultiNodeSpec extends MultiNodeSpec(ReplicationActorSpecConfig) with STMultiNodeSpec {
import ReplicationActorMultiNodeSpec._
import ReplicationActorSpecConfig._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import lerna.akka.entityreplication.raft.RaftProtocol.Command
import lerna.akka.entityreplication.raft.protocol.SnapshotOffer
import lerna.akka.entityreplication.raft.routing.MemberIndex

import scala.annotation.nowarn
import scala.concurrent.Future
import scala.jdk.CollectionConverters._
import scala.concurrent.duration._
Expand Down Expand Up @@ -47,6 +48,7 @@ object ReplicationRegionSpec {
}
}

@nowarn("msg=Use typed.ReplicatedEntityBehavior instead")
class DummyReplicationActor(probe: TestProbe) extends DiagnosticActorLogging with ReplicationActor[Int] {

import DummyReplicationActor._
Expand Down Expand Up @@ -114,7 +116,7 @@ object ReplicationRegionSpecConfig extends MultiNodeConfig {
.withFallback(ConfigFactory.parseString(s"""
akka.actor.provider = cluster
akka.test.single-expect-default = 15s

lerna.akka.entityreplication.raft.compaction.log-size-threshold = 2
lerna.akka.entityreplication.raft.compaction.preserve-log-size = 1
lerna.akka.entityreplication.raft.compaction.log-size-check-interval = 0.1s
Expand Down Expand Up @@ -176,6 +178,7 @@ class ReplicationRegionSpec extends MultiNodeSpec(ReplicationRegionSpecConfig) w

val raftActorProbe = TestProbe("RaftActor")

@nowarn("msg=method start in class ClusterReplication is deprecated")
def createReplication(typeName: String): ActorRef =
planAutoKill {
ClusterReplication(system).start(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import lerna.akka.entityreplication.ReplicationActorSpec.{ config, ExampleReplic
import lerna.akka.entityreplication.model.EntityInstanceId
import lerna.akka.entityreplication.raft.model.{ EntityEvent, LogEntry, LogEntryIndex, Term }
import lerna.akka.entityreplication.raft.{ ActorSpec, RaftProtocol }

import java.util.concurrent.atomic.AtomicInteger
import scala.annotation.nowarn

object ReplicationActorSpec {

Expand All @@ -29,6 +31,7 @@ object ReplicationActorSpec {
case class Counted() extends Event
}

@nowarn("msg=Use typed.ReplicatedEntityBehavior instead")
class ExampleReplicationActor extends ReplicationActor[Int] {
import ExampleReplicationActor._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import lerna.akka.entityreplication.{ ReplicationActor, ReplicationRegion }
import lerna.akka.entityreplication.testkit.TestReplicationActorPropsSpec.WordCountReplicationActor
import org.scalatest.{ Matchers, WordSpecLike }

import scala.annotation.nowarn

object TestReplicationActorPropsSpec {

object WordCountReplicationActor {
Expand All @@ -22,6 +24,7 @@ object TestReplicationActorPropsSpec {
final case class Counted(wordCount: Int) extends DomainEvent
}

@nowarn("msg=Use typed.ReplicatedEntityBehavior instead")
class WordCountReplicationActor extends ReplicationActor[Int] {
import WordCountReplicationActor._

Expand Down Expand Up @@ -54,6 +57,7 @@ object TestReplicationActorPropsSpec {
}
}

@nowarn("msg=Use typed.testkit.ReplicatedEntityBehaviorTestKit instead")
class TestReplicationActorPropsSpec extends TestKit(ActorSystem()) with WordSpecLike with Matchers with ImplicitSender {
import WordCountReplicationActor._

Expand Down