ServiceDeploymentDescriptor mdd =
new ServiceDeploymentDescriptor(mainConfigFileURL);
ServiceDeploymentDescriptor pdd =
new ServiceDeploymentDescriptor(persistenceConfigFileURL);
MBeanConfigurationElement persistenceManagerConfig =
(MBeanConfigurationElement)pdd.query("service", "PersistenceManager").iterator().next();
persistenceManagerObjectName = sc.registerAndConfigureService(persistenceManagerConfig);
overrideAttributes(persistenceManagerObjectName, attrOverrides);
sc.invoke(persistenceManagerObjectName, "create", new Object[0], new String[0]);
sc.invoke(persistenceManagerObjectName, "start", new Object[0], new String[0]);
MBeanConfigurationElement jmsUserManagerConfig =
(MBeanConfigurationElement)pdd.query("service", "JMSUserManager").iterator().next();
jmsUserManagerObjectName = sc.registerAndConfigureService(jmsUserManagerConfig);
overrideAttributes(jmsUserManagerObjectName, attrOverrides);
sc.invoke(jmsUserManagerObjectName, "create", new Object[0], new String[0]);
sc.invoke(jmsUserManagerObjectName, "start", new Object[0], new String[0]);
// register server peer as a service, dependencies are injected automatically
MBeanConfigurationElement serverPeerConfig =
(MBeanConfigurationElement)mdd.query("service", "ServerPeer").iterator().next();
// overwrite the file configuration, if needed
serverPeerConfig.setConstructorArgumentValue(0, 0, String.valueOf(serverPeerID));
if (defaultQueueJNDIContext != null)
{
serverPeerConfig.setConstructorArgumentValue(0, 1, defaultQueueJNDIContext);
}
if (defaultTopicJNDIContext != null)
{
serverPeerConfig.setConstructorArgumentValue(0, 2, defaultTopicJNDIContext);
}
serverPeerObjectName = sc.registerAndConfigureService(serverPeerConfig);
overrideAttributes(serverPeerObjectName, attrOverrides);
// overwrite the config file security domain
sc.setAttribute(serverPeerObjectName, "SecurityDomain",
MockJBossSecurityManager.TEST_SECURITY_DOMAIN);
log.debug("starting JMS server");
sc.invoke(serverPeerObjectName, "create", new Object[0], new String[0]);
sc.invoke(serverPeerObjectName, "start", new Object[0], new String[0]);
MBeanConfigurationElement postOfficeConfig =
(MBeanConfigurationElement)pdd.query("service", "PostOffice").iterator().next();
postOfficeObjectName = sc.registerAndConfigureService(postOfficeConfig);
overrideAttributes(postOfficeObjectName, attrOverrides);
sc.invoke(postOfficeObjectName, "create", new Object[0], new String[0]);