[jboss-cvs] JBoss Messaging SVN: r4500 - in trunk: src/main/org/jboss/messaging/core/deployers/impl and 13 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 17 07:30:54 EDT 2008


Author: timfox
Date: 2008-06-17 07:30:54 -0400 (Tue, 17 Jun 2008)
New Revision: 4500

Modified:
   trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java
   trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java
   trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java
   trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java
   trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java
   trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java
   trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java
   trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
   trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java
   trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java
   trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java
   trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
   trunk/src/main/org/jboss/messaging/core/settings/HierarchicalRepository.java
   trunk/src/main/org/jboss/messaging/core/transaction/impl/ResourceManagerImpl.java
   trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/SecurityTest.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
   trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/SecurityStoreImplTest.java
Log:
More tweaks and fixes mainly regarding use of interface vs implementation and other coding issues


Modified: trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -63,8 +63,8 @@
    void undeploy(URL url) throws Exception;
 
    /**
-    * the weight of the deployer, used for ordering the order that deployers are deployed.
-    * @return the weight
+    * the order of the deployer, used for ordering the order that deployers are deployed.
+    * @return the order
     */
-   int getWeight();
+   int getOrder();
 }
\ No newline at end of file

Modified: trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -45,7 +45,7 @@
     */
    void unregisterDeployer(Deployer deployer);
 
-   void start(int weight) throws Exception;
+   void start(int order) throws Exception;
 
    void stop();
 }

Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -29,6 +29,8 @@
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
@@ -44,23 +46,27 @@
 {
    private static final Logger log = Logger.getLogger(FileDeploymentManager.class);
    //these are the list of deployers, typically destination and connection factory.
-   private static ArrayList<Deployer> deployers = new ArrayList<Deployer>();
+   private static List<Deployer> deployers = new ArrayList<Deployer>();
    //any config files deployed and the time they were deployed
-   private static HashMap<URL, Long> deployed = new HashMap<URL, Long>();
+   private static Map<URL, Long> deployed = new HashMap<URL, Long>();
    // the list of URL's to deploy
-   private static ArrayList<URL> toDeploy = new ArrayList<URL>();
+   private static List<URL> toDeploy = new ArrayList<URL>();
    //the list of URL's to undeploy if removed
-   private static ArrayList<URL> toUndeploy = new ArrayList<URL>();
+   private static List<URL> toUndeploy = new ArrayList<URL>();
    //the list of URL's to redeploy if changed
-   private static ArrayList<URL> toRedeploy = new ArrayList<URL>();
+   private static List<URL> toRedeploy = new ArrayList<URL>();
    
    private static ScheduledExecutorService scheduler;
 
-   int currentWeight = 0;
+   private int currentOrder = 0;
 
-   public void start(final int weight) throws Exception
+   public synchronized void start(final int order) throws Exception
    {
-      Collection<ConfigurationURL> configurations = getUnstartedConfigurations(weight);
+      if (order <= currentOrder)
+      {
+         throw new IllegalArgumentException("Already started with weight " + currentOrder);
+      }
+      Collection<ConfigurationURL> configurations = getUnstartedConfigurations(order);
       for (ConfigurationURL configuration : configurations)
       {
          Iterator<URL> urls = configuration.getUrls();
@@ -71,14 +77,14 @@
             deployed.put(url, new File(url.getFile()).lastModified());
          }
       }
-      currentWeight = weight;
+      currentOrder = order;
       // Get the scheduler
       scheduler = Executors.newSingleThreadScheduledExecutor();
 
       scheduler.scheduleAtFixedRate(this, 10, 5, TimeUnit.SECONDS);
    }
 
