Search in sources :

Example 1 with DataFormatComponent

use of org.apache.camel.component.dataformat.DataFormatComponent in project camel by apache.

the class DataFormatComponentConfigurationAndDocumentationTest method testComponentConfiguration.

@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\", \"displayName\": \"Name\", \"group\": \"producer\", \"required\": true, \"type\": \"string\", \"javaType\": \"java.lang.String\"," + " \"deprecated\": false, \"secret\": false, \"description\": \"Name of data format\" }"));
    assertTrue(json.contains("\"operation\": { \"kind\": \"path\", \"displayName\": \"Operation\", \"group\": \"producer\", \"required\": true, \"type\": \"string\""));
    assertTrue(json.contains("\"synchronous\": { \"kind\": \"parameter\", \"displayName\": \"Synchronous\", \"group\": \"advanced\", \"label\": \"advanced\", \"type\": \"boolean\""));
}
Also used : DataFormatComponent(org.apache.camel.component.dataformat.DataFormatComponent) ComponentConfiguration(org.apache.camel.ComponentConfiguration) EndpointConfiguration(org.apache.camel.EndpointConfiguration) Test(org.junit.Test)

Example 2 with DataFormatComponent

use of org.apache.camel.component.dataformat.DataFormatComponent in project camel by apache.

the class DataFormatComponentAutoConfiguration method configureDataFormatComponent.

@Lazy
@Bean(name = "dataformat-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(DataFormatComponent.class)
public DataFormatComponent configureDataFormatComponent(CamelContext camelContext) throws Exception {
    DataFormatComponent component = new DataFormatComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : DataFormatComponent(org.apache.camel.component.dataformat.DataFormatComponent) 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)

Aggregations

DataFormatComponent (org.apache.camel.component.dataformat.DataFormatComponent)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