Skip to content

Commit

Permalink
Refactor ParamsWithChannelHandler name to ParamsHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
K1li4nL committed May 20, 2023
1 parent 10e6098 commit a63c7cf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit a63c7cf

Please sign in to comment.