Java 类org.apache.camel.Endpoint 实例源码

项目:camel-atlasmap    文件:AtlasComponent.java   
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    boolean cache = getAndRemoveParameter(parameters, "contentCache", Boolean.class, Boolean.TRUE);

    AtlasEndpoint endpoint = new AtlasEndpoint(uri, this, remaining);
    setProperties(endpoint, parameters);
    endpoint.setContentCache(cache);
    endpoint.setAtlasContextFactory(getAtlasContextFactory());

    // if its a http resource then append any remaining parameters and update the
    // resource uri
    if (ResourceHelper.isHttpUri(remaining)) {
        String remainingAndParameters = ResourceHelper.appendParameters(remaining, parameters);
        endpoint.setResourceUri(remainingAndParameters);
    }

    return endpoint;
}
项目:syndesis    文件:SwaggerConnectorComponentTest.java   
@Test
public void shouldPassSpecificationToRestSwaggerComponent() throws Exception {
    final Component component = camelContext.getComponent("swagger-operation");
    assertThat(component).isNotNull();

    final String specification = IOUtils.toString(SwaggerConnectorComponentTest.class.getResource("/petstore.json"),
        StandardCharsets.UTF_8);
    IntrospectionSupport.setProperties(component, new HashMap<>(Collections.singletonMap("specification", specification)));

    final Endpoint endpoint = component.createEndpoint("swagger-operation://?operationId=addPet");
    assertThat(endpoint).isNotNull();

    final Optional<RestSwaggerEndpoint> maybeRestSwagger = camelContext.getEndpoints().stream()
        .filter(RestSwaggerEndpoint.class::isInstance).map(RestSwaggerEndpoint.class::cast).findFirst();

    assertThat(maybeRestSwagger).hasValueSatisfying(restSwagger -> {
        assertThat(restSwagger.getSpecificationUri()).isNotNull();
        assertThat(restSwagger.getOperationId()).isEqualTo("addPet");
    });
}
项目:syndesis    文件:SalesforceConnector.java   
@Override
protected final Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters)
    throws Exception {
    final DefaultConnectorEndpoint connectorEndpoint = (DefaultConnectorEndpoint) super.createEndpoint(uri, remaining, parameters);

    final DataType inputDataType = connectorEndpoint.getInputDataType();
    final UnmarshallProcessor unmarshallInputProcessor = new UnmarshallInputProcessor(inputDataType);
    final Processor existingBeforeProducer = connectorEndpoint.getBeforeProducer();
    if (existingBeforeProducer == null) {
        connectorEndpoint.setBeforeProducer(unmarshallInputProcessor);
    } else {
        connectorEndpoint.setBeforeProducer(Pipeline.newInstance(getCamelContext(), unmarshallInputProcessor, existingBeforeProducer));
    }

    final DataType outputDataType = connectorEndpoint.getOutputDataType();
    final UnmarshallProcessor unmarshallOutputProcessor = new UnmarshallOutputProcessor(outputDataType);
    final Processor existingAfterProducer = connectorEndpoint.getAfterProducer();
    if (existingAfterProducer == null) {
        connectorEndpoint.setAfterProducer(unmarshallOutputProcessor);
    } else {
        connectorEndpoint.setAfterProducer(Pipeline.newInstance(getCamelContext(), unmarshallOutputProcessor, existingAfterProducer));
    }

    return connectorEndpoint;
}
项目:syndesis    文件:ComponentProxyComponent.java   
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    // grab the regular query parameters
    Map<String, String> options = buildEndpointOptions(remaining, parameters);

    // create the uri of the base component
    String delegateUri = catalog.asEndpointUri(componentSchemeAlias.orElse(componentScheme), options, false);
    Endpoint delegate = getCamelContext().getEndpoint(delegateUri);

    LOGGER.info("Connector resolved: {} -> {}", URISupport.sanitizeUri(uri), URISupport.sanitizeUri(delegateUri));

    ComponentProxyEndpoint answer = new ComponentProxyEndpoint(uri, this, delegate);
    answer.setBeforeProducer(getBeforeProducer());
    answer.setAfterProducer(getAfterProducer());
    answer.setBeforeConsumer(getBeforeConsumer());
    answer.setAfterConsumer(getAfterConsumer());

    // clean-up parameters so that validation won't fail later on
    // in DefaultConnectorComponent.validateParameters()
    parameters.clear();

    return answer;
}
项目:connectors    文件:TwitterSearchConnectorTest.java   
@Test
public void testConfiguration() throws Exception {
    TwitterSearchEndpoint twitterEnpoint = null;

    for (Endpoint endpoint : camelContext.getEndpoints()) {
        LOGGER.debug("instance:" + endpoint.getClass());
        if (endpoint instanceof TwitterSearchEndpoint) {
            twitterEnpoint = (TwitterSearchEndpoint)endpoint;
            break;
        }
    }

    String uri = twitterEnpoint.getEndpointUri();

    Assert.assertNotNull("No TwitterSearchEndpoint found", twitterEnpoint);
    Assert.assertTrue(uri.startsWith("twitter-search-connector:") || uri.startsWith("twitter-search-connector-component:"));
    Assert.assertEquals("camelsearchtest", twitterEnpoint.getKeywords());
    Assert.assertFalse(twitterEnpoint.isFilterOld());
}
项目:connectors    文件:TwitterMentionConnectorTest.java   
@Test
public void testConfiguration() throws Exception {
    TwitterTimelineEndpoint twitterEnpoint = null;

    for (Endpoint endpoint : camelContext.getEndpoints()) {
        LOGGER.debug("instance:" + endpoint.getClass());
        if (endpoint instanceof TwitterTimelineEndpoint) {
            twitterEnpoint = (TwitterTimelineEndpoint)endpoint;
            break;
        }
    }

    String uri = twitterEnpoint.getEndpointUri();

    Assert.assertNotNull("No TwitterTimelineEndpoint found", twitterEnpoint);
    Assert.assertTrue(uri.startsWith("twitter-mention-connector:") || uri.startsWith("twitter-mention-connector-component:"));
    Assert.assertEquals(TimelineType.MENTIONS, twitterEnpoint.getTimelineType());
}
项目:Camel    文件:TimerReferenceConfigurationTest.java   
/**
 * Test that the 'value' configuration params are correct
 *
 * @throws Exception
 */
