Java Code Examples for org.apache.camel.component.mock.MockEndpoint#expectedPropertyReceived()

The following examples show how to use org.apache.camel.component.mock.MockEndpoint#expectedPropertyReceived() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilteringTest.java    From camel-cookbook-examples with Apache License 2.0 6 votes vote down vote up
@Test
public void testFirstFilter() throws Exception {
    final MockEndpoint mockEndpointC = getMockEndpoint("mock:C");
    mockEndpointC.expectedMessageCount(1);
    mockEndpointC.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    final MockEndpoint mockEndpointAfterC = getMockEndpoint("mock:afterC");
    mockEndpointAfterC.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointAfterC.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    getMockEndpoint("mock:amel").expectedMessageCount(0);

    final MockEndpoint mockEndpointOther = getMockEndpoint("mock:other");
    mockEndpointOther.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointOther.expectedPropertyReceived(Exchange.FILTER_MATCHED, false);

    template.sendBody("direct:start", "Cooks Rocks");

    assertMockEndpointsSatisfied();
}
 
Example 2
Source File: FilteringTest.java    From camel-cookbook-examples with Apache License 2.0 6 votes vote down vote up
@Test
public void testSecondFilter() throws Exception {
    getMockEndpoint("mock:C").expectedMessageCount(0);

    final MockEndpoint mockEndpointAfterC = getMockEndpoint("mock:afterC");
    mockEndpointAfterC.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointAfterC.expectedPropertyReceived(Exchange.FILTER_MATCHED, false);

    final MockEndpoint mockEndpointAmel = getMockEndpoint("mock:amel");
    mockEndpointAmel.expectedMessageCount(1);
    mockEndpointAmel.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    final MockEndpoint mockEndpointOther = getMockEndpoint("mock:other");
    mockEndpointOther.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointOther.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    template.sendBody("direct:start", "amel is in Belgium");

    assertMockEndpointsSatisfied();
}
 
Example 3
Source File: FilteringTest.java    From camel-cookbook-examples with Apache License 2.0 6 votes vote down vote up
@Test
public void testBothFilter() throws Exception {
    final MockEndpoint mockEndpointC = getMockEndpoint("mock:C");
    mockEndpointC.expectedMessageCount(1);
    mockEndpointC.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    final MockEndpoint mockEndpointAfterC = getMockEndpoint("mock:afterC");
    mockEndpointAfterC.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointAfterC.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    final MockEndpoint mockEndpointAmel = getMockEndpoint("mock:amel");
    mockEndpointAmel.expectedMessageCount(1);
    mockEndpointAmel.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    final MockEndpoint mockEndpointOther = getMockEndpoint("mock:other");
    mockEndpointOther.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointOther.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    template.sendBody("direct:start", "Camel Rocks!");

    assertMockEndpointsSatisfied();
}
 
Example 4
Source File: FilteringSpringTest.java    From camel-cookbook-examples with Apache License 2.0 6 votes vote down vote up
@Test
public void testFirstFilter() throws Exception {
    final MockEndpoint mockEndpointC = getMockEndpoint("mock:C");
    mockEndpointC.expectedMessageCount(1);
    mockEndpointC.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    final MockEndpoint mockEndpointAfterC = getMockEndpoint("mock:afterC");
    mockEndpointAfterC.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointAfterC.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    getMockEndpoint("mock:amel").expectedMessageCount(0);

    final MockEndpoint mockEndpointOther = getMockEndpoint("mock:other");
    mockEndpointOther.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointOther.expectedPropertyReceived(Exchange.FILTER_MATCHED, false);

    template.sendBody("direct:start", "Cooks Rocks");

    assertMockEndpointsSatisfied();
}
 
Example 5
Source File: FilteringSpringTest.java    From camel-cookbook-examples with Apache License 2.0 6 votes vote down vote up
@Test
public void testSecondFilter() throws Exception {
    getMockEndpoint("mock:C").expectedMessageCount(0);

    final MockEndpoint mockEndpointAfterC = getMockEndpoint("mock:afterC");
    mockEndpointAfterC.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointAfterC.expectedPropertyReceived(Exchange.FILTER_MATCHED, false);

    final MockEndpoint mockEndpointAmel = getMockEndpoint("mock:amel");
    mockEndpointAmel.expectedMessageCount(1);
    mockEndpointAmel.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    final MockEndpoint mockEndpointOther = getMockEndpoint("mock:other");
    mockEndpointOther.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointOther.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    template.sendBody("direct:start", "amel is in Belgium");

    assertMockEndpointsSatisfied();
}
 
Example 6
Source File: FilteringSpringTest.java    From camel-cookbook-examples with Apache License 2.0 6 votes vote down vote up
@Test
public void testBothFilter() throws Exception {
    final MockEndpoint mockEndpointC = getMockEndpoint("mock:C");
    mockEndpointC.expectedMessageCount(1);
    mockEndpointC.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    final MockEndpoint mockEntpointAfterC = getMockEndpoint("mock:afterC");
    mockEntpointAfterC.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEntpointAfterC.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    final MockEndpoint mockEndpointAmel = getMockEndpoint("mock:amel");
    mockEndpointAmel.expectedMessageCount(1);
    mockEndpointAmel.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    final MockEndpoint mockEndpointOther = getMockEndpoint("mock:other");
    mockEndpointOther.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointOther.expectedPropertyReceived(Exchange.FILTER_MATCHED, true);

    template.sendBody("direct:start", "Camel Rocks!");

    assertMockEndpointsSatisfied();
}
 
Example 7
Source File: FilteringTest.java    From camel-cookbook-examples with Apache License 2.0 4 votes vote down vote up
@Test
public void testOther() throws Exception {
    getMockEndpoint("mock:C").expectedMessageCount(0);

    final MockEndpoint mockEndpointAfterC = getMockEndpoint("mock:afterC");
    mockEndpointAfterC.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointAfterC.expectedPropertyReceived(Exchange.FILTER_MATCHED, false);

    getMockEndpoint("mock:amel").expectedMessageCount(0);

    final MockEndpoint mockEndpointOther = getMockEndpoint("mock:other");
    mockEndpointOther.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointOther.expectedPropertyReceived(Exchange.FILTER_MATCHED, false);

    template.sendBody("direct:start", "Hello World");

    assertMockEndpointsSatisfied();
}
 
Example 8
Source File: FilteringSpringTest.java    From camel-cookbook-examples with Apache License 2.0 4 votes vote down vote up
@Test
public void testOther() throws Exception {
    getMockEndpoint("mock:C").expectedMessageCount(0);

    final MockEndpoint mockEndpointAfterC = getMockEndpoint("mock:afterC");
    mockEndpointAfterC.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointAfterC.expectedPropertyReceived(Exchange.FILTER_MATCHED, false);

    getMockEndpoint("mock:amel").expectedMessageCount(0);

    final MockEndpoint mockEndpointOther = getMockEndpoint("mock:other");
    mockEndpointOther.expectedMessageCount(1);

    // FILTER_MATCHED set to true if message matched previous Filter Predicate
    mockEndpointOther.expectedPropertyReceived(Exchange.FILTER_MATCHED, false);

    template.sendBody("direct:start", "Hello World");

    assertMockEndpointsSatisfied();
}