-   public void stop()
+   public synchronized void stop()
    {
       deployers.clear();
       if (scheduler != null)
@@ -94,37 +100,34 @@
     * @param Deployer The Deployer object
     * @throws Exception .
     */
-   public void registerDeployer(final Deployer Deployer) throws Exception
+   public synchronized void registerDeployer(final Deployer Deployer) throws Exception
    {
-      synchronized (this)
+      deployers.add(Deployer);
+      if (Deployer.getOrder() <= currentOrder)
       {
-         deployers.add(Deployer);
-         if (Deployer.getWeight() <= currentWeight)
+         Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(Deployer.getConfigFileName());
+         while (urls.hasMoreElements())
          {
-            Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(Deployer.getConfigFileName());
-            while (urls.hasMoreElements())
+            URL url = urls.nextElement();
+            if (!deployed.keySet().contains(url))
             {
-               URL url = urls.nextElement();
-               if (!deployed.keySet().contains(url))
-               {
-                  deployed.put(url, new File(url.getFile()).lastModified());
-               }
-               try
-               {
-                  log.info(new StringBuilder("Deploying ").append(Deployer).append(" with url").append(url));
-                  Deployer.deploy(url);
+               deployed.put(url, new File(url.getFile()).lastModified());
+            }
+            try
+            {
+               log.info(new StringBuilder("Deploying ").append(Deployer).append(" with url").append(url));
+               Deployer.deploy(url);
 
-               }
-               catch (Exception e)
-               {
-                  log.error(new StringBuilder("Error deploying ").append(url), e);
-               }
             }
+            catch (Exception e)
+            {
+               log.error(new StringBuilder("Error deploying ").append(url), e);
+            }
          }
-      }
+      }      
    }
 
