public void testRecipientListParallel() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceivedInAnyOrder("c", "b", "a");

    template.sendBodyAndHeader("direct:start", "Hello World", "foo", "direct:a,direct:b,direct:c");

    assertMockEndpointsSatisfied();
  }
  public void testQueue() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World", "Bar");

    template.sendBody("direct:foo", "Hello World");
    template.sendBody("direct:foo", "Bye World");
    template.sendBody("direct:bar", "Bar");
  }
  @Test
  public void testSearchTerm() throws Exception {
    Mailbox mailbox = Mailbox.get("bill@localhost");
    assertEquals(6, mailbox.size());

    // should only get the 4 latest emails that was sent within the last 24 hours
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceivedInAnyOrder(
        "Ordering ActiveMQ in Action",
        "This is spam",
        "We meet at 7pm the usual place",
        "I am attaching you");

    assertMockEndpointsSatisfied();
  }
Exemplo n.º 4
0
  public void testSplitterWithAggregationStrategyParallelStreaming() throws Exception {
    MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
    resultEndpoint.expectedMessageCount(5);
    resultEndpoint.expectedBodiesReceivedInAnyOrder("James", "Guillaume", "Hiram", "Rob", "Roman");

    Exchange result =
        template.request(
            "direct:parallel-streaming",
            new Processor() {
              public void process(Exchange exchange) {
                Message in = exchange.getIn();
                in.setBody("James,Guillaume,Hiram,Rob,Roman");
                in.setHeader("foo", "bar");
              }
            });

    assertMockEndpointsSatisfied();
    Message out = result.getOut();

    assertMessageHeader(out, "foo", "bar");
    assertEquals((Integer) 5, result.getProperty("aggregated", Integer.class));
  }
 @Test
 public void testSplitter() throws InterruptedException {
   MockEndpoint processZipEntry = getMockEndpoint("mock:processZipEntry");
   processZipEntry.expectedBodiesReceivedInAnyOrder("chau", "hi", "hola");
   assertMockEndpointsSatisfied();
 }