[jboss-cvs] JBoss Messaging SVN: r3573 - in branches/Branch_Stable: tests/src/org/jboss/test/messaging/tools/container and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 16 05:38:36 EST 2008


Author: ataylor
Date: 2008-01-16 05:38:35 -0500 (Wed, 16 Jan 2008)
New Revision: 3573

Modified:
   branches/Branch_Stable/src/main/org/jboss/jms/server/ServerPeer.java
   branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
   branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java
Log:
fixes for tests for sexuritystore config changes

Modified: branches/Branch_Stable/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_Stable/src/main/org/jboss/jms/server/ServerPeer.java	2008-01-16 08:38:21 UTC (rev 3572)
+++ branches/Branch_Stable/src/main/org/jboss/jms/server/ServerPeer.java	2008-01-16 10:38:35 UTC (rev 3573)
@@ -21,28 +21,7 @@
   */
 package org.jboss.jms.server;
 
-import java.io.ByteArrayOutputStream;
-import java.io.CharArrayWriter;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import javax.management.Attribute;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.transaction.xa.Xid;
-
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
 import org.jboss.aop.AspectXmlLoader;
 import org.jboss.jms.server.connectionfactory.ConnectionFactoryJNDIMapper;
 import org.jboss.jms.server.connectionmanager.SimpleConnectionManager;
@@ -57,14 +36,8 @@
 import org.jboss.jms.server.security.SecurityMetadataStore;
 import org.jboss.jms.wireformat.JMSWireFormat;
 import org.jboss.logging.Logger;
-import org.jboss.messaging.core.contract.Binding;
-import org.jboss.messaging.core.contract.ClusterNotifier;
-import org.jboss.messaging.core.contract.MemoryManager;
-import org.jboss.messaging.core.contract.MessageStore;
-import org.jboss.messaging.core.contract.PersistenceManager;
-import org.jboss.messaging.core.contract.PostOffice;
+import org.jboss.messaging.core.contract.*;
 import org.jboss.messaging.core.contract.Queue;
-import org.jboss.messaging.core.contract.Replicator;
 import org.jboss.messaging.core.impl.DefaultClusterNotifier;
 import org.jboss.messaging.core.impl.FailoverWaiter;
 import org.jboss.messaging.core.impl.IDManager;
@@ -78,14 +51,24 @@
 import org.jboss.messaging.util.JMXAccessor;
 import org.jboss.messaging.util.Util;
 import org.jboss.messaging.util.Version;
-import org.jboss.mx.loading.UnifiedClassLoader3;
 import org.jboss.remoting.marshal.MarshalFactory;
 import org.jboss.system.ServiceCreator;
 import org.jboss.system.ServiceMBeanSupport;
 import org.jboss.util.JBossStringBuilder;
 import org.w3c.dom.Element;
 
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
+import javax.management.Attribute;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.transaction.xa.Xid;
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayWriter;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.*;
 
 /**
  * A JMS server peer.
@@ -1463,11 +1446,12 @@
 
       ClassLoader cl = this.getClass().getClassLoader();
       ObjectName loaderObjectName = null;
-      // Try reflection for getObjectName on the class loader
-      Class[] sig = {};
-      Method getObjectName = cl.getClass().getMethod("getObjectName", sig);
+
       try
       {
+         // Try reflection for getObjectName on the class loader
+         Class[] sig = {};
+         Method getObjectName = cl.getClass().getMethod("getObjectName", sig);
          Object[] args = {};
          loaderObjectName = (ObjectName) getObjectName.invoke(cl, args);
       }

Modified: branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2008-01-16 08:38:21 UTC (rev 3572)
+++ branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2008-01-16 10:38:35 UTC (rev 3573)
@@ -21,20 +21,6 @@
 */
 package org.jboss.test.messaging.tools.container;
 
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jms.Destination;
-import javax.jms.Queue;
-import javax.jms.Topic;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-import javax.transaction.UserTransaction;
-
 import org.jboss.aop.AspectXmlLoader;
 import org.jboss.jms.server.DestinationManager;
 import org.jboss.jms.server.ServerPeer;
@@ -50,6 +36,15 @@
 import org.jboss.test.messaging.tools.jboss.ServiceDeploymentDescriptor;
 import org.w3c.dom.Element;
 
+import javax.jms.Destination;
+import javax.jms.Queue;
+import javax.jms.Topic;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import javax.transaction.UserTransaction;
+import java.net.URL;
+import java.util.*;
+
 /**
  * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
@@ -324,6 +319,11 @@
          toStop.add(jmsUserManagerObjectName);
          sc.invoke(jmsUserManagerObjectName, "create", new Object[0], new String[0]);
          sc.invoke(jmsUserManagerObjectName, "start", new Object[0], new String[0]);
+         //regioster metadatasore
+        /* MBeanConfigurationElement securityStoreConfig =
+            ServiceConfigHelper.getServiceConfiguration(mdd, "SecurityStore");
+         securityStoreObjectname = sc.registerAndConfigureService(securityStoreConfig);
+         toStop.add(securityStoreObjectname);*/
 
          // register server peer as a service, dependencies are injected automatically
          MBeanConfigurationElement serverPeerConfig =
@@ -337,9 +337,7 @@
 
          overrideAttributes(serverPeerObjectName, attrOverrides);
 
-         // overwrite the config file security domain
-         sc.setAttribute(serverPeerObjectName, "SecurityDomain",
-                         MockJBossSecurityManager.TEST_SECURITY_DOMAIN);
+         //ServerPeer serverPeer = (ServerPeer) sc.getMBeanServer().
 
          log.debug("starting JMS server");
 
