From 4c3ada95876ca5e069f0d76dd8e22918c1bdeabc Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Wed, 25 Mar 2015 13:54:44 +0000 Subject: [PATCH] Task #7508: Fixed tPyMsgBus, and test both sending a new message and resending a received message --- LCS/MessageBus/test/tPyMsgBus.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/LCS/MessageBus/test/tPyMsgBus.py b/LCS/MessageBus/test/tPyMsgBus.py index e32c1f727eb..8b88c1a9819 100644 --- a/LCS/MessageBus/test/tPyMsgBus.py +++ b/LCS/MessageBus/test/tPyMsgBus.py @@ -1,17 +1,25 @@ #!/usr/bin/python from lofar.messagebus.msgbus import FromBus, ToBus -from lofar.messagebus.message import Message +from lofar.messagebus.message import Message, MessageContent -# Send a message +# Send a message (send MessageContent) tbus = ToBus("test") -tmsg = Message() +tmsg = MessageContent() tmsg.payload = "foo" tbus.send(tmsg) # Receive it fbus = FromBus("test") fmsg = fbus.get(1) + +# Verify the content assert fmsg != None +assert fmsg.content().payload == "foo" + +# Resend it! (send Message) +tbus.send(fmsg) +rmsg = fbus.get(1) # Verify the content -assert fmsg.payload == "foo" +assert rmsg != None +assert rmsg.content().payload == "foo" -- GitLab