Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-13540

isUseAdviceWith causes test to hang

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.24.0
    • Fix Version/s: 3.0.0-M3, 3.0.0
    • Component/s: camel-test
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      Having this test:

      import org.apache.camel.CamelContext;
      import org.apache.camel.RoutesBuilder;
      import org.apache.camel.builder.AdviceWithRouteBuilder;
      import org.apache.camel.builder.RouteBuilder;
      import org.apache.camel.component.mock.MockEndpoint;
      import org.apache.camel.test.junit4.CamelTestSupport;
      import org.junit.Test;
      
      public class MyRouteTest extends CamelTestSupport {
      
        private static final String ROUTE_ID = "mytest";
      
        @Override
        public RoutesBuilder createRouteBuilder() throws Exception {
          return new RouteBuilder() {
      
            @Override
            public void configure() throws Exception {
              from("direct:mytest")
                .id(ROUTE_ID)
                .to("stream:out");
            }
          };
        }
      
        @Override
        public void setUp() throws Exception {
            super.setUp();
            final CamelContext camelContext = context();
            camelContext.getRouteDefinition(ROUTE_ID)
              .adviceWith(camelContext, new AdviceWithRouteBuilder() {
                @Override
                public void configure() throws Exception {
                  weaveAddLast().to("mock:extract");
                }
              });
        }
      
        @Override
        public boolean isUseAdviceWith() {
            return true; // <- here is the problem
        }
      
        @Test
        public void shouldFire() throws InterruptedException {
          // given
          final MockEndpoint myMock = getMockEndpoint("mock:extract");
      
          myMock.expectedMessageCount(1);
          myMock.expectedBodiesReceived("test");
      
          // when
          template.sendBody("direct:mytest", "test");
      
          // then
          myMock.assertIsSatisfied();
        }
      }
      

       Causes Camel to hang

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                eximius Kamil
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: