use of org.apache.cxf.transport.http.HTTPException in project camel by apache.
the class CxfEndpointBeansTest method testCxfBusConfiguration.
@Test
public void testCxfBusConfiguration() throws Exception {
// get the camelContext from application context
ProducerTemplate template = context.createProducerTemplate();
Exchange reply = template.request("cxf:bean:serviceEndpoint", new Processor() {
public void process(final Exchange exchange) {
final List<String> params = new ArrayList<String>();
params.add("hello");
exchange.getIn().setBody(params);
exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, "echo");
}
});
Exception ex = reply.getException();
assertTrue("Should get the fault here", ex instanceof org.apache.cxf.interceptor.Fault || ex instanceof HTTPException);
}
use of org.apache.cxf.transport.http.HTTPException in project camel by apache.
the class CxfEndpointBeansRouterTest method testCxfBusConfiguration.
@Test
public void testCxfBusConfiguration() throws Exception {
// get the camelContext from application context
CamelContext camelContext = ctx.getBean("camel", CamelContext.class);
ProducerTemplate template = camelContext.createProducerTemplate();
Exchange reply = template.request("cxf:bean:serviceEndpoint", new Processor() {
public void process(final Exchange exchange) {
final List<String> params = new ArrayList<String>();
params.add("hello");
exchange.getIn().setBody(params);
exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, "echo");
}
});
Exception ex = reply.getException();
assertTrue("Should get the fault here", ex instanceof org.apache.cxf.interceptor.Fault || ex instanceof HTTPException);
}
use of org.apache.cxf.transport.http.HTTPException in project cxf by apache.
the class DigestAuthTest method testNoAuth.
@Test
public void testNoAuth() throws Exception {
URL wsdl = getClass().getResource("../greeting.wsdl");
assertNotNull("WSDL is null", wsdl);
SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull("Service is null", service);
Greeter mortimer = service.getPort(mortimerQ, Greeter.class);
assertNotNull("Port is null", mortimer);
TestUtil.setAddress(mortimer, "http://localhost:" + PORT + "/digestauth/greeter");
try {
String answer = mortimer.sayHi();
Assert.fail("Unexpected reply (" + answer + "). Should throw exception");
} catch (Exception e) {
Throwable cause = e.getCause();
Assert.assertEquals(HTTPException.class, cause.getClass());
HTTPException he = (HTTPException) cause;
Assert.assertEquals(401, he.getResponseCode());
}
}
Aggregations