Search in sources :

Example 1 with MockComponent

use of org.apache.camel.component.mock.MockComponent in project camel by apache.

the class ManagedCustomComponentNameTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            context.addComponent("foo", new MockComponent());
            from("direct:start").to("foo:foo").to("mock:result");
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) MockComponent(org.apache.camel.component.mock.MockComponent)

Example 2 with MockComponent

use of org.apache.camel.component.mock.MockComponent in project camel by apache.

the class RecipientListInterceptSendToEndpointException method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            // simulate ftp/http using mocks
            context.addComponent("ftp", new MockComponent());
            context.addComponent("http", new MockComponent());
            interceptSendToEndpoint("(ftp|http):.*").to("log:intercept").to("mock:intercept");
            from("direct:start").recipientList(header("foo")).parallelProcessing().to("mock:end");
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) MockComponent(org.apache.camel.component.mock.MockComponent)

Example 3 with MockComponent

use of org.apache.camel.component.mock.MockComponent in project camel by apache.

the class MockComponentAutoConfiguration method configureMockComponent.

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

use of org.apache.camel.component.mock.MockComponent 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 5 with MockComponent

use of org.apache.camel.component.mock.MockComponent in project ddf by codice.

the class ContentDirectoryMonitorTest method setup.

@Before
public void setup() throws Exception {
    monitoredDirectory = temporaryFolder.newFolder("inbox");
    monitoredDirectoryPath = monitoredDirectory.getCanonicalPath();
    camelContext = super.createCamelContext();
    camelContext.start();
    MockComponent contentComponent = new MockComponent();
    camelContext.addComponent("content", contentComponent);
    MockComponent catalogComponent = new MockComponent();
    camelContext.addComponent("catalog", catalogComponent);
    monitor = createContentDirectoryMonitor();
}
Also used : MockComponent(org.apache.camel.component.mock.MockComponent) Before(org.junit.Before)

Aggregations

MockComponent (org.apache.camel.component.mock.MockComponent)5 RouteBuilder (org.apache.camel.builder.RouteBuilder)2 ComponentConfiguration (org.apache.camel.ComponentConfiguration)1 EndpointConfiguration (org.apache.camel.EndpointConfiguration)1 Before (org.junit.Before)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