本文整理汇总了Java中org.apache.camel.component.cxf.CxfEndpoint类的典型用法代码示例。如果您正苦于以下问题:Java CxfEndpoint类的具体用法?Java CxfEndpoint怎么用?Java CxfEndpoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CxfEndpoint类属于org.apache.camel.component.cxf包,在下文中一共展示了CxfEndpoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCxfProducerEndpoint
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Named("cxfProducerEndpoint")
@Produces
public CxfEndpoint createCxfProducerEndpoint() {
CxfComponent cxfProducerComponent = new CxfComponent(this.camelContext);
CxfEndpoint cxfProducerEndpoint = new CxfEndpoint(CXF_PRODUCER_ENDPOINT_ADDRESS, cxfProducerComponent);
cxfProducerEndpoint.setBeanId("cxfProducerEndpoint");
cxfProducerEndpoint.setServiceClass(org.wildfly.camel.examples.cxf.jaxws.GreetingService.class);
SSLContextParameters producerSslContextParameters = this.createProducerSSLContextParameters();
cxfProducerEndpoint.setSslContextParameters(producerSslContextParameters);
// Not for use in production
HostnameVerifier hostnameVerifier = new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
cxfProducerEndpoint.setHostnameVerifier(hostnameVerifier);
return cxfProducerEndpoint;
}
示例2: testCxfEndpointBeanDefinitionParser
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Test
public void testCxfEndpointBeanDefinitionParser() {
CxfEndpoint routerEndpoint = ctx.getBean("routerEndpoint", CxfEndpoint.class);
assertEquals("Got the wrong endpoint address", "http://localhost:" + port1
+ "/CxfEndpointBeanTest/router", routerEndpoint.getAddress());
assertEquals("Got the wrong endpont service class", "org.apache.camel.component.cxf.HelloService",
routerEndpoint.getServiceClass().getName());
assertEquals("loggingFeatureEnabled should be false", false, routerEndpoint.isLoggingFeatureEnabled());
assertEquals("loggingSizeLimit should not be set", 0, routerEndpoint.getLoggingSizeLimit());
assertEquals("Got the wrong handlers size", 1, routerEndpoint.getHandlers().size());
assertEquals("Got the wrong schemalocations size", 1, routerEndpoint.getSchemaLocations().size());
assertEquals("Got the wrong schemalocation", "classpath:wsdl/Message.xsd", routerEndpoint.getSchemaLocations().get(0));
assertEquals("Got the wrong continuationTimeout", 60000, routerEndpoint.getContinuationTimeout());
CxfEndpoint myEndpoint = ctx.getBean("myEndpoint", CxfEndpoint.class);
assertEquals("Got the wrong endpointName", endpointName, myEndpoint.getPortName());
assertEquals("Got the wrong serviceName", serviceName, myEndpoint.getServiceName());
assertEquals("loggingFeatureEnabled should be true", true, myEndpoint.isLoggingFeatureEnabled());
assertEquals("loggingSizeLimit should be set", 200, myEndpoint.getLoggingSizeLimit());
assertTrue("We should get a soap binding", myEndpoint.getBindingConfig() instanceof SoapBindingConfiguration);
SoapBindingConfiguration configuration = (SoapBindingConfiguration)myEndpoint.getBindingConfig();
assertEquals("We should get a right soap version", "1.2", String.valueOf(configuration.getVersion().getVersion()));
}
示例3: testBusInjectedBySpring
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Test
public void testBusInjectedBySpring() throws Exception {
CamelContext camelContext = ctx.getBean("camel", CamelContext.class);
CxfEndpoint endpoint = camelContext.getEndpoint("cxf:bean:routerEndpoint", CxfEndpoint.class);
// verify the interceptor that is added by the logging feature
// Spring 3.0.0 has an issue of SPR-6589 which will call the BusApplicationListener twice for the same event,
// so we will get more one InInterceptors here
assertTrue(endpoint.getBus().getInInterceptors().size() >= 1);
for (Interceptor<?> i : endpoint.getBus().getInInterceptors()) {
if (i instanceof LoggingInInterceptor) {
return;
}
}
fail("Could not find the LoggingInInterceptor on the bus. " + endpoint.getBus().getInInterceptors());
}
示例4: testBusInjectedBySpring
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Test
public void testBusInjectedBySpring() throws Exception {
CamelContext camelContext = (CamelContext) ctx.getBean("camel");
CxfEndpoint endpoint = camelContext.getEndpoint("cxf:bean:routerEndpoint", CxfEndpoint.class);
assertEquals("Get a wrong endpoint uri", "cxf://bean:routerEndpoint", endpoint.getEndpointUri());
Bus cxf1 = endpoint.getBus();
assertEquals(cxf1, ctx.getBean("cxf1"));
assertEquals(cxf1, endpoint.getBus());
assertEquals("barf", endpoint.getBus().getProperty("foo"));
endpoint = camelContext.getEndpoint("cxf:bean:serviceEndpoint", CxfEndpoint.class);
assertEquals("Get a wrong endpoint uri", "cxf://bean:serviceEndpoint", endpoint.getEndpointUri());
Bus cxf2 = endpoint.getBus();
assertEquals(cxf2, ctx.getBean("cxf2"));
assertEquals(cxf2, endpoint.getBus());
assertEquals("snarf", endpoint.getBus().getProperty("foo"));
}
示例5: testCheckServiceClassConsumer
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Test
public void testCheckServiceClassConsumer() throws Exception {
CxfEndpoint endpoint = createEndpoint(getNoServiceClassURI());
try {
endpoint.createConsumer(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
// noop
}
});
fail("Should have thrown exception");
} catch (IllegalArgumentException exception) {
assertNotNull("Should get a CamelException here", exception);
assertTrue(exception.getMessage().startsWith("serviceClass must be specified"));
}
}
示例6: testCreateDestinationFromSpring
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Test
public void testCreateDestinationFromSpring() throws Exception {
CxfEndpoint cxfEndpoint = context.getEndpoint("cxf:bean:serviceEndpoint", CxfEndpoint.class);
CxfProducer producer = (CxfProducer)cxfEndpoint.createProducer();
assertNotNull("The producer should not be null", producer);
producer.start();
CamelConduit conduit = (CamelConduit)producer.getClient().getConduit();
assertTrue("we should get SpringCamelContext here", conduit.getCamelContext() instanceof SpringCamelContext);
assertEquals("The context id should be camel_conduit", "camel_conduit", conduit.getCamelContext().getName());
cxfEndpoint = context.getEndpoint("cxf:bean:routerEndpoint", CxfEndpoint.class);
CxfConsumer consumer = (CxfConsumer)cxfEndpoint.createConsumer(new Processor() {
public void process(Exchange exchange) throws Exception {
// do nothing here
}
});
assertNotNull("The consumer should not be null", consumer);
consumer.start();
CamelDestination destination = (CamelDestination)consumer.getServer().getDestination();
assertTrue("we should get SpringCamelContext here", destination.getCamelContext() instanceof SpringCamelContext);
assertEquals("The context id should be camel_destination", "camel_destination", destination.getCamelContext().getName());
}
示例7: userServiceEndpoint
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Bean(name = "helloEndpoint")
public CxfEndpoint userServiceEndpoint() {
CxfEndpoint cxfEndpoint = new CxfEndpoint();
cxfEndpoint.setAddress("http://localhost:8888/services/hello");
cxfEndpoint.setServiceClass(HelloWorld.class);
LoggingInInterceptor loggingInInterceptor = new LoggingInInterceptor();
loggingInInterceptor.setPrettyLogging(true);
LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
loggingOutInterceptor.setPrettyLogging(true);
cxfEndpoint.getOutInterceptors().add(loggingOutInterceptor);
cxfEndpoint.getInInterceptors().add(loggingInInterceptor);
cxfEndpoint.setDataFormat(DataFormat.POJO);
final Map<String, Object> properties = new HashMap<>();
properties.put("schema-validation-enabled", "true");
properties.put("bus.jmx.enabled", "true");
//properties.setProperty("faultStackTraceEnabled", "true");
//properties.setProperty("exceptionMessageCauseEnabled", "true");
//properties.setProperty("schema-validation-enabled", "false");
//properties.put("allowStreaming", true);
cxfEndpoint.configureProperties(properties);
return cxfEndpoint;
}
示例8: createCxfConsumerEndpoint
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Named("cxfConsumerEndpoint")
@Produces
public CxfEndpoint createCxfConsumerEndpoint() {
CxfComponent cxfConsumerComponent = new CxfComponent(this.camelContext);
CxfEndpoint cxfConsumerEndpoint = new CxfEndpoint(CXF_CONSUMER_ENDPOINT_ADDRESS, cxfConsumerComponent);
cxfConsumerEndpoint.setBeanId("cxfConsumerEndpoint");
cxfConsumerEndpoint.setServiceClass(org.wildfly.camel.examples.cxf.jaxws.GreetingService.class);
SSLContextParameters consumerSslContextParameters = this.createConsumerSSLContextParameters();
cxfConsumerEndpoint.setSslContextParameters(consumerSslContextParameters);
List<Interceptor<? extends Message>> inInterceptors = cxfConsumerEndpoint.getInInterceptors();
// Authentication
JAASLoginInterceptor jaasLoginInterceptor = new JAASLoginInterceptor();
jaasLoginInterceptor.setContextName(WILDFLY_SECURITY_DOMAIN_NAME);
jaasLoginInterceptor.setAllowAnonymous(false);
List<CallbackHandlerProvider> chp = Arrays.asList(new JBossCallbackHandlerTlsCert());
jaasLoginInterceptor.setCallbackHandlerProviders(chp);
inInterceptors.add(jaasLoginInterceptor);
// Authorization
SimpleAuthorizingInterceptor authorizingInterceptor = new SimpleAuthorizingInterceptor();
authorizingInterceptor.setAllowAnonymousUsers(false);
Map<String, String> rolesMap = new HashMap<>(1);
rolesMap.put("greet", "testRole");
authorizingInterceptor.setMethodRolesMap(rolesMap);
inInterceptors.add(authorizingInterceptor);
return cxfConsumerEndpoint;
}
示例9: createCxfConsumer
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Named("cxfConsumer")
@Produces
public CxfEndpoint createCxfConsumer() {
CxfComponent cxfComponent = new CxfComponent(this.context);
CxfEndpoint cxfFromEndpoint = new CxfEndpoint("http://localhost:8080/webservices/greeting-cdi-xml", cxfComponent);
cxfFromEndpoint.setServiceClass(GreetingService.class);
return cxfFromEndpoint;
}
示例10: createCxfProducer
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Named("cxfProducer")
@Produces
public CxfEndpoint createCxfProducer() {
CxfComponent cxfComponent = new CxfComponent(this.context);
CxfEndpoint cxfToEndpoint = new CxfEndpoint("http://localhost:8080/webservices/greeting-cdi-xml", cxfComponent);
cxfToEndpoint.setServiceClass(GreetingService.class);
return cxfToEndpoint;
}
示例11: configure
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Override
public void configure() throws Exception {
// Set system properties for use with Camel property placeholders for running the example tests.
System.setProperty("routerPort", String.valueOf(AvailablePortFinder.getNextAvailable()));
System.setProperty("servicePort", String.valueOf(AvailablePortFinder.getNextAvailable()));
CxfComponent cxfComponent = new CxfComponent(getContext());
CxfEndpoint serviceEndpoint = new CxfEndpoint(SERVICE_ADDRESS, cxfComponent);
serviceEndpoint.setServiceClass(Greeter.class);
// Here we just pass the exception back, don't need to use errorHandler
errorHandler(noErrorHandler());
from(ROUTER_ENDPOINT_URI).to(serviceEndpoint);
}
示例12: testCxfEndpointBeanDefinitionParser
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Test
public void testCxfEndpointBeanDefinitionParser() {
CxfEndpoint routerEndpoint = context.getEndpoint("routerEndpoint", CxfEndpoint.class);
assertEquals("Got the wrong endpoint address", routerEndpoint.getAddress(),
"http://localhost:" + CXFTestSupport.getPort1() + "/CxfEndpointBeansRouterTest/router");
assertEquals("Got the wrong endpont service class",
"org.apache.camel.component.cxf.HelloService",
routerEndpoint.getServiceClass().getName());
}
示例13: testCreateCxfEndpointFromURI
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Test
public void testCreateCxfEndpointFromURI() throws Exception {
CxfEndpoint endpoint1 = context.getEndpoint("cxf:bean:routerEndpoint?address=http://localhost:9000/test1", CxfEndpoint.class);
CxfEndpoint endpoint2 = context.getEndpoint("cxf:bean:routerEndpoint?address=http://localhost:8000/test2", CxfEndpoint.class);
assertEquals("Get a wrong endpoint address.", "http://localhost:9000/test1", endpoint1.getAddress());
assertEquals("Get a wrong endpoint address.", "http://localhost:8000/test2", endpoint2.getAddress());
// the uri will always be normalized
String uri1 = URISupport.normalizeUri("cxf://bean:routerEndpoint?address=http://localhost:9000/test1");
String uri2 = URISupport.normalizeUri("cxf://bean:routerEndpoint?address=http://localhost:8000/test2");
assertEquals("Get a wrong endpoint key.", uri1, endpoint1.getEndpointKey());
assertEquals("Get a wrong endpoint key.", uri2, endpoint2.getEndpointKey());
}
示例14: testCxfBeanWithCamelPropertiesHolder
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Test
public void testCxfBeanWithCamelPropertiesHolder() throws Exception {
// get the camelContext from application context
CxfEndpoint testEndpoint = context.getEndpoint("cxf:bean:testEndpoint", CxfEndpoint.class);
QName endpointName = QName.valueOf("{http://org.apache.camel.component.cxf}myEndpoint");
QName serviceName = QName.valueOf("{http://org.apache.camel.component.cxf}myService");
assertEquals("Got a wrong address",
"http://localhost:" + CXFTestSupport.getPort3() + "/testEndpoint", testEndpoint.getAddress());
assertEquals("Got a wrong bindingId", "http://schemas.xmlsoap.org/wsdl/soap12/", testEndpoint.getBindingId());
assertEquals("Got a wrong transportId", "http://cxf.apache.org/transports/http", testEndpoint.getTransportId());
assertEquals("Got a wrong endpointName", endpointName, testEndpoint.getPortName());
assertEquals("Got a wrong WsdlURL", "wsdl/test.wsdl", testEndpoint.getWsdlURL());
assertEquals("Got a wrong serviceName", serviceName, testEndpoint.getServiceName());
}
示例15: testCxfEndpointBeanDefinitionParser
import org.apache.camel.component.cxf.CxfEndpoint; //导入依赖的package包/类
@Test
public void testCxfEndpointBeanDefinitionParser() {
CxfEndpoint routerEndpoint = context.getEndpoint("routerEndpoint", CxfEndpoint.class);
assertEquals("Got the wrong endpoint address", routerEndpoint.getAddress(),
"http://localhost:" + CXFTestSupport.getPort1() + "/CxfConsumerSoap12Test/router");
assertEquals("Got the wrong endpont service class",
"org.apache.hello_world_soap_http.Greeter",
routerEndpoint.getServiceClass().getName());
BindingConfiguration binding = routerEndpoint.getBindingConfig();
assertTrue("Got no soap binding", binding instanceof SoapBindingConfiguration);
assertEquals("Got the wrong soap version", "http://schemas.xmlsoap.org/wsdl/soap12/",
((SoapBindingConfiguration)binding).getVersion().getBindingId());
assertTrue("Mtom not enabled", ((SoapBindingConfiguration)binding).isMtomEnabled());
}