From a63c7cf78e4014fcd04652d3350467b06efe7030 Mon Sep 17 00:00:00 2001 From: lauener Date: Sat, 20 May 2023 11:38:19 +0200 Subject: [PATCH] Refactor ParamsWithChannelHandler name to ParamsHandler --- .../scala/ch/epfl/pop/pubsub/PublishSubscribe.scala | 8 ++++---- ...amsWithChannelHandler.scala => ParamsHandler.scala} | 2 +- ...nnelHandlerSuite.scala => ParamsHandlerSuite.scala} | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) rename be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/handlers/{ParamsWithChannelHandler.scala => ParamsHandler.scala} (98%) rename be2-scala/src/test/scala/ch/epfl/pop/pubsub/graph/handlers/{ParamsWithChannelHandlerSuite.scala => ParamsHandlerSuite.scala} (90%) diff --git a/be2-scala/src/main/scala/ch/epfl/pop/pubsub/PublishSubscribe.scala b/be2-scala/src/main/scala/ch/epfl/pop/pubsub/PublishSubscribe.scala index dafe9cecc7..8f2f5be318 100644 --- a/be2-scala/src/main/scala/ch/epfl/pop/pubsub/PublishSubscribe.scala +++ b/be2-scala/src/main/scala/ch/epfl/pop/pubsub/PublishSubscribe.scala @@ -10,7 +10,7 @@ import ch.epfl.pop.decentralized.Monitor import ch.epfl.pop.model.network.MethodType._ import ch.epfl.pop.model.network.{JsonRpcRequest, JsonRpcResponse} import ch.epfl.pop.pubsub.graph._ -import ch.epfl.pop.pubsub.graph.handlers.{GetMessagesByIdResponseHandler, ParamsWithChannelHandler, ParamsWithMapHandler, ParamsWithMessageHandler} +import ch.epfl.pop.pubsub.graph.handlers.{GetMessagesByIdResponseHandler, ParamsHandler, ParamsWithMapHandler, ParamsWithMessageHandler} object PublishSubscribe { @@ -126,9 +126,9 @@ object PublishSubscribe { )) val hasMessagePartition = builder.add(ParamsWithMessageHandler.graph(messageRegistry)) - val subscribePartition = builder.add(ParamsWithChannelHandler.subscribeHandler(clientActorRef)) - val unsubscribePartition = builder.add(ParamsWithChannelHandler.unsubscribeHandler(clientActorRef)) - val catchupPartition = builder.add(ParamsWithChannelHandler.catchupHandler(clientActorRef)) + val subscribePartition = builder.add(ParamsHandler.subscribeHandler(clientActorRef)) + val unsubscribePartition = builder.add(ParamsHandler.unsubscribeHandler(clientActorRef)) + val catchupPartition = builder.add(ParamsHandler.catchupHandler(clientActorRef)) val heartbeatPartition = builder.add(ParamsWithMapHandler.heartbeatHandler(dbActorRef)) val getMessagesByIdPartition = builder.add(ParamsWithMapHandler.getMessagesByIdHandler(dbActorRef)) diff --git a/be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsWithChannelHandler.scala b/be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsHandler.scala similarity index 98% rename from be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsWithChannelHandler.scala rename to be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsHandler.scala index a40f2d26d7..fedf1ac875 100644 --- a/be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsWithChannelHandler.scala +++ b/be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsHandler.scala @@ -11,7 +11,7 @@ import ch.epfl.pop.pubsub.{AskPatternConstants, ClientActor, PubSubMediator} import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.{Await, Future} -object ParamsWithChannelHandler extends AskPatternConstants { +object ParamsHandler extends AskPatternConstants { def subscribeHandler(clientActorRef: AskableActorRef): Flow[GraphMessage, GraphMessage, NotUsed] = Flow[GraphMessage].map { case Right(jsonRpcMessage: JsonRpcRequest) => diff --git a/be2-scala/src/test/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsWithChannelHandlerSuite.scala b/be2-scala/src/test/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsHandlerSuite.scala similarity index 90% rename from be2-scala/src/test/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsWithChannelHandlerSuite.scala rename to be2-scala/src/test/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsHandlerSuite.scala index 2cb3fa62a3..25519178d5 100644 --- a/be2-scala/src/test/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsWithChannelHandlerSuite.scala +++ b/be2-scala/src/test/scala/ch/epfl/pop/pubsub/graph/handlers/ParamsHandlerSuite.scala @@ -12,7 +12,7 @@ import util.examples.JsonRpcRequestExample import scala.concurrent.Await import scala.util.{Failure, Success} -class ParamsWithChannelHandlerSuite extends FunSuite with Matchers with AskPatternConstants { +class ParamsHandlerSuite extends FunSuite with Matchers with AskPatternConstants { implicit val system: ActorSystem = ActorSystem() @@ -22,7 +22,7 @@ class ParamsWithChannelHandlerSuite extends FunSuite with Matchers with AskPatte val rpcExample = JsonRpcRequestExample.subscribeRpcRequest val expectedAsk = ClientActor.SubscribeTo(rpcExample.getParams.channel) val pipelineOutput = Source.single(Right(rpcExample)) - .via(ParamsWithChannelHandler.subscribeHandler(mockClientRef.ref)) + .via(ParamsHandler.subscribeHandler(mockClientRef.ref)) .runWith(Sink.head) val channel = mockClientRef.expectMsg(expectedAsk).channel @@ -40,7 +40,7 @@ class ParamsWithChannelHandlerSuite extends FunSuite with Matchers with AskPatte val rpcExample = JsonRpcRequestExample.subscribeRpcRequest val expectedAsk = ClientActor.SubscribeTo(rpcExample.getParams.channel) val pipelineOutput = Source.single(Right(rpcExample)) - .via(ParamsWithChannelHandler.subscribeHandler(mockClientRef.ref)) + .via(ParamsHandler.subscribeHandler(mockClientRef.ref)) .runWith(Sink.head) val channel = mockClientRef.expectMsg(expectedAsk).channel @@ -59,7 +59,7 @@ class ParamsWithChannelHandlerSuite extends FunSuite with Matchers with AskPatte val rpcExample = JsonRpcRequestExample.unSubscribeRpcRequest val expectedAsk = ClientActor.UnsubscribeFrom(rpcExample.getParams.channel) val pipelineOutput = Source.single(Right(rpcExample)) - .via(ParamsWithChannelHandler.unsubscribeHandler(mockClientRef.ref)) + .via(ParamsHandler.unsubscribeHandler(mockClientRef.ref)) .runWith(Sink.head) val channel = mockClientRef.expectMsg(expectedAsk).channel @@ -77,7 +77,7 @@ class ParamsWithChannelHandlerSuite extends FunSuite with Matchers with AskPatte val rpcExample = JsonRpcRequestExample.unSubscribeRpcRequest val expectedAsk = ClientActor.UnsubscribeFrom(rpcExample.getParams.channel) val pipelineOutput = Source.single(Right(rpcExample)) - .via(ParamsWithChannelHandler.unsubscribeHandler(mockClientRef.ref)) + .via(ParamsHandler.unsubscribeHandler(mockClientRef.ref)) .runWith(Sink.head) val channel = mockClientRef.expectMsg(expectedAsk).channel