@@ -454,6 +452,8 @@
             sc.invoke(serverPeerObjectName, "stop", new Object[0], new String[0]);
             sc.invoke(serverPeerObjectName, "destroy", new Object[0], new String[0]);
             sc.unregisterService(serverPeerObjectName);
+            sc.invoke(ServiceContainer.SECURITYSTORE_OBJECT_NAME, "stop", new Object[0], new String[0]);
+            sc.unregisterService(ServiceContainer.SECURITYSTORE_OBJECT_NAME);
          }
          catch (Exception ignore)
          {
@@ -848,12 +848,12 @@
 
    public void setDefaultSecurityConfig(String config) throws Exception
    {
-      sc.setAttribute(serverPeerObjectName, "DefaultSecurityConfig", config);
+      sc.setAttribute(ServiceContainer.SECURITYSTORE_OBJECT_NAME, "DefaultSecurityConfig", config);
    }
 
    public String getDefaultSecurityConfig() throws Exception
    {
-      Element element = (Element)sc.getAttribute(serverPeerObjectName, "DefaultSecurityConfig");
+      Element element = (Element)sc.getAttribute(ServiceContainer.SECURITYSTORE_OBJECT_NAME, "DefaultSecurityConfig");
       return XMLUtil.elementToString(element);
    }
 

Modified: branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java
===================================================================
--- branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java	2008-01-16 08:38:21 UTC (rev 3572)
+++ branches/Branch_Stable/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java	2008-01-16 10:38:35 UTC (rev 3573)
@@ -21,47 +21,14 @@
 */
 package org.jboss.test.messaging.tools.container;
 
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import javax.management.Attribute;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.spi.NamingManager;
-import javax.sql.DataSource;
-import javax.transaction.TransactionManager;
-import javax.transaction.UserTransaction;
-
+import com.arjuna.ats.arjuna.recovery.RecoveryManager;
 import org.hsqldb.Server;
 import org.hsqldb.persist.HsqlProperties;
 import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.jms.jndi.JNDIProviderAdapter;
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.jms.server.remoting.JMSServerInvocationHandler;
+import org.jboss.jms.server.security.SecurityMetadataStore;
 import org.jboss.logging.Logger;
 import org.jboss.messaging.util.JNDIUtil;
 import org.jboss.messaging.util.XMLUtil;
@@ -71,11 +38,7 @@
 import org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory;
 import org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService;
 import org.jboss.resource.adapter.jms.JmsManagedConnectionFactory;
-import org.jboss.resource.connectionmanager.CachedConnectionManager;
-import org.jboss.resource.connectionmanager.CachedConnectionManagerMBean;
-import org.jboss.resource.connectionmanager.ConnectionFactoryBindingService;
-import org.jboss.resource.connectionmanager.JBossManagedConnectionPool;
-import org.jboss.resource.connectionmanager.TxConnectionManager;
+import org.jboss.resource.connectionmanager.*;
 import org.jboss.system.Registry;
 import org.jboss.system.ServiceController;
 import org.jboss.system.ServiceCreator;
@@ -88,7 +51,20 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
-import com.arjuna.ats.arjuna.recovery.RecoveryManager;
+import javax.management.*;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.spi.NamingManager;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.sql.*;
+import java.util.*;
 
 /**
  * An MBeanServer and a configurable set of services (TransactionManager, Remoting, etc) available
@@ -125,6 +101,7 @@
    public static ObjectName JMS_MANAGED_CONNECTION_POOL_OBJECT_NAME;
    public static ObjectName JMS_CONNECTION_MANAGER_OBJECT_NAME;
    public static ObjectName JMS_CONNECTION_FACTORY_BINDING_SERVICE_OBJECT_NAME;
+   public static ObjectName SECURITYSTORE_OBJECT_NAME;
 
    public static ObjectName REMOTING_OBJECT_NAME;
 
@@ -183,6 +160,7 @@
          
          SERVER_PEER_OBJECT_NAME =
          new ObjectName("jboss.messaging:service=ServerPeer");
+         SECURITYSTORE_OBJECT_NAME = new ObjectName("jboss.messaging:service=SecurityStore");
       }
       catch(Exception e)
       {
@@ -745,6 +723,10 @@
    public void setAttribute(ObjectName on, String name, String valueAsString) throws Exception
    {
       MBeanInfo mbeanInfo = mbeanServer.getMBeanInfo(on);
+      if("SecurityStore".equals(name))
+      {
+         return;
+      }
       Object value = type(mbeanInfo, name, valueAsString);
       mbeanServer.setAttribute(on, new Attribute(name, value));
    }
@@ -1114,6 +1096,18 @@
       log.debug("bound " + USER_TRANSACTION_JNDI_NAME);
    }
 
+   public SecurityMetadataStore startSecurityStore() throws Exception
+   {
+      SecurityMetadataStore securityMetadataStore = new SecurityMetadataStore();
+      securityMetadataStore.setSecurityDomain(MockJBossSecurityManager.TEST_SECURITY_DOMAIN);
+      securityMetadataStore.setDefaultSecurityConfig(XMLUtil.stringToElement("<security>\n" +
+              "                  <role name=\"guest\" read=\"true\" write=\"true\" create=\"true\"/>\n" +
+              "             </security>"));
+      mbeanServer.registerMBean(securityMetadataStore, new ObjectName("jboss.messaging:service=SecurityStore"));
+      mbeanServer.invoke(new ObjectName("jboss.messaging:service=SecurityStore"), "start", new Object[0], new String[0]);
+      return securityMetadataStore;
+   }
+
    private static boolean deleteDirectory(File directory)
    {
       if (directory.isDirectory())




More information about the jboss-cvs-commits mailing list