activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq git commit: NO-JIRA Allow validation points to use asserts, adds a new test in idle test.
Date Thu, 22 Oct 2015 14:55:42 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 9ddd162d2 -> 7c06d8d68


NO-JIRA Allow validation points to use asserts, adds a new test in idle
test.

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/7c06d8d6
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/7c06d8d6
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/7c06d8d6

Branch: refs/heads/master
Commit: 7c06d8d683290e9ebda0312993236b0895b68172
Parents: 9ddd162
Author: Timothy Bish <tabish121@gmail.com>
Authored: Thu Oct 22 10:17:41 2015 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Thu Oct 22 10:55:33 2015 -0400

----------------------------------------------------------------------
 .../transport/amqp/client/AmqpConnection.java   | 12 +++++++--
 .../transport/amqp/client/AmqpReceiver.java     | 18 +++++++++++---
 .../transport/amqp/client/AmqpSender.java       | 18 +++++++++++---
 .../transport/amqp/client/AmqpSession.java      | 12 +++++++--
 .../AmqpBrokerReuqestedHearbeatsTest.java       | 26 +++++++++++++++++++-
 5 files changed, 75 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/7c06d8d6/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
index 9c13e74..f922af9 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpConnection.java
@@ -507,12 +507,20 @@ public class AmqpConnection extends AmqpAbstractResource<Connection>
implements
 
     @Override
     protected void doOpenInspection() {
-        getStateInspector().inspectOpenedResource(getConnection());
+        try {
+            getStateInspector().inspectOpenedResource(getConnection());
+        } catch (Throwable error) {
+            getStateInspector().markAsInvalid(error.getMessage());
+        }
     }
 
     @Override
     protected void doClosedInspection() {
-        getStateInspector().inspectClosedResource(getConnection());
+        try {
+            getStateInspector().inspectClosedResource(getConnection());
+        } catch (Throwable error) {
+            getStateInspector().markAsInvalid(error.getMessage());
+        }
     }
 
     protected void fireClientException(Throwable ex) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/7c06d8d6/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpReceiver.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpReceiver.java
b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpReceiver.java
index 98241cd..a40b10c 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpReceiver.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpReceiver.java
@@ -512,17 +512,29 @@ public class AmqpReceiver extends AmqpAbstractResource<Receiver>
{
 
     @Override
     protected void doOpenInspection() {
-        getStateInspector().inspectOpenedResource(getReceiver());
+        try {
+            getStateInspector().inspectOpenedResource(getReceiver());
+        } catch (Throwable error) {
+            getStateInspector().markAsInvalid(error.getMessage());
+        }
     }
 
     @Override
     protected void doClosedInspection() {
-        getStateInspector().inspectClosedResource(getReceiver());
+        try {
+            getStateInspector().inspectClosedResource(getReceiver());
+        } catch (Throwable error) {
+            getStateInspector().markAsInvalid(error.getMessage());
+        }
     }
 
     @Override
     protected void doDetachedInspection() {
-        getStateInspector().inspectDetachedResource(getReceiver());
+        try {
+            getStateInspector().inspectDetachedResource(getReceiver());
+        } catch (Throwable error) {
+            getStateInspector().markAsInvalid(error.getMessage());
+        }
     }
 
     protected void configureSource(Source source) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/7c06d8d6/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpSender.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpSender.java
b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpSender.java
index 303c7b2..cfaaa4c 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpSender.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpSender.java
@@ -278,17 +278,29 @@ public class AmqpSender extends AmqpAbstractResource<Sender> {
 
     @Override
     protected void doOpenInspection() {
-        getStateInspector().inspectOpenedResource(getSender());
+        try {
+            getStateInspector().inspectOpenedResource(getSender());
+        } catch (Throwable error) {
+            getStateInspector().markAsInvalid(error.getMessage());
+        }
     }
 
     @Override
     protected void doClosedInspection() {
-        getStateInspector().inspectClosedResource(getSender());
+        try {
+            getStateInspector().inspectClosedResource(getSender());
+        } catch (Throwable error) {
+            getStateInspector().markAsInvalid(error.getMessage());
+        }
     }
 
     @Override
     protected void doDetachedInspection() {
-        getStateInspector().inspectDetachedResource(getSender());
+        try {
+            getStateInspector().inspectDetachedResource(getSender());
+        } catch (Throwable error) {
+            getStateInspector().markAsInvalid(error.getMessage());
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/activemq/blob/7c06d8d6/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpSession.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpSession.java
b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpSession.java
index b934f95..62414bf 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpSession.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/client/AmqpSession.java
@@ -381,12 +381,20 @@ public class AmqpSession extends AmqpAbstractResource<Session>
{
 
     @Override
     protected void doOpenInspection() {
-        getStateInspector().inspectOpenedResource(getSession());
+        try {
+            getStateInspector().inspectOpenedResource(getSession());
+        } catch (Throwable error) {
+            getStateInspector().markAsInvalid(error.getMessage());
+        }
     }
 
     @Override
     protected void doClosedInspection() {
-        getStateInspector().inspectClosedResource(getSession());
+        try {
+            getStateInspector().inspectClosedResource(getSession());
+        } catch (Throwable error) {
+            getStateInspector().markAsInvalid(error.getMessage());
+        }
     }
 
     private String getNextSenderId() {

http://git-wip-us.apache.org/repos/asf/activemq/blob/7c06d8d6/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpBrokerReuqestedHearbeatsTest.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpBrokerReuqestedHearbeatsTest.java
b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpBrokerReuqestedHearbeatsTest.java
index d33a217..75e30f9 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpBrokerReuqestedHearbeatsTest.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/interop/AmqpBrokerReuqestedHearbeatsTest.java
@@ -54,7 +54,8 @@ public class AmqpBrokerReuqestedHearbeatsTest extends AmqpClientTestSupport
{
 
             @Override
             public void inspectOpenedResource(Connection connection) {
-                assertEquals(TEST_IDLE_TIMEOUT / 2, connection.getTransport().getRemoteIdleTimeout());
+                assertEquals("Broker did not send half the idle timeout",
+                    TEST_IDLE_TIMEOUT / 2, connection.getTransport().getRemoteIdleTimeout());
             }
         });
 
@@ -66,6 +67,29 @@ public class AmqpBrokerReuqestedHearbeatsTest extends AmqpClientTestSupport
{
     }
 
     @Test(timeout = 60000)
+    public void testBrokerSendsHalfConfiguredIdleTimeoutWhenClientSendsTimeout() throws Exception
{
+        AmqpClient client = createAmqpClient();
+        assertNotNull(client);
+
+        client.setValidator(new AmqpValidator() {
+
+            @Override
+            public void inspectOpenedResource(Connection connection) {
+                assertEquals("Broker did not send half the idle timeout",
+                    TEST_IDLE_TIMEOUT / 2, connection.getTransport().getRemoteIdleTimeout());
+            }
+        });
+
+        AmqpConnection connection = client.createConnection();
+        connection.setIdleTimeout(TEST_IDLE_TIMEOUT * 4);
+        assertNotNull(connection);
+
+        connection.connect();
+        connection.getStateInspector().assertValid();
+        connection.close();
+    }
+
+    @Test(timeout = 60000)
     public void testClientWithoutHeartbeatsGetsDropped() throws Exception {
 
         final CountDownLatch disconnected = new CountDownLatch(1);


Mime
View raw message