You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/01/26 03:33:45 UTC
[1/3] activemq-artemis git commit: small improvement on stomp test
Repository: activemq-artemis
Updated Branches:
refs/heads/master 8c90e5bb8 -> 065bd1678
small improvement on stomp test
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/af150b5b
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/af150b5b
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/af150b5b
Branch: refs/heads/master
Commit: af150b5beaf4b59950febb05196a4ed7b161d5da
Parents: 2c4312d
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Jan 25 21:27:18 2016 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jan 25 21:33:28 2016 -0500
----------------------------------------------------------------------
.../tests/integration/stomp/v12/StompV12Test.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/af150b5b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
index 6711643..246cc30 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
@@ -1038,7 +1038,7 @@ public class StompV12Test extends StompV11TestBase {
Assert.assertEquals("ERROR", frame.getCommand());
- Thread.sleep(1000);
+ waitDisconnect(connV12);
Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
//message still there.
@@ -1065,7 +1065,7 @@ public class StompV12Test extends StompV11TestBase {
System.out.println("Receiver error: " + error);
- Thread.sleep(1000);
+ waitDisconnect(connV12);
Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
//message should still there
@@ -1100,7 +1100,7 @@ public class StompV12Test extends StompV11TestBase {
Assert.assertEquals("answer-me", error.getHeader("receipt-id"));
- Thread.sleep(1000);
+ waitDisconnect(connV12);
Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
//message should still there
@@ -1135,7 +1135,7 @@ public class StompV12Test extends StompV11TestBase {
Assert.assertEquals("answer-me", error.getHeader("receipt-id"));
- Thread.sleep(1000);
+ waitDisconnect(connV12);
Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
//message should still there
@@ -1144,6 +1144,14 @@ public class StompV12Test extends StompV11TestBase {
Assert.assertNotNull(message);
}
+ protected void waitDisconnect(StompClientConnectionV12 connection) throws Exception {
+
+ long timeout = System.currentTimeMillis() + 10000;
+ while (timeout > System.currentTimeMillis() && connection.isConnected()) {
+ Thread.sleep(10);
+ }
+ }
+
@Test
public void testAckModeClient() throws Exception {
connV12.connect(defUser, defPass);
[3/3] activemq-artemis git commit: This closes #344
Posted by cl...@apache.org.
This closes #344
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/065bd167
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/065bd167
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/065bd167
Branch: refs/heads/master
Commit: 065bd167821eaae0d0bb69bd7395ce51a381862e
Parents: 8c90e5b af150b5
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Jan 25 21:33:38 2016 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jan 25 21:33:38 2016 -0500
----------------------------------------------------------------------
.../protocol/stomp/ActiveMQStompException.java | 6 ++-
.../core/protocol/stomp/v12/StompFrameV12.java | 10 +++++
.../util/AbstractStompClientConnection.java | 2 +-
.../integration/stomp/v12/StompV12Test.java | 44 +++++++++++---------
4 files changed, 39 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
[2/3] activemq-artemis git commit: Disconnect on STOMP 1.2 errors
Posted by cl...@apache.org.
Disconnect on STOMP 1.2 errors
https://stomp.github.io/stomp-specification-1.2.html#ERROR
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2c4312d4
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2c4312d4
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2c4312d4
Branch: refs/heads/master
Commit: 2c4312d4f279b0955c7644bd302d8480d7e4b6f0
Parents: 8c90e5b
Author: Ville Skyttä <vi...@iki.fi>
Authored: Mon Jan 25 21:01:10 2016 +0200
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jan 25 21:33:28 2016 -0500
----------------------------------------------------------------------
.../protocol/stomp/ActiveMQStompException.java | 6 ++--
.../core/protocol/stomp/v12/StompFrameV12.java | 10 ++++++
.../util/AbstractStompClientConnection.java | 2 +-
.../integration/stomp/v12/StompV12Test.java | 36 +++++++++-----------
4 files changed, 31 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2c4312d4/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompException.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompException.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompException.java
index a6a7c50..9fb0786 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompException.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompException.java
@@ -32,7 +32,7 @@ public class ActiveMQStompException extends Exception {
private final List<Header> headers = new ArrayList<>(10);
private String body;
private VersionedStompFrameHandler handler;
- private boolean disconnect;
+ private Boolean disconnect;
public ActiveMQStompException(StompConnection connection, String msg) {
super(msg);
@@ -86,7 +86,9 @@ public class ActiveMQStompException extends Exception {
else {
frame.setByteBody(new byte[0]);
}
- frame.setNeedsDisconnect(disconnect);
+ if (disconnect != null) {
+ frame.setNeedsDisconnect(disconnect);
+ }
return frame;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2c4312d4/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
index 471311d..ac51ed4 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v12/StompFrameV12.java
@@ -18,15 +18,25 @@ package org.apache.activemq.artemis.core.protocol.stomp.v12;
import java.util.Map;
+import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
import org.apache.activemq.artemis.core.protocol.stomp.v11.StompFrameV11;
public class StompFrameV12 extends StompFrameV11 {
public StompFrameV12(String command, Map<String, String> headers, byte[] content) {
super(command, headers, content);
+ initV12();
}
public StompFrameV12(String command) {
super(command);
+ initV12();
+ }
+
+ private void initV12() {
+ // STOMP 1.2 requires disconnect after sending ERROR
+ if (Stomp.Responses.ERROR.equals(command)) {
+ setNeedsDisconnect(true);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2c4312d4/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractStompClientConnection.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractStompClientConnection.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractStompClientConnection.java
index 42f8a1d..5c6cc6b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractStompClientConnection.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractStompClientConnection.java
@@ -264,7 +264,7 @@ public abstract class AbstractStompClientConnection implements StompClientConnec
@Override
public boolean isConnected() {
- return connected;
+ return connected && socketChannel.isConnected();
}
@Override
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2c4312d4/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
index e6cbf64..6711643 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
@@ -952,9 +952,8 @@ public class StompV12Test extends StompV11TestBase {
Assert.assertEquals("ERROR", error.getCommand());
- unsubscribe(connV12, "sub1");
-
- connV12.disconnect();
+ Thread.sleep(1000);
+ Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
//message should be still there
MessageConsumer consumer = session.createConsumer(queue);
@@ -982,9 +981,8 @@ public class StompV12Test extends StompV11TestBase {
System.out.println("Receiver error: " + error);
- unsubscribe(connV12, "sub1");
-
- connV12.disconnect();
+ Thread.sleep(1000);
+ Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
//message should still there
MessageConsumer consumer = session.createConsumer(queue);
@@ -1040,9 +1038,8 @@ public class StompV12Test extends StompV11TestBase {
Assert.assertEquals("ERROR", frame.getCommand());
- unsubscribe(connV12, "sub1");
-
- connV12.disconnect();
+ Thread.sleep(1000);
+ Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
//message still there.
MessageConsumer consumer = session.createConsumer(queue);
@@ -1068,9 +1065,8 @@ public class StompV12Test extends StompV11TestBase {
System.out.println("Receiver error: " + error);
- unsubscribe(connV12, "sub1");
-
- connV12.disconnect();
+ Thread.sleep(1000);
+ Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
//message should still there
MessageConsumer consumer = session.createConsumer(queue);
@@ -1104,9 +1100,8 @@ public class StompV12Test extends StompV11TestBase {
Assert.assertEquals("answer-me", error.getHeader("receipt-id"));
- unsubscribe(connV12, "sub1");
-
- connV12.disconnect();
+ Thread.sleep(1000);
+ Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
//message should still there
MessageConsumer consumer = session.createConsumer(queue);
@@ -1140,9 +1135,8 @@ public class StompV12Test extends StompV11TestBase {
Assert.assertEquals("answer-me", error.getHeader("receipt-id"));
- unsubscribe(connV12, "sub1");
-
- connV12.disconnect();
+ Thread.sleep(1000);
+ Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
//message should still there
MessageConsumer consumer = session.createConsumer(queue);
@@ -1521,7 +1515,8 @@ public class StompV12Test extends StompV11TestBase {
ClientStompFrame frame = connV12.receiveFrame();
Assert.assertTrue(frame.getCommand().equals("ERROR"));
- connV12.disconnect();
+ Thread.sleep(1000);
+ Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
}
@Test
@@ -2513,7 +2508,8 @@ public class StompV12Test extends StompV11TestBase {
Assert.assertEquals("1234", frame.getHeader("receipt-id"));
System.out.println("message: " + frame.getHeader("message"));
- connV12.disconnect();
+ Thread.sleep(1000);
+ Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
}
@Test