Search in sources :

Example 1 with JmsConfigurator

use of org.talend.esb.mep.requestcallback.beans.JmsConfigurator in project tesb-rt-se by Talend.

the class JmsConfiguratorTest method testCreateAndConfigureEndpoint.

@Test
public void testCreateAndConfigureEndpoint() {
    HelloWorldImpl2 implementor = new HelloWorldImpl2();
    String address = "local://JmsUriConfiguratorTest";
    ep = Endpoint.publish(address, implementor);
    JmsConfigurator jmsConfigurator = JmsConfigurator.create(ep);
    Assert.assertNotNull(jmsConfigurator);
    Assert.assertEquals("HelloWorldImpl2Port", jmsConfigurator.getConfigurationPrefix());
    Assert.assertEquals(SERVICE_NAME, jmsConfigurator.getServiceName());
    JMSConfiguration jmsConf = new JMSConfiguration();
    jmsConfigurator.setJmsConfiguration(jmsConf);
    Endpoint ep2 = jmsConfigurator.configureEndpoint(ep);
    Assert.assertNotNull(ep2);
    Configuration cnf = jmsConfigurator.getConfiguration();
    Assert.assertNotNull(cnf);
    Assert.assertEquals("org.apache.activemq.jndi.ActiveMQInitialContextFactory", cnf.get("jndiInitialContextFactory"));
    Assert.assertEquals("jndi", cnf.get("variant"));
    Assert.assertEquals("ConnectionFactory", cnf.get("jndiConnectionFactoryName"));
    Assert.assertEquals("tcp://localhost:61616", cnf.get("jndiURL"));
    Assert.assertEquals("dynamicQueues/libraryprovider.queue", cnf.get("destinationName"));
    List<Feature> features = ((EndpointImpl) ep2).getFeatures();
    boolean jmsConfigFeaturePresent = false;
    for (Feature f : features) {
        if (f instanceof org.apache.cxf.transport.jms.JMSConfigFeature) {
            jmsConfigFeaturePresent = true;
            break;
        }
    }
    Assert.assertTrue(jmsConfigFeaturePresent);
}
Also used : JMSConfiguration(org.apache.cxf.transport.jms.JMSConfiguration) Configuration(org.talend.esb.mep.requestcallback.feature.Configuration) JMSConfiguration(org.apache.cxf.transport.jms.JMSConfiguration) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) Feature(org.apache.cxf.feature.Feature) HelloWorldImpl2(org.talend.esb.mep.requestcallback.test.internal.HelloWorldImpl2) JmsConfigurator(org.talend.esb.mep.requestcallback.beans.JmsConfigurator) Endpoint(javax.xml.ws.Endpoint) Test(org.junit.Test)

Example 2 with JmsConfigurator

use of org.talend.esb.mep.requestcallback.beans.JmsConfigurator in project tesb-rt-se by Talend.

the class JmsConfiguratorTest method createAndConfigureDispatchAddressing.

@Test
public void createAndConfigureDispatchAddressing() {
    Service service = Service.create(SERVICE_NAME);
    service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, "jms://");
    Dispatch<Source> dispatch = service.createDispatch(PORT_NAME, Source.class, Service.Mode.PAYLOAD);
    Assert.assertNotNull(dispatch);
    JmsConfigurator jmsConfigurator = JmsConfigurator.create(dispatch);
    Assert.assertNotNull(jmsConfigurator);
    Assert.assertEquals("SoapPort", jmsConfigurator.getConfigurationPrefix());
    Assert.assertEquals(SERVICE_NAME, jmsConfigurator.getServiceName());
    Dispatch<Source> dispatch2 = jmsConfigurator.configureDispatch(dispatch, "jms://");
    Assert.assertNotNull(dispatch2);
    Conduit conduit = ((DispatchImpl) dispatch2).getClient().getConduit();
    Assert.assertNotNull(conduit);
    Assert.assertTrue(conduit instanceof JMSConduit);
    JMSConduit jmsConduit = (JMSConduit) conduit;
    JMSConfiguration jmsConfiguration = jmsConduit.getJmsConfig();
    Assert.assertNotNull(jmsConfiguration);
}
Also used : JMSConfiguration(org.apache.cxf.transport.jms.JMSConfiguration) JMSConduit(org.apache.cxf.transport.jms.JMSConduit) JMSConduit(org.apache.cxf.transport.jms.JMSConduit) Conduit(org.apache.cxf.transport.Conduit) Service(javax.xml.ws.Service) Source(javax.xml.transform.Source) JmsConfigurator(org.talend.esb.mep.requestcallback.beans.JmsConfigurator) Test(org.junit.Test)