-   public void unregisterDeployer(final Deployer Deployer)
+   public synchronized void unregisterDeployer(final Deployer Deployer)
    {
       deployers.remove(Deployer);
       if (deployers.size() == 0)
@@ -140,19 +143,16 @@
    /**
     * called by the ExecutorService every n seconds
     */
-   public void run()
+   public synchronized void run()
    {
-      synchronized (this)
+      try
       {
-         try
-         {
-            scan();
-         }
-         catch (Exception e)
-         {
-            log.warn("error scanning for URL's " + e);
-         }
+         scan();
       }
+      catch (Exception e)
+      {
+         log.warn("error scanning for URL's " + e);
+      }      
    }
 
    /**
@@ -163,10 +163,10 @@
     */
    private Collection<ConfigurationURL> getUnstartedConfigurations(final int weight) throws IOException
    {
-      HashMap<String, ConfigurationURL> configurations = new HashMap<String, ConfigurationURL>();
+      Map<String, ConfigurationURL> configurations = new HashMap<String, ConfigurationURL>();
       for (Deployer deployer : deployers)
       {
-         if (deployer.getWeight() <= weight && deployer.getWeight() > currentWeight)
+         if (deployer.getOrder() <= weight && deployer.getOrder() > currentOrder)
          {
             Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(deployer.getConfigFileName());
 
@@ -186,10 +186,10 @@
 
    private Collection<ConfigurationURL> getStartedConfigurations() throws IOException
    {
-      HashMap<String, ConfigurationURL> configurations = new HashMap<String, ConfigurationURL>();
+      Map<String, ConfigurationURL> configurations = new HashMap<String, ConfigurationURL>();
       for (Deployer deployer : deployers)
       {
-         if (deployer.getWeight() <= currentWeight)
+         if (deployer.getOrder() <= currentOrder)
          {
             Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(deployer.getConfigFileName());
 
@@ -311,8 +311,7 @@
     * @param url the url to deploy
     * @throws Exception .
     */
-   private void deploy(final URL url)
-           throws Exception
+   private void deploy(final URL url) throws Exception
    {
       deployed.put(url, new File(url.getFile()).lastModified());
       for (Deployer Deployer : deployers)
@@ -329,9 +328,9 @@
       }
    }
 
-   static class ConfigurationURL
+   private static class ConfigurationURL
    {
-      private ArrayList<URL> urls = new ArrayList<URL>();
+      private List<URL> urls = new ArrayList<URL>();
       private String configFileName;
 
       public ConfigurationURL(final Enumeration<URL> urls, final String configFileName)

Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -21,7 +21,6 @@
    */
 package org.jboss.messaging.core.deployers.impl;
 
-import org.jboss.messaging.core.postoffice.PostOffice;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
 import org.jboss.messaging.core.settings.impl.QueueSettings;
 import org.jboss.messaging.util.SimpleString;
@@ -126,7 +125,7 @@
       return "queues.xml";
    }
 
-   public int getWeight()
+   public int getOrder()
    {
       return 1;
    }

Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -21,14 +21,15 @@
    */
 package org.jboss.messaging.core.deployers.impl;
 
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+
 import org.jboss.messaging.core.security.Role;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-
 /**
  * Deploys the security settings into a security repository and adds them to the security store.
  *
@@ -51,9 +52,9 @@
    /**
     * The repository to add to
     */
-   private HierarchicalRepository<HashSet<Role>> securityRepository;
+   private HierarchicalRepository<Set<Role>> securityRepository;
 
-   public SecurityDeployer(HierarchicalRepository<HashSet<Role>> securityRepository)
+   public SecurityDeployer(final HierarchicalRepository<Set<Role>> securityRepository)
    {
       this.securityRepository = securityRepository;
    }
@@ -84,7 +85,7 @@
     * @param node the element to deploy
     * @throws Exception .
     */
-   public void deploy(Node node) throws Exception
+   public void deploy(final Node node) throws Exception
    {
       HashSet<Role> securityRoles = new HashSet<Role>();
       ArrayList<String> create = new ArrayList<String>();
@@ -135,7 +136,7 @@
     * @param node the element to undeploy
     * @throws Exception .
     */
-   public void undeploy(Node node) throws Exception
+   public void undeploy(final Node node) throws Exception
    {
       String match = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
       securityRepository.removeMatch(match);
@@ -151,7 +152,7 @@
       return QUEUES_XML;
    }
 
-   public int getWeight()
+   public int getOrder()
    {
       return 1;
    }

Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -75,7 +75,7 @@
       return "jbm-security.xml";
    }
 
-   public int getWeight()
+   public int getOrder()
    {
       return 1;
    }

Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -233,7 +233,7 @@
            throws Exception;
 
 
-   abstract public int getWeight();
+   abstract public int getOrder();
 
    protected Element getRootElement(URL url)
            throws Exception

Modified: trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -87,7 +87,7 @@
 	
 	private volatile boolean started;
 	
-	public JournalStorageManager(Configuration config)
+	public JournalStorageManager(final Configuration config)
 	{
 		if (config.getJournalType() != JournalType.NIO && config.getJournalType() != JournalType.ASYNCIO)
 		{
@@ -123,7 +123,7 @@
          log.info("AIO journal selected");
          if (!AIOSequentialFileFactory.isSupported())
          {
-            log.warn("AIO wasn't located on this platform, it will fall back to Java NIO. " +
+            log.warn("AIO wasn't located on this platform, it will fall back to using pure Java NIO. " +
                      "If your platform is Linux, install LibAIO to enable the AIO journal");
             journalFF = new NIOSequentialFileFactory(journalDir);
          }

Modified: trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -21,7 +21,7 @@
   */
 package org.jboss.messaging.core.security;
 
-import java.util.HashSet;
+import java.util.Set;
 
 import org.jboss.messaging.core.server.ServerConnection;
 import org.jboss.messaging.core.settings.HierarchicalRepository;
@@ -40,7 +40,7 @@
    
    void check(SimpleString address, CheckType checkType, ServerConnection conn) throws Exception;
 
-   void setSecurityRepository(HierarchicalRepository<HashSet<Role>> securityRepository);
+   void setSecurityRepository(HierarchicalRepository<Set<Role>> securityRepository);
    
    void setSecurityManager(JBMSecurityManager securityManager);
 }

Modified: trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -64,9 +64,9 @@
 
    private boolean trace = log.isTraceEnabled();
 
-   private HierarchicalRepository<HashSet<Role>> securityRepository;
+   private HierarchicalRepository<Set<Role>> securityRepository;
 
-   JBMSecurityManager securityManager;
+   private JBMSecurityManager securityManager;
 
    private final Set<SimpleString> readCache = new ConcurrentHashSet<SimpleString>();
 
@@ -113,7 +113,7 @@
    
          String saddress = address.toString();
          
-         HashSet<Role> roles = securityRepository.getMatch(saddress);
+         Set<Role> roles = securityRepository.getMatch(saddress);
          if(!securityManager.validateUserAndRole(conn.getUsername(), conn.getPassword(), roles, checkType))
          {
              throw new MessagingException(MessagingException.SECURITY_EXCEPTION, "Unable to validate user: " + conn.getUsername());
@@ -153,7 +153,7 @@
 
    // Public --------------------------------------------------------
 
-   public void setSecurityRepository(HierarchicalRepository<HashSet<Role>> securityRepository)
+   public void setSecurityRepository(HierarchicalRepository<Set<Role>> securityRepository)
    {
       this.securityRepository = securityRepository;
       securityRepository.registerListener(this);

Modified: trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/server/MessagingServer.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -21,7 +21,7 @@
  */
 package org.jboss.messaging.core.server;
 
-import java.util.HashSet;
+import java.util.Set;
 
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.deployers.DeploymentManager;
@@ -79,7 +79,7 @@
        
    ConnectionManager getConnectionManager();
    
-   HierarchicalRepository<HashSet<Role>> getSecurityRepository();
+   HierarchicalRepository<Set<Role>> getSecurityRepository();
    
    SecurityStore getSecurityStore();
 

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -22,6 +22,7 @@
 package org.jboss.messaging.core.server.impl;
 
 import java.util.HashSet;
+import java.util.Set;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
@@ -108,7 +109,7 @@
    private DeploymentManager deploymentManager = new FileDeploymentManager();
    private ExecutorFactory executorFactory;
    private ExecutorService threadPool;
-   private HierarchicalRepository<HashSet<Role>> securityRepository = new HierarchicalObjectRepository<HashSet<Role>>();
+   private HierarchicalRepository<Set<Role>> securityRepository = new HierarchicalObjectRepository<Set<Role>>();
    private HierarchicalRepository<QueueSettings> queueSettingsRepository = new HierarchicalObjectRepository<QueueSettings>();
    private QueueFactory queueFactory;
    private ResourceManager resourceManager = new ResourceManagerImpl(0);
@@ -312,7 +313,7 @@
       this.postOffice = postOffice;
    }
 
-   public HierarchicalRepository<HashSet<Role>> getSecurityRepository()
+   public HierarchicalRepository<Set<Role>> getSecurityRepository()
    {
       return securityRepository;
    }

Modified: trunk/src/main/org/jboss/messaging/core/settings/HierarchicalRepository.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/settings/HierarchicalRepository.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/settings/HierarchicalRepository.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -1,7 +1,5 @@
 package org.jboss.messaging.core.settings;
 
-
-
 /**
  * allows objects to be mapped against a regex pattern and held in order in a list
  *

Modified: trunk/src/main/org/jboss/messaging/core/transaction/impl/ResourceManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/transaction/impl/ResourceManagerImpl.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/core/transaction/impl/ResourceManagerImpl.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -23,7 +23,6 @@
 
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicLong;
 
 import javax.transaction.xa.Xid;
 

Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -256,7 +256,7 @@
       return "jbm-jndi.xml";
    }
 
-   public int getWeight()
+   public int getOrder()
    {
       return 2;
    }

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -28,6 +28,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import javax.jms.Queue;
 import javax.jms.Topic;
@@ -36,11 +37,9 @@
 import javax.sql.DataSource;
 import javax.transaction.TransactionManager;
 
-import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.security.Role;
 import org.jboss.messaging.core.server.ConnectionManager;
 import org.jboss.messaging.core.server.MessagingServer;
-import org.jboss.messaging.core.remoting.TransportType;
 import org.jboss.messaging.jms.client.JBossConnectionFactory;
 import org.jboss.messaging.jms.server.JMSServerManager;
 import org.jboss.messaging.microcontainer.JBMBootstrapServer;
@@ -861,12 +860,12 @@
       return servers.get(server).getMessageCountForQueue(s);
    }
 
-   protected HashSet<Role> getSecurityConfig() throws Exception
+   protected Set<Role> getSecurityConfig() throws Exception
    {
       return servers.get(0).getSecurityConfig();
    }
 
-   protected void setSecurityConfig(HashSet<Role> defConfig) throws Exception
+   protected void setSecurityConfig(Set<Role> defConfig) throws Exception
    {
       servers.get(0).setSecurityConfig(defConfig);
    }

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/SecurityTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/SecurityTest.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/SecurityTest.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -21,8 +21,9 @@
   */
 package org.jboss.test.messaging.jms;
 
-import java.util.HashSet;
 import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
@@ -35,16 +36,9 @@
 import javax.jms.Queue;
 import javax.jms.Session;
 import javax.jms.Topic;
-import javax.jms.XAConnection;
-import javax.jms.XAConnectionFactory;
-import javax.jms.XASession;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
 
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.security.Role;
-import org.jboss.messaging.core.transaction.impl.XidImpl;
-import org.jboss.messaging.jms.client.JBossConnectionFactory;
 import org.jboss.test.messaging.tools.ServerManagement;
 
 /**
@@ -78,7 +72,7 @@
 
    // Attributes ----------------------------------------------------
 
-   private HashSet<Role> oldDefaultConfig;
+   private Set<Role> oldDefaultConfig;
 
    // Constructors --------------------------------------------------
 
@@ -528,9 +522,8 @@
     */
    public void testDefaultSecurityUpdate() throws Exception
    {
-      HashSet<Role>  defSecConf = getSecurityConfig();
+      Set<Role> defSecConf = getSecurityConfig();
 
-
       // "john" has the role def, so he should be able to create a producer and a consumer on a queue
       Connection conn = null;
 
@@ -684,7 +677,7 @@
          //Should fall back to the default config
          HashSet<Role> lockedConf = new HashSet<Role>();
          lockedConf.add(new Role("alien", true, true, true)) ;
-         HashSet<Role> orig = getSecurityConfig();
+         Set<Role> orig = getSecurityConfig();
          setSecurityConfig(lockedConf);
 
          assertFalse(canReadDestination(conn, topic2));

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -27,9 +27,9 @@
 import java.sql.SQLException;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Properties;
+import java.util.Set;
 
 import javax.jms.InvalidDestinationException;
 import javax.management.NotificationListener;
@@ -655,7 +655,7 @@
       getJMSServerManager().destroyConnectionFactory(objectName);
    }
 
-   public void configureSecurityForDestination(String destName, boolean isQueue, HashSet<Role> roles) throws Exception
+   public void configureSecurityForDestination(String destName, boolean isQueue, Set<Role> roles) throws Exception
    {
       String prefix = isQueue ? "queuejms." : "topicjms.";
       if (roles != null)
@@ -798,19 +798,19 @@
    }
 
 
-   public HashSet<Role> getSecurityConfig() throws Exception
+   public Set<Role> getSecurityConfig() throws Exception
    {
       return getMessagingServer().getSecurityRepository().getMatch("*");
    }
 
-   public void setSecurityConfig(HashSet<Role> defConfig) throws Exception
+   public void setSecurityConfig(Set<Role> defConfig) throws Exception
    {
       getMessagingServer().getSecurityRepository().removeMatch("*");
       getMessagingServer().getSecurityRepository().addMatch("*", defConfig);      
    }
 
 
-   public void setSecurityConfigOnManager(boolean b, String s, HashSet<Role> conf) throws Exception
+   public void setSecurityConfigOnManager(boolean b, String s, Set<Role> conf) throws Exception
    {
       String prefix = b ? "queuejms." : "topicjms.";
       getMessagingServer().getSecurityRepository().addMatch(prefix + s, conf);

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -30,6 +30,7 @@
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.management.NotificationListener;
 import javax.management.ObjectName;
@@ -455,7 +456,7 @@
       server.undeployConnectionFactory(objectName);
    }
 
-   public void configureSecurityForDestination(String destName, boolean isQueue, HashSet<Role> roles) throws Exception
+   public void configureSecurityForDestination(String destName, boolean isQueue, Set<Role> roles) throws Exception
    {
       server.configureSecurityForDestination(destName, isQueue, roles);
    }
@@ -538,18 +539,18 @@
    }
 
 
-   public HashSet<Role> getSecurityConfig() throws Exception
+   public Set<Role> getSecurityConfig() throws Exception
    {
       return server.getSecurityConfig();
    }
 
-   public void setSecurityConfig(HashSet<Role> defConfig) throws Exception
+   public void setSecurityConfig(Set<Role> defConfig) throws Exception
    {
       server.setSecurityConfig(defConfig);
    }
 
 
-   public void setSecurityConfigOnManager(boolean b, String s, HashSet<Role> conf) throws Exception
+   public void setSecurityConfigOnManager(boolean b, String s, Set<Role> conf) throws Exception
    {
       server.setSecurityConfigOnManager(b, s, conf);
    }

Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -21,21 +21,21 @@
 */
 package org.jboss.test.messaging.tools.container;
 
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.jboss.messaging.core.management.MessagingServerManagement;
-import org.jboss.messaging.core.security.Role;
-import org.jboss.messaging.core.server.MessagingServer;
-import org.jboss.messaging.jms.server.JMSServerManager;
+import java.rmi.Remote;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
 
 import javax.management.NotificationListener;
 import javax.management.ObjectName;
 import javax.naming.InitialContext;
 import javax.transaction.UserTransaction;
-import java.rmi.Remote;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
 
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.messaging.core.security.Role;
+import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.jms.server.JMSServerManager;
+
 /**
  * The remote interface exposed by TestServer.
  *
@@ -230,7 +230,7 @@
     * @param config - sending 'config' as a String and not as an org.w3c.dom.Element to avoid
     *        NotSerializableExceptions that show up when running tests on JDK 1.4.
     */
-   void configureSecurityForDestination(String destName, boolean isQueue, HashSet<Role> roles) throws Exception;
+   void configureSecurityForDestination(String destName, boolean isQueue, Set<Role> roles) throws Exception;
 
    /**
     * Executes a command on the server
@@ -262,11 +262,11 @@
 
    List listAllSubscriptionsForTopic(String s) throws Exception;
 
-   HashSet<Role> getSecurityConfig() throws Exception;
+   Set<Role> getSecurityConfig() throws Exception;
 
-   void setSecurityConfig(HashSet<Role> defConfig) throws Exception;
+   void setSecurityConfig(Set<Role> defConfig) throws Exception;
 
-   void setSecurityConfigOnManager(boolean b, String s, HashSet<Role> lockedConf) throws Exception;
+   void setSecurityConfigOnManager(boolean b, String s, Set<Role> lockedConf) throws Exception;
 
    void setRedeliveryDelayOnDestination(String dest, boolean queue, long delay) throws Exception;
 

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -241,7 +241,7 @@
          return element;
       }
 
-      public int getWeight()
+      public int getOrder()
       {
          return 0;
       }

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/SecurityStoreImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/SecurityStoreImplTest.java	2008-06-17 11:18:59 UTC (rev 4499)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/security/impl/SecurityStoreImplTest.java	2008-06-17 11:30:54 UTC (rev 4500)
@@ -21,7 +21,11 @@
    */
 package org.jboss.messaging.tests.unit.core.security.impl;
 
+import java.util.HashSet;
+import java.util.Set;
+
 import junit.framework.TestCase;
+
 import org.easymock.EasyMock;
 import org.jboss.messaging.core.security.CheckType;
 import org.jboss.messaging.core.security.JBMSecurityManager;
@@ -31,8 +35,6 @@
 import org.jboss.messaging.core.settings.HierarchicalRepository;
 import org.jboss.messaging.util.SimpleString;
 
-import java.util.HashSet;
-
 /**
  * tests SecurityStoreImpl
  *
@@ -83,10 +85,10 @@
       JBMSecurityManager securityManager = EasyMock.createStrictMock(JBMSecurityManager.class);
       securityStore.setSecurityManager(securityManager);
       //noinspection unchecked
-      HierarchicalRepository<HashSet<Role>> repository = EasyMock.createStrictMock(HierarchicalRepository.class);
+      HierarchicalRepository<Set<Role>> repository = EasyMock.createStrictMock(HierarchicalRepository.class);
 
       SimpleString address = new SimpleString("anaddress");
-      HashSet<Role> roles = new HashSet<Role>();
+      Set<Role> roles = new HashSet<Role>();
       roles.add(new Role("user", false, false, true));
       repository.registerListener(securityStore);
       EasyMock.expect(repository.getMatch(address.toString())).andReturn(roles);
@@ -114,10 +116,10 @@
       JBMSecurityManager securityManager = EasyMock.createStrictMock(JBMSecurityManager.class);
       securityStore.setSecurityManager(securityManager);
       //noinspection unchecked
-      HierarchicalRepository<HashSet<Role>> repository = EasyMock.createStrictMock(HierarchicalRepository.class);
+      HierarchicalRepository<Set<Role>> repository = EasyMock.createStrictMock(HierarchicalRepository.class);
 
       SimpleString address = new SimpleString("anaddress");
-      HashSet<Role> roles = new HashSet<Role>();
+      Set<Role> roles = new HashSet<Role>();
       roles.add(new Role("user", false, false, true));
       repository.registerListener(securityStore);
       EasyMock.expect(repository.getMatch(address.toString())).andReturn(roles);
@@ -145,10 +147,10 @@
       JBMSecurityManager securityManager = EasyMock.createStrictMock(JBMSecurityManager.class);
       securityStore.setSecurityManager(securityManager);
       //noinspection unchecked
-      HierarchicalRepository<HashSet<Role>> repository = EasyMock.createStrictMock(HierarchicalRepository.class);
+      HierarchicalRepository<Set<Role>> repository = EasyMock.createStrictMock(HierarchicalRepository.class);
 
       SimpleString address = new SimpleString("anaddress");
-      HashSet<Role> roles = new HashSet<Role>();
+      Set<Role> roles = new HashSet<Role>();
       roles.add(new Role("user", false, false, true));
       repository.registerListener(securityStore);
       EasyMock.expect(repository.getMatch(address.toString())).andReturn(roles);
@@ -176,10 +178,10 @@
       JBMSecurityManager securityManager = EasyMock.createStrictMock(JBMSecurityManager.class);
       securityStore.setSecurityManager(securityManager);
       //noinspection unchecked
-      HierarchicalRepository<HashSet<Role>> repository = EasyMock.createStrictMock(HierarchicalRepository.class);
+      HierarchicalRepository<Set<Role>> repository = EasyMock.createStrictMock(HierarchicalRepository.class);
 
       SimpleString address = new SimpleString("anaddress");
-      HashSet<Role> roles = new HashSet<Role>();
+      Set<Role> roles = new HashSet<Role>();
       roles.add(new Role("user", false, false, true));
       repository.registerListener(securityStore);
       EasyMock.expect(repository.getMatch(address.toString())).andReturn(roles);




More information about the jboss-cvs-commits mailing list