use of org.apache.cxf.feature.Feature 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);
}
use of org.apache.cxf.feature.Feature in project tesb-rt-se by Talend.
the class JmsConfigurator method configureEndpoint.
public Endpoint configureEndpoint(Endpoint endpoint) {
if (jmsConfiguration == null || !(endpoint instanceof EndpointImpl) || (serviceName == null && configuration == null)) {
return null;
}
if (!jmsConfigured) {
setupJmsConfiguration();
}
final EndpointImpl ei = (EndpointImpl) endpoint;
final JMSConfigFeature feature = new JMSConfigFeature();
feature.setJmsConfig(jmsConfiguration);
List<Feature> features = ei.getFeatures();
if (features == null) {
features = new ArrayList<Feature>();
}
features.add(feature);
ei.setFeatures(features);
return endpoint;
}
use of org.apache.cxf.feature.Feature in project tesb-rt-se by Talend.
the class CallContext method createCallbackEndpoint.
public static Endpoint createCallbackEndpoint(final Object implementor, final CallbackInfo cbInfo, final String policyAlias) {
final Bus bus = BusFactory.getThreadDefaultBus();
final JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
final List<Feature> features = new ArrayList<Feature>();
features.add(new RequestCallbackFeature());
if (logging) {
features.add(new LoggingFeature());
}
if (serviceActivityMonitoring) {
features.add(getEventFeature());
}
serverFactory.setFeatures(features);
final QName cbInterfaceName;
final String wsdlLocation;
if (cbInfo == null) {
cbInterfaceName = null;
wsdlLocation = null;
} else {
cbInterfaceName = cbInfo.getCallbackPortTypeName();
wsdlLocation = cbInfo.getEffectiveCallbackReceiverWsdlLocation(policyAlias);
}
final boolean useWsdlLocation = wsdlLocation != null && cbInfo.getCallbackServiceName() != null && cbInfo.getCallbackPortName() != null;
if (cbInterfaceName != null) {
final QName cbServiceName = cbInfo.getCallbackServiceName() == null ? new QName(cbInterfaceName.getNamespaceURI(), cbInterfaceName.getLocalPart() + "Service") : cbInfo.getCallbackServiceName();
final QName cbEndpointName = cbInfo.getCallbackServiceName() == null ? new QName(cbInterfaceName.getNamespaceURI(), cbInterfaceName.getLocalPart() + "ServicePort") : new QName(cbServiceName.getNamespaceURI(), cbInfo.getCallbackPortName() == null ? cbServiceName.getLocalPart() + "Port" : cbInfo.getCallbackPortName());
serverFactory.setServiceName(cbServiceName);
serverFactory.setEndpointName(cbEndpointName);
final List<AbstractServiceConfiguration> svcConfigs = serverFactory.getServiceFactory().getServiceConfigurations();
for (ListIterator<AbstractServiceConfiguration> it = svcConfigs.listIterator(); it.hasNext(); ) {
final AbstractServiceConfiguration cfg = it.next();
if (cfg instanceof DefaultServiceConfiguration) {
final AbstractServiceConfiguration ncfg = new CallbackDefaultServiceConfiguration(cbInfo);
it.set(ncfg);
}
}
if (useWsdlLocation) {
serverFactory.setWsdlLocation(wsdlLocation);
}
}
final EndpointImpl endpoint = new EndpointImpl(bus, implementor, serverFactory);
endpoint.setFeatures(features);
endpoint.getProperties().put(NULL_MEANS_ONEWAY, Boolean.TRUE);
if (cbInterfaceName != null) {
endpoint.setEndpointName(serverFactory.getEndpointName());
endpoint.setServiceName(serverFactory.getServiceName());
if (useWsdlLocation) {
endpoint.setWsdlLocation(wsdlLocation);
}
}
return endpoint;
}
use of org.apache.cxf.feature.Feature in project tesb-rt-se by Talend.
the class CallContext method setupServerFactory.
public static void setupServerFactory(final JaxWsServerFactoryBean serverFactory) {
final List<Feature> features = serverFactory.getFeatures();
features.add(new RequestCallbackFeature());
if (logging) {
features.add(new LoggingFeature());
}
if (serviceActivityMonitoring) {
features.add(getEventFeature());
}
serverFactory.getProperties(true).put(NULL_MEANS_ONEWAY, Boolean.TRUE);
}
use of org.apache.cxf.feature.Feature in project tesb-rt-se by Talend.
the class RuntimeESBConsumerTest method noPropertiesSetProvidesEmptyArgumentList.
@Test
public void noPropertiesSetProvidesEmptyArgumentList() throws Exception {
QName serviceName = new QName("http://services.talend.org/test/Library/1.0", "LibraryProvider");
QName portName = new QName("http://services.talend.org/test/Library/1.0", "LibraryHttpPort");
QName operationName = new QName("http://services.talend.org/test/Library/1.0", "seekBook");
String publishedEndpointUrl = "local://LibraryHttpPort";
String wsdlURL = "classpath:/conf/libraryService/Library.wsdl";
boolean useServiceLocator = false;
LocatorFeature locatorFeature = null;
Map<String, String> locatorProps = new HashMap<String, String>();
EventFeature samFeature = null;
Map<String, String> samProps = new HashMap<String, String>();
boolean useServiceRegistry = false;
EsbSecurity esbSecurity = null;
Policy policy = null;
String username = "";
String password = "";
String alias = "";
Map<String, String> clientProperties = new HashMap<String, String>();
String roleName = "";
Object securityToken = null;
Crypto cryptoProvider = null;
SecurityArguments securityArguments = new SecurityArguments(esbSecurity, policy, username, password, alias, clientProperties, roleName, securityToken, cryptoProvider);
Bus bus = null;
boolean logging = false;
List<Header> soapHeaders = new ArrayList<Header>();
Feature httpHeadersFeature = null;
boolean enhancedResponse = false;
Object correlationIDCallbackHandler = null;
final boolean useGZipCompression = false;
RuntimeESBConsumer consumer = new RuntimeESBConsumer(serviceName, portName, operationName, publishedEndpointUrl, wsdlURL, useServiceLocator, locatorFeature, locatorProps, samFeature, samProps, useServiceRegistry, securityArguments, bus, logging, soapHeaders, httpHeadersFeature, enhancedResponse, correlationIDCallbackHandler, useGZipCompression);
String requestString = "<ns2:SearchFor xmlns:ns2=\"http://types.talend.org/test/Library/Common/1.0\" " + "xmlns:ns3=\"http://types.talend.org/test/GeneralObjects/ErrorHandling/1.0\">" + "<AuthorLastName>Icebear</AuthorLastName><ISBNNumber>123</ISBNNumber></ns2:SearchFor>";
consumer.invoke(getDocumentFromString(requestString));
}
Aggregations