Search in sources :

Example 1 with LanguageComponent

use of org.apache.camel.component.language.LanguageComponent in project camel by apache.

the class LanguageComponentConfigurationAndDocumentationTest method testComponentConfiguration.

@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\", \"displayName\": \"Language Name\", \"group\": \"producer\", \"required\": true"));
    assertTrue(json.contains("\"script\": { \"kind\": \"parameter\", \"displayName\": \"Script\", \"group\": \"producer\", \"type\": \"string\""));
}
Also used : ComponentConfiguration(org.apache.camel.ComponentConfiguration) LanguageComponent(org.apache.camel.component.language.LanguageComponent) EndpointConfiguration(org.apache.camel.EndpointConfiguration) Test(org.junit.Test)

Example 2 with LanguageComponent

use of org.apache.camel.component.language.LanguageComponent in project camel by apache.

the class LanguageComponentAutoConfiguration method configureLanguageComponent.

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

LanguageComponent (org.apache.camel.component.language.LanguageComponent)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