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 2015/08/03 14:56:37 UTC

[1/2] activemq-artemis git commit: This closes #105 test fix on openwire

Repository: activemq-artemis
Updated Branches:
  refs/heads/master d9ba65c01 -> 4b77633af


This closes #105 test fix on openwire


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

Branch: refs/heads/master
Commit: 4b77633af77923a18d29bb327fa73701f04a96de
Parents: d9ba65c 65e9ec0
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Aug 3 08:56:27 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Aug 3 08:56:27 2015 -0400

----------------------------------------------------------------------
 .../artemis/core/protocol/openwire/OpenWireConnection.java  | 8 +++++---
 .../core/protocol/openwire/OpenWireProtocolManager.java     | 9 +++++++++
 .../test/java/org/apache/activemq/JmsRedeliveredTest.java   | 8 ++++++--
 3 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: Fix openwire unit tests Fix JmsRedeliveredTest and add processing of RemoveSubscriptionInfo command

Posted by cl...@apache.org.
Fix openwire unit tests
  Fix JmsRedeliveredTest and add processing of RemoveSubscriptionInfo command


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

Branch: refs/heads/master
Commit: 65e9ec01b8cb9d01690a56cb69a6ce6cf88c9007
Parents: d9ba65c
Author: Howard Gao <hg...@redhat.com>
Authored: Mon Aug 3 15:11:25 2015 +0800
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Aug 3 08:56:27 2015 -0400

----------------------------------------------------------------------
 .../artemis/core/protocol/openwire/OpenWireConnection.java  | 8 +++++---
 .../core/protocol/openwire/OpenWireProtocolManager.java     | 9 +++++++++
 .../test/java/org/apache/activemq/JmsRedeliveredTest.java   | 8 ++++++--
 3 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/65e9ec01/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index 6c6bff3..674055b 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -258,7 +258,8 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor
                   || command.getClass() == MessageAck.class
                   || command.getClass() == TransactionInfo.class
                   || command.getClass() == DestinationInfo.class
-                  || command.getClass() == ShutdownInfo.class)
+                  || command.getClass() == ShutdownInfo.class
+                  || command.getClass() == RemoveSubscriptionInfo.class)
             {
                Response response = null;
 
@@ -1706,9 +1707,10 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor
    }
 
    @Override
-   public Response processRemoveSubscription(RemoveSubscriptionInfo arg0) throws Exception
+   public Response processRemoveSubscription(RemoveSubscriptionInfo subInfo) throws Exception
    {
-      throw new IllegalStateException("not implemented! ");
+      protocolManager.removeSubscription(subInfo);
+      return null;
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/65e9ec01/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
index fcdff05..8e7d31c 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
@@ -57,6 +57,7 @@ import org.apache.activemq.command.MessageDispatch;
 import org.apache.activemq.command.MessageId;
 import org.apache.activemq.command.ProducerId;
 import org.apache.activemq.command.ProducerInfo;
+import org.apache.activemq.command.RemoveSubscriptionInfo;
 import org.apache.activemq.command.SessionId;
 import org.apache.activemq.command.SessionInfo;
 import org.apache.activemq.command.TransactionId;
@@ -856,4 +857,12 @@ public class OpenWireProtocolManager implements ProtocolManager<Interceptor>, No
          fireAdvisory(conn.getConext(), topic, advisoryMessage, consumer.getId());
       }
    }
+
+   public void removeSubscription(RemoveSubscriptionInfo subInfo) throws Exception
+   {
+      SimpleString subQueueName = new SimpleString(
+              org.apache.activemq.artemis.jms.client.ActiveMQDestination.createQueueNameForDurableSubscription(
+                      true, subInfo.getClientId(), subInfo.getSubscriptionName()));
+      server.destroyQueue(subQueueName);
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/65e9ec01/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRedeliveredTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRedeliveredTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRedeliveredTest.java
index 8a2cd62..07e8eeb 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRedeliveredTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRedeliveredTest.java
@@ -32,6 +32,7 @@ import javax.jms.Topic;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
+import org.apache.activemq.transport.tcp.TcpTransport;
 import org.apache.activemq.transport.vm.VMTransport;
 import org.apache.activemq.util.Wait;
 
@@ -426,8 +427,7 @@ public class JmsRedeliveredTest extends TestCase {
             }
         });
 
-        // whack the connection - like a rebalance or tcp drop
-        ((ActiveMQConnection)connection).getTransport().narrow(VMTransport.class).stop();
+        connection.close();
 
         session = keepBrokerAliveConnection.createSession(true, Session.CLIENT_ACKNOWLEDGE);
         MessageConsumer messageConsumer = session.createConsumer(queue);
@@ -436,6 +436,7 @@ public class JmsRedeliveredTest extends TestCase {
         msg.acknowledge();
 
         assertFalse("Message should not be redelivered.", msg.getJMSRedelivered());
+        session.commit();
         session.close();
         keepBrokerAliveConnection.close();
     }
@@ -460,6 +461,7 @@ public class JmsRedeliveredTest extends TestCase {
         assertNotNull(msg);
 
         assertFalse("Message should not be redelivered.", msg.getJMSRedelivered());
+        session.commit();
         session.close();
     }
 
@@ -483,6 +485,8 @@ public class JmsRedeliveredTest extends TestCase {
         assertNotNull(msg);
 
         assertFalse("Message should not be redelivered.", msg.getJMSRedelivered());
+
+        session.commit();
         session.close();
     }