[hornetq-commits] JBoss hornetq SVN: r10134 - in branches/Branch_2_2_EAP: src/main/org/hornetq/jms/persistence/impl/journal and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Jan 22 20:07:58 EST 2011


Author: clebert.suconic at jboss.com
Date: 2011-01-22 20:07:57 -0500 (Sat, 22 Jan 2011)
New Revision: 10134

Added:
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSDynamicConfigTest.java
Modified:
   branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
   branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java
Log:
HORNETQ-625 / https://issues.jboss.org/browse/JBPAPP-5803 - deleteCF doesn't survive restarts

Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java	2011-01-22 09:41:30 UTC (rev 10133)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java	2011-01-23 01:07:57 UTC (rev 10134)
@@ -340,7 +340,7 @@
 
       try
       {
-         boolean destroyed = server.destroyConnectionFactory(name);
+         boolean destroyed = server.removeConnectionFactoryFromJNDI(name);
          if (destroyed)
          {
             sendNotification(NotificationType.CONNECTION_FACTORY_DESTROYED, name);

Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java	2011-01-22 09:41:30 UTC (rev 10133)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java	2011-01-23 01:07:57 UTC (rev 10134)
@@ -152,6 +152,8 @@
       {
          jmsJournal.appendDeleteRecord(oldCF.getId(), false);
       }
+      
+      this.deleteJNDI(PersistedType.ConnectionFactory, cfName);
    }
 
    /* (non-Javadoc)
@@ -257,12 +259,8 @@
       
       PersistedJNDI currentJNDI = mapJNDI.remove(key);
 
-      if (currentJNDI == null)
+      if (currentJNDI != null)
       {
-         return;
-      }
-      else
-      {
          jmsJournal.appendDeleteRecord(currentJNDI.getId(), true);
       }
    }

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java	2011-01-22 09:41:30 UTC (rev 10133)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java	2011-01-23 01:07:57 UTC (rev 10134)
@@ -21,8 +21,6 @@
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.HornetQBuffers;
 import org.hornetq.api.core.Pair;
-import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
 import org.hornetq.core.remoting.impl.netty.TransportConstants;
 import org.hornetq.jms.persistence.config.PersistedConnectionFactory;
 import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;

Added: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSDynamicConfigTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSDynamicConfigTest.java	                        (rev 0)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSDynamicConfigTest.java	2011-01-23 01:07:57 UTC (rev 10134)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.persistence;
+
+import java.util.ArrayList;
+
+import javax.naming.NamingException;
+
+import org.hornetq.core.persistence.impl.journal.OperationContextImpl;
+import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
+import org.hornetq.tests.util.JMSTestBase;
+
+/**
+ * A JMSDynamicConfigTest
+ *
+ * @author clebertsuconic
+ *
+ *
+ */
+public class JMSDynamicConfigTest extends JMSTestBase
+{
+
+   protected boolean usePersistence()
+   {
+      return true;
+   }
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   public void testStart() throws Exception
+   {
+      ArrayList<String> connectors = new ArrayList<String>();
+
+      connectors.add("netty");
+
+      ConnectionFactoryConfiguration cfg = new ConnectionFactoryConfigurationImpl("tst", false, connectors, "tt");
+      jmsServer.createConnectionFactory(true, cfg, "tst");
+      
+      assertNotNull(context.lookup("tst"));
+      jmsServer.removeConnectionFactoryFromJNDI("tst");
+      
+      try
+      {
+         context.lookup("tst");
+         fail("failure expected");
+      }
+      catch (NamingException excepted)
+      {
+      }
+
+      jmsServer.stop();
+
+      OperationContextImpl.clearContext();
+      jmsServer.start();
+
+      try
+      {
+         context.lookup("tst");
+         fail("failure expected");
+      }
+      catch (NamingException excepted)
+      {
+      }
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}



More information about the hornetq-commits mailing list