diff options
| author | Keith Wall <kwall@apache.org> | 2013-10-30 21:38:03 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2013-10-30 21:38:03 +0000 |
| commit | 9b1bf6023a9869af744e2fbc03664d41ced37df6 (patch) | |
| tree | 8999f016b40ce753bb560589326fa84d507759ea /qpid/java/client/src/test | |
| parent | f6c119bb54dceaa1451f31c7c0be504a7f6bf3ca (diff) | |
| download | qpid-python-9b1bf6023a9869af744e2fbc03664d41ced37df6.tar.gz | |
QPID-4534: unify client heartbeat system properties/connection url options.
* Connection url 'heartbeat' broker-option (and deprecated 'idle_timeout') now understood for all protocols
* System property 'qpid.heartbeat' (and deprecated 'amqj.heartbeat.delay' and 'idle_timeout') now understood for all protocols
* Enhanced heartbeat system tests
* Docbook updates
Original patch from Keith Wall, plus updates from Robbie Gemmell
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1537313 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src/test')
| -rw-r--r-- | qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java index 1e9e5b00a5..ad9d3d3516 100644 --- a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java +++ b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java @@ -164,4 +164,30 @@ public class BrokerDetailsTest extends TestCase assertFalse("value should be false", Boolean.valueOf(broker.getProperty(BrokerDetails.OPTIONS_SSL))); } + + public void testHeartbeatDefaultsToNull() throws Exception + { + String brokerURL = "tcp://localhost:5672"; + AMQBrokerDetails broker = new AMQBrokerDetails(brokerURL); + assertNull("unexpected default value for " + BrokerDetails.OPTIONS_HEARTBEAT, broker.getProperty(BrokerDetails.OPTIONS_HEARTBEAT)); + } + + public void testOverriddingHeartbeat() throws Exception + { + String brokerURL = "tcp://localhost:5672?heartbeat='60'"; + AMQBrokerDetails broker = new AMQBrokerDetails(brokerURL); + assertEquals(60, Integer.parseInt(broker.getProperty(BrokerDetails.OPTIONS_HEARTBEAT))); + + assertEquals(Integer.valueOf(60), broker.buildConnectionSettings().getHeartbeatInterval08()); + } + + @SuppressWarnings("deprecation") + public void testLegacyHeartbeat() throws Exception + { + String brokerURL = "tcp://localhost:5672?idle_timeout='60000'"; + AMQBrokerDetails broker = new AMQBrokerDetails(brokerURL); + assertEquals(60000, Integer.parseInt(broker.getProperty(BrokerDetails.OPTIONS_IDLE_TIMEOUT))); + + assertEquals(Integer.valueOf(60), broker.buildConnectionSettings().getHeartbeatInterval08()); + } } |
