Repository: qpid-proton Updated Branches: refs/heads/master 17594bc3f -> ee43cbb7e
PROTON-842: fix java tests that I broke with previous commit. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/ee43cbb7 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/ee43cbb7 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/ee43cbb7 Branch: refs/heads/master Commit: ee43cbb7ed5762e45b690631ad7e90d9f6031ca6 Parents: 17594bc Author: Mick Goulish <m...@redhat.com> Authored: Tue Jun 23 11:36:21 2015 -0400 Committer: Mick Goulish <m...@redhat.com> Committed: Tue Jun 23 11:36:21 2015 -0400 ---------------------------------------------------------------------- .../qpid/proton/engine/impl/TransportImpl.java | 19 +++++++++-- tests/python/proton_tests/engine.py | 35 ++++++++++++++------ 2 files changed, 40 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ee43cbb7/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java ---------------------------------------------------------------------- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java index a5c8ba9..835d214 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java @@ -63,6 +63,7 @@ public class TransportImpl extends EndpointImpl FrameHandler, TransportOutputWriter { static final int BUFFER_RELEASE_THRESHOLD = Integer.getInteger("proton.transport_buffer_release_threshold", 2 * 1024 * 1024); + private static final int CHANNEL_MAX_LIMIT = 65535; private static final boolean getBooleanEnv(String name) { @@ -97,8 +98,8 @@ public class TransportImpl extends EndpointImpl private int _maxFrameSize = DEFAULT_MAX_FRAME_SIZE; private int _remoteMaxFrameSize = 512; - private int _channelMax = 65535; - private int _remoteChannelMax = 65535; + private int _channelMax = CHANNEL_MAX_LIMIT; + private int _remoteChannelMax = CHANNEL_MAX_LIMIT; private final FrameWriter _frameWriter; @@ -204,7 +205,19 @@ public class TransportImpl extends EndpointImpl @Override public void setChannelMax(int n) { - _channelMax = n; + if(_isOpenSent) + { + throw new IllegalArgumentException("Cannot change channel max after open frame has been sent"); + } + + if(n < CHANNEL_MAX_LIMIT) + { + _channelMax = n; + } + else + { + _channelMax = CHANNEL_MAX_LIMIT; + } } @Override http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ee43cbb7/tests/python/proton_tests/engine.py ---------------------------------------------------------------------- diff --git a/tests/python/proton_tests/engine.py b/tests/python/proton_tests/engine.py index 8021e64..258665d 100644 --- a/tests/python/proton_tests/engine.py +++ b/tests/python/proton_tests/engine.py @@ -236,29 +236,42 @@ class ConnectionTest(Test): self.pump() assert self.c1.transport.channel_max == value, (self.c1.transport.channel_max, value) - def test_channel_max_high(self, value=33333): - if "java" in sys.platform: - raise Skipped("Mick needs to fix me") + def test_channel_max_high(self, value=65535): self.c1.transport.channel_max = value self.c1.open() self.pump() - assert self.c1.transport.channel_max == 32767, (self.c1.transport.channel_max, value) + if "java" in sys.platform: + assert self.c1.transport.channel_max == 65535, (self.c1.transport.channel_max, value) + else: + assert self.c1.transport.channel_max == 32767, (self.c1.transport.channel_max, value) def test_channel_max_raise_and_lower(self): if "java" in sys.platform: - raise Skipped("Mick needs to fix me, also") - # It's OK to lower the max below 32767. + upper_limit = 65535 + else: + upper_limit = 32767 + + # It's OK to lower the max below upper_limit. self.c1.transport.channel_max = 12345 assert self.c1.transport.channel_max == 12345 - # But it won't let us raise the limit above 32767. - self.c1.transport.channel_max = 33333 - assert self.c1.transport.channel_max == 32767 + + # But it won't let us raise the limit above PN_IMPL_CHANNEL_MAX. + self.c1.transport.channel_max = 65535 + assert self.c1.transport.channel_max == upper_limit + + # send the OPEN frame self.c1.open() self.pump() + # Now it's too late to make any change, because # we have already sent the OPEN frame. - self.c1.transport.channel_max = 666 - assert self.c1.transport.channel_max == 32767 + try: + self.c1.transport.channel_max = 666 + except: + # The java impl will throw an exception. + pass + + assert self.c1.transport.channel_max == upper_limit def test_channel_max_limits_sessions(self): --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org