use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class CxfEndpointTest method testSettingContinucationTimout.
@Test
public void testSettingContinucationTimout() throws Exception {
CamelContext context = new DefaultCamelContext();
CxfEndpoint endpoint = context.getEndpoint(routerEndpointURI + "&continuationTimeout=800000", CxfEndpoint.class);
assertEquals("Get a wrong continucationTimeout value", 800000, endpoint.getContinuationTimeout());
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class CxfCustomerStartStopTest method startAndStopService.
@Test
public void startAndStopService() throws Exception {
CamelContext context = new DefaultCamelContext();
// start a server
context.addRoutes(new RouteBuilder() {
public void configure() {
from("cxf:http://localhost:" + PORT1 + "/test?serviceClass=org.apache.camel.component.cxf.HelloService").to("log:endpoint");
}
});
context.start();
Thread.sleep(300);
context.stop();
Bus bus = BusFactory.getDefaultBus();
JettyHTTPServerEngineFactory factory = bus.getExtension(JettyHTTPServerEngineFactory.class);
JettyHTTPServerEngine engine = factory.retrieveJettyHTTPServerEngine(PORT1);
assertNotNull("Jetty engine should be found there", engine);
// Need to call the bus shutdown ourselves.
String orig = System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort", "false");
bus.shutdown(true);
System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort", orig == null ? "true" : "false");
engine = factory.retrieveJettyHTTPServerEngine(PORT1);
assertNull("Jetty engine should be removed", engine);
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class ConverterTest method testFallbackConverter.
@Test
public void testFallbackConverter() throws Exception {
CamelContext context = new DefaultCamelContext();
Exchange exchange = new DefaultExchange(context);
MessageContentsList list = new MessageContentsList();
NodeListWrapper nl = new NodeListWrapper(new ArrayList<Element>());
list.add(nl);
exchange.getIn().setBody(list);
Node node = exchange.getIn().getBody(Node.class);
assertNull(node);
File file = new File("src/test/resources/org/apache/camel/component/cxf/converter/test.xml");
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(file);
document.getDocumentElement().normalize();
List<Element> elements = new ArrayList<Element>();
elements.add(document.getDocumentElement());
nl = new NodeListWrapper(elements);
list.clear();
list.add(nl);
exchange.getIn().setBody(list);
node = exchange.getIn().getBody(Node.class);
assertNotNull(node);
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class ConverterTest method testToInputStream.
@Test
public void testToInputStream() throws Exception {
CamelContext context = new DefaultCamelContext();
Exchange exchange = new DefaultExchange(context);
Response response = EasyMock.createMock(Response.class);
InputStream is = EasyMock.createMock(InputStream.class);
response.getEntity();
EasyMock.expectLastCall().andReturn(is);
EasyMock.replay(response);
InputStream result = CxfConverter.toInputStream(response, exchange);
assertEquals("We should get the inputStream here ", is, result);
EasyMock.verify(response);
EasyMock.reset(response);
response.getEntity();
EasyMock.expectLastCall().andReturn("Hello World");
EasyMock.replay(response);
result = CxfConverter.toInputStream(response, exchange);
assertTrue("We should get the inputStream here ", result instanceof ByteArrayInputStream);
EasyMock.verify(response);
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class CxfProducerSoapFaultTest method setUp.
@Before
public void setUp() throws Exception {
camelContext = new DefaultCamelContext();
camelContext.start();
template = camelContext.createProducerTemplate();
}
Aggregations