Search in sources :

Example 66 with MockEndpoint

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

the class SshComponentConsumerTest method testPollingConsumer.

@Test
public void testPollingConsumer() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMinimumMessageCount(1);
    mock.expectedBodiesReceived("test\r");
    mock.expectedHeaderReceived(SshResult.EXIT_VALUE, 0);
    mock.expectedHeaderReceived(SshResult.STDERR, "Error:test\r");
    assertMockEndpointsSatisfied();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 67 with MockEndpoint

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

the class SshComponentProducerTest method testReconnect.

@Test
public void testReconnect() throws Exception {
    final String msg = "test\n";
    MockEndpoint mock = getMockEndpoint("mock:password");
    mock.expectedMinimumMessageCount(1);
    mock.expectedBodiesReceived(msg);
    template.sendBody("direct:ssh", msg);
    assertMockEndpointsSatisfied();
    sshd.stop();
    sshd.start();
    mock.reset();
    mock.expectedMinimumMessageCount(1);
    mock.expectedBodiesReceived(msg);
    template.sendBody("direct:ssh", msg);
    assertMockEndpointsSatisfied();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 68 with MockEndpoint

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

the class SshComponentSecurityTest method testRsa.

@Test
public void testRsa() throws Exception {
    final String msg = "test\n";
    MockEndpoint mock = getMockEndpoint("mock:rsa");
    mock.expectedMinimumMessageCount(1);
    mock.expectedBodiesReceived(msg);
    template.sendBody("direct:ssh-rsa", msg);
    assertMockEndpointsSatisfied();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 69 with MockEndpoint

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

the class SshComponentSecurityTest method testRsaFile.

@Test
public void testRsaFile() throws Exception {
    final String msg = "test\n";
    MockEndpoint mock = getMockEndpoint("mock:rsaFile");
    mock.expectedMinimumMessageCount(1);
    mock.expectedBodiesReceived(msg);
    template.sendBody("direct:ssh-rsaFile", msg);
    assertMockEndpointsSatisfied();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 70 with MockEndpoint

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

the class JdbcAggregateSerializedHeadersTest method testLoadTestJdbcAggregate.

@Test
public void testLoadTestJdbcAggregate() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMinimumMessageCount(1);
    mock.setResultWaitTime(50 * 1000);
    LOG.info("Staring to send " + SIZE + " messages.");
    for (int i = 0; i < SIZE; i++) {
        final int value = 1;
        HeaderDto headerDto = new HeaderDto("org", "company", 1);
        LOG.debug("Sending {} with id {}", value, headerDto);
        template.sendBodyAndHeader("seda:start?size=" + SIZE, value, "id", headerDto);
    }
    LOG.info("Sending all " + SIZE + " message done. Now waiting for aggregation to complete.");
    assertMockEndpointsSatisfied();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) HeaderDto(org.apache.camel.processor.aggregate.jdbc.util.HeaderDto) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Aggregations

MockEndpoint (org.apache.camel.component.mock.MockEndpoint)3401 Test (org.junit.Test)2024 Exchange (org.apache.camel.Exchange)511 RouteBuilder (org.apache.camel.builder.RouteBuilder)302 Processor (org.apache.camel.Processor)148 File (java.io.File)144 HashMap (java.util.HashMap)130 ObjectName (javax.management.ObjectName)90 MBeanServer (javax.management.MBeanServer)85 Message (org.apache.camel.Message)85 InputStream (java.io.InputStream)73 ArrayList (java.util.ArrayList)63 CamelExecutionException (org.apache.camel.CamelExecutionException)63 List (java.util.List)57 CamelContext (org.apache.camel.CamelContext)57 ProducerTemplate (org.apache.camel.ProducerTemplate)51 Tx (org.nhindirect.common.tx.model.Tx)49 ByteArrayInputStream (java.io.ByteArrayInputStream)47 Map (java.util.Map)43 RuntimeCamelException (org.apache.camel.RuntimeCamelException)38