[jboss-cvs] JBoss Messaging SVN: r5859 - in trunk: src/config and 16 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 13 06:59:51 EST 2009
Author: jmesnil
Date: 2009-02-13 06:59:51 -0500 (Fri, 13 Feb 2009)
New Revision: 5859
Added:
trunk/tests/config/ConfigurationTest-defaults.xml
trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java
Removed:
trunk/tests/config/ConfigurationTest-config2.xml
trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest2.java
Modified:
trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java
trunk/src/config/jbm-configuration.xml
trunk/src/config/jbm-queues.xml
trunk/src/main/org/jboss/messaging/core/config/Configuration.java
trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
trunk/src/main/org/jboss/messaging/core/management/ManagementService.java
trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java
trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java
trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareQueueControlWrapper.java
trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.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/cluster/impl/BridgeImpl.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java
trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java
trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSQueueControlWrapper.java
trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java
trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareTopicControlWrapper.java
trunk/src/schemas/jbm-configuration.xsd
trunk/tests/config/ConfigurationTest-config.xml
trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java
Log:
JBMESSAGING-1508: prevent anybody to send destructive management message
* added a special user SecurityStoreImpl.CLUSTER_ADMIN_USER to send management messages from within the cluster nodes
* its password must be the same on all nodes (configurable in jbm-configuration.xml)
* in jbm-queues.admin, only user with the 'admin' role are allowed to read/write from/to the management address
* added test to check default values when reading a configuration file
Modified: trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java
===================================================================
--- trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/examples/messaging/src/org/jboss/messaging/example/ManagementClient.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -36,8 +36,10 @@
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
import org.jboss.messaging.core.client.management.impl.ManagementHelper;
import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
import org.jboss.messaging.util.SimpleString;
/*
@@ -52,7 +54,7 @@
SimpleString replytoQueue = new SimpleString("replyto.adminQueue");
ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.integration.transports.netty.NettyConnectorFactory"));
- final ClientSession clientSession = sessionFactory.createSession(false, true, true);
+ final ClientSession clientSession = sessionFactory.createSession(SecurityStoreImpl.CLUSTER_ADMIN_USER, ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD, false, true, true, false, 1);
SimpleString queue = new SimpleString("queuejms.testQueue");
sendMessages(clientSession, queue);
Modified: trunk/src/config/jbm-configuration.xml
===================================================================
--- trunk/src/config/jbm-configuration.xml 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/config/jbm-configuration.xml 2009-02-13 11:59:51 UTC (rev 5859)
@@ -18,8 +18,8 @@
<wild-card-routing-enabled>true</wild-card-routing-enabled>
- <management-address>admin.management</management-address>
- <management-notification-address>admin.notification</management-notification-address>
+ <management-address>jbm.admin.management</management-address>
+ <management-notification-address>jbm.admin.notification</management-notification-address>
<!-- true to expose JBoss Messaging resources through JMX -->
<jmx-management-enabled>true</jmx-management-enabled>
Modified: trunk/src/config/jbm-queues.xml
===================================================================
--- trunk/src/config/jbm-queues.xml 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/config/jbm-queues.xml 2009-02-13 11:59:51 UTC (rev 5859)
@@ -3,8 +3,8 @@
xsi:schemaLocation="urn:jboss:messaging ../schemas/jbm-queues.xsd ">
<!-- manangement address -->
- <security match="admin.management">
- <!-- only the admin role can interact with the admin.management address -->
+ <security match="jbm.admin.management">
+ <!-- only the admin role can interact with the management address -->
<permission type="read" roles="admin"/>
<permission type="write" roles="admin"/>
</security>
Modified: trunk/src/main/org/jboss/messaging/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/Configuration.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/config/Configuration.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -133,8 +133,10 @@
SimpleString getManagementNotificationAddress();
- void setManagementNotificationAddress(SimpleString address);
-
+ String getManagementClusterPassword();
+
+ long getManagementRequestTimeout();
+
int getIDCacheSize();
void setIDCacheSize(int idCacheSize);
@@ -236,4 +238,5 @@
int getMessageExpiryThreadPriority();
void setMessageExpiryThreadPriority(int messageExpiryThreadPriority);
+
}
Modified: trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -73,6 +73,8 @@
public static final long DEFAULT_PAGE_SIZE = 10 * 1024 * 1024;
+ public static final long DEFAULT_PAGE_MAX_GLOBAL_SIZE = -1;
+
public static final String DEFAULT_LARGE_MESSAGES_DIR = "data/largemessages";
public static final boolean DEFAULT_CREATE_JOURNAL_DIR = true;
@@ -99,10 +101,14 @@
public static final long DEFAULT_TRANSACTION_TIMEOUT_SCAN_PERIOD = 1000;
- public static final SimpleString DEFAULT_MANAGEMENT_ADDRESS = new SimpleString("admin.management");
+ public static final SimpleString DEFAULT_MANAGEMENT_ADDRESS = new SimpleString("jbm.admin.management");
- public static final SimpleString DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS = new SimpleString("admin.notification");
+ public static final SimpleString DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS = new SimpleString("jbm.admin.notification");
+ public static final String DEFAULT_MANAGEMENT_CLUSTER_PASSWORD = "CHANGE ME!!";
+
+ public static final long DEFAULT_MANAGEMENT_REQUEST_TIMEOUT = 500;
+
public static final long DEFAULT_BROADCAST_PERIOD = 5000;
public static final long DEFAULT_BROADCAST_REFRESH_TIMEOUT = 10000;
@@ -128,7 +134,7 @@
public static final boolean DEFAULT_DIVERT_EXCLUSIVE = false;
public static final boolean DEFAULT_BRIDGE_DUPLICATE_DETECTION = true;
-
+
// Attributes -----------------------------------------------------------------------------
protected boolean clustered = DEFAULT_CLUSTERED;
@@ -158,7 +164,7 @@
protected int idCacheSize = DEFAULT_ID_CACHE_SIZE;
protected boolean persistIDCache = DEFAULT_PERSIST_ID_CACHE;
-
+
protected List<String> interceptorClassNames = new ArrayList<String>();
protected Map<String, TransportConfiguration> connectorConfigs = new HashMap<String, TransportConfiguration>();
@@ -182,7 +188,7 @@
// Paging related attributes ------------------------------------------------------------
- protected long pagingMaxGlobalSize = -1;
+ protected long pagingMaxGlobalSize = DEFAULT_PAGE_MAX_GLOBAL_SIZE;
protected long pagingDefaultSize = DEFAULT_PAGE_SIZE;
@@ -228,7 +234,11 @@
protected SimpleString managementAddress = DEFAULT_MANAGEMENT_ADDRESS;
protected SimpleString managementNotificationAddress = DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS;
+
+ protected String managementClusterPassword = DEFAULT_MANAGEMENT_CLUSTER_PASSWORD;
+ protected long managementRequestTimeout = DEFAULT_MANAGEMENT_REQUEST_TIMEOUT;
+
public boolean isClustered()
{
return clustered;
@@ -692,6 +702,25 @@
this.managementNotificationAddress = address;
}
+ public String getManagementClusterPassword()
+ {
+ return managementClusterPassword;
+ }
+
+ public void setManagementClusterPassword(String clusterPassword)
+ {
+ this.managementClusterPassword = clusterPassword;
+ }
+
+ public long getManagementRequestTimeout()
+ {
+ return managementRequestTimeout;
+ }
+
+ public void setManagementRequestTimeout(long managementRequestTimeout)
+ {
+ this.managementRequestTimeout = managementRequestTimeout;
+ }
@Override
public boolean equals(final Object other)
Modified: trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -121,10 +121,12 @@
managementAddress = new SimpleString(getString(e, "management-address", managementAddress.toString()));
- managementNotificationAddress = new SimpleString(getString(e,
- "management-notification-address",
- managementNotificationAddress.toString()));
+ managementNotificationAddress = new SimpleString(getString(e, "management-notification-address", managementNotificationAddress.toString()));
+ managementClusterPassword = getString(e, "management-cluster-password", managementClusterPassword.toString());
+
+ managementRequestTimeout = getLong(e, "management-request-timeout", managementRequestTimeout);
+
NodeList interceptorNodes = e.getElementsByTagName("remoting-interceptors");
ArrayList<String> interceptorList = new ArrayList<String>();
Modified: trunk/src/main/org/jboss/messaging/core/management/ManagementService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/ManagementService.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/management/ManagementService.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -61,8 +61,28 @@
*/
public interface ManagementService extends MessagingComponent
{
+ // Configuration
+
MessageCounterManager getMessageCounterManager();
+ String getClusterPassword();
+
+ void setClusterPassword(String clusterPassword);
+
+ SimpleString getManagementAddress();
+
+ void setManagementAddress(SimpleString managementAddress);
+
+ SimpleString getManagementNotificationAddress();
+
+ void setManagementNotificationAddress(SimpleString managementNotificationAddress);
+
+ long getManagementRequestTimeout();
+
+ void setManagementRequestTimeout(long timeout);
+
+ // Resource Registration
+
MessagingServerControlMBean registerServer(PostOffice postOffice,
StorageManager storageManager,
Configuration configuration,
@@ -111,10 +131,12 @@
void unregisterResource(ObjectName objectName) throws Exception;
- public Object getResource(ObjectName objectName);
+ Object getResource(ObjectName objectName);
void handleMessage(ServerMessage message);
+ // Notfication
+
/**
* the message corresponding to a notification will always contain the properties:
* <ul>
@@ -134,4 +156,5 @@
void addNotificationListener(NotificationListener listener);
void removeNotificationListener(NotificationListener listener);
+
}
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -48,6 +48,7 @@
import org.jboss.messaging.core.config.cluster.BroadcastGroupConfiguration;
import org.jboss.messaging.core.config.cluster.ClusterConnectionConfiguration;
import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.management.AcceptorControlMBean;
import org.jboss.messaging.core.management.BridgeControlMBean;
@@ -118,15 +119,21 @@
private final MessageCounterManager messageCounterManager = new MessageCounterManagerImpl(10000);
- private SimpleString managementNotificationAddress;
+ private SimpleString managementNotificationAddress = ConfigurationImpl.DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS;
+ private SimpleString managementAddress = ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS;
+
+ private String managementClusterPassword = ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD;
+
+ private long managementRequestTimeout = ConfigurationImpl.DEFAULT_MANAGEMENT_REQUEST_TIMEOUT;
+
private boolean started = false;
private boolean noticationsEnabled;
private final Set<NotificationListener> listeners = new ConcurrentHashSet<NotificationListener>();
- // Static --------------------------------------------------------
+ // Constructor ----------------------------------------------------
public ManagementServiceImpl(final MBeanServer mbeanServer, final boolean jmxManagementEnabled)
{
@@ -160,7 +167,6 @@
this.addressSettingsRepository = addressSettingsRepository;
this.securityRepository = securityRepository;
this.storageManager = storageManager;
- this.managementNotificationAddress = configuration.getManagementNotificationAddress();
managedServer = new MessagingServerControl(postOffice,
storageManager,
configuration,
@@ -171,7 +177,11 @@
broadcaster,
queueFactory);
ObjectName objectName = ObjectNames.getMessagingServerObjectName();
- registerInJMX(objectName, new ReplicationAwareMessagingServerControlWrapper(objectName, managedServer));
+ registerInJMX(objectName, new ReplicationAwareMessagingServerControlWrapper(objectName,
+ managedServer,
+ managementClusterPassword,
+ managementAddress,
+ managementRequestTimeout));
registerInRegistry(objectName, managedServer);
return managedServer;
@@ -188,7 +198,11 @@
ObjectName objectName = ObjectNames.getAddressObjectName(address);
AddressControl addressControl = new AddressControl(address, postOffice, securityRepository);
- registerInJMX(objectName, new ReplicationAwareAddressControlWrapper(objectName, addressControl));
+ registerInJMX(objectName, new ReplicationAwareAddressControlWrapper(objectName,
+ addressControl,
+ managementClusterPassword,
+ managementAddress,
+ managementRequestTimeout));
registerInRegistry(objectName, addressControl);
@@ -227,7 +241,11 @@
messageCounterManager.registerMessageCounter(queue.getName().toString(), counter);
ObjectName objectName = ObjectNames.getQueueObjectName(address, queue.getName());
QueueControl queueControl = new QueueControl(queue, storageManager, postOffice, addressSettingsRepository, counter);
- registerInJMX(objectName, new ReplicationAwareQueueControlWrapper(objectName, queueControl));
+ registerInJMX(objectName, new ReplicationAwareQueueControlWrapper(objectName,
+ queueControl,
+ managementClusterPassword,
+ managementAddress,
+ managementRequestTimeout));
registerInRegistry(objectName, queueControl);
if (log.isDebugEnabled())
@@ -409,7 +427,48 @@
{
listeners.remove(listener);
}
+
+ public SimpleString getManagementAddress()
+ {
+ return managementAddress;
+ }
+
+ public void setManagementAddress(SimpleString managementAddress)
+ {
+ this.managementAddress = managementAddress;
+ }
+
+ public SimpleString getManagementNotificationAddress()
+ {
+ return managementNotificationAddress;
+ }
+
+ public void setManagementNotificationAddress(SimpleString managementNotificationAddress)
+ {
+ this.managementNotificationAddress = managementNotificationAddress;
+ }
+ public String getClusterPassword()
+ {
+ return managementClusterPassword;
+ }
+
+ public void setClusterPassword(String clusterPassword)
+ {
+ this.managementClusterPassword = clusterPassword;
+ }
+
+ public long getManagementRequestTimeout()
+ {
+ return managementRequestTimeout;
+ }
+
+ public void setManagementRequestTimeout(long timeout)
+ {
+ this.managementRequestTimeout = timeout;
+ }
+
+
// MessagingComponent implementation -----------------------------
public void start() throws Exception
Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -30,6 +30,7 @@
import org.jboss.messaging.core.management.RoleInfo;
import org.jboss.messaging.core.management.impl.AddressControl;
import org.jboss.messaging.core.management.impl.MBeanInfoHelper;
+import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareAddressControlWrapper
@@ -50,9 +51,13 @@
// Constructors --------------------------------------------------
- public ReplicationAwareAddressControlWrapper(final ObjectName objectName, final AddressControl localAddressControl) throws Exception
+ public ReplicationAwareAddressControlWrapper(final ObjectName objectName,
+ final AddressControl localAddressControl,
+ final String clusterPassword,
+ final SimpleString managementAddress,
+ final long managementRequestTimeout) throws Exception
{
- super(objectName, AddressControlMBean.class);
+ super(objectName, AddressControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
this.localAddressControl = localAddressControl;
}
Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -55,9 +55,12 @@
// Constructors --------------------------------------------------
public ReplicationAwareMessagingServerControlWrapper(final ObjectName objectName,
- final MessagingServerControl localControl) throws Exception
+ final MessagingServerControl localControl,
+ final String clusterPassword,
+ final SimpleString managementAddress,
+ final long managementRequestTimeout) throws Exception
{
- super(objectName, MessagingServerControlMBean.class);
+ super(objectName, MessagingServerControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
this.localControl = localControl;
}
Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareQueueControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareQueueControlWrapper.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareQueueControlWrapper.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -30,6 +30,7 @@
import org.jboss.messaging.core.management.QueueControlMBean;
import org.jboss.messaging.core.management.impl.MBeanInfoHelper;
import org.jboss.messaging.core.management.impl.QueueControl;
+import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareQueueControlWrapper
@@ -50,9 +51,13 @@
// Constructors --------------------------------------------------
- public ReplicationAwareQueueControlWrapper(final ObjectName objectName, final QueueControl localControl) throws Exception
+ public ReplicationAwareQueueControlWrapper(final ObjectName objectName,
+ final QueueControl localControl,
+ final String clusterPassword,
+ final SimpleString managementAddress,
+ final long managementRequestTimeout) throws Exception
{
- super(objectName, QueueControlMBean.class);
+ super(objectName, QueueControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
this.localQueueControl = localControl;
}
Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -22,6 +22,8 @@
package org.jboss.messaging.core.management.jmx.impl;
+import static org.jboss.messaging.core.security.impl.SecurityStoreImpl.CLUSTER_ADMIN_USER;
+
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
import javax.management.StandardMBean;
@@ -32,7 +34,6 @@
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
import org.jboss.messaging.core.client.management.impl.ManagementHelper;
import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
import org.jboss.messaging.util.SimpleString;
@@ -56,19 +57,29 @@
private final ClientSessionFactoryImpl sessionFactory;
- // FIXME moved to configuration
- private final long timeout = 500;
+ private final long timeout;
+
+ private final SimpleString managementAddress;
+ private final String clusterPassword;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- protected ReplicationAwareStandardMBeanWrapper(final ObjectName objectName, final Class mbeanInterface) throws NotCompliantMBeanException
+ protected ReplicationAwareStandardMBeanWrapper(final ObjectName objectName,
+ final Class mbeanInterface,
+ final String clusterPassword,
+ final SimpleString managementAddress,
+ final long managementRequestTimeout) throws NotCompliantMBeanException
{
super(mbeanInterface);
this.objectName = objectName;
this.sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
+ this.clusterPassword = clusterPassword;
+ this.managementAddress = managementAddress;
+ this.timeout = managementRequestTimeout;
}
// Public --------------------------------------------------------
@@ -79,8 +90,8 @@
protected Object replicationAwareInvoke(final String operationName, final Object... parameters) throws Exception
{
- ClientSession clientSession = sessionFactory.createSession(false, true, true);
- ClientRequestor requestor = new ClientRequestor(clientSession, ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS);
+ ClientSession clientSession = sessionFactory.createSession(CLUSTER_ADMIN_USER, clusterPassword, false, true, true, false, 1);
+ ClientRequestor requestor = new ClientRequestor(clientSession, managementAddress);
clientSession.start();
ClientMessage mngmntMessage = clientSession.createClientMessage(false);
Modified: trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/security/SecurityStore.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -45,4 +45,6 @@
void setSecurityRepository(HierarchicalRepository<Set<Role>> securityRepository);
void setSecurityManager(JBMSecurityManager securityManager);
+
+ void setManagementClusterPassword(String clusterAdminPassword);
}
Modified: trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/security/impl/SecurityStoreImpl.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -22,6 +22,8 @@
package org.jboss.messaging.core.security.impl;
+import static org.jboss.messaging.core.config.impl.ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD;
+
import java.util.Set;
import org.jboss.messaging.core.exception.MessagingException;
@@ -58,6 +60,8 @@
private static final Logger log = Logger.getLogger(SecurityStoreImpl.class);
+ public static final String CLUSTER_ADMIN_USER = "JBM.MANAGEMENT.ADMIN.USER";
+
// Static --------------------------------------------------------
// Attributes ----------------------------------------------------
@@ -80,6 +84,8 @@
private final boolean securityEnabled;
+ private String managementClusterPassword;
+
// Constructors --------------------------------------------------
public SecurityStoreImpl(final long invalidationInterval, final boolean securityEnabled)
@@ -93,9 +99,27 @@
public void authenticate(final String user, final String password) throws Exception
{
- if (securityEnabled && !securityManager.validateUser(user, password))
+ if (securityEnabled)
{
- throw new MessagingException(MessagingException.SECURITY_EXCEPTION, "Unable to validate user: " + user);
+ if (CLUSTER_ADMIN_USER.equals(user))
+ {
+ if (trace) { log.trace("Authenticating cluster admin user"); }
+
+ checkDefaultManagementClusterPassword(password);
+
+ // The special user CLUSTER_ADMIN_USER is used for creating sessions that replicate management operation between nodes
+ if (!managementClusterPassword.equals(password))
+ {
+ throw new MessagingException(MessagingException.SECURITY_EXCEPTION, "Unable to validate user: " + user);
+ }
+ }
+ else
+ {
+ if (!securityManager.validateUser(user, password))
+ {
+ throw new MessagingException(MessagingException.SECURITY_EXCEPTION, "Unable to validate user: " + user);
+ }
+ }
}
}
@@ -115,8 +139,16 @@
Set<Role> roles = securityRepository.getMatch(saddress);
- if (!securityManager.validateUserAndRole(session.getUsername(), session.getPassword(), roles, checkType))
+ String user = session.getUsername();
+
+ if (CLUSTER_ADMIN_USER.equals(user))
{
+ // The special user CLUSTER_ADMIN_USER is used for creating sessions that replicate management operation between nodes
+ //It has automatic read/write access to all destinations
+ return;
+ }
+ else if (!securityManager.validateUserAndRole(user, session.getPassword(), roles, checkType))
+ {
throw new MessagingException(MessagingException.SECURITY_EXCEPTION, "Unable to validate user: " + session.getUsername());
}
// if we get here we're granted, add to the cache
@@ -164,6 +196,13 @@
this.securityManager = securityManager;
}
+ public void setManagementClusterPassword(String password)
+ {
+ this.managementClusterPassword = password;
+
+ checkDefaultManagementClusterPassword(password);
+ }
+
// Protected -----------------------------------------------------
// Package Private -----------------------------------------------
@@ -218,6 +257,17 @@
return granted;
}
+
+ private void checkDefaultManagementClusterPassword(String password)
+ {
+ // Sanity check
+ if (DEFAULT_MANAGEMENT_CLUSTER_PASSWORD.equals(password))
+ {
+ log.warn("WARNING! POTENTIAL SECURITY RISK. It has been detected that the cluster admin password which is used to " +
+ "replicate management operation from one node to the other has not had its password changed from the installation default. " +
+ "Please see the JBoss Messaging user guide for instructions on how to do this.");
+ }
+ }
// Inner class ---------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -37,7 +37,6 @@
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
-import static org.jboss.messaging.core.config.impl.ConfigurationImpl.DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS;
import java.nio.ByteBuffer;
import java.util.HashSet;
@@ -56,7 +55,6 @@
import org.jboss.messaging.core.client.impl.ClientSessionInternal;
import org.jboss.messaging.core.client.management.impl.ManagementHelper;
import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.filter.impl.FilterImpl;
@@ -68,6 +66,7 @@
import org.jboss.messaging.core.postoffice.BindingType;
import org.jboss.messaging.core.remoting.FailureListener;
import org.jboss.messaging.core.remoting.RemotingConnection;
+import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
import org.jboss.messaging.core.server.HandleStatus;
import org.jboss.messaging.core.server.MessageReference;
import org.jboss.messaging.core.server.Queue;
@@ -139,6 +138,12 @@
private MessageFlowRecord flowRecord;
+ private final SimpleString managementAddress;
+
+ private final SimpleString managementNotificationAddres;
+
+ private final String clusterPassword;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -157,7 +162,10 @@
final double retryIntervalMultiplier,
final int maxRetriesBeforeFailover,
final int maxRetriesAfterFailover,
- final boolean useDuplicateDetection) throws Exception
+ final boolean useDuplicateDetection,
+ final SimpleString managementAddress,
+ final SimpleString managementNotificationAddress,
+ final String clusterPassword) throws Exception
{
this(name,
queue,
@@ -172,6 +180,9 @@
maxRetriesBeforeFailover,
maxRetriesAfterFailover,
useDuplicateDetection,
+ managementAddress,
+ managementNotificationAddress,
+ clusterPassword,
null);
}
@@ -188,6 +199,9 @@
final int maxRetriesBeforeFailover,
final int maxRetriesAfterFailover,
final boolean useDuplicateDetection,
+ final SimpleString managementAddress,
+ final SimpleString managementNotificationAddress,
+ final String clusterPassword,
final MessageFlowRecord flowRecord) throws Exception
{
this.name = name;
@@ -225,6 +239,12 @@
this.idsHeaderName = MessageImpl.HDR_ROUTE_TO_IDS.concat(name);
+ this.managementAddress = managementAddress;
+
+ this.managementNotificationAddres = managementNotificationAddress;
+
+ this.clusterPassword = clusterPassword;
+
this.flowRecord = flowRecord;
}
@@ -409,7 +429,7 @@
maxRetriesBeforeFailover,
maxRetriesAfterFailover);
- session = (ClientSessionInternal)csf.createSession(null, null, false, true, true, false, 1);
+ session = (ClientSessionInternal)csf.createSession(SecurityStoreImpl.CLUSTER_ADMIN_USER, clusterPassword, false, true, true, false, 1);
if (session == null)
{
@@ -456,7 +476,7 @@
flowRecord.getAddress() +
"%')");
- session.createQueue(DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS, notifQueueName, filter, false, true);
+ session.createQueue(managementNotificationAddres, notifQueueName, filter, false, true);
ClientConsumer notifConsumer = session.createConsumer(notifQueueName);
@@ -472,7 +492,7 @@
notifQueueName.toString(),
flowRecord.getAddress());
- ClientProducer prod = session.createProducer(ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS);
+ ClientProducer prod = session.createProducer(managementAddress);
prod.send(message);
}
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterConnectionImpl.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -349,7 +349,10 @@
retryIntervalMultiplier,
maxRetriesBeforeFailover,
maxRetriesAfterFailover,
- false, // Duplicate detection is handled in the RemoteQueueBindingImpl
+ false, // Duplicate detection is handled in the RemoteQueueBindingImpl,
+ managementService.getManagementAddress(),
+ managementService.getManagementNotificationAddress(),
+ managementService.getClusterPassword(),
record);
record.setBridge(bridge);
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -384,7 +384,10 @@
config.getRetryIntervalMultiplier(),
config.getMaxRetriesBeforeFailover(),
config.getMaxRetriesAfterFailover(),
- config.isUseDuplicateDetection());
+ config.isUseDuplicateDetection(),
+ managementService.getManagementAddress(),
+ managementService.getManagementNotificationAddress(),
+ managementService.getClusterPassword());
bridges.put(config.getName(), bridge);
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -225,6 +225,7 @@
securityStore = new SecurityStoreImpl(configuration.getSecurityInvalidationInterval(),
configuration.isSecurityEnabled());
+ securityStore.setManagementClusterPassword(configuration.getManagementClusterPassword());
addressSettingsRepository.setDefault(new AddressSettings());
scheduledExecutor = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(),
new JBMThreadFactory("JBM-scheduled-threads"));
@@ -255,6 +256,11 @@
pagingManager.start();
+ managementService.setManagementAddress(configuration.getManagementAddress());
+ managementService.setManagementNotificationAddress(configuration.getManagementNotificationAddress());
+ managementService.setClusterPassword(configuration.getManagementClusterPassword());
+ managementService.setManagementRequestTimeout(configuration.getManagementRequestTimeout());
+
serverManagement = managementService.registerServer(postOffice,
storageManager,
configuration,
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -76,7 +76,11 @@
ObjectName objectName = ObjectNames.getJMSServerObjectName();
JMSServerControl control = new JMSServerControl(server);
managementService.registerInJMX(objectName,
- new ReplicationAwareJMSServerControlWrapper(objectName, control));
+ new ReplicationAwareJMSServerControlWrapper(objectName,
+ control,
+ managementService.getClusterPassword(),
+ managementService.getManagementAddress(),
+ managementService.getManagementRequestTimeout()));
managementService.registerInRegistry(objectName, control);
}
@@ -109,7 +113,11 @@
addressSettingsRepository,
counter);
managementService.registerInJMX(objectName,
- new ReplicationAwareJMSQueueControlWrapper(objectName, control));
+ new ReplicationAwareJMSQueueControlWrapper(objectName,
+ control,
+ managementService.getClusterPassword(),
+ managementService.getManagementAddress(),
+ managementService.getManagementRequestTimeout()));
managementService.registerInRegistry(objectName, control);
}
@@ -127,7 +135,11 @@
{
ObjectName objectName = ObjectNames.getJMSTopicObjectName(topic.getTopicName());
TopicControl control = new TopicControl(topic, jndiBinding, postOffice);
- managementService.registerInJMX(objectName, new ReplicationAwareTopicControlWrapper(objectName, control));
+ managementService.registerInJMX(objectName, new ReplicationAwareTopicControlWrapper(objectName,
+ control,
+ managementService.getClusterPassword(),
+ managementService.getManagementAddress(),
+ managementService.getManagementRequestTimeout()));
managementService.registerInRegistry(objectName, control);
}
@@ -144,7 +156,11 @@
ObjectName objectName = ObjectNames.getConnectionFactoryObjectName(name);
ConnectionFactoryControl control = new ConnectionFactoryControl(connectionFactory, name, bindings);
managementService.registerInJMX(objectName,
- new ReplicationAwareConnectionFactoryControlWrapper(objectName, control));
+ new ReplicationAwareConnectionFactoryControlWrapper(objectName,
+ control,
+ managementService.getClusterPassword(),
+ managementService.getManagementAddress(),
+ managementService.getManagementRequestTimeout()));
managementService.registerInRegistry(objectName, control);
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -31,6 +31,7 @@
import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareStandardMBeanWrapper;
import org.jboss.messaging.jms.server.management.ConnectionFactoryControlMBean;
import org.jboss.messaging.jms.server.management.impl.ConnectionFactoryControl;
+import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareConnectionFactoryControlWrapper
@@ -51,9 +52,13 @@
// Constructors --------------------------------------------------
- public ReplicationAwareConnectionFactoryControlWrapper(final ObjectName objectName, final ConnectionFactoryControl localControl) throws Exception
+ public ReplicationAwareConnectionFactoryControlWrapper(final ObjectName objectName,
+ final ConnectionFactoryControl localControl,
+ final String clusterPassword,
+ final SimpleString managementAddress,
+ final long managementRequestTimeout) throws Exception
{
- super(objectName, ConnectionFactoryControlMBean.class);
+ super(objectName, ConnectionFactoryControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
this.localControl = localControl;
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSQueueControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSQueueControlWrapper.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSQueueControlWrapper.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -31,6 +31,7 @@
import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareStandardMBeanWrapper;
import org.jboss.messaging.jms.server.management.JMSQueueControlMBean;
import org.jboss.messaging.jms.server.management.impl.JMSQueueControl;
+import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareJMSQueueControlWrapper
@@ -51,9 +52,13 @@
// Constructors --------------------------------------------------
- public ReplicationAwareJMSQueueControlWrapper(final ObjectName objectName, final JMSQueueControl localControl) throws Exception
+ public ReplicationAwareJMSQueueControlWrapper(final ObjectName objectName,
+ final JMSQueueControl localControl,
+ final String clusterPassword,
+ final SimpleString managementAddress,
+ final long managementRequestTimeout) throws Exception
{
- super(objectName, JMSQueueControlMBean.class);
+ super(objectName, JMSQueueControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
this.localControl = localControl;
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -33,6 +33,7 @@
import org.jboss.messaging.jms.server.management.JMSServerControlMBean;
import org.jboss.messaging.jms.server.management.impl.JMSServerControl;
import org.jboss.messaging.util.Pair;
+import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareJMSServerControlWrapper
@@ -53,9 +54,13 @@
// Constructors --------------------------------------------------
- public ReplicationAwareJMSServerControlWrapper(final ObjectName objectName, final JMSServerControl localControl) throws Exception
+ public ReplicationAwareJMSServerControlWrapper(final ObjectName objectName,
+ final JMSServerControl localControl,
+ final String clusterPassword,
+ final SimpleString managementAddress,
+ final long managementRequestTimeout) throws Exception
{
- super(objectName, JMSServerControlMBean.class);
+ super(objectName, JMSServerControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
this.localControl = localControl;
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareTopicControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareTopicControlWrapper.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareTopicControlWrapper.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -31,6 +31,7 @@
import org.jboss.messaging.jms.server.management.SubscriptionInfo;
import org.jboss.messaging.jms.server.management.TopicControlMBean;
import org.jboss.messaging.jms.server.management.impl.TopicControl;
+import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareTopicControlWrapper
@@ -51,9 +52,13 @@
// Constructors --------------------------------------------------
- public ReplicationAwareTopicControlWrapper(final ObjectName objectName, final TopicControl localControl) throws Exception
+ public ReplicationAwareTopicControlWrapper(final ObjectName objectName,
+ final TopicControl localControl,
+ final String clusterPassword,
+ final SimpleString managementAddress,
+ final long managementRequestTimeout) throws Exception
{
- super(objectName, TopicControlMBean.class);
+ super(objectName, TopicControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
this.localControl = localControl;
}
Modified: trunk/src/schemas/jbm-configuration.xsd
===================================================================
--- trunk/src/schemas/jbm-configuration.xsd 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/src/schemas/jbm-configuration.xsd 2009-02-13 11:59:51 UTC (rev 5859)
@@ -51,6 +51,12 @@
<xsd:element name="management-notification-address"
type="xsd:string" maxOccurs="1" minOccurs="0">
</xsd:element>
+ <xsd:element name="management-cluster-password"
+ type="xsd:string" maxOccurs="1" minOccurs="0">
+ </xsd:element>
+ <xsd:element name="management-request-timeout"
+ type="xsd:long" maxOccurs="1" minOccurs="0">
+ </xsd:element>
<xsd:element name="jmx-management-enabled"
type="xsd:boolean" maxOccurs="1" minOccurs="0">
</xsd:element>
Modified: trunk/tests/config/ConfigurationTest-config.xml
===================================================================
--- trunk/tests/config/ConfigurationTest-config.xml 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/tests/config/ConfigurationTest-config.xml 2009-02-13 11:59:51 UTC (rev 5859)
@@ -7,6 +7,7 @@
<security-invalidation-interval>5423</security-invalidation-interval>
<wild-card-routing-enabled>true</wild-card-routing-enabled>
<management-address>Giraffe</management-address>
+ <management-request-timeout>91</management-request-timeout>
<connection-scan-period>6543</connection-scan-period>
<transaction-timeout>98765</transaction-timeout>
<transaction-timeout-scan-period>56789</transaction-timeout-scan-period>
Deleted: trunk/tests/config/ConfigurationTest-config2.xml
===================================================================
--- trunk/tests/config/ConfigurationTest-config2.xml 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/tests/config/ConfigurationTest-config2.xml 2009-02-13 11:59:51 UTC (rev 5859)
@@ -1,9 +0,0 @@
-<deployment xmlns="urn:jboss:messaging" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:messaging ../../src/schemas/jbm-configuration.xsd ">
- <configuration>
- <!-- just use all the defaults -->
- <!-- we must declare at least one acceptor to have a valid configuration -->
- <acceptor>
- <factory-class>org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
- </acceptor>
- </configuration>
-</deployment>
\ No newline at end of file
Copied: trunk/tests/config/ConfigurationTest-defaults.xml (from rev 5804, trunk/tests/config/ConfigurationTest-config2.xml)
===================================================================
--- trunk/tests/config/ConfigurationTest-defaults.xml (rev 0)
+++ trunk/tests/config/ConfigurationTest-defaults.xml 2009-02-13 11:59:51 UTC (rev 5859)
@@ -0,0 +1,9 @@
+<deployment xmlns="urn:jboss:messaging" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:messaging ../../src/schemas/jbm-configuration.xsd ">
+ <configuration>
+ <!-- just use all the defaults -->
+ <!-- we must declare at least one acceptor to have a valid configuration -->
+ <acceptor>
+ <factory-class>org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
+ </acceptor>
+ </configuration>
+</deployment>
\ No newline at end of file
Property changes on: trunk/tests/config/ConfigurationTest-defaults.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTest.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTest.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -1,168 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.tests.integration.management;
-
-import static org.jboss.messaging.core.config.impl.ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.jboss.messaging.core.client.ClientMessage;
-import org.jboss.messaging.core.client.ClientRequestor;
-import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
-import org.jboss.messaging.core.client.management.impl.ManagementHelper;
-import org.jboss.messaging.core.config.Configuration;
-import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.management.ObjectNames;
-import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
-import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
-import org.jboss.messaging.core.security.Role;
-import org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl;
-import org.jboss.messaging.core.server.Messaging;
-import org.jboss.messaging.core.server.MessagingService;
-import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.util.SimpleString;
-
-/**
- * A SecurityManagementTest
- *
- * @author jmesnil
- *
- * Created 6 feb 2009 11:04:21
- *
- *
- */
-public class SecurityManagementTest extends TestCase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private MessagingService service;
-
- private final String validAdminUser = "validAdminUser";
-
- private final String validAdminPassword = "validAdminPassword";
-
- private final String invalidAdminUser = "invalidAdminUser";
-
- private final String invalidAdminPassword = "invalidAdminPassword";
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testSendManagementMessageWithAdminRole() throws Exception
- {
- doSendManagementMessage(validAdminUser, validAdminPassword, true);
- }
-
- public void testSendManagementMessageWithoutAdminRole() throws Exception
- {
- doSendManagementMessage(invalidAdminUser, invalidAdminPassword, false);
- }
-
- public void testSendManagementMessageWithoutUserCredentials() throws Exception
- {
- doSendManagementMessage(null, null, false);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- @Override
- protected void setUp() throws Exception
- {
- Configuration conf = new ConfigurationImpl();
- conf.setSecurityEnabled(true);
- conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
- service = Messaging.newNullStorageMessagingService(conf);
- service.start();
- HierarchicalRepository<Set<Role>> securityRepository = service.getServer().getSecurityRepository();
- JBMSecurityManagerImpl securityManager = (JBMSecurityManagerImpl)service.getServer().getSecurityManager();
- securityManager.addUser(validAdminUser, validAdminPassword);
- securityManager.addUser(invalidAdminUser, invalidAdminPassword);
- securityManager.addRole(validAdminUser, "admin");
- securityManager.addRole(validAdminUser, "guest");
- securityManager.addRole(invalidAdminUser, "guest");
-
- Set<Role> adminRole = new HashSet<Role>();
- adminRole.add(new Role("admin", true, true, false));
- securityRepository.addMatch(DEFAULT_MANAGEMENT_ADDRESS.toString(), adminRole);
- Set<Role> guestRole = new HashSet<Role>();
- guestRole.add(new Role("guest", true, true, true));
- securityRepository.addMatch("*", guestRole);
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- service.stop();
-
- super.tearDown();
- }
-
- // Private -------------------------------------------------------
-
- public void doSendManagementMessage(String user, String password, boolean expectReply) throws Exception
- {
- ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
- ClientSession session = null;
- if (user == null)
- {
- session = sf.createSession(false, true, true);
- }
- else
- {
- session = sf.createSession(user, password, false, true, true, false, 1);
- }
- session.start();
-
- ClientRequestor requestor = new ClientRequestor(session, DEFAULT_MANAGEMENT_ADDRESS);
-
- ClientMessage mngmntMessage = session.createClientMessage(false);
- ManagementHelper.putAttributes(mngmntMessage, ObjectNames.getMessagingServerObjectName(), "Started");
- ClientMessage reply = requestor.request(mngmntMessage, 500);
- if (expectReply)
- {
- assertNotNull(reply);
- assertTrue((Boolean)reply.getProperty(new SimpleString("Started")));
- }
- else
- {
- assertNull(reply);
- }
- }
-
- // Inner classes -------------------------------------------------
-
-}
Copied: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java (from rev 5838, trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTest.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.management;
+
+import static org.jboss.messaging.core.config.impl.ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS;
+import junit.framework.TestCase;
+
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientRequestor;
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
+import org.jboss.messaging.core.client.management.impl.ManagementHelper;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * A SecurityManagementTest
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public abstract class SecurityManagementTestBase extends TestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private MessagingService service;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ service = setupAndStartMessagingService();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ service.stop();
+
+ super.tearDown();
+ }
+
+ protected abstract MessagingService setupAndStartMessagingService() throws Exception;
+
+ protected void doSendManagementMessage(String user, String password, boolean expectSuccess) throws Exception
+ {
+ ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
+ try {
+ ClientSession session = null;
+ if (user == null)
+ {
+ session = sf.createSession(false, true, true);
+ }
+ else
+ {
+ session = sf.createSession(user, password, false, true, true, false, 1);
+ }
+
+ session.start();
+
+ ClientRequestor requestor = new ClientRequestor(session, DEFAULT_MANAGEMENT_ADDRESS);
+
+ ClientMessage mngmntMessage = session.createClientMessage(false);
+ ManagementHelper.putAttributes(mngmntMessage, ObjectNames.getMessagingServerObjectName(), "Started");
+ ClientMessage reply = requestor.request(mngmntMessage, 500);
+ if (expectSuccess)
+ {
+ assertNotNull(reply);
+ assertTrue((Boolean)reply.getProperty(new SimpleString("Started")));
+ }
+ else
+ {
+ assertNull(reply);
+ }
+
+ requestor.close();
+ } catch (Exception e)
+ {
+ if (expectSuccess)
+ {
+ fail("got unexpected exception " + e.getClass() + ": " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Property changes on: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementTestBase.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithConfiguredAdminUserTest.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.management;
+
+import static org.jboss.messaging.core.config.impl.ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.jboss.messaging.core.security.Role;
+import org.jboss.messaging.core.security.impl.JBMSecurityManagerImpl;
+import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
+import org.jboss.messaging.core.server.Messaging;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.settings.HierarchicalRepository;
+
+/**
+ * A SecurityManagementTest
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class SecurityManagementWithConfiguredAdminUserTest extends SecurityManagementTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final String validAdminUser = "validAdminUser";
+
+ private final String validAdminPassword = "validAdminPassword";
+
+ private final String invalidAdminUser = "invalidAdminUser";
+
+ private final String invalidAdminPassword = "invalidAdminPassword";
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ /**
+ * default CLUSTER_ADMIN_USER must work even when there are other
+ * configured admin users
+ */
+ public void testSendManagementMessageWithClusterAdminUser() throws Exception
+ {
+ doSendManagementMessage(SecurityStoreImpl.CLUSTER_ADMIN_USER,
+ ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD, true);
+ }
+
+ public void testSendManagementMessageWithAdminRole() throws Exception
+ {
+ doSendManagementMessage(validAdminUser, validAdminPassword, true);
+ }
+
+ public void testSendManagementMessageWithoutAdminRole() throws Exception
+ {
+ doSendManagementMessage(invalidAdminUser, invalidAdminPassword, false);
+ }
+
+ public void testSendManagementMessageWithoutUserCredentials() throws Exception
+ {
+ doSendManagementMessage(null, null, false);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected MessagingService setupAndStartMessagingService() throws Exception
+ {
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(true);
+ conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+ MessagingService service = Messaging.newNullStorageMessagingService(conf);
+ service.start();
+ HierarchicalRepository<Set<Role>> securityRepository = service.getServer().getSecurityRepository();
+ JBMSecurityManagerImpl securityManager = (JBMSecurityManagerImpl)service.getServer().getSecurityManager();
+ securityManager.addUser(validAdminUser, validAdminPassword);
+ securityManager.addUser(invalidAdminUser, invalidAdminPassword);
+ securityManager.addRole(validAdminUser, "admin");
+ securityManager.addRole(validAdminUser, "guest");
+ securityManager.addRole(invalidAdminUser, "guest");
+
+ Set<Role> adminRole = new HashSet<Role>();
+ adminRole.add(new Role("admin", true, true, false));
+ securityRepository.addMatch(DEFAULT_MANAGEMENT_ADDRESS.toString(), adminRole);
+ Set<Role> guestRole = new HashSet<Role>();
+ guestRole.add(new Role("guest", true, true, true));
+ securityRepository.addMatch("*", guestRole);
+
+ return service;
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithDefaultConfigurationTest.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.management;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
+import org.jboss.messaging.core.server.Messaging;
+import org.jboss.messaging.core.server.MessagingService;
+
+/**
+ * A SecurityManagementTest
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class SecurityManagementWithDefaultConfigurationTest extends SecurityManagementTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testSendManagementMessageWithDefaultClusterAdminUser() throws Exception
+ {
+ doSendManagementMessage(SecurityStoreImpl.CLUSTER_ADMIN_USER,
+ ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD, true);
+ }
+
+ public void testSendManagementMessageWithGuest() throws Exception
+ {
+ doSendManagementMessage("guest", "guest", false);
+ }
+
+ public void testSendManagementMessageWithoutUserCredentials() throws Exception
+ {
+ doSendManagementMessage(null, null, false);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected MessagingService setupAndStartMessagingService() throws Exception
+ {
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(true);
+ conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+ MessagingService service = Messaging.newNullStorageMessagingService(conf);
+ service.start();
+
+ return service;
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/SecurityManagementWithModifiedConfigurationTest.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration.management;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.jboss.messaging.core.security.impl.SecurityStoreImpl;
+import org.jboss.messaging.core.server.Messaging;
+import org.jboss.messaging.core.server.MessagingService;
+
+/**
+ * A SecurityManagementTest
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class SecurityManagementWithModifiedConfigurationTest extends SecurityManagementTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private String configuredClusterPassword = "this is not the default password";
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testSendManagementMessageWithModifiedClusterAdminUser() throws Exception
+ {
+ doSendManagementMessage(SecurityStoreImpl.CLUSTER_ADMIN_USER,
+ configuredClusterPassword, true);
+ }
+
+ public void testSendManagementMessageWithDefaultClusterAdminUser() throws Exception
+ {
+ doSendManagementMessage(SecurityStoreImpl.CLUSTER_ADMIN_USER,
+ ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD, false);
+ }
+
+ public void testSendManagementMessageWithGuest() throws Exception
+ {
+ doSendManagementMessage("guest", "guest", false);
+ }
+
+ public void testSendManagementMessageWithoutUserCredentials() throws Exception
+ {
+ doSendManagementMessage(null, null, false);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected MessagingService setupAndStartMessagingService() throws Exception
+ {
+ ConfigurationImpl conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(true);
+ conf.setManagementClusterPassword(configuredClusterPassword);
+ conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+ MessagingService service = Messaging.newNullStorageMessagingService(conf);
+ service.start();
+
+ return service;
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Copied: trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java (from rev 5804, trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest2.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.unit.core.config.impl;
+
+import static java.util.Collections.emptyList;
+import static java.util.Collections.emptyMap;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.config.impl.FileConfiguration;
+
+/**
+ *
+ * A DefaultsFileConfigurationTest
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class DefaultsFileConfigurationTest extends ConfigurationImplTest
+{
+ public void testDefaults()
+ {
+
+ assertEquals(ConfigurationImpl.DEFAULT_CLUSTERED, conf.isClustered());
+
+ assertEquals(ConfigurationImpl.DEFAULT_BACKUP, conf.isBackup());
+
+ assertEquals(ConfigurationImpl.DEFAULT_QUEUE_ACTIVATION_TIMEOUT, conf.getQueueActivationTimeout());
+
+ assertEquals(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, conf.getScheduledThreadPoolMaxSize());
+
+ assertEquals(ConfigurationImpl.DEFAULT_SECURITY_INVALIDATION_INTERVAL, conf.getSecurityInvalidationInterval());
+
+ assertEquals(ConfigurationImpl.DEFAULT_SECURITY_ENABLED, conf.isSecurityEnabled());
+
+ assertEquals(ConfigurationImpl.DEFAULT_REQUIRE_DESTINATIONS, conf.isRequireDestinations());
+
+ assertEquals(ConfigurationImpl.DEFAULT_JMX_MANAGEMENT_ENABLED, conf.isJMXManagementEnabled());
+
+ assertEquals(0, conf.getInterceptorClassNames().size());
+
+ assertEquals(ConfigurationImpl.DEFAULT_CONNECTION_SCAN_PERIOD, conf.getConnectionScanPeriod());
+
+ assertEquals(ConfigurationImpl.DEFAULT_CONNECTION_TTL_OVERRIDE, conf.getConnectionTTLOverride());
+
+ // there must be at least 1 acceptor for the configuration to be valid
+ assertEquals(1, conf.getAcceptorConfigurations().size());
+
+ assertEquals(emptyMap(), conf.getConnectorConfigurations());
+
+ assertEquals(null, conf.getBackupConnectorName());
+
+ assertEquals(emptyList(), conf.getBroadcastGroupConfigurations());
+
+ assertEquals(emptyMap(), conf.getDiscoveryGroupConfigurations());
+
+ assertEquals(emptyList(), conf.getBridgeConfigurations());
+
+ assertEquals(emptyList(), conf.getDivertConfigurations());
+
+ assertEquals(emptyList(), conf.getClusterConfigurations());
+
+ assertEquals(emptyList(), conf.getQueueConfigurations());
+
+ assertEquals(ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS, conf.getManagementAddress());
+
+ assertEquals(ConfigurationImpl.DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS, conf.getManagementNotificationAddress());
+
+ assertEquals(ConfigurationImpl.DEFAULT_MANAGEMENT_CLUSTER_PASSWORD, conf.getManagementClusterPassword());
+
+ assertEquals(ConfigurationImpl.DEFAULT_MANAGEMENT_REQUEST_TIMEOUT, conf.getManagementRequestTimeout());
+
+ assertEquals(ConfigurationImpl.DEFAULT_ID_CACHE_SIZE, conf.getIDCacheSize());
+
+ assertEquals(ConfigurationImpl.DEFAULT_PERSIST_ID_CACHE, conf.isPersistIDCache());
+
+ assertEquals(ConfigurationImpl.DEFAULT_BINDINGS_DIRECTORY, conf.getBindingsDirectory());
+
+ assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_DIR, conf.getJournalDirectory());
+
+ assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_TYPE, conf.getJournalType());
+
+ assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_SYNC_TRANSACTIONAL, conf.isJournalSyncTransactional());
+
+ assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_SYNC_NON_TRANSACTIONAL, conf.isJournalSyncNonTransactional());
+
+ assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_FILE_SIZE, conf.getJournalFileSize());
+
+ assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_MIN_FILES, conf.getJournalMinFiles());
+
+ assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_MAX_AIO, conf.getJournalMaxAIO());
+
+ assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_REUSE_BUFFER_SIZE, conf.getJournalBufferReuseSize());
+
+ assertEquals(ConfigurationImpl.DEFAULT_CREATE_BINDINGS_DIR, conf.isCreateBindingsDir());
+
+ assertEquals(ConfigurationImpl.DEFAULT_CREATE_JOURNAL_DIR, conf.isCreateJournalDir());
+
+ assertEquals(ConfigurationImpl.DEFAULT_PAGE_MAX_THREADS, conf.getPagingMaxThreads());
+
+ assertEquals(ConfigurationImpl.DEFAULT_PAGING_DIR, conf.getPagingDirectory());
+
+ assertEquals(ConfigurationImpl.DEFAULT_PAGE_MAX_GLOBAL_SIZE, conf.getPagingMaxGlobalSizeBytes());
+
+ assertEquals(ConfigurationImpl.DEFAULT_PAGE_SIZE, conf.getPagingDefaultSize());
+
+ assertEquals(ConfigurationImpl.DEFAULT_LARGE_MESSAGES_DIR, conf.getLargeMessagesDirectory());
+
+ assertEquals(ConfigurationImpl.DEFAULT_WILDCARD_ROUTING_ENABLED, conf.isWildcardRoutingEnabled());
+
+ assertEquals(ConfigurationImpl.DEFAULT_TRANSACTION_TIMEOUT, conf.getTransactionTimeout());
+
+ assertEquals(ConfigurationImpl.DEFAULT_MESSAGE_COUNTER_ENABLED, conf.isMessageCounterEnabled());
+
+ assertEquals(ConfigurationImpl.DEFAULT_TRANSACTION_TIMEOUT_SCAN_PERIOD, conf.getTransactionTimeoutScanPeriod());
+
+ assertEquals(ConfigurationImpl.DEFAULT_MESSAGE_EXPIRY_SCAN_PERIOD, conf.getMessageExpiryScanPeriod());
+
+ assertEquals(ConfigurationImpl.DEFAULT_MESSAGE_EXPIRY_THREAD_PRIORITY, conf.getMessageExpiryThreadPriority());
+ }
+
+ // Protected ---------------------------------------------------------------------------------------------
+
+ protected Configuration createConfiguration() throws Exception
+ {
+ FileConfiguration fc = new FileConfiguration();
+
+ fc.setConfigurationUrl("ConfigurationTest-defaults.xml");
+
+ fc.start();
+
+ return fc;
+ }
+
+}
+
Property changes on: trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -59,6 +59,7 @@
assertEquals(10111213, conf.getMessageExpiryScanPeriod());
assertEquals(8, conf.getMessageExpiryThreadPriority());
assertEquals(new SimpleString("Giraffe"), conf.getManagementAddress());
+ assertEquals(91, conf.getManagementRequestTimeout());
assertEquals(2, conf.getInterceptorClassNames().size());
assertTrue(conf.getInterceptorClassNames().contains("org.jboss.messaging.tests.unit.core.config.impl.TestInterceptor1"));
assertTrue(conf.getInterceptorClassNames().contains("org.jboss.messaging.tests.unit.core.config.impl.TestInterceptor2"));
Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest2.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest2.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/FileConfigurationTest2.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.tests.unit.core.config.impl;
-
-import org.jboss.messaging.core.config.Configuration;
-import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.config.impl.FileConfiguration;
-
-/**
- *
- * A FileConfigurationTest2
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class FileConfigurationTest2 extends ConfigurationImplTest
-{
- public void testDefaults()
- {
- assertEquals(ConfigurationImpl.DEFAULT_CLUSTERED, conf.isClustered());
- assertEquals(ConfigurationImpl.DEFAULT_BACKUP, conf.isBackup());
- assertEquals(ConfigurationImpl.DEFAULT_QUEUE_ACTIVATION_TIMEOUT, conf.getQueueActivationTimeout());
- assertEquals(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, conf.getScheduledThreadPoolMaxSize());
- assertEquals(ConfigurationImpl.DEFAULT_SECURITY_INVALIDATION_INTERVAL, conf.getSecurityInvalidationInterval());
- assertEquals(ConfigurationImpl.DEFAULT_REQUIRE_DESTINATIONS, conf.isRequireDestinations());
- assertEquals(ConfigurationImpl.DEFAULT_SECURITY_ENABLED, conf.isSecurityEnabled());
- assertEquals(ConfigurationImpl.DEFAULT_CONNECTION_SCAN_PERIOD, conf.getConnectionScanPeriod());
- assertEquals(ConfigurationImpl.DEFAULT_BINDINGS_DIRECTORY, conf.getBindingsDirectory());
- assertEquals(ConfigurationImpl.DEFAULT_CREATE_BINDINGS_DIR, conf.isCreateBindingsDir());
- assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_DIR, conf.getJournalDirectory());
- assertEquals(ConfigurationImpl.DEFAULT_CREATE_JOURNAL_DIR, conf.isCreateJournalDir());
- assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_TYPE.toString(), conf.getJournalType().toString());
- assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_SYNC_TRANSACTIONAL, conf.isJournalSyncTransactional());
- assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_SYNC_NON_TRANSACTIONAL, conf.isJournalSyncNonTransactional());
- assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_FILE_SIZE, conf.getJournalFileSize());
- assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_MIN_FILES, conf.getJournalMinFiles());
- assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_MAX_AIO, conf.getJournalMaxAIO());
-
- assertEquals(0, conf.getInterceptorClassNames().size());
- assertEquals(0, conf.getAcceptorConfigurations().size());
- }
-
- // Protected ---------------------------------------------------------------------------------------------
-
- protected Configuration createConfiguration() throws Exception
- {
- FileConfiguration fc = new FileConfiguration();
-
- fc.setConfigurationUrl("ConfigurationTest-config2.xml");
-
- fc.start();
-
- return fc;
- }
-
-}
-
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java 2009-02-13 04:23:14 UTC (rev 5858)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java 2009-02-13 11:59:51 UTC (rev 5859)
@@ -28,6 +28,8 @@
import static org.easymock.classextension.EasyMock.replay;
import static org.easymock.classextension.EasyMock.verify;
import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveInt;
+import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveLong;
+import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
import static org.jboss.messaging.tests.util.RandomUtil.randomString;
import java.util.ArrayList;
@@ -57,6 +59,7 @@
import org.jboss.messaging.jms.server.management.impl.JMSManagementServiceImpl;
import org.jboss.messaging.jms.server.management.impl.JMSQueueControl;
import org.jboss.messaging.jms.server.management.impl.TopicControl;
+import org.jboss.messaging.tests.util.RandomUtil;
/*
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
@@ -82,6 +85,9 @@
JMSServerManager server = createMock(JMSServerManager.class);
ManagementService managementService = createMock(ManagementService.class);
+ expect(managementService.getClusterPassword()).andReturn(randomString());
+ expect(managementService.getManagementAddress()).andReturn(randomSimpleString());
+ expect(managementService.getManagementRequestTimeout()).andReturn(randomPositiveLong());
managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
managementService.registerInRegistry(eq(objectName), isA(JMSServerControlMBean.class));
replay(managementService, server);
@@ -109,6 +115,9 @@
MessageCounterManager messageCounterManager = createMock(MessageCounterManager.class);
expect(managementService.getMessageCounterManager()).andReturn(messageCounterManager );
expect(messageCounterManager.getMaxDayCount()).andReturn(randomPositiveInt());
+ expect(managementService.getClusterPassword()).andReturn(randomString());
+ expect(managementService.getManagementAddress()).andReturn(randomSimpleString());
+ expect(managementService.getManagementRequestTimeout()).andReturn(randomPositiveLong());
messageCounterManager.registerMessageCounter(eq(name), isA(MessageCounter.class));
managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
managementService.registerInRegistry(eq(objectName), isA(JMSQueueControl.class));
@@ -133,6 +142,9 @@
HierarchicalRepository<AddressSettings> addressSettingsRepository = createMock(HierarchicalRepository.class);
ManagementService managementService = createMock(ManagementService.class);
+ expect(managementService.getClusterPassword()).andReturn(randomString());
+ expect(managementService.getManagementAddress()).andReturn(randomSimpleString());
+ expect(managementService.getManagementRequestTimeout()).andReturn(randomPositiveLong());
managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
managementService.registerInRegistry(eq(objectName), isA(TopicControl.class));
@@ -155,6 +167,9 @@
JBossConnectionFactory connectionFactory = createMock(JBossConnectionFactory.class);
ManagementService managementService = createMock(ManagementService.class);
+ expect(managementService.getClusterPassword()).andReturn(randomString());
+ expect(managementService.getManagementAddress()).andReturn(randomSimpleString());
+ expect(managementService.getManagementRequestTimeout()).andReturn(randomPositiveLong());
managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
managementService.registerInRegistry(eq(objectName), isA(ConnectionFactoryControl.class));
More information about the jboss-cvs-commits
mailing list