use of org.apache.camel.Endpoint in project camel by apache.
the class SedaDisruptorCompareTest method uninstallSizeMonitoring.
private void uninstallSizeMonitoring(final ExecutorService monitoring) {
if (monitoring != null) {
monitoring.shutdownNow();
}
final Histogram histogram = new Histogram(sizeHistogramBounds);
for (final int observation : endpointSizeQueue) {
histogram.addObservation(observation);
}
System.out.printf("%82s %s%n", "Endpoint size (# exchanges pending):", histogram.toString());
}
use of org.apache.camel.Endpoint in project camel by apache.
the class EndpointTest method testZKJdbcURL.
@Test
public void testZKJdbcURL() throws Exception {
Endpoint endpoint = context.getEndpoint("drill://" + HOST + "?port=" + PORT + "&directory=" + DIRECTORY + "&clusterId=" + CLUSTERID + "&mode=" + MODE);
final String uri = "jdbc:drill:zk=" + HOST + ":" + PORT + "/" + DIRECTORY + "/" + CLUSTERID;
assertTrue(endpoint instanceof DrillEndpoint);
assertEquals(HOST, ((DrillEndpoint) endpoint).getHost());
assertEquals(PORT, ((DrillEndpoint) endpoint).getPort());
assertEquals(DIRECTORY, ((DrillEndpoint) endpoint).getDirectory());
assertEquals(CLUSTERID, ((DrillEndpoint) endpoint).getClusterId());
assertEquals(MODE, ((DrillEndpoint) endpoint).getMode());
assertEquals(uri, ((DrillEndpoint) endpoint).toJDBCUri());
}
use of org.apache.camel.Endpoint in project camel by apache.
the class DropboxConsumerTest method shouldCreateGetConsumer.
@Test
public void shouldCreateGetConsumer() throws Exception {
// Given
Endpoint dropboxEndpoint1 = context.getEndpoint("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/path");
// When
Consumer consumer1 = dropboxEndpoint1.createConsumer(null);
// Then
Assert.assertTrue(consumer1 instanceof DropboxScheduledPollGetConsumer);
// Given
Endpoint dropboxEndpoint2 = context.getEndpoint("dropbox://get?accessToken={{accessToken}}&clientIdentifier={{clientIdentifier}}&remotePath=/path with spaces/file");
// When
Consumer consumer2 = dropboxEndpoint2.createConsumer(null);
// Then
Assert.assertTrue(consumer2 instanceof DropboxScheduledPollGetConsumer);
}
use of org.apache.camel.Endpoint in project camel by apache.
the class FopEndpointTest method encryptPdfWithUserPassword.
@Test
public void encryptPdfWithUserPassword() throws Exception {
Endpoint endpoint = context().getEndpoint("fop:pdf");
Producer producer = endpoint.createProducer();
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setHeader("CamelFop.Encrypt.userPassword", "secret");
exchange.getIn().setBody(FopHelper.decorateTextWithXSLFO("Test Content"));
producer.process(exchange);
PDDocument document = getDocumentFrom(exchange);
assertTrue(document.isEncrypted());
}
use of org.apache.camel.Endpoint in project camel by apache.
the class FopEndpointTest method overridePdfOutputFormatToPlainText.
@Test
public void overridePdfOutputFormatToPlainText() throws Exception {
String defaultOutputFormat = "pdf";
Endpoint endpoint = context().getEndpoint("fop:" + defaultOutputFormat);
Producer producer = endpoint.createProducer();
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setHeader(FopConstants.CAMEL_FOP_OUTPUT_FORMAT, "txt");
exchange.getIn().setBody(FopHelper.decorateTextWithXSLFO("Test Content"));
producer.process(exchange);
String plainText = exchange.getOut().getBody(String.class).trim();
assertEquals("Test Content", plainText);
}
Aggregations