Skip to content

Commit

Permalink
replace unicode arrows again (akka#26732)
Browse files Browse the repository at this point in the history
  • Loading branch information
patriknw authored and raboof committed Apr 15, 2019
1 parent ee67c11 commit a5e9741
Show file tree
Hide file tree
Showing 40 changed files with 125 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class LogMessagesSpec extends ScalaTestWithActorTestKit("""
logEvent.message should ===("received message Hello")
logEvent.mdc should ===(Map("mdc" -> true))
true
case _
case _ =>
false

},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ActorSystemSpec extends WordSpec with Matchers with BeforeAndAfterAll with
case class Probe(message: String, replyTo: ActorRef[String])

def withSystem[T](name: String, behavior: Behavior[T], doTerminate: Boolean = true)(
block: ActorSystem[T] Unit): Unit = {
block: ActorSystem[T] => Unit): Unit = {
val sys = system(behavior, s"$suite-$name")
try {
block(sys)
Expand All @@ -47,7 +47,7 @@ class ActorSystemSpec extends WordSpec with Matchers with BeforeAndAfterAll with
withSystem("a", Behaviors.receiveMessage[Probe] { p =>
p.replyTo ! p.message
Behaviors.stopped
}, doTerminate = false) { sys
}, doTerminate = false) { sys =>
val inbox = TestInbox[String]("a")
sys ! Probe("hello", inbox.ref)
eventually {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class IntroSpec extends ScalaTestWithActorTestKit with WordSpecLike {
import ChatRoom._

val gabbler: Behavior[SessionEvent] =
Behaviors.setup { context
Behaviors.setup { context =>
Behaviors.receiveMessage {
//#chatroom-gabbler
// We document that the compiler warns about the missing handler for `SessionDenied`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ class OOIntroSpec extends ScalaTestWithActorTestKit with WordSpecLike {
import ChatRoom._

val gabbler =
Behaviors.setup[SessionEvent] { context
Behaviors.setup[SessionEvent] { context =>
Behaviors.receiveMessage[SessionEvent] {
case SessionDenied(reason) =>
context.log.info("cannot start chat room session: {}", reason)
Behaviors.stopped
case SessionGranted(handle)
case SessionGranted(handle) =>
handle ! PostMessage("Hello World!")
Behaviors.same
case MessagePosted(screenName, message) =>
Expand All @@ -117,7 +117,7 @@ class OOIntroSpec extends ScalaTestWithActorTestKit with WordSpecLike {

Behaviors
.receiveMessagePartial[String] {
case "go"
case "go" =>
chatRoom ! GetSession("ol’ Gabbler", gabblerRef)
Behaviors.same
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private[akka] trait DeathWatch { this: ActorCell =>
}

protected def receivedTerminated(t: Terminated): Unit =
terminatedQueued.get(t.actor).foreach { optionalMessage
terminatedQueued.get(t.actor).foreach { optionalMessage =>
terminatedQueued -= t.actor // here we know that it is the SAME ref which was put in
receiveMessage(optionalMessage.getOrElse(t))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,22 @@ object ClusterShardingPersistenceSpec {
stashing = false
Effect.unstashAll()

case UnstashAllAndPassivate
case UnstashAllAndPassivate =>
stashing = false
shard ! Passivate(ctx.self)
Effect.unstashAll()
},
eventHandler = (state, evt) if (state.isEmpty) evt else state + "|" + evt).receiveSignal {
case (state, RecoveryCompleted)
eventHandler = (state, evt) => if (state.isEmpty) evt else state + "|" + evt).receiveSignal {
case (state, RecoveryCompleted) =>
ctx.log.debug("onRecoveryCompleted: [{}]", state)
lifecycleProbes.get(entityId) match {
case null ctx.log.debug("no lifecycleProbe (onRecoveryCompleted) for [{}]", entityId)
case p p ! s"recoveryCompleted:$state"
case null => ctx.log.debug("no lifecycleProbe (onRecoveryCompleted) for [{}]", entityId)
case p => p ! s"recoveryCompleted:$state"
}
case (_, PostStop)
case (_, PostStop) =>
lifecycleProbes.get(entityId) match {
case null ctx.log.debug("no lifecycleProbe (postStop) for [{}]", entityId)
case p p ! "stopped"
case null => ctx.log.debug("no lifecycleProbe (postStop) for [{}]", entityId)
case p => p ! "stopped"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ object ClusterShardingSettings {
else config.getDuration("passivate-idle-entity-after", MILLISECONDS).millis

val lease = config.getString("use-lease") match {
case s if s.isEmpty None
case other Some(new LeaseUsageSettings(other, config.getDuration("lease-retry-interval").asScala))
case s if s.isEmpty => None
case other => Some(new LeaseUsageSettings(other, config.getDuration("lease-retry-interval").asScala))
}

new ClusterShardingSettings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object ShardSpec {

class EntityActor extends Actor with ActorLogging {
override def receive: Receive = {
case msg
case msg =>
log.info("Msg {}", msg)
sender() ! s"ack ${msg}"
}
Expand All @@ -45,11 +45,11 @@ object ShardSpec {
case class EntityEnvelope(entityId: Int, msg: Any)

val extractEntityId: ShardRegion.ExtractEntityId = {
case EntityEnvelope(id, payload) (id.toString, payload)
case EntityEnvelope(id, payload) => (id.toString, payload)
}

val extractShardId: ShardRegion.ExtractShardId = {
case EntityEnvelope(id, _) (id % numberOfShards).toString
case EntityEnvelope(id, _) => (id % numberOfShards).toString
}

case class BadLease(msg: String) extends RuntimeException(msg) with NoStackTrace
Expand Down Expand Up @@ -111,7 +111,7 @@ class ShardSpec extends AkkaSpec(ShardSpec.config) with ImplicitSender {
Shard.props(
typeName,
shardId,
_ Props(new EntityActor()),
_ => Props(new EntityActor()),
settings,
extractEntityId,
extractShardId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ object ClusterSingletonManagerSettings {
*/
def apply(config: Config): ClusterSingletonManagerSettings = {
val lease = config.getString("use-lease") match {
case s if s.isEmpty None
case s if s.isEmpty => None
case leaseConfigPath =>
Some(new LeaseUsageSettings(leaseConfigPath, config.getDuration("lease-retry-interval").asScala))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ class TestLeaseActor extends Actor with ActorLogging {

override def receive = {

case c: Create
case c: Create =>
log.info("Lease created with name {} ownerName {}", c.leaseName, c.ownerName)

case request: LeaseRequest
case request: LeaseRequest =>
log.info("Lease request {} from {}", request, sender())
requests = (sender(), request) :: requests

case GetRequests
case GetRequests =>
sender() ! LeaseRequests(requests.map(_._2))

case ActionRequest(request, result)
case ActionRequest(request, result) =>
requests.find(_._2 == request) match {
case Some((snd, req))
case Some((snd, req)) =>
log.info("Actioning request {} to {}", req, result)
snd ! result
requests = requests.filterNot(_._2 == request)
case None
case None =>
throw new RuntimeException(s"unknown request to action: ${request}. Requests: ${requests}")
}

Expand Down Expand Up @@ -111,6 +111,6 @@ class TestLeaseActorClient(settings: LeaseSettings, system: ExtendedActorSystem)

override def checkLease(): Boolean = false

override def acquire(callback: Option[Throwable] Unit): Future[Boolean] =
override def acquire(callback: Option[Throwable] => Unit): Future[Boolean] =
(leaseActor ? Acquire(settings.ownerName)).mapTo[Boolean]
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ object ClusterSingletonManagerLeaseSpec extends MultiNodeConfig {
log.info("Singleton stopping")
}
override def receive: Receive = {
case msg
case msg =>
sender() ! Response(msg, selfAddress)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ class TestLease(settings: LeaseSettings, system: ExtendedActorSystem) extends Le

private val nextAcquireResult = new AtomicReference[Future[Boolean]](initialPromise.future)
private val nextCheckLeaseResult = new AtomicReference[Boolean](false)
private val currentCallBack = new AtomicReference[Option[Throwable] Unit](_ ())
private val currentCallBack = new AtomicReference[Option[Throwable] => Unit](_ => ())

def setNextAcquireResult(next: Future[Boolean]): Unit =
nextAcquireResult.set(next)

def setNextCheckLeaseResult(value: Boolean): Unit =
nextCheckLeaseResult.set(value)

def getCurrentCallback(): Option[Throwable] Unit = currentCallBack.get()
def getCurrentCallback(): Option[Throwable] => Unit = currentCallBack.get()

override def acquire(): Future[Boolean] = {
log.info("acquire, current response " + nextAcquireResult)
Expand All @@ -88,7 +88,7 @@ class TestLease(settings: LeaseSettings, system: ExtendedActorSystem) extends Le

override def checkLease(): Boolean = nextCheckLeaseResult.get

override def acquire(callback: Option[Throwable] Unit): Future[Boolean] = {
override def acquire(callback: Option[Throwable] => Unit): Future[Boolean] = {
currentCallBack.set(callback)
acquire()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ImportantSingleton(lifeCycleProbe: ActorRef) extends Actor with ActorLoggi
}

override def receive: Receive = {
case msg
case msg =>
sender() ! msg
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ActorSystemSpec extends WordSpec with Matchers with BeforeAndAfterAll with
withSystem("a", Behaviors.receiveMessage[Probe] { p =>
p.replyTo ! p.message
Behaviors.stopped
}, doTerminate = false) { sys
}, doTerminate = false) { sys =>
val inbox = TestInbox[String]("a")
sys ! Probe("hello", inbox.ref)
eventually {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ object TimeoutSettings {
def apply(config: Config): TimeoutSettings = {
val heartBeatTimeout = config.getDuration("heartbeat-timeout").asScala
val heartBeatInterval = config.getValue("heartbeat-interval").valueType() match {
case ConfigValueType.STRING if config.getString("heartbeat-interval").isEmpty
case ConfigValueType.STRING if config.getString("heartbeat-interval").isEmpty =>
(heartBeatTimeout / 10).max(5.seconds)
case _ config.getDuration("heartbeat-interval").asScala
case _ => config.getDuration("heartbeat-interval").asScala
}
require(heartBeatInterval < (heartBeatTimeout / 2), "heartbeat-interval must be less than half heartbeat-timeout")
new TimeoutSettings(heartBeatInterval, heartBeatTimeout, config.getDuration("lease-operation-timeout").asScala)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final private[akka] class LeaseAdapter(delegate: ScalaLease)(implicit val ec: Ex
override def acquire(): CompletionStage[java.lang.Boolean] = delegate.acquire().map(Boolean.box).toJava

override def acquire(leaseLostCallback: Consumer[Optional[Throwable]]): CompletionStage[java.lang.Boolean] = {
delegate.acquire(o leaseLostCallback.accept(o.asJava)).map(Boolean.box).toJava
delegate.acquire(o => leaseLostCallback.accept(o.asJava)).map(Boolean.box).toJava
}

override def release(): CompletionStage[java.lang.Boolean] = delegate.release().map(Boolean.box).toJava
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package akka.coordination.lease.javadsl
import akka.actor.{ ActorSystem, ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider }
import akka.annotation.ApiMayChange
import akka.coordination.lease.internal.LeaseAdapter
import akka.coordination.lease.scaladsl.{ LeaseProvider ScalaLeaseProvider }
import akka.coordination.lease.scaladsl.{ LeaseProvider => ScalaLeaseProvider }

@ApiMayChange
object LeaseProvider extends ExtensionId[LeaseProvider] with ExtensionIdProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ abstract class Lease(val settings: LeaseSettings) {
* Implementations should not call leaseLostCallback until after the returned future
* has been completed
*/
def acquire(leaseLostCallback: Option[Throwable] Unit): Future[Boolean]
def acquire(leaseLostCallback: Option[Throwable] => Unit): Future[Boolean]

/**
* Release the lease so some other owner can acquire it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class LeaseProvider(system: ExtendedActorSystem) extends Extension {
f
}
instance match {
case Success(value) value
case Failure(e)
case Success(value) => value
case Failure(e) =>
log.error(
e,
"Invalid lease configuration for leaseName [{}], configPath [{}] lease-class [{}]. " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ object LeaseProviderSpec {
override def acquire(): Future[Boolean] = Future.successful(false)
override def release(): Future[Boolean] = Future.successful(false)
override def checkLease(): Boolean = false
override def acquire(callback: Option[Throwable] Unit): Future[Boolean] = Future.successful(false)
override def acquire(callback: Option[Throwable] => Unit): Future[Boolean] = Future.successful(false)
}

class LeaseB(settings: LeaseSettings, system: ExtendedActorSystem) extends Lease(settings) {
system.name // warning
override def acquire(): Future[Boolean] = Future.successful(false)
override def release(): Future[Boolean] = Future.successful(false)
override def checkLease(): Boolean = false
override def acquire(callback: Option[Throwable] Unit): Future[Boolean] = Future.successful(false)
override def acquire(callback: Option[Throwable] => Unit): Future[Boolean] = Future.successful(false)
}

val config = ConfigFactory.parseString(s"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ object Discovery extends ExtensionId[Discovery] with ExtensionIdProvider {
throw new RuntimeException(
"Old version of Akka Discovery from Akka Management found on the classpath. Remove `com.lightbend.akka.discovery:akka-discovery` from the classpath..")
} catch {
case _: ClassCastException
case _: ClassCastException =>
throw new RuntimeException(
"Old version of Akka Discovery from Akka Management found on the classpath. Remove `com.lightbend.akka.discovery:akka-discovery` from the classpath..")
case _: ClassNotFoundException =>
Expand Down
4 changes: 2 additions & 2 deletions akka-discovery/src/test/scala/akka/discovery/LookupSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class LookupSpec extends WordSpec with Matchers with OptionValues {
}

"generate a SRV Lookup from a valid SRV String" in {
srvWithValidDomainNames.foreach { str
srvWithValidDomainNames.foreach { str =>
withClue(s"parsing '$str'") {
val lookup = Lookup.parseSrv(str)
lookup.portName.value shouldBe "portName"
Expand Down Expand Up @@ -117,7 +117,7 @@ class LookupSpec extends WordSpec with Matchers with OptionValues {
}

"return true for any valid SRV String" in {
srvWithValidDomainNames.foreach { str
srvWithValidDomainNames.foreach { str =>
withClue(s"parsing '$str'") {
Lookup.isValidSrv(str) shouldBe true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DeltaPropagationSelectorSpec extends WordSpec with Matchers with TypeCheck
DeltaPropagation(
selfUniqueAddress,
false,
Map("A" -> Delta(DataEnvelope(deltaA), 1L, 1L), "B" Delta(DataEnvelope(deltaB), 1L, 1L)))
Map("A" -> Delta(DataEnvelope(deltaA), 1L, 1L), "B" -> Delta(DataEnvelope(deltaB), 1L, 1L)))
selector.collectPropagations() should ===(Map(nodes(0) -> expected))
selector.collectPropagations() should ===(Map.empty[UniqueAddress, DeltaPropagation])
selector.cleanupDeltaEntries()
Expand All @@ -72,8 +72,8 @@ class DeltaPropagationSelectorSpec extends WordSpec with Matchers with TypeCheck
DeltaPropagation(
selfUniqueAddress,
false,
Map("A" -> Delta(DataEnvelope(deltaA), 1L, 1L), "B" Delta(DataEnvelope(deltaB), 1L, 1L)))
selector.collectPropagations() should ===(Map(nodes(0) -> expected, nodes(1) expected))
Map("A" -> Delta(DataEnvelope(deltaA), 1L, 1L), "B" -> Delta(DataEnvelope(deltaB), 1L, 1L)))
selector.collectPropagations() should ===(Map(nodes(0) -> expected, nodes(1) -> expected))
selector.cleanupDeltaEntries()
selector.hasDeltaEntries("A") should ===(true)
selector.hasDeltaEntries("B") should ===(true)
Expand All @@ -92,8 +92,8 @@ class DeltaPropagationSelectorSpec extends WordSpec with Matchers with TypeCheck
DeltaPropagation(
selfUniqueAddress,
false,
Map("A" -> Delta(DataEnvelope(deltaA), 1L, 1L), "B" Delta(DataEnvelope(deltaB), 1L, 1L)))
selector.collectPropagations() should ===(Map(nodes(0) -> expected1, nodes(1) expected1))
Map("A" -> Delta(DataEnvelope(deltaA), 1L, 1L), "B" -> Delta(DataEnvelope(deltaB), 1L, 1L)))
selector.collectPropagations() should ===(Map(nodes(0) -> expected1, nodes(1) -> expected1))
// new update before previous was propagated to all nodes
selector.update("C", deltaC)
val expected2 = DeltaPropagation(
Expand All @@ -105,7 +105,7 @@ class DeltaPropagationSelectorSpec extends WordSpec with Matchers with TypeCheck
"C" -> Delta(DataEnvelope(deltaC), 1L, 1L)))
val expected3 =
DeltaPropagation(selfUniqueAddress, false, Map("C" -> Delta(DataEnvelope(deltaC), 1L, 1L)))
selector.collectPropagations() should ===(Map(nodes(2) -> expected2, nodes(0) expected3))
selector.collectPropagations() should ===(Map(nodes(2) -> expected2, nodes(0) -> expected3))
selector.cleanupDeltaEntries()
selector.hasDeltaEntries("A") should ===(false)
selector.hasDeltaEntries("B") should ===(false)
Expand Down
Loading

0 comments on commit a5e9741

Please sign in to comment.