Search in sources :

Example 16 with Endpoint

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());
}
Also used : Histogram(com.lmax.disruptor.collections.Histogram) SedaEndpoint(org.apache.camel.component.seda.SedaEndpoint) Endpoint(org.apache.camel.Endpoint)

Example 17 with Endpoint

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());
}
Also used : Endpoint(org.apache.camel.Endpoint) Test(org.junit.Test)

Example 18 with Endpoint

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);
}
Also used : Endpoint(org.apache.camel.Endpoint) DropboxScheduledPollGetConsumer(org.apache.camel.component.dropbox.integration.consumer.DropboxScheduledPollGetConsumer) Consumer(org.apache.camel.Consumer) DropboxScheduledPollGetConsumer(org.apache.camel.component.dropbox.integration.consumer.DropboxScheduledPollGetConsumer) Test(org.junit.Test)

Example 19 with Endpoint

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());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) Endpoint(org.apache.camel.Endpoint) Producer(org.apache.camel.Producer) PDDocument(org.apache.pdfbox.pdmodel.PDDocument) Test(org.junit.Test)

Example 20 with Endpoint

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);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) Endpoint(org.apache.camel.Endpoint) Producer(org.apache.camel.Producer) Test(org.junit.Test)

Aggregations

Endpoint (org.apache.camel.Endpoint)564 Test (org.junit.Test)206 Exchange (org.apache.camel.Exchange)201 Producer (org.apache.camel.Producer)137 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)89 Processor (org.apache.camel.Processor)43 Message (org.apache.camel.Message)38 CamelContext (org.apache.camel.CamelContext)32 HashMap (java.util.HashMap)28 Map (java.util.Map)28 Consumer (org.apache.camel.Consumer)27 RouteBuilder (org.apache.camel.builder.RouteBuilder)24 File (java.io.File)21 Route (org.apache.camel.Route)21 EventDrivenConsumerRoute (org.apache.camel.impl.EventDrivenConsumerRoute)18 CountDownLatch (java.util.concurrent.CountDownLatch)16 DefaultExchange (org.apache.camel.impl.DefaultExchange)16 SpanDecorator (org.apache.camel.opentracing.SpanDecorator)15 ArrayList (java.util.ArrayList)14 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)14