// Constructors --------------------------------------------------
public void testSetupJMSConfiguration() throws Exception
{
Context context = new InVMContext();
Configuration coreConfiguration = createDefaultConfig(false);
HornetQServer coreServer = new HornetQServerImpl(coreConfiguration);
JMSConfiguration jmsConfiguration = new JMSConfigurationImpl();
jmsConfiguration.setContext(context);
TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName());
ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl(RandomUtil.randomString(),
connectorConfig,
"/cf/binding1",
"/cf/binding2");
jmsConfiguration.getConnectionFactoryConfigurations().add(cfConfig);
JMSQueueConfigurationImpl queueConfig = new JMSQueueConfigurationImpl(RandomUtil.randomString(),
null,
false,
"/queue/binding1",
"/queue/binding2");
jmsConfiguration.getQueueConfigurations().add(queueConfig);
TopicConfiguration topicConfig = new TopicConfigurationImpl(RandomUtil.randomString(),
"/topic/binding1",
"/topic/binding2");
jmsConfiguration.getTopicConfigurations().add(topicConfig);
JMSServerManager server = new JMSServerManagerImpl(coreServer, jmsConfiguration);
server.start();
for (String binding : cfConfig.getBindings())
{
Object o = context.lookup(binding);
Assert.assertNotNull(o);
Assert.assertTrue(o instanceof ConnectionFactory);
ConnectionFactory cf = (ConnectionFactory)o;
Connection connection = cf.createConnection();
connection.close();
}
for (String binding : queueConfig.getBindings())
{
Object o = context.lookup(binding);
Assert.assertNotNull(o);
Assert.assertTrue(o instanceof Queue);
Queue queue = (Queue)o;
Assert.assertEquals(queueConfig.getName(), queue.getQueueName());
}
for (String binding : topicConfig.getBindings())
{
Object o = context.lookup(binding);
Assert.assertNotNull(o);
Assert.assertTrue(o instanceof Topic);
Topic topic = (Topic)o;
Assert.assertEquals(topicConfig.getName(), topic.getTopicName());
}