use of java.io.File in project camel by apache.
the class CometdProducerConsumerInOutInteractiveMain method createRouteBuilder.
private RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
CometdComponent component = (CometdComponent) context.getComponent("cometds");
component.setSslPassword(pwd);
component.setSslKeyPassword(pwd);
File file = new File("./src/test/resources/jsse/localhost.ks");
URI keyStoreUrl = file.toURI();
component.setSslKeystore(keyStoreUrl.getPath());
from(URI, URIS).setExchangePattern(ExchangePattern.InOut).process(new Processor() {
public void process(Exchange exchange) throws Exception {
Message out = new DefaultMessage();
out.setBody("reply: " + exchange.getIn().getBody());
exchange.setOut(out);
}
});
}
};
}
use of java.io.File in project camel by apache.
the class CometdProducerConsumerInteractiveAuthenticatedMain method createRouteBuilder.
private RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
CometdComponent component = (CometdComponent) context.getComponent("cometds");
component.setSslPassword(pwd);
component.setSslKeyPassword(pwd);
CometdComponent component2 = (CometdComponent) context.getComponent("cometd");
BayeuxAuthenticator bayeuxAuthenticator = new BayeuxAuthenticator();
component2.setSecurityPolicy(bayeuxAuthenticator);
component2.addExtension(bayeuxAuthenticator);
File file = new File("./src/test/resources/jsse/localhost.ks");
URI keyStoreUrl = file.toURI();
component.setSslKeystore(keyStoreUrl.getPath());
from("stream:in").to(URI).to(URIS);
}
};
}
use of java.io.File in project camel by apache.
the class CometdProducerConsumerInteractiveExtensionMain method createRouteBuilder.
private RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
CometdComponent component = (CometdComponent) context.getComponent("cometds");
component.setSslPassword(pwd);
component.setSslKeyPassword(pwd);
CometdComponent component2 = (CometdComponent) context.getComponent("cometd");
Censor bayeuxAuthenticator = new Censor();
component2.addExtension(bayeuxAuthenticator);
File file = new File("./src/test/resources/jsse/localhost.ks");
URI keyStoreUrl = file.toURI();
component.setSslKeystore(keyStoreUrl.getPath());
from("stream:in").to(URI).to(URIS);
}
};
}
use of java.io.File in project camel by apache.
the class CometdProducerConsumerInteractiveMain method createRouteBuilder.
private RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
CometdComponent component = (CometdComponent) context.getComponent("cometds");
component.setSslPassword(pwd);
component.setSslKeyPassword(pwd);
File file = new File("./src/test/resources/jsse/localhost.ks");
URI keyStoreUrl = file.toURI();
component.setSslKeystore(keyStoreUrl.getPath());
from("stream:in").to(URI).to(URIS);
}
};
}
use of java.io.File in project camel by apache.
the class CsvUnmarshalStreamTest method testCsvUnMarshalWithFile.
@SuppressWarnings("unchecked")
@Test
public void testCsvUnMarshalWithFile() throws Exception {
result.reset();
result.expectedMessageCount(EXPECTED_COUNT);
template.sendBody("direct:start", new MyFileInputStream(new File("src/test/resources/data.csv")));
assertMockEndpointsSatisfied();
for (int i = 0; i < EXPECTED_COUNT; ++i) {
List<String> body = result.getReceivedExchanges().get(i).getIn().getBody(List.class);
assertEquals(2, body.size());
assertEquals(String.valueOf(i), body.get(0));
assertEquals(String.format("%d%s%d", i, LS, i), body.get(1));
}
}
Aggregations