Search in sources :

Example 1 with TestComponent

use of org.apache.camel.component.test.TestComponent in project camel by apache.

the class TestComponentAutoConfiguration method configureTestComponent.

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

use of org.apache.camel.component.test.TestComponent 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)

Aggregations

TestComponent (org.apache.camel.component.test.TestComponent)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