9 from zio
import Node, Message, CoordHeader
10 from zio.flow import Flow, stringify, objectify
18 sport = self.
snode.port(
"sport", zmq.SERVER)
24 cport = self.
cnode.port(
"cport", zmq.CLIENT)
25 cport.connect(
"server",
"sport")
32 bot =
Message(label=
'{"credit":2,"direction":"inject"}')
33 self.
cflow.send_bot(bot)
34 bot = self.
sflow.recv_bot(1000);
36 assert(self.
sflow.credit == 0)
37 assert(self.
sflow.total_credit == 2)
40 bot =
Message(label=
'{"credit":2,"direction":"extract"}')
41 self.
sflow.send_bot(bot)
42 bot = self.
cflow.recv_bot(1000);
44 assert(self.
cflow.credit == 2)
45 assert(self.
cflow.total_credit == 2)
47 self.
cflow.flush_pay()
48 assert(self.
cflow.credit == 0)
49 c = self.
sflow.slurp_pay()
51 assert(self.
sflow.credit == 2)
53 for count
in range(10):
57 dat = self.
cflow.get()
58 assert(dat.seqno == 100+count)
59 dat = self.
cflow.get()
60 assert(dat.seqno == 200+count)
68 surprise = self.
sflow.recv_eot(1000)
72 expected = self.
cflow.recv_eot(1000)
77 msg =
Message(label=
'{"extra":42}')
80 assert(fobj[
"extra"] == 42)
81 assert(fobj[
"flow"] ==
"DAT")
92 if __name__ ==
'__main__':
An identified vertex in a ported, directed graph.
def stringify(flowtype, params)
def test_flow_string(self)
def test_conversation(self)