diff options
| author | Gordon Sim <gsim@apache.org> | 2007-09-21 10:39:36 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2007-09-21 10:39:36 +0000 |
| commit | 03cd19556c261f43a8d95bd7d803c59bd488aeef (patch) | |
| tree | c589afb8a7d83dc44c445fc44df7850d0bf01ae4 /python/qpid | |
| parent | 75d71dd695da1612d8ff6768a1a4b8082b2d2d65 (diff) | |
| download | qpid-python-03cd19556c261f43a8d95bd7d803c59bd488aeef.tar.gz | |
Use octet each for class and method id (changed c++ and python)
Modified indexes in xml for message.empty, message.offset and the c++ cluster class
Fixed encoding for rfc1982-long-set in c++ and python (its a size not a count that is prepended)
Fixed minor typo in configuration option help string
Use session.open/close in python tests, handle session.closed
Commented out the response tag in session.close due to pythons ambiguity as to whether session.closed is a response or not
Disabled broker.test_closed_channel (due to above issue); broker behaves as expected but test fails; test_invalid_channel is safe enough for now.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@578053 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid')
| -rw-r--r-- | python/qpid/client.py | 3 | ||||
| -rw-r--r-- | python/qpid/codec.py | 9 | ||||
| -rw-r--r-- | python/qpid/connection.py | 18 | ||||
| -rw-r--r-- | python/qpid/peer.py | 5 | ||||
| -rw-r--r-- | python/qpid/spec.py | 2 | ||||
| -rw-r--r-- | python/qpid/testlib.py | 15 |
6 files changed, 35 insertions, 17 deletions
diff --git a/python/qpid/client.py b/python/qpid/client.py index 5734873c6f..f0d7935283 100644 --- a/python/qpid/client.py +++ b/python/qpid/client.py @@ -138,6 +138,9 @@ class ClientDelegate(Delegate): def channel_close(self, ch, msg): ch.close(msg) + def session_closed(self, ch, msg): + ch.close(msg) + def connection_close(self, ch, msg): self.client.peer.close(msg) diff --git a/python/qpid/codec.py b/python/qpid/codec.py index c1a912f5d0..d0a95debb3 100644 --- a/python/qpid/codec.py +++ b/python/qpid/codec.py @@ -346,23 +346,22 @@ class Codec: return self.decode_long() def encode_rfc1982_long_set(self, s): - self.encode_short(len(s)) + self.encode_short(len(s) * 4) for i in s: self.encode_long(i) def decode_rfc1982_long_set(self): - count = self.decode_short() + count = self.decode_short() / 4 set = [] for i in range(0, count): set.append(self.decode_long()) return set; - #not correct for 0-10 yet def encode_uuid(self, s): - self.encode_longstr(s) + self.pack("16s", s) def decode_uuid(self): - return self.decode_longstr() + return self.unpack("16s") def encode_struct(self, type, s): for f in type.fields: diff --git a/python/qpid/connection.py b/python/qpid/connection.py index d23a3b909e..98fff9cd2f 100644 --- a/python/qpid/connection.py +++ b/python/qpid/connection.py @@ -229,14 +229,24 @@ class Method(Frame): self.eof = not method.content def encode(self, c): - c.encode_short(self.method.klass.id) - c.encode_short(self.method.id) + version = (c.spec.major, c.spec.minor) + if version == (0, 10): + c.encode_octet(self.method.klass.id) + c.encode_octet(self.method.id) + else: + c.encode_short(self.method.klass.id) + c.encode_short(self.method.id) for field, arg in zip(self.method.fields, self.args): c.encode(field.type, arg) def decode(spec, c, size): - klass = spec.classes.byid[c.decode_short()] - meth = klass.methods.byid[c.decode_short()] + version = (c.spec.major, c.spec.minor) + if version == (0, 10): + klass = spec.classes.byid[c.decode_octet()] + meth = klass.methods.byid[c.decode_octet()] + else: + klass = spec.classes.byid[c.decode_short()] + meth = klass.methods.byid[c.decode_short()] args = tuple([c.decode(f.type) for f in meth.fields]) return Method(meth, args) diff --git a/python/qpid/peer.py b/python/qpid/peer.py index 5cabf98236..6e91c09806 100644 --- a/python/qpid/peer.py +++ b/python/qpid/peer.py @@ -261,7 +261,7 @@ class Channel: self.responder.respond(method, batch, request) def invoke(self, type, args, kwargs): - if type.klass.name == "channel" and (type.name == "close" or type.name == "open"): + if (type.klass.name in ["channel", "session"]) and (type.name in ["close", "open", "closed"]): self.completion.reset() self.incoming_completion.reset() self.completion.next_command(type) @@ -421,6 +421,7 @@ class OutgoingCompletion: self.condition.acquire() try: self.mark = mark + #print "set mark to %s [%s] " % (self.mark, self) self.condition.notifyAll() finally: self.condition.release() @@ -432,7 +433,7 @@ class OutgoingCompletion: self.condition.acquire() try: while not self.closed and point_of_interest > self.mark: - #print "waiting for ", point_of_interest, " mark is currently at ", self.mark + #print "waiting for %s, mark = %s [%s]" % (point_of_interest, self.mark, self) self.condition.wait(remaining) if not self.closed and point_of_interest > self.mark and timeout: if (start_time + timeout) < time(): break diff --git a/python/qpid/spec.py b/python/qpid/spec.py index 3febab7e09..3cb5f0ca25 100644 --- a/python/qpid/spec.py +++ b/python/qpid/spec.py @@ -208,7 +208,7 @@ class Method(Metadata): self.response = False def is_l4_command(self): - return self.klass.name not in ["execution", "channel", "connection"] + return self.klass.name not in ["execution", "channel", "connection", "session"] def arguments(self, *args, **kwargs): nargs = len(args) + len(kwargs) diff --git a/python/qpid/testlib.py b/python/qpid/testlib.py index ce1ba462a0..c4f55be18a 100644 --- a/python/qpid/testlib.py +++ b/python/qpid/testlib.py @@ -208,8 +208,8 @@ class TestBase(unittest.TestCase): self.exchanges = [] self.client = self.connect() self.channel = self.client.channel(1) - version = (self.client.spec.major, self.client.spec.minor) - if version == (8, 0) or "transitional" in self.client.spec.file: + self.version = (self.client.spec.major, self.client.spec.minor) + if self.version == (8, 0): self.channel.channel_open() else: self.channel.session_open() @@ -313,9 +313,14 @@ class TestBase(unittest.TestCase): self.assertPublishGet(self.consume(queue), exchange, routing_key, properties) def assertChannelException(self, expectedCode, message): - if not isinstance(message, Message): self.fail("expected channel_close method, got %s" % (message)) - self.assertEqual("channel", message.method.klass.name) - self.assertEqual("close", message.method.name) + if self.version == (8, 0): #or "transitional" in self.client.spec.file: + if not isinstance(message, Message): self.fail("expected channel_close method, got %s" % (message)) + self.assertEqual("channel", message.method.klass.name) + self.assertEqual("close", message.method.name) + else: + if not isinstance(message, Message): self.fail("expected session_closed method, got %s" % (message)) + self.assertEqual("session", message.method.klass.name) + self.assertEqual("closed", message.method.name) self.assertEqual(expectedCode, message.reply_code) |