public void testValueConfiguration() throws Exception {
    Endpoint e = context.getEndpoint(valueTimerUri);
    TimerEndpoint timer = (TimerEndpoint) e;
    final Date expectedTimeObject = new SimpleDateFormat(valExpectedPattern).parse(valExpectedTimeString);
    final Date time = timer.getTime();
    final long period = timer.getPeriod();
    final long delay = timer.getDelay();
    final boolean fixedRate = timer.isFixedRate();
    final boolean daemon = timer.isDaemon();
    final long repeatCount = timer.getRepeatCount();

    assertEquals(valExpectedDelay, delay);
    assertEquals(valExpectedPeriod, period);
    assertEquals(expectedTimeObject, time);
    assertEquals(valExpectedFixedRate, fixedRate);
    assertEquals(valExpectedDaemon, daemon);
    assertEquals(valExpectedRepeatCount, repeatCount);
}
项目:Camel    文件:SnsComponent.java   
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    SnsConfiguration configuration = new SnsConfiguration();
    setProperties(configuration, parameters);

    if (remaining == null || remaining.trim().length() == 0) {
        throw new IllegalArgumentException("Topic name must be specified.");
    }
    if (remaining.startsWith("arn:")) {
        configuration.setTopicArn(remaining);
    } else {
        configuration.setTopicName(remaining);
    }

    if (configuration.getAmazonSNSClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
        throw new IllegalArgumentException("AmazonSNSClient or accessKey and secretKey must be specified");
    }

    SnsEndpoint endpoint = new SnsEndpoint(uri, this, configuration);
    return endpoint;
}
项目:Camel    文件:FromFtpTwoSlashesIssueTest.java   
private void prepareFtpServer() throws Exception {
    // prepares the FTP Server by creating a file on the server that we want to unit
    // test that we can pool and store as a local file
    Endpoint endpoint = context.getEndpoint(getFtpUrl());
    Exchange exchange = endpoint.createExchange();
    exchange.getIn().setBody("Hello World");
    exchange.getIn().setHeader(Exchange.FILE_NAME, "hello.txt");
    Producer producer = endpoint.createProducer();
    producer.start();
    producer.process(exchange);
    producer.stop();

    // assert file is created
    File file = new File(FTP_ROOT_DIR + "/hello.txt");
    assertTrue("The file should exists", file.exists());
}
项目:Camel    文件:TimerReferenceConfigurationTest.java   
/**
 * Test that the reference configuration params are correct
 *
 * @throws Exception
 */
public void testReferenceConfiguration() throws Exception {

    Endpoint e = context.getEndpoint(refTimerUri);
    TimerEndpoint timer = (TimerEndpoint) e;
    final Date expectedTimeObject = new SimpleDateFormat(refExpectedPattern).parse(refExpectedTimeString);
    final Date time = timer.getTime();
    final long period = timer.getPeriod();
    final long delay = timer.getDelay();
    final boolean fixedRate = timer.isFixedRate();
    final boolean daemon = timer.isDaemon();
    final long repeatCount = timer.getRepeatCount();

    assertEquals(refExpectedDelay, delay);
    assertEquals(refExpectedPeriod, period);
    assertEquals(expectedTimeObject, time);
    assertEquals(refExpectedFixedRate, fixedRate);
    assertEquals(refExpectedDaemon, daemon);
    assertEquals(refExpectedRepeatCount, repeatCount);
}
项目:Camel    文件:EmptyProducerCache.java   
@Override
public Producer acquireProducer(Endpoint endpoint) {
    // always create a new producer
    Producer answer;
    try {
        answer = endpoint.createProducer();
        if (getCamelContext().isStartingRoutes() && answer.isSingleton()) {
            // if we are currently starting a route, then add as service and enlist in JMX
            // - but do not enlist non-singletons in JMX
            // - note addService will also start the service
            getCamelContext().addService(answer);
        } else {
            // must then start service so producer is ready to be used
            ServiceHelper.startService(answer);
        }
    } catch (Exception e) {
        throw new FailedToCreateProducerException(endpoint, e);
    }
    return answer;
}
项目:Camel    文件:DefaultProducerCacheTest.java   
public void testCacheProducerAcquireAndRelease() throws Exception {
    ProducerCache cache = new ProducerCache(this, context);
    cache.start();

    assertEquals("Size should be 0", 0, cache.size());

    // test that we cache at most 1000 producers to avoid it eating to much memory
    for (int i = 0; i < 1003; i++) {
        Endpoint e = context.getEndpoint("direct:queue:" + i);
        Producer p = cache.acquireProducer(e);
        cache.releaseProducer(e, p);
    }

    // the eviction is async so force cleanup
    cache.cleanUp();

    assertEquals("Size should be 1000", 1000, cache.size());
    cache.stop();
}
项目:flowable-engine    文件:FlowableComponent.java   
@Override
protected Endpoint createEndpoint(String s, String s1, Map<String, Object> parameters) throws Exception {
    FlowableEndpoint ae = new FlowableEndpoint(s, getCamelContext());
    ae.setIdentityService(identityService);
    ae.setRuntimeService(runtimeService);
    ae.setRepositoryService(repositoryService);

    ae.setCopyVariablesToProperties(this.copyVariablesToProperties);
    ae.setCopyVariablesToBodyAsMap(this.copyVariablesToBodyAsMap);
    ae.setCopyCamelBodyToBody(this.copyCamelBodyToBody);

    Map<String, Object> returnVars = IntrospectionSupport.extractProperties(parameters, "var.return.");
    if (returnVars != null && returnVars.size() > 0) {
        ae.getReturnVarMap().putAll(returnVars);
    }

    return ae;
}
项目:Camel    文件:LdapRouteTest.java   
@Test
public void testLdapRouteWithPaging() throws Exception {
    camel.addRoutes(createRouteBuilder("ldap:localhost:" + port + "?base=ou=system&pageSize=5"));
    camel.start();

    Endpoint endpoint = camel.getEndpoint("direct:start");
    Exchange exchange = endpoint.createExchange();
    // then we set the LDAP filter on the in body
    exchange.getIn().setBody("(objectClass=*)");

    // now we send the exchange to the endpoint, and receives the response from Camel
    Exchange out = template.send(endpoint, exchange);

    Collection<SearchResult> searchResults = defaultLdapModuleOutAssertions(out);
    assertEquals(16, searchResults.size());
}
项目:Camel    文件:ValidatorComponent.java   
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    ValidatorEndpoint endpoint = new ValidatorEndpoint(uri, this, remaining);
    // lookup custom resolver to use
    ValidatorResourceResolverFactory resolverFactory = resolveAndRemoveReferenceParameter(parameters, "resourceResolverFactory", ValidatorResourceResolverFactory.class);
    if (resolverFactory == null) {
        // not in endpoint then use component specific resource resolver factory
        resolverFactory = getResourceResolverFactory();
    }
    if (resolverFactory == null) {
        // fallback to use a Camel default resource resolver factory
        resolverFactory = new DefaultValidatorResourceResolverFactory();
    }
    endpoint.setResourceResolverFactory(resolverFactory);
    setProperties(endpoint, parameters);
    return endpoint;
}
项目:Camel    文件:MinaTransferExchangeOptionTest.java   
private Exchange sendExchange(boolean setException) throws Exception {
    Endpoint endpoint = context.getEndpoint("mina:tcp://localhost:{{port}}?sync=true&encoding=UTF-8&transferExchange=true");
    Exchange exchange = endpoint.createExchange();

    Message message = exchange.getIn();
    message.setBody("Hello!");
    message.setHeader("cheese", "feta");
    exchange.setProperty("ham", "old");
    exchange.setProperty("setException", setException);

    Producer producer = endpoint.createProducer();
    producer.start();
    producer.process(exchange);

    return exchange;
}
项目:Camel    文件:ProducerTemplateMaximumCacheSizeTest.java   
@Test
public void testTemplateMaximumCache() throws Exception {
    assertNotNull("Should have injected a producer template", template);

    ProducerTemplate lookup = context.getRegistry().lookupByNameAndType("template", ProducerTemplate.class);
    assertNotNull("Should lookup producer template", lookup);

    assertEquals(50, template.getMaximumCacheSize());
    assertEquals("Size should be 0", 0, template.getCurrentCacheSize());

    // test that we cache at most 50 producers to avoid it eating to much memory
    for (int i = 0; i < 53; i++) {
        Endpoint e = context.getEndpoint("seda:queue:" + i);
        template.sendBody(e, "Hello");
    }

    // the eviction is async so force cleanup
    template.cleanUp();

    assertEquals("Size should be 50", 50, template.getCurrentCacheSize());
    template.stop();

    // should be 0
    assertEquals("Size should be 0", 0, template.getCurrentCacheSize());
}
项目:Camel    文件:DefaultEndpointRegistry.java   
@Override
public Endpoint put(EndpointKey key, Endpoint endpoint) {
    // at first we must see if the key already exists and then replace it back, so it stays the same spot
    Endpoint answer = staticMap.remove(key);
    if (answer != null) {
        // replace existing
        staticMap.put(key, endpoint);
        return answer;
    }

    answer = super.remove(key);
    if (answer != null) {
        // replace existing
        super.put(key, endpoint);
        return answer;
    }

    // we want endpoints to be static if they are part of setting up or starting routes
    if (context.isSetupRoutes() || context.isStartingRoutes()) {
        answer = staticMap.put(key, endpoint);
    } else {
        answer = super.put(key, endpoint);
    }

    return answer;
}
项目:Camel    文件:MinaFiltersTest.java   
private void testFilter(final String uri) throws Exception {
    context.addRoutes(new RouteBuilder() {

        public void configure() throws Exception {
            from(uri).to("mock:result");
        }
    });

    MockEndpoint mock = this.getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello World");

    Endpoint endpoint = context.getEndpoint(uri);
    Exchange exchange = endpoint.createExchange();
    Producer producer = endpoint.createProducer();
    producer.start();

    // set input and execute it
    exchange.getIn().setBody("Hello World");
    producer.process(exchange);

    assertMockEndpointsSatisfied();

    assertEquals("The filter should have been called twice (producer and consumer)", 2, TestFilter.called);

    producer.stop();
}
项目:Camel    文件:RouteboxComponent.java   
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters)
    throws Exception {
    RouteboxEndpoint blackboxRouteEndpoint = null;

    config.parseURI(new URI(uri), parameters, this);
    if (config.getInnerProtocol().equalsIgnoreCase("direct")) {
        blackboxRouteEndpoint = new RouteboxDirectEndpoint(uri, this, config);
        setProperties(blackboxRouteEndpoint.getConfig(), parameters);
    } else {
        String baseUri = getQueueKey(uri);
        blackboxRouteEndpoint = new RouteboxSedaEndpoint(uri, this, config, createQueue(baseUri, parameters));
        setProperties(blackboxRouteEndpoint.getConfig(), parameters);
    }

    return blackboxRouteEndpoint;
}
项目:Camel    文件:SdbComponent.java   
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    SdbConfiguration configuration = new SdbConfiguration();
    setProperties(configuration, parameters);

    if (remaining == null || remaining.trim().length() == 0) {
        throw new IllegalArgumentException("Domain name must be specified.");
    }
    configuration.setDomainName(remaining);

    if (configuration.getAmazonSDBClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
        throw new IllegalArgumentException("amazonSDBClient or accessKey and secretKey must be specified");
    }

    SdbEndpoint endpoint = new SdbEndpoint(uri, this, configuration);
    return endpoint;
}
项目:Camel    文件:RouteBuilderTest.java   
public void testComplexExpressions() throws Exception {
    // START SNIPPET: e7
    RouteBuilder builder = new RouteBuilder() {
        public void configure() {
            errorHandler(deadLetterChannel("mock:error"));

            from("direct:a")
                .filter(header("foo").isEqualTo(123))
                    .to("direct:b");
        }
    };
    // END SNIPPET: e7

    List<Route> routes = getRouteList(builder);
    log.debug("Created routes: " + routes);

    assertEquals("Number routes created", 1, routes.size());
    for (Route route : routes) {
        Endpoint key = route.getEndpoint();
        assertEquals("From endpoint", "direct://a", key.getEndpointUri());
    }
}
项目:syndesis    文件:SwaggerConnectorComponentTest.java   
@Test
public void shouldDetermineScheme() {
    final Endpoint endpoint = camelContext.getEndpoint("swagger-operation?petId=3");

    assertThat(endpoint).isNotNull();

    final Optional<RestSwaggerEndpoint> maybeRestSwagger = camelContext.getEndpoints().stream()
        .filter(RestSwaggerEndpoint.class::isInstance).map(RestSwaggerEndpoint.class::cast).findFirst();

    assertThat(maybeRestSwagger).hasValueSatisfying(restSwagger -> {
        assertThat(restSwagger.getSpecificationUri().toString()).matches("file:.*swagger-operation.*\\.swagger");
    });
}
项目:sponge    文件:SpongeComponent.java   
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    SpongeEndpoint endpoint = new SpongeEndpoint(uri, this, engine, action, managed);

    endpoint.setEngineRef(remaining);
    setProperties(endpoint, parameters);

    return endpoint;
}
项目:ipf-flow-manager    文件:FlowBeginProcessor.java   
private Endpoint resolveReplayErrorEndpoint(String replayErrorUri) {
    Endpoint endpoint = getCamelContext().getEndpoint(replayErrorUri);
    if (endpoint == null) {
        throw new IllegalArgumentException("Unknown endpoint with URI " + replayErrorUri);
    }
    return endpoint;
}
项目:Camel    文件:FopEndpointTest.java   
@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());
}
项目:Camel    文件:ZooKeeperComponent.java   
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    if (getCamelContext() == null) {
        throw new CamelException("No Camel context has been provided to this zookeeper component");
    }

    ZooKeeperConfiguration config = getConfiguration().copy();
    extractConfigFromUri(uri, config);
    setProperties(config, parameters);

    return new ZooKeeperEndpoint(uri, this, config);
}
项目:Camel    文件:FromFtpServerLanguageCodeTest.java   
private void prepareFtpServer() throws Exception {
    // prepares the FTP Server by creating a file on the server
    Endpoint endpoint = context.getEndpoint(getFtpUrl());
    Exchange exchange = endpoint.createExchange();
    exchange.getIn().setBody("Hello World");
    exchange.getIn().setHeader(Exchange.FILE_NAME, "hello.txt");
    Producer producer = endpoint.createProducer();
    producer.start();
    producer.process(exchange);
    producer.stop();
}
项目:Camel    文件:AbstractJdbcGeneratedKeysTest.java   
@SuppressWarnings("unchecked")
protected void testRetrieveGeneratedKeysWithIntGeneratedColumns(String query,
                                                                Map<String, Object> parameters) throws Exception {
    // first we create our exchange using the endpoint
    Endpoint endpoint = context.getEndpoint("direct:hello");

    Exchange exchange = endpoint.createExchange();
    // then we set the SQL on the in body and add possible parameters
    exchange.getIn().setBody(query);
    exchange.getIn().setHeader(JdbcConstants.JDBC_RETRIEVE_GENERATED_KEYS, true);
    exchange.getIn().setHeader(JdbcConstants.JDBC_GENERATED_COLUMNS, new int[]{1});
    setHeaders(exchange, parameters);

    // now we send the exchange to the endpoint, and receives the response from Camel
    Exchange out = template.send(endpoint, exchange);

    // assertions of the response
    assertNotNull(out);
    assertNotNull(out.getOut());
    assertNotNull(out.getOut().getHeader(JdbcConstants.JDBC_GENERATED_KEYS_DATA));
    assertNotNull(out.getOut().getHeader(JdbcConstants.JDBC_GENERATED_KEYS_ROW_COUNT));

    List<Map<String, Object>> generatedKeys = out.getOut().getHeader(JdbcConstants.JDBC_GENERATED_KEYS_DATA, List.class);
    assertNotNull("out body could not be converted to an ArrayList - was: "
        + out.getOut().getBody(), generatedKeys);
    assertEquals(1, generatedKeys.size());

    Map<String, Object> row = generatedKeys.get(0);
    assertEquals("auto increment value should be 2", BigDecimal.valueOf(2), row.get("1"));

    assertEquals("generated keys row count should be one", 1, out.getOut().getHeader(JdbcConstants.JDBC_GENERATED_KEYS_ROW_COUNT));
}
项目:Camel    文件:DefaultEndpointRegistry.java   
@Override
public Collection<Endpoint> values() {
    Collection<Endpoint> answer = new ArrayList<Endpoint>();
    answer.addAll(staticMap.values());
    answer.addAll(super.values());
    return answer;
}
项目:Camel    文件:EC2Component.java   
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    EC2Configuration configuration = new EC2Configuration();
    setProperties(configuration, parameters);

    if (configuration.getAmazonEc2Client() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
        throw new IllegalArgumentException("amazonEC2Client or accessKey and secretKey must be specified");
    }

    EC2Endpoint endpoint = new EC2Endpoint(uri, this, configuration);
    return endpoint;
}
项目:Camel    文件:BeanProxyNoBindingTest.java   
public void testProxyBuilderProxyCallAnotherBeanWithNoArgs() throws Exception {
    Endpoint endpoint = context.getEndpoint("direct:bean");
    OrderService service = new ProxyBuilder(context).endpoint(endpoint).binding(false).build(OrderService.class);

    String reply = service.doAbsolutelyNothing();
    assertEquals("Hi nobody", reply);
}
项目:Camel    文件:CMISConsumerTest.java   
private Consumer createConsumerFor(String path) throws Exception {
    Endpoint endpoint = context.getEndpoint("cmis://" + path);
    return endpoint.createConsumer(new Processor() {
        public void process(Exchange exchange) throws Exception {
            template.send("mock:result", exchange);
        }
    });
}
项目:Camel    文件:RecipientListProcessor.java   
private RecipientProcessorExchangePair(int index, ProducerCache producerCache, Endpoint endpoint, Producer producer,
                                       Processor prepared, Exchange exchange, ExchangePattern pattern) {
    this.index = index;
    this.producerCache = producerCache;
    this.endpoint = endpoint;
    this.producer = producer;
    this.prepared = prepared;
    this.exchange = exchange;
    this.pattern = pattern;
}
项目:DataVec    文件:DataVecComponent.java   
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    DataVecEndpoint endpoint = new DataVecEndpoint(uri, this);
    setProperties(endpoint, parameters);
    endpoint.setInputFormat(remaining);
    return endpoint;
}
项目:Camel    文件:DirectVmConsumerExpression.java   
@Override
public Object evaluate(Exchange exchange) {
    Collection<Endpoint> endpoints = new ArrayList<Endpoint>();
    for (Endpoint endpoint : DirectVmComponent.getConsumerEndpoints()) {
        if (matcher.match(pattern, endpoint.getEndpointKey())) {
            endpoints.add(endpoint);
        }
    }
    return endpoints;
}
项目:Camel    文件:MyAsyncComponent.java   
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    MyAsyncEndpoint answer = new MyAsyncEndpoint(uri, this);
    answer.setReply(prepareReply(remaining));
    setProperties(answer, parameters);
    return answer;
}
项目:Camel    文件:DefaultExchangeFormatterTest.java   
public void testSendCaughtExchangeWithExceptionAndStackTrace() throws Exception {
    Endpoint endpoint = resolveMandatoryEndpoint("log:org.apache.camel.TEST?showCaughtException=true&showStackTrace=true");
    Exchange exchange = endpoint.createExchange();
    exchange.getIn().setBody("Hello World");
    exchange.setProperty(Exchange.EXCEPTION_CAUGHT, new IllegalArgumentException("I am caught"));

    Producer producer = endpoint.createProducer();
    producer.start();
    producer.process(exchange);
    producer.stop();
}