use of org.talend.esb.mep.requestcallback.beans.JmsUriConfiguration in project tesb-rt-se by Talend.
the class DetailTest method testJmsUriParsing.
@Test
public void testJmsUriParsing() {
JmsUriConfiguration cfg = new JmsUriConfiguration();
cfg.applyJmsUri("jms:queue:callbackRequestQueue.queue?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory&jndiConnectionFactoryName=ConnectionFactory&jndiURL=tcp://localhost:61616");
assertEquals(cfg.getVariant(), "queue");
assertEquals(cfg.getDestinationName(), "callbackRequestQueue.queue");
assertEquals(cfg.getParameter("jndiInitialContextFactory"), "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
assertEquals(cfg.getParameter("jndiConnectionFactoryName"), "ConnectionFactory");
assertEquals(cfg.getParameter("jndiURL"), "tcp://localhost:61616");
}
use of org.talend.esb.mep.requestcallback.beans.JmsUriConfiguration in project tesb-rt-se by Talend.
the class JmsUriConfiguratorTest method testCreateEndpoint.
@Test
public void testCreateEndpoint() {
HelloWorldImpl implementor = new HelloWorldImpl();
String address = "local://JmsUriConfiguratorTest";
ep = Endpoint.publish(address, implementor);
Assert.assertNotNull(ep);
Assert.assertTrue(ep instanceof EndpointImpl);
JmsUriConfigurator conf = JmsUriConfigurator.create(ep);
Assert.assertNotNull(conf);
JmsUriConfiguration jmsConf = conf.createJmsUriConfiguration();
Assert.assertNotNull(jmsConf);
System.out.println("Configurator identifier is: " + conf.getConfiguration().getConfigurationIdentifier());
Assert.assertNotNull(conf.getConfiguration().getProperty("jndiInitialContextFactory"));
Assert.assertEquals("org.apache.activemq.jndi.ActiveMQInitialContextFactory", conf.getConfiguration().getProperty("jndiInitialContextFactory"));
// --------------------------------------------------------------------------------------------------
conf.setPresetJmsAddress("jms://");
conf.setVariant(jmsConf.getVariant());
conf.setDefaultVariant("jndi");
conf.setDestinationName(jmsConf.getDestinationName());
conf.setDefaultDestinationName("defaultDestinationName");
conf.setEndpointName("JmsUriConfiguratorTest");
Assert.assertEquals("jms://", conf.getPresetJmsAddress());
Assert.assertEquals("jndi", conf.getVariant());
Assert.assertEquals("jndi", conf.getDefaultVariant());
Assert.assertEquals("dynamicQueues/libraryprovider.queue", conf.getDestinationName());
Assert.assertEquals("defaultDestinationName", conf.getDefaultDestinationName());
Assert.assertEquals("jms:jndi:dynamicQueues/libraryprovider.queue?jndiConnectionFactoryName=ConnectionFactory&jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory&jndiURL=tcp://localhost:61616", conf.getJmsAddress());
Assert.assertEquals("http://internal.test.requestcallback.mep.esb.talend.org/", conf.getServiceName().getNamespaceURI());
Assert.assertEquals("HelloWorldImplService", conf.getServiceName().getLocalPart());
Assert.assertEquals(new QName(null, "JmsUriConfiguratorTest"), conf.getEndpointName());
Assert.assertEquals("JmsUriConfiguratorTest", conf.getConfigurationPrefix());
Map<String, Object> m = new HashMap<String, Object>();
m.put("key1", "val1");
conf.setDefaultParameters(m);
Map m2 = conf.getDefaultParameters();
Assert.assertNotNull(m2);
Assert.assertEquals(1, m2.size());
Assert.assertTrue(m2.containsKey("key1"));
Assert.assertTrue(m2.containsValue("val1"));
conf.setParameters(m);
m2 = conf.getParameters();
Assert.assertNotNull(m2);
Assert.assertEquals(1, m2.size());
Assert.assertTrue(m2.containsKey("key1"));
Assert.assertTrue(m2.containsValue("val1"));
String jmsAddr = conf.getJmsAddress();
Assert.assertEquals(jmsAddr, conf.resetJmsAddress());
Assert.assertNotNull(conf.getJmsAddress());
conf.setServiceName("{http://example.com/}AService");
Assert.assertEquals(new QName("http://example.com/", "AService"), conf.getServiceName());
conf.setEndpointName(new QName("http://example.com/", "AService"));
Assert.assertEquals(new QName("http://example.com/", "AService"), conf.getEndpointName());
conf.setEncodeURI(true);
Assert.assertTrue(conf.isEncodeURI());
conf.setEncodeURI("none");
Assert.assertFalse(conf.isEncodeURI());
conf.setConfiguration(null);
Assert.assertNull(conf.getConfiguration());
}
Aggregations