Skip to content

Commit d250a58

Browse files
committed
enable default handler functionality
1 parent 5b6b09d commit d250a58

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

core/src/main/scala/chargepoint/docile/dsl/DocileConnection.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ trait DocileConnection[
8383
()
8484
}
8585

86-
receivedMsgManager.enqueue(
87-
GenericIncomingMessage[OutgoingReqBound, IncomingResBound, OutgoingReqRes, IncomingReqBound, OutgoingResBound, IncomingReqRes](req, respond _)
88-
)
86+
val incomingMsg = GenericIncomingMessage[OutgoingReqBound, IncomingResBound, OutgoingReqRes, IncomingReqBound, OutgoingResBound, IncomingReqRes](req, respond _)
87+
val incomingMsgHandler = incomingMessageHandlerStack.find(_.accepts(incomingMsg))
88+
89+
incomingMsgHandler.map(_.fireSideEffects(incomingMsg)).getOrElse(receivedMsgManager.enqueue(incomingMsg))
8990

9091
// TODO nicer conversion?
9192
responsePromise.future.map(_.asInstanceOf[RES])(ec)

core/src/main/scala/chargepoint/docile/dsl/GenericIncomingMessageProcessor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ trait GenericIncomingMessageProcessor[
4040
* Execute the side effects of this processor.
4141
*
4242
* In an OCPP test, this is supposed to happen when an assertion expecting a
43-
* certain incoming message has received an inomcing message that matches
43+
* certain incoming message has received an incoming message that matches
4444
* the expectation.
4545
*/
4646
def fireSideEffects(msg: IncomingMessage): Unit

0 commit comments

Comments
 (0)