activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [28/48] activemq-artemis git commit: Fix Joram tests
Date Wed, 23 Nov 2016 17:43:29 GMT
Fix Joram tests


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

Branch: refs/heads/ARTEMIS-780
Commit: 62a5cfd1204f69616dcb140fe2369026379cb4d8
Parents: edc947d
Author: jbertram <jbertram@apache.com>
Authored: Sat Nov 19 11:03:20 2016 -0600
Committer: jbertram <jbertram@apache.com>
Committed: Wed Nov 23 09:04:35 2016 -0600

----------------------------------------------------------------------
 .../impl/journal/AbstractJournalStorageManager.java    |  1 +
 .../artemis/core/postoffice/impl/PostOfficeImpl.java   |  3 +--
 .../artemis/core/server/impl/ActiveMQServerImpl.java   | 13 +++++++++----
 .../activemq/artemis/core/server/impl/AddressInfo.java | 11 +++++++++++
 .../jtests/jms/conform/session/TopicSessionTest.java   |  2 ++
 5 files changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/62a5cfd1/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
index b4247ae..ee40f4e 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
@@ -1278,6 +1278,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager
{
       try {
          long recordID = idGenerator.generateID();
          bindingEncoding.setId(recordID);
+         addressInfo.setId(recordID);
          bindingsJournal.appendAddRecordTransactional(tx, recordID, JournalRecordIds.ADDRESS_BINDING_RECORD,
bindingEncoding);
       } finally {
          readUnLock();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/62a5cfd1/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
index 1c0c343..dc73680 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
@@ -450,8 +450,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
       synchronized (addressLock) {
          Bindings bindingsForAddress = getBindingsForAddress(address);
          if (bindingsForAddress.getBindings().size() > 0) {
-            return null;
-//            throw new IllegalStateException("Address has bindings");
+            throw ActiveMQMessageBundle.BUNDLE.addressHasBindings(address);
          }
          managementService.unregisterAddress(address);
          return addressManager.removeAddressInfo(address);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/62a5cfd1/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index b865361..16dccbb 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -2271,6 +2271,11 @@ public class ActiveMQServerImpl implements ActiveMQServer {
       if (putAddressInfoIfAbsent(addressInfo) != null) {
          throw ActiveMQMessageBundle.BUNDLE.addressAlreadyExists(addressInfo.getName());
       }
+
+      // TODO: is this the right way to do this?
+      long txID = storageManager.generateID();
+      storageManager.addAddressBinding(txID, addressInfo);
+      storageManager.commitBindings(txID);
    }
 
    @Override
@@ -2292,10 +2297,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
       }
 
       // TODO: is this the right way to do this?
-      //      long txID = storageManager.generateID();
-      //      storageManager.deleteAddressBinding(txID, getAddressInfo(address).getID());
-      //      storageManager.commitBindings(txID);
-
+      long txID = storageManager.generateID();
+      storageManager.deleteAddressBinding(txID, getAddressInfo(address).getId());
+      storageManager.commitBindings(txID);
    }
 
    @Override
@@ -2347,6 +2351,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
 
       final long txID = storageManager.generateID();
       final long queueID = storageManager.generateID();
+      final long addressID = storageManager.generateID();
 
       final QueueConfig.Builder queueConfigBuilder;
       if (addressName == null) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/62a5cfd1/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
index a92e8d3..9653a4e 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
@@ -21,6 +21,8 @@ import org.apache.activemq.artemis.api.core.SimpleString;
 
 public class AddressInfo {
 
+   private long id;
+
    private final SimpleString name;
 
    private RoutingType routingType = RoutingType.MULTICAST;
@@ -84,10 +86,19 @@ public class AddressInfo {
       return name;
    }
 
+   public void setId(long id) {
+      this.id = id;
+   }
+
+   public long getId() {
+      return id;
+   }
+
    @Override
    public String toString() {
       StringBuffer buff = new StringBuffer();
       buff.append("Address [name=" + name);
+      buff.append(", id=" + id);
       buff.append(", routingType=" + routingType);
       buff.append(", defaultMaxQueueConsumers=" + defaultMaxQueueConsumers);
       buff.append(", defaultDeleteOnNoConsumers=" + defaultDeleteOnNoConsumers);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/62a5cfd1/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java
----------------------------------------------------------------------
diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java
b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java
index 7ad6c76..6eab31d 100644
--- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java
+++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/session/TopicSessionTest.java
@@ -115,6 +115,8 @@ public class TopicSessionTest extends PubSubTestCase {
          TextMessage m = (TextMessage) subscriber.receive(TestConfig.TIMEOUT);
          Assert.assertTrue(m != null);
          Assert.assertEquals("test", m.getText());
+         subscriber.close();
+         subscriberSession.unsubscribe("testTopic");
       } catch (JMSException e) {
          fail(e);
       }


Mime
View raw message