Example 3 with JmsConfigurator

use of org.talend.esb.mep.requestcallback.beans.JmsConfigurator in project tesb-rt-se by Talend.

the class JmsConfiguratorTest method createAndConfigureDispatch.

@Test
public void createAndConfigureDispatch() {
    Service service = Service.create(SERVICE_NAME);
    service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, "jms://");
    Dispatch<Source> dispatch = service.createDispatch(PORT_NAME, Source.class, Service.Mode.PAYLOAD);
    Assert.assertNotNull(dispatch);
    JmsConfigurator jmsConfigurator = JmsConfigurator.create(dispatch);
    Assert.assertNotNull(jmsConfigurator);
    Assert.assertEquals("SoapPort", jmsConfigurator.getConfigurationPrefix());
    Assert.assertEquals(SERVICE_NAME, jmsConfigurator.getServiceName());
    Dispatch<Source> dispatch2 = jmsConfigurator.configureDispatch(dispatch);
    Assert.assertNotNull(dispatch2);
    Conduit conduit = ((DispatchImpl) dispatch2).getClient().getConduit();
    Assert.assertNotNull(conduit);
    Assert.assertTrue(conduit instanceof JMSConduit);
    JMSConduit jmsConduit = (JMSConduit) conduit;
    JMSConfiguration jmsConfiguration = jmsConduit.getJmsConfig();
    Assert.assertNotNull(jmsConfiguration);
}
Also used : JMSConfiguration(org.apache.cxf.transport.jms.JMSConfiguration) JMSConduit(org.apache.cxf.transport.jms.JMSConduit) JMSConduit(org.apache.cxf.transport.jms.JMSConduit) Conduit(org.apache.cxf.transport.Conduit) Service(javax.xml.ws.Service) Source(javax.xml.transform.Source) JmsConfigurator(org.talend.esb.mep.requestcallback.beans.JmsConfigurator) Test(org.junit.Test)

Example 4 with JmsConfigurator

use of org.talend.esb.mep.requestcallback.beans.JmsConfigurator in project tesb-rt-se by Talend.

the class JmsConfiguratorTest method testCreateAndConfigureFactory.

@Test
public void testCreateAndConfigureFactory() {
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setServiceName(SERVICE_NAME);
    factory.setEndpointName(new QName(SERVICE_NS, "HelloWorldImplServiceInstance1"));
    JmsConfigurator jmsConfigurator = JmsConfigurator.create(factory);
    Assert.assertNotNull(jmsConfigurator);
    Assert.assertEquals("HelloWorldImplServiceInstance1", jmsConfigurator.getConfigurationPrefix());
    Assert.assertEquals(SERVICE_NAME, jmsConfigurator.getServiceName());
    JaxWsServerFactoryBean factory2 = jmsConfigurator.configureServerFactory(factory);
    Assert.assertNotNull(factory2);
    List<Feature> features = factory2.getFeatures();
    boolean jmsConfigFeaturePresent = false;
    for (Feature f : features) {
        if (f instanceof org.apache.cxf.transport.jms.JMSConfigFeature) {
            jmsConfigFeaturePresent = true;
            break;
        }
    }
    Assert.assertTrue(jmsConfigFeaturePresent);
}
Also used : QName(javax.xml.namespace.QName) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Feature(org.apache.cxf.feature.Feature) JmsConfigurator(org.talend.esb.mep.requestcallback.beans.JmsConfigurator) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 JmsConfigurator (org.talend.esb.mep.requestcallback.beans.JmsConfigurator)4 JMSConfiguration (org.apache.cxf.transport.jms.JMSConfiguration)3 Source (javax.xml.transform.Source)2 Service (javax.xml.ws.Service)2 Feature (org.apache.cxf.feature.Feature)2 Conduit (org.apache.cxf.transport.Conduit)2 JMSConduit (org.apache.cxf.transport.jms.JMSConduit)2 QName (javax.xml.namespace.QName)1 Endpoint (javax.xml.ws.Endpoint)1 EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)1 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)1 Configuration (org.talend.esb.mep.requestcallback.feature.Configuration)1 HelloWorldImpl2 (org.talend.esb.mep.requestcallback.test.internal.HelloWorldImpl2)1