diff --git a/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala b/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala index 12172d34f4..8ccfb6df4d 100644 --- a/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala +++ b/src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala @@ -245,12 +245,12 @@ class ExtEvDataService(override val scheduler: ActorRef) private def requestDepartingEvs( tick: Long, - allDepartingEvs: java.util.Map[UUID, java.util.List[UUID]] + requestedDepartingEvs: java.util.Map[UUID, java.util.List[UUID]] )(implicit serviceStateData: ExtEvStateData ): (ExtEvStateData, Option[Seq[ScheduleTriggerMessage]]) = { - allDepartingEvs.asScala.foreach { case (evcs, departingEvs) => + requestedDepartingEvs.asScala.foreach { case (evcs, departingEvs) => serviceStateData.uuidToActorRef.get(evcs) match { case Some((evcsActor, _)) => evcsActor ! DepartingEvsRequest(tick, departingEvs.asScala.toSeq) @@ -269,7 +269,7 @@ class ExtEvDataService(override val scheduler: ActorRef) // if there are no departing evs during this tick, // we're sending response right away - if (departingEvResponses.isEmpty) + if (requestedDepartingEvs.isEmpty) serviceStateData.extEvData.queueExtResponseMsg(new ProvideDepartingEvs()) ( @@ -283,13 +283,13 @@ class ExtEvDataService(override val scheduler: ActorRef) private def handleArrivingEvs( tick: Long, - allArrivingEvs: java.util.Map[UUID, java.util.List[EvModel]] + arrivingEvs: java.util.Map[UUID, java.util.List[EvModel]] )(implicit serviceStateData: ExtEvStateData ): (ExtEvStateData, Option[Seq[ScheduleTriggerMessage]]) = { val scheduleTriggerMsgs = - allArrivingEvs.asScala.flatMap { case (evcs, arrivingEvs) => + arrivingEvs.asScala.flatMap { case (evcs, arrivingEvs) => serviceStateData.uuidToActorRef.get(evcs) match { case Some((evcsActor, scheduleFunc)) => evcsActor ! ProvideEvDataMessage( diff --git a/src/test/scala/edu/ie3/simona/service/ev/ExtEvDataServiceSpec.scala b/src/test/scala/edu/ie3/simona/service/ev/ExtEvDataServiceSpec.scala index 47f134da5e..a6f05c0fe7 100644 --- a/src/test/scala/edu/ie3/simona/service/ev/ExtEvDataServiceSpec.scala +++ b/src/test/scala/edu/ie3/simona/service/ev/ExtEvDataServiceSpec.scala @@ -132,6 +132,7 @@ class ExtEvDataServiceSpec } "An idle ev movements service" must { + // TODO enhance with tests for cases where no EVCS are applicable and answer is sent right away "handle duplicate registrations correctly" in { val evService = TestActorRef( new ExtEvDataService(