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

项目:Camel    文件:DefaultEndpoint.java   
/**
 * A factory method to lazily create the endpoint configuration if none is specified
 */
protected EndpointConfiguration createEndpointConfiguration(String uri) {
    // using this factory method to be backwards compatible with the old code
    if (getComponent() != null) {
        // prefer to use component endpoint configuration
        try {
            return getComponent().createConfiguration(uri);
        } catch (Exception e) {
            throw ObjectHelper.wrapRuntimeCamelException(e);
        }
    } else if (getCamelContext() != null) {
        // fallback and use a mapped endpoint configuration
        return new MappedEndpointConfiguration(getCamelContext(), uri);
    }
    // not configuration possible
    return null;
}
项目:Camel    文件:ConfigurationHelper.java   
public static EndpointConfiguration createConfiguration(String uri, CamelContext context) throws Exception {
    int schemeSeparator = uri.indexOf(':');
    if (schemeSeparator == -1) {
        // not an URIConfiguration
        return null;
    }
    String scheme = uri.substring(0, schemeSeparator);

    Component component = context.getComponent(scheme);
    if (LOG.isTraceEnabled()) {
        LOG.trace("Lookup for Component handling \"{}:\" configuration returned {}",
            new Object[]{scheme, component != null ? component.getClass().getName() : "<null>"});
    }
    if (component != null) {
        EndpointConfiguration config = component.createConfiguration(scheme);
        if (config instanceof DefaultEndpointConfiguration) {
            ((DefaultEndpointConfiguration) config).setURI(uri);
        }
        return config;
    } else {
        // no component to create the configuration
        return null;
    }
}
项目:Camel    文件:ConfigurationHelper.java   
public static void populateFromURI(CamelContext camelContext, EndpointConfiguration config, ParameterSetter setter) {
    URI uri = config.getURI();

    setter.set(camelContext, config, EndpointConfiguration.URI_SCHEME, uri.getScheme());
    setter.set(camelContext, config, EndpointConfiguration.URI_SCHEME_SPECIFIC_PART, uri.getSchemeSpecificPart());
    setter.set(camelContext, config, EndpointConfiguration.URI_AUTHORITY, uri.getAuthority());
    setter.set(camelContext, config, EndpointConfiguration.URI_USER_INFO, uri.getUserInfo());
    setter.set(camelContext, config, EndpointConfiguration.URI_HOST, uri.getHost());
    setter.set(camelContext, config, EndpointConfiguration.URI_PORT, Integer.toString(uri.getPort()));
    setter.set(camelContext, config, EndpointConfiguration.URI_PATH, uri.getPath());
    setter.set(camelContext, config, EndpointConfiguration.URI_QUERY, uri.getQuery());
    setter.set(camelContext, config, EndpointConfiguration.URI_FRAGMENT, uri.getFragment());

    // now parse query and set custom parameters
    Map<String, Object> parameters;
    try {
        parameters = URISupport.parseParameters(uri);
        for (Map.Entry<String, Object> pair : parameters.entrySet()) {
            setter.set(camelContext, config, pair.getKey(), pair.getValue());
        }
    } catch (URISyntaxException e) {
        throw new RuntimeCamelException(e);
    }
}
项目:Camel    文件:ConfigurationHelper.java   
public static Field findConfigurationField(EndpointConfiguration config, String name) {
    if (config != null && name != null) {
        Class<?> clazz = config.getClass();
        Field[] fields = clazz.getDeclaredFields();

        Field found;
        URIField anno;
        for (final Field field : fields) {
            anno = field.getAnnotation(URIField.class);
            if (anno == null ? field.getName().equals(name) : anno.component().equals(name) 
                || (anno.component().equals(EndpointConfiguration.URI_QUERY) && anno.parameter().equals(name))) { 

                found = field;
                LOG.trace("Found field {}.{} as candidate for parameter {}", new Object[]{clazz.getName(), found.getName(), name});
                return found;
            }
        }
    }            
    return null;
}
项目:Camel    文件:DataSetComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    DataSetComponent comp = context.getComponent("dataset", DataSetComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("dataset:foo?minRate=3&produceDelay=33&consumeDelay=333&preloadSize=3333&initialDelay=33333&disableDataSetIndex=true");

    assertEquals("Unexpected endpoint configuration value for minRate", "3", conf.getParameter("minRate"));
    assertEquals("Unexpected endpoint configuration value for produceDelay", "33", conf.getParameter("produceDelay"));
    assertEquals("Unexpected endpoint configuration value for consumeDelay", "333", conf.getParameter("consumeDelay"));
    assertEquals("Unexpected endpoint configuration value for preloadSize", "3333", conf.getParameter("preloadSize"));
    assertEquals("Unexpected endpoint configuration value for initialDelay", "33333", conf.getParameter("initialDelay"));
    assertEquals("Unexpected endpoint configuration value for disableDataSetIndex", "true", conf.getParameter("disableDataSetIndex"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"name\": { \"kind\": \"path\", \"group\": \"common\", \"required\": \"true\", \"type\""));
    assertTrue(json.contains("\"kind\": \"parameter\", \"group\": \"consumer\", \"label\": \"consumer\", \"type\": \"integer\""));
    assertTrue(json.contains("\"retainFirst\": { \"kind\": \"parameter\", \"group\": \"producer\", \"label\": \"producer\", \"type\": \"integer"));
}
项目:Camel    文件:DataFormatComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    DataFormatComponent comp = context.getComponent("dataformat", DataFormatComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("dataformaat:marshal:string?charset=iso-8859-1");

    assertEquals("iso-8859-1", conf.getParameter("charset"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"name\": { \"kind\": \"path\", \"group\": \"producer\", \"required\": \"true\", \"type\": \"string\", \"javaType\": \"java.lang.String\","
                    + " \"deprecated\": \"false\", \"description\": \"Name of data format\" }"));
    assertTrue(json.contains("\"operation\": { \"kind\": \"path\", \"group\": \"producer\", \"required\": \"true\", \"type\": \"string\""));
    assertTrue(json.contains("\"synchronous\": { \"kind\": \"parameter\", \"group\": \"advanced\", \"label\": \"advanced\", \"type\": \"boolean\""));
}
项目:Camel    文件:FileComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    FileComponent comp = context.getComponent("file", FileComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("file:target/foo?delete=true");

    assertEquals("true", conf.getParameter("delete"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"directoryName\": { \"kind\": \"path\", \"group\": \"common\", \"required\": \"true\""));
    assertTrue(json.contains("\"doneFileName\": { \"kind\": \"parameter\", \"group\": \"producer\", \"label\": \"producer\", \"type\": \"string\""));
    assertTrue(json.contains("\"autoCreate\": { \"kind\": \"parameter\", \"group\": \"advanced\", \"label\": \"advanced\", \"type\": \"boolean\""));
    assertTrue(json.contains("\"readLockMinAge\": { \"kind\": \"parameter\", \"group\": \"lock\", \"label\": \"consumer,lock\""));
}
项目:Camel    文件:UriConfigurationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    CamelContext context = new DefaultCamelContext();

    BeanstalkComponent comp = context.getComponent("beanstalk", BeanstalkComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("beanstalk:tube?command=put");

    assertEquals("put", conf.getParameter("command"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"command\": { \"kind\": \"parameter\", \"group\": \"common\", \"type\": \"string\""));
    assertTrue(json.contains("\"jobTimeToRun\": { \"kind\": \"parameter\", \"group\": \"common\", \"type\": \"integer\""));
    assertTrue(json.contains("\"awaitJob\": { \"kind\": \"parameter\", \"group\": \"consumer\", \"label\": \"consumer\", \"type\": \"boolean\""));
}
项目:Camel    文件:ConfigurationHelper.java   
public static Object getConfigurationParameter(EndpointConfiguration config, Field field) {
    if (field != null) {
        try {
            return IntrospectionSupport.getProperty(config, field.getName());
        } catch (Exception e) {
            throw new RuntimeCamelException("Failed to get property '" + field.getName() + "' on " + config + " due " + e.getMessage(), e);
        }
    }
    return null;
}
项目:Camel    文件:ConfigurationHelper.java   
public static <T> void setConfigurationField(CamelContext camelContext, EndpointConfiguration config, String name, T value) {
    Field field = findConfigurationField(config, name);
    if (field == null) {
        return;
    }

    try {
        IntrospectionSupport.setProperty(camelContext.getTypeConverter(), config, name, value);
    } catch (Exception e) {
        throw new RuntimeCamelException("Failed to set property '" + name + "' on " + config + " due " + e.getMessage(), e);
    }
}
项目:Camel    文件:MappedEndpointConfiguration.java   
@Override
protected void parseURI() {
    ConfigurationHelper.populateFromURI(getCamelContext(), this, new ConfigurationHelper.ParameterSetter() {
        @Override
        public <T> void set(CamelContext camelContext, EndpointConfiguration config, String name, T value) {
            if (name != null && value != null) {
                params.put(name, value);
            }
        }
    });
}
项目:Camel    文件:ConfigurationHelperTest.java   
@Test
public void testUrnNoQuery() throws Exception {
    EndpointConfiguration cfg = ConfigurationHelper.createConfiguration("uri-dump:foo", context);
    logConfigurationObject(cfg);
    assertEquals(URIDUMP_SCHEME, cfg.getParameter(EndpointConfiguration.URI_SCHEME));
    assertEquals("foo", cfg.getParameter(EndpointConfiguration.URI_SCHEME_SPECIFIC_PART));
    assertEquals("URNs don't set the authority field", null, cfg.getParameter(EndpointConfiguration.URI_AUTHORITY));
    assertEquals("URNs don't set the userInfo field", null, cfg.getParameter(EndpointConfiguration.URI_USER_INFO));
    assertEquals("URNs don't set the host field", null, cfg.getParameter(EndpointConfiguration.URI_HOST));
    assertEquals("URNs don't set the port field", Integer.valueOf(-1), cfg.getParameter(EndpointConfiguration.URI_PORT));
    assertEquals("URNs don't set the path field", null, cfg.getParameter(EndpointConfiguration.URI_PATH));
    assertEquals("URNs don't set the query field", null, cfg.getParameter(EndpointConfiguration.URI_QUERY));
    assertEquals("URNs don't set the fragment field", null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
}
项目:Camel    文件:ConfigurationHelperTest.java   
@Test
public void testUrlSimple() throws Exception {
    EndpointConfiguration cfg = ConfigurationHelper.createConfiguration("uri-dump://foo", context);
    logConfigurationObject(cfg);
    assertEquals(URIDUMP_SCHEME, cfg.getParameter(EndpointConfiguration.URI_SCHEME));
    assertEquals("//foo", cfg.getParameter(EndpointConfiguration.URI_SCHEME_SPECIFIC_PART));
    assertEquals("foo", cfg.getParameter(EndpointConfiguration.URI_AUTHORITY));
    assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_USER_INFO));
    assertEquals("foo", cfg.getParameter(EndpointConfiguration.URI_HOST));
    assertEquals(Integer.valueOf(-1), cfg.getParameter(EndpointConfiguration.URI_PORT));
    assertEquals("", cfg.getParameter(EndpointConfiguration.URI_PATH));
    assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_QUERY));
    assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
}
项目:Camel    文件:ConfigurationHelperTest.java   
@Test
public void testUrlWithPath() throws Exception {
    EndpointConfiguration cfg = ConfigurationHelper.createConfiguration("uri-dump://foo/bar#defrag", context);
    logConfigurationObject(cfg);
    assertEquals(URIDUMP_SCHEME, cfg.getParameter(EndpointConfiguration.URI_SCHEME));
    assertEquals("//foo/bar#defrag", cfg.getParameter(EndpointConfiguration.URI_SCHEME_SPECIFIC_PART));
    assertEquals("foo", cfg.getParameter(EndpointConfiguration.URI_AUTHORITY));
    assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_USER_INFO));
    assertEquals("foo", cfg.getParameter(EndpointConfiguration.URI_HOST));
    assertEquals(Integer.valueOf(-1), cfg.getParameter(EndpointConfiguration.URI_PORT));
    assertEquals("/bar#defrag", cfg.getParameter(EndpointConfiguration.URI_PATH));
    assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_QUERY));
    assertEquals(null, cfg.getParameter(EndpointConfiguration.URI_FRAGMENT));
}
项目:Camel    文件:ConfigurationHelperTest.java   
@Test
public void testConfigurationFormat() throws Exception {
    EndpointConfiguration config = ConfigurationHelper.createConfiguration("uri-dump:foo", context);
    assertEquals(null, config.toUriString(EndpointConfiguration.UriFormat.Canonical));
    assertEquals(null, config.toUriString(EndpointConfiguration.UriFormat.Provider));
    assertEquals(null, config.toUriString(EndpointConfiguration.UriFormat.Consumer));
    assertEquals(null, config.toUriString(EndpointConfiguration.UriFormat.Complete));
}
项目:Camel    文件:ConfigurationHelperTest.java   
@Test
public void testDummyConfiguration() throws Exception {

    String configUri = "dummy://foobar?first=one&second=2";

    EndpointConfiguration config = ConfigurationHelper.createConfiguration(configUri, context);
    assertNotNull(config);
    assertTrue(config instanceof DummyConfiguration);
    assertEquals("one", config.getParameter("first"));
    assertEquals(Integer.valueOf(2), config.getParameter("second"));
}
项目:Camel    文件:ConfigurationHelperTest.java   
protected static void logConfigurationObject(EndpointConfiguration config) {
    if (config == null) {
        return;
    }
    LOG.info("{} [", config.getClass().getCanonicalName()); 
    LOG.info("  uri={}", config.getURI().toASCIIString()); 
    LOG.info("  fields:"); 

    Class<?> clazz = config.getClass();
    Field[] fields = clazz.getDeclaredFields();

    // Put the Fields in a Map first for a prettier print
    Map<String, Field> map = new HashMap<String, Field>();

    URIField anno = null;
    for (final Field field : fields) {
        anno = field.getAnnotation(URIField.class);
        String key = anno == null ? field.getName() 
            : (EndpointConfiguration.URI_QUERY.equals(anno.parameter()) ? anno.parameter() : anno.component());
        map.put(key, field);
    }

    // Log standard URI components and remove them from the map
    logConfigurationField(config, map, EndpointConfiguration.URI_SCHEME, true);
    logConfigurationField(config, map, EndpointConfiguration.URI_SCHEME_SPECIFIC_PART, true);
    logConfigurationField(config, map, EndpointConfiguration.URI_AUTHORITY, true);
    logConfigurationField(config, map, EndpointConfiguration.URI_USER_INFO, true);
    logConfigurationField(config, map, EndpointConfiguration.URI_HOST, true);
    logConfigurationField(config, map, EndpointConfiguration.URI_PORT, true);
    logConfigurationField(config, map, EndpointConfiguration.URI_PATH, true);
    logConfigurationField(config, map, EndpointConfiguration.URI_QUERY, true);
    logConfigurationField(config, map, EndpointConfiguration.URI_FRAGMENT, true);

    // Log all other fields
    for (Field f : map.values()) {
        logConfigurationField(config, f);
    }
    LOG.info("]"); 
}
项目:Camel    文件:ConfigurationHelperTest.java   
protected static void logConfigurationField(EndpointConfiguration config, Field field) {
    if (field == null) {
        return;
    }
    URIField anno = field.getAnnotation(URIField.class);
    if (anno != null) {
        LOG.info("  @URIField(component = \"{}\", parameter = \"{}\")", anno.component(), anno.parameter());
    }
    LOG.info("  {} {}={}", new Object[] {field.getType().getName(), field.getName(), config.getParameter(field.getName())});
}
项目:Camel    文件:ConfigurationHelperTest.java   
@Override
public EndpointConfiguration createConfiguration(String uri) throws Exception {
    if (uri.equals(URIDUMP_SCHEME)) {
        return new UriDumpConfiguration(getCamelContext());
    } else if (uri.equals(DUMMY_SCHEME)) {
        return new DummyConfiguration(getCamelContext());
    }
    return null;
}
项目:Camel    文件:EndpointConfigurationTest.java   
@Test
public void testConfigurationEquals() throws Exception {
    EndpointConfiguration cfg1 = ConfigurationHelper.createConfiguration("mapped://foo?one=true&two=2", context);
    EndpointConfiguration cfg2 = ConfigurationHelper.createConfiguration("mapped://foo?two=2&one=true", context);
    String uri1 = cfg1.toUriString(EndpointConfiguration.UriFormat.Complete);
    String uri2 = cfg2.toUriString(EndpointConfiguration.UriFormat.Complete);
    assertEquals("Query parameter order should not matter", uri1, uri2);
}
项目:Camel    文件:EndpointConfigurationTest.java   
@Test
@Ignore("Fails due CAMEL-5183")
public void testConfigurationPortParameter() throws Exception {
    EndpointConfiguration cfg1 = ConfigurationHelper.createConfiguration("mapped://foo:8080?one=true&two=2&port=123", context);
    String uri1 = cfg1.toUriString(EndpointConfiguration.UriFormat.Complete);
    assertEquals("mapped://foo:8080?one=true&port=123&two=2", uri1);
}
项目:Camel    文件:XsltComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    XsltComponent comp = context.getComponent("xslt", XsltComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("xslt:foo?deleteOutputFile=true");

    assertEquals("true", conf.getParameter("deleteOutputFile"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"resourceUri\": { \"kind\": \"path\", \"group\": \"producer\", \"required\": \"true\""));
    assertTrue(json.contains("\"allowStAX\": { \"kind\": \"parameter\", \"group\": \"producer\", \"type\": \"boolean\""));
    assertTrue(json.contains("\"transformerFactoryClass\": { \"kind\": \"parameter\", \"group\": \"advanced\", \"label\": \"advanced\""));
}
项目:Camel    文件:MockComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    MockComponent comp = context.getComponent("mock", MockComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("mock:foo?retainFirst=10");

    assertEquals("10", conf.getParameter("retainFirst"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"name\": { \"kind\": \"path\", \"group\": \"producer\", \"required\": \"true\""));
    assertTrue(json.contains("\"expectedCount\": { \"kind\": \"parameter\", \"group\": \"producer\", \"label\": \"producer\""));
    assertTrue(json.contains("\"retainFirst\": { \"kind\": \"parameter\", \"group\": \"producer\", \"label\": \"producer\""));
}
项目:Camel    文件:SedaComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    SedaComponent comp = context.getComponent("seda", SedaComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("seda:foo?blockWhenFull=true");

    assertEquals("true", conf.getParameter("blockWhenFull"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"concurrentConsumers\": { \"kind\": \"parameter\", \"group\": \"consumer\", \"label\": \"consumer\""));
    assertTrue(json.contains("\"timeout\": { \"kind\": \"parameter\", \"group\": \"producer\", \"label\": \"producer\""));
}
项目:Camel    文件:DirectVmComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    DirectVmComponent comp = context.getComponent("direct-vm", DirectVmComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("direct-vm:foo?block=false");

    assertEquals("false", conf.getParameter("block"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"name\": { \"kind\": \"path\", \"group\": \"common\", \"required\": \"true\", \"type\": \"string\""));
    assertTrue(json.contains("\"timeout\": { \"kind\": \"parameter\", \"group\": \"producer\", \"label\": \"producer\", \"type\": \"integer\""));
}
项目:Camel    文件:LogComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    LogComponent comp = context.getComponent("log", LogComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("log:foo?level=DEBUG");

    assertEquals("DEBUG", conf.getParameter("level"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"loggerName\": { \"kind\": \"path\", \"group\": \"producer\", \"required\": \"true\""));
    assertTrue(json.contains("\"level\": { \"kind\": \"parameter\", \"group\": \"producer\", \"type\": \"string\""));
    assertTrue(json.contains("\"showBody\": { \"kind\": \"parameter\", \"group\": \"formatting\", \"label\": \"formatting\""));
}
项目:Camel    文件:DirectComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    DirectComponent comp = context.getComponent("direct", DirectComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("direct:foo?block=true");

    assertEquals("true", conf.getParameter("block"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"name\": { \"kind\": \"path\", \"group\": \"common\", \"required\": \"true\", \"type\": \"string\""));
    assertTrue(json.contains("\"timeout\": { \"kind\": \"parameter\", \"group\": \"producer\", \"label\": \"producer\", \"type\": \"integer\""));
}
项目:Camel    文件:LanguageComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    LanguageComponent comp = context.getComponent("language", LanguageComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("language:simple:foo?transform=false");

    assertEquals("false", conf.getParameter("transform"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"languageName\": { \"kind\": \"path\", \"group\": \"producer\", \"required\": \"true\""));
    assertTrue(json.contains("\"script\": { \"kind\": \"parameter\", \"group\": \"producer\", \"type\": \"string\""));
}
项目:Camel    文件:BrowseComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    BrowseComponent comp = context.getComponent("browse", BrowseComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("browse:seda:foo?synchronous=true");

    assertEquals("true", conf.getParameter("synchronous"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"name\": { \"kind\": \"path\", \"group\": \"common\", \"required\": \"true\", \"type\": \"string\""));
    assertTrue(json.contains("\"synchronous\": { \"kind\": \"parameter\", \"group\": \"advanced\", \"label\": \"advanced\", \"type\": \"boolean\""));
}
项目:Camel    文件:TestComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    TestComponent comp = context.getComponent("test", TestComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("test:my:foo?timeout=1000");

    assertEquals("1000", conf.getParameter("timeout"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"name\": { \"kind\": \"path\", \"group\": \"producer\", \"required\": \"true\""));
    assertTrue(json.contains("\"retainFirst\": { \"kind\": \"parameter\", \"group\": \"producer\", \"label\": \"producer\""));
}
项目:Camel    文件:TimerComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    TimerComponent comp = context.getComponent("timer", TimerComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("timer:foo?period=2000");

    assertEquals("2000", conf.getParameter("period"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"timerName\": { \"kind\": \"path\", \"group\": \"consumer\", \"required\": \"true\""));
    assertTrue(json.contains("\"delay\": { \"kind\": \"parameter\", \"group\": \"consumer\", \"type\": \"integer\""));
    assertTrue(json.contains("\"timer\": { \"kind\": \"parameter\", \"group\": \"advanced\", \"label\": \"advanced\""));
}
项目:Camel    文件:BeanComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    BeanComponent comp = context.getComponent("bean", BeanComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("bean:foo?method=bar");

    assertEquals("bar", conf.getParameter("method"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"method\": { \"kind\": \"parameter\", \"group\": \"producer\", \"type\": \"string\""));
    assertTrue(json.contains("\"cache\": { \"kind\": \"parameter\", \"group\": \"advanced\", \"label\": \"advanced\", \"type\": \"boolean\""));
}
项目:Camel    文件:ControlBusComponentConfigurationAndDocumentationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    ControlBusComponent comp = context.getComponent("controlbus", ControlBusComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("controlbus:route?routeId=bar&action=stop");

    assertEquals("bar", conf.getParameter("routeId"));
    assertEquals("stop", conf.getParameter("action"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    assertTrue(json.contains("\"action\": { \"kind\": \"parameter\", \"group\": \"producer\", \"type\": \"string\""));
    assertTrue(json.contains("\"async\": { \"kind\": \"parameter\", \"group\": \"producer\", \"type\": \"boolean\""));
}
项目:Camel    文件:UriConfigurationTest.java   
@Test
public void testComponentConfiguration() throws Exception {
    TwitterComponent comp = context.getComponent("twitter", TwitterComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("twitter:search?keywords=camel");

    assertEquals("camel", conf.getParameter("keywords"));

    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);

    // REVIST this comparison test may be sensitive to some changes.
    assertTrue(json.contains("\"accessToken\": { \"kind\": \"parameter\", \"group\": \"common\", \"type\": \"string\""));
    assertTrue(json.contains("\"consumerKey\": { \"kind\": \"parameter\", \"group\": \"common\", \"type\": \"string\""));
}
项目:syndesis    文件:RecordSplitterEndpoint.java   
@Override
public EndpointConfiguration getEndpointConfiguration() {
    return endpoint.getEndpointConfiguration();
}
项目:Camel    文件:DefaultEndpoint.java   
public EndpointConfiguration getEndpointConfiguration() {
    if (endpointConfiguration == null) {
        endpointConfiguration = createEndpointConfiguration(getEndpointUri());
    }
    return endpointConfiguration;
}
项目:Camel    文件:DefaultComponent.java   
public EndpointConfiguration createConfiguration(String uri) throws Exception {
    MappedEndpointConfiguration config = new MappedEndpointConfiguration(getCamelContext());
    config.setURI(new URI(uri));
    return config;
}
项目:Camel    文件:ConfigurationHelper.java   
public static Object getConfigurationParameter(EndpointConfiguration config, String name) {
    Field field = findConfigurationField(config, name);
    return getConfigurationParameter(config, field);
}