diff options
| author | Robert Gemmell <robbie@apache.org> | 2012-02-19 20:32:26 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2012-02-19 20:32:26 +0000 |
| commit | 32c23e810cab3b87b0faf485848216ad66766b78 (patch) | |
| tree | a546f1b98078df7b5c2446a28c0fbe64a0c62051 /qpid/java/common/src/test | |
| parent | 5a593b1b1cd31b272bec1d09a1940f7e6a517018 (diff) | |
| download | qpid-python-32c23e810cab3b87b0faf485848216ad66766b78.tar.gz | |
QPID-3293: add new system properties for setting client send/receive buffer sizes on connections, restore legacy properties
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1291056 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/common/src/test')
| -rw-r--r-- | qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java b/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java index 47773ff2f8..fc4f5374f0 100644 --- a/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java +++ b/qpid/java/common/src/test/java/org/apache/qpid/transport/ConnectionSettingsTest.java @@ -101,6 +101,38 @@ public class ConnectionSettingsTest extends QpidTestCase systemPropertyOverrideForTrustFactoryAlgorithm(ClientProperties.QPID_SSL_TRUST_STORE_CERT_TYPE_PROP_NAME, algorithmName); } + public void testSendBufferSizeDefault() + { + assertEquals("unexpected default for buffer size", 65535, _conConnectionSettings.getWriteBufferSize()); + } + + public void testSendBufferSizeOverridden() + { + systemPropertyOverrideForSocketBufferSize(ClientProperties.SEND_BUFFER_SIZE_PROP_NAME, 1024, false); + } + + @SuppressWarnings("deprecation") + public void testtestSendBufferSizeOverriddenLegacyOverridden() + { + systemPropertyOverrideForSocketBufferSize(ClientProperties.LEGACY_SEND_BUFFER_SIZE_PROP_NAME, 1024, false); + } + + public void testReceiveBufferSizeDefault() + { + assertEquals("unexpected default for buffer size", 65535, _conConnectionSettings.getReadBufferSize()); + } + + public void testReceiveBufferSizeOverridden() + { + systemPropertyOverrideForSocketBufferSize(ClientProperties.RECEIVE_BUFFER_SIZE_PROP_NAME, 1024, true); + } + + @SuppressWarnings("deprecation") + public void testtestReceiveBufferSizeOverriddenLegacyOverridden() + { + systemPropertyOverrideForSocketBufferSize(ClientProperties.LEGACY_RECEIVE_BUFFER_SIZE_PROP_NAME, 1024, true); + } + private void systemPropertyOverrideForTcpDelay(String propertyName, boolean value) { resetSystemProperty(propertyName, String.valueOf(value)); @@ -119,6 +151,20 @@ public class ConnectionSettingsTest extends QpidTestCase assertEquals(value, _conConnectionSettings.getTrustManagerFactoryAlgorithm()); } + + private void systemPropertyOverrideForSocketBufferSize(String propertyName, int value, boolean read) + { + resetSystemProperty(propertyName, String.valueOf(value)); + if(read) + { + assertEquals("unexpected value for receive buffer", value, _conConnectionSettings.getReadBufferSize()); + } + else + { + assertEquals("unexpected value for send buffer", value, _conConnectionSettings.getWriteBufferSize()); + } + } + private void resetSystemProperty(String propertyName, String value) { setTestSystemProperty(propertyName, value); |
