Search in sources :

Example 1 with Configuration

use of org.talend.esb.mep.requestcallback.feature.Configuration 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 Configuration

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

the class ConfigurationUpdater method resolveConfigIdentifier.

private String resolveConfigIdentifier() {
    if (configuration.getAlternateConfigurationIdentifier() == null) {
        return configuration.getConfigurationIdentifier();
    }
    final Configuration baseConfig = ConfigurationInitializer.resolveConfiguration(null);
    String key = configuration.getConfigurationName().toString() + ".pidMode";
    PidMode pidMode = baseConfig.getPidModeProperty(key);
    if (pidMode == null) {
        pidMode = baseConfig.getPidModeProperty("default.pidMode");
    }
    if (pidMode == PidMode.FULL_NAME) {
        return configuration.getConfigurationIdentifier();
    }
    return configuration.getAlternateConfigurationIdentifier();
}
Also used : Configuration(org.talend.esb.mep.requestcallback.feature.Configuration) PidMode(org.talend.esb.mep.requestcallback.feature.Configuration.PidMode)

Example 3 with Configuration

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

the class JmsConfigurator method configureJndi.

private void configureJndi(JMSConfiguration jmsConfiguration) {
    final Configuration cfg = configuration == null ? CallContext.resolveConfiguration(serviceName) : configuration;
    final String jndiConnectionFactoryName = getJndiProperty("jndiConnectionFactoryName");
    if (jndiConnectionFactoryName != null) {
        jmsConfiguration.setConnectionFactoryName(jndiConnectionFactoryName);
    }
    final String connectionUserName = getJndiProperty("connectionUserName");
    if (connectionUserName != null) {
        jmsConfiguration.setUserName(connectionUserName);
    }
    final String connectionPassword = getJndiProperty("connectionPassword");
    if (connectionPassword != null) {
        jmsConfiguration.setPassword(connectionPassword);
    }
    Properties env = jmsConfiguration.getJndiEnvironment();
    final boolean hasNoEnv = env == null;
    if (hasNoEnv) {
        env = new Properties();
    }
    cfg.fillProperties("jndiConfig.environment", env);
    if (workPrefix != null) {
        cfg.fillProperties(workPrefix + "jndiConfig.environment", env);
    }
    if (hasNoEnv && !env.isEmpty()) {
        jmsConfiguration.setJndiEnvironment(env);
    }
}
Also used : Configuration(org.talend.esb.mep.requestcallback.feature.Configuration) JMSConfiguration(org.apache.cxf.transport.jms.JMSConfiguration) Properties(java.util.Properties)

Aggregations

Configuration (org.talend.esb.mep.requestcallback.feature.Configuration)3 JMSConfiguration (org.apache.cxf.transport.jms.JMSConfiguration)2 Properties (java.util.Properties)1 Endpoint (javax.xml.ws.Endpoint)1 Feature (org.apache.cxf.feature.Feature)1 EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)1 Test (org.junit.Test)1 JmsConfigurator (org.talend.esb.mep.requestcallback.beans.JmsConfigurator)1 PidMode (org.talend.esb.mep.requestcallback.feature.Configuration.PidMode)1 HelloWorldImpl2 (org.talend.esb.mep.requestcallback.test.internal.HelloWorldImpl2)1