當前位置: 首頁>>代碼示例>>Java>>正文


Java Endpoint類代碼示例

本文整理匯總了Java中org.apache.camel.Endpoint的典型用法代碼示例。如果您正苦於以下問題:Java Endpoint類的具體用法?Java Endpoint怎麽用?Java Endpoint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Endpoint類屬於org.apache.camel包,在下文中一共展示了Endpoint類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createEndpoint

import org.apache.camel.Endpoint; //導入依賴的package包/類
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;
}
 
開發者ID:atlasmap,項目名稱:camel-atlasmap,代碼行數:18,代碼來源:AtlasComponent.java

示例2: shouldPassSpecificationToRestSwaggerComponent

import org.apache.camel.Endpoint; //導入依賴的package包/類
@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");
    });
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:21,代碼來源:SwaggerConnectorComponentTest.java

示例3: createEndpoint

import org.apache.camel.Endpoint; //導入依賴的package包/類
@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;
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:26,代碼來源:SalesforceConnector.java

示例4: createEndpoint

import org.apache.camel.Endpoint; //導入依賴的package包/類
@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;
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:24,代碼來源:ComponentProxyComponent.java

示例5: testConfiguration

import org.apache.camel.Endpoint; //導入依賴的package包/類
@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());
}
 
開發者ID:syndesisio,項目名稱:connectors,代碼行數:20,代碼來源:TwitterSearchConnectorTest.java

示例6: testConfiguration

import org.apache.camel.Endpoint; //導入依賴的package包/類
@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());
}
 
開發者ID:syndesisio,項目名稱:connectors,代碼行數:19,代碼來源:TwitterMentionConnectorTest.java

示例7: testValueConfiguration

import org.apache.camel.Endpoint; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:24,代碼來源:TimerReferenceConfigurationTest.java

示例8: createEndpoint

import org.apache.camel.Endpoint; //導入依賴的package包/類
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;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:21,代碼來源:SnsComponent.java

示例9: prepareFtpServer

import org.apache.camel.Endpoint; //導入依賴的package包/類
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());
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:17,代碼來源:FromFtpTwoSlashesIssueTest.java

示例10: testReferenceConfiguration

import org.apache.camel.Endpoint; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:25,代碼來源:TimerReferenceConfigurationTest.java

示例11: acquireProducer

import org.apache.camel.Endpoint; //導入依賴的package包/類
@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;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:21,代碼來源:EmptyProducerCache.java

示例12: prepareFtpServer

import org.apache.camel.Endpoint; //導入依賴的package包/類
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
    String ftpUrl = "ftp://[email protected]:" + getPort() + "/incoming/data1/?password=admin&binary=true";
    Endpoint endpoint = context.getEndpoint(ftpUrl);
    Exchange exchange = endpoint.createExchange();
    exchange.getIn().setBody(IOConverter.toFile("src/test/data/ftpbinarytest/logo1.jpeg"));
    exchange.getIn().setHeader(Exchange.FILE_NAME, "logo1.jpeg");
    Producer producer = endpoint.createProducer();
    producer.start();
    producer.process(exchange);
    producer.stop();

    ftpUrl = "ftp://[email protected]:" + getPort() + "/incoming/data2/?password=admin&binary=true";
    endpoint = context.getEndpoint(ftpUrl);
    exchange = endpoint.createExchange();
    exchange.getIn().setBody(IOConverter.toFile("src/test/data/ftpbinarytest/logo2.png"));
    exchange.getIn().setHeader(Exchange.FILE_NAME, "logo2.png");
    producer = endpoint.createProducer();
    producer.start();
    producer.process(exchange);
    producer.stop();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:24,代碼來源:FromFtpSetNamesWithMultiDirectoriesTest.java

示例13: testCacheProducerAcquireAndRelease

import org.apache.camel.Endpoint; //導入依賴的package包/類
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();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:20,代碼來源:DefaultProducerCacheTest.java

示例14: createEndpoint

import org.apache.camel.Endpoint; //導入依賴的package包/類
@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;
}
 
開發者ID:flowable,項目名稱:flowable-engine,代碼行數:19,代碼來源:FlowableComponent.java

示例15: testLdapRouteWithPaging

import org.apache.camel.Endpoint; //導入依賴的package包/類
@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());
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:17,代碼來源:LdapRouteTest.java


注:本文中的org.apache.camel.Endpoint類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。