Skip to content

Commit

Permalink
Merge branch 'sp/#000-em-combined' into sp/#339-em-it
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-peter committed Oct 19, 2022
2 parents e27fb2f + e49163f commit 15aa35f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/scala/edu/ie3/simona/service/ev/ExtEvDataService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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())

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

0 comments on commit 15aa35f

Please sign in to comment.