Search in sources :

Example 6 with EndpointConfiguration

use of org.apache.camel.EndpointConfiguration in project camel by apache.

the class TestComponentConfigurationAndDocumentationTest method testComponentConfiguration.

@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\", \"displayName\": \"Name\", \"group\": \"producer\", \"required\": true"));
    assertTrue(json.contains("\"retainFirst\": { \"kind\": \"parameter\", \"displayName\": \"Retain First\", \"group\": \"producer\", \"label\": \"producer\""));
}
Also used : ComponentConfiguration(org.apache.camel.ComponentConfiguration) TestComponent(org.apache.camel.component.test.TestComponent) EndpointConfiguration(org.apache.camel.EndpointConfiguration) Test(org.junit.Test)

Example 7 with EndpointConfiguration

use of org.apache.camel.EndpointConfiguration in project camel by apache.

the class ConfigurationHelperTest method testUrlWithPath.

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

Example 8 with EndpointConfiguration

use of org.apache.camel.EndpointConfiguration in project camel by apache.

the class ConfigurationHelperTest method testUrlSimple.

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

Example 9 with EndpointConfiguration

use of org.apache.camel.EndpointConfiguration in project camel by apache.

the class EndpointConfigurationTest method testConfigurationPortParameter.

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

Example 10 with EndpointConfiguration

use of org.apache.camel.EndpointConfiguration in project camel by apache.

the class BeanComponentConfigurationAndDocumentationTest method testComponentConfiguration.

@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\", \"displayName\": \"Method\", \"group\": \"producer\", \"type\": \"string\""));
    assertTrue(json.contains("\"cache\": { \"kind\": \"parameter\", \"displayName\": \"Cache\", \"group\": \"advanced\", \"label\": \"advanced\", \"type\": \"boolean\""));
}
Also used : ComponentConfiguration(org.apache.camel.ComponentConfiguration) BeanComponent(org.apache.camel.component.bean.BeanComponent) EndpointConfiguration(org.apache.camel.EndpointConfiguration) Test(org.junit.Test)

Aggregations

EndpointConfiguration (org.apache.camel.EndpointConfiguration)27 Test (org.junit.Test)26 ComponentConfiguration (org.apache.camel.ComponentConfiguration)16 Component (org.apache.camel.Component)1 BeanComponent (org.apache.camel.component.bean.BeanComponent)1 BrowseComponent (org.apache.camel.component.browse.BrowseComponent)1 ControlBusComponent (org.apache.camel.component.controlbus.ControlBusComponent)1 DataFormatComponent (org.apache.camel.component.dataformat.DataFormatComponent)1 DataSetComponent (org.apache.camel.component.dataset.DataSetComponent)1 DirectComponent (org.apache.camel.component.direct.DirectComponent)1 DirectVmComponent (org.apache.camel.component.directvm.DirectVmComponent)1 FileComponent (org.apache.camel.component.file.FileComponent)1 FtpComponent (org.apache.camel.component.file.remote.FtpComponent)1 LanguageComponent (org.apache.camel.component.language.LanguageComponent)1 LogComponent (org.apache.camel.component.log.LogComponent)1 MockComponent (org.apache.camel.component.mock.MockComponent)1 SedaComponent (org.apache.camel.component.seda.SedaComponent)1 TestComponent (org.apache.camel.component.test.TestComponent)1 TimerComponent (org.apache.camel.component.timer.TimerComponent)1 XsltComponent (org.apache.camel.component.xslt.XsltComponent)1