Search in sources :

Example 1 with FtpComponent

use of org.apache.camel.component.file.remote.FtpComponent in project camel by apache.

the class FtpComponentAutoConfiguration method configureFtpComponent.

@Lazy
@Bean(name = "ftp-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(FtpComponent.class)
public FtpComponent configureFtpComponent(CamelContext camelContext) throws Exception {
    FtpComponent component = new FtpComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : FtpComponent(org.apache.camel.component.file.remote.FtpComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with FtpComponent

use of org.apache.camel.component.file.remote.FtpComponent 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)

Aggregations

FtpComponent (org.apache.camel.component.file.remote.FtpComponent)2 ComponentConfiguration (org.apache.camel.ComponentConfiguration)1 EndpointConfiguration (org.apache.camel.EndpointConfiguration)1 Test (org.junit.Test)1 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1 Lazy (org.springframework.context.annotation.Lazy)1