Search in sources :

Example 16 with EndpointConfiguration

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

the class FtpComponentConfigurationAndDocumentationTest method testComponentConfiguration.

@Test
public void testComponentConfiguration() throws Exception {
    FtpComponent comp = context.getComponent("ftp", FtpComponent.class);
    EndpointConfiguration conf = comp.createConfiguration("ftp://myhost?username=foo&password=secret&soTimeout=1234");
    assertEquals("foo", conf.getParameter("username"));
    assertEquals("secret", conf.getParameter("password"));
    assertEquals("1234", conf.getParameter("soTimeout"));
    ComponentConfiguration compConf = comp.createComponentConfiguration();
    String json = compConf.createParameterJsonSchema();
    assertNotNull(json);
    assertTrue(json.contains("\"minDepth\": { \"kind\": \"parameter\", \"displayName\": \"Min Depth\", \"group\": \"filter\", \"label\": \"consumer,filter\", \"type\": \"integer\", \"javaType\": \"int\""));
    assertTrue(json.contains("\"username\": { \"kind\": \"parameter\", \"displayName\": \"Username\", \"group\": \"security\", \"label\": \"security\", \"type\": \"string\""));
}
Also used : ComponentConfiguration(org.apache.camel.ComponentConfiguration) EndpointConfiguration(org.apache.camel.EndpointConfiguration) FtpComponent(org.apache.camel.component.file.remote.FtpComponent) Test(org.junit.Test)

Example 17 with EndpointConfiguration

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

the class LogComponentConfigurationAndDocumentationTest method testComponentConfiguration.

@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\", \"displayName\": \"Logger Name\", \"group\": \"producer\", \"required\": true"));
    assertTrue(json.contains("\"level\": { \"kind\": \"parameter\", \"displayName\": \"Level\", \"group\": \"producer\", \"type\": \"string\""));
    assertTrue(json.contains("\"showBody\": { \"kind\": \"parameter\", \"displayName\": \"Show Body\", \"group\": \"formatting\", \"label\": \"formatting\""));
}
Also used : ComponentConfiguration(org.apache.camel.ComponentConfiguration) EndpointConfiguration(org.apache.camel.EndpointConfiguration) LogComponent(org.apache.camel.component.log.LogComponent) Test(org.junit.Test)

Example 18 with EndpointConfiguration

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

the class MockComponentConfigurationAndDocumentationTest method testComponentConfiguration.

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

Example 19 with EndpointConfiguration

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

the class SedaComponentConfigurationAndDocumentationTest method testComponentConfiguration.

@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\", \"displayName\": \"Concurrent Consumers\", \"group\": \"consumer\", \"label\": \"consumer\""));
    assertTrue(json.contains("\"timeout\": { \"kind\": \"parameter\", \"displayName\": \"Timeout\", \"group\": \"producer\", \"label\": \"producer\""));
}
Also used : ComponentConfiguration(org.apache.camel.ComponentConfiguration) SedaComponent(org.apache.camel.component.seda.SedaComponent) EndpointConfiguration(org.apache.camel.EndpointConfiguration) Test(org.junit.Test)

Example 20 with EndpointConfiguration

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

the class EndpointConfigurationTest method testConfigurationEquals.

@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);
}
Also used : 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