AnsweredAssumed Answered

Activiti-camel defect?

Question asked by njames on Sep 22, 2011
Latest reply on Sep 23, 2011 by trademak
I am using the activiti-camel integration (after reading the latest installment of "Activiti in Action"). Nice jobs all around! Kudos!
My problem comes with my unit test. My routes look like:

            .log(LoggingLevel.INFO, "Received message on service task")
Which I want to unit test using a MockEndpoint. I checked out, especially the section on "Mocking Existing Endpoints" and so I coded my unit test as:

    private CamelContext camelContext;

    @Produce(uri = "direct:start", context = "camelProcess")
    protected ProducerTemplate template;

    public void testMyProcessViaCamel() throws Exception {

        // Advise all the endpoints
        for (final RouteDefinition route : this.camelContext.getRouteDefinitions()) {
            route.adviceWith(this.camelContext, new AdviceWithRouteBuilder() {

                public void configure() throws Exception {
                    // mock all endpoints
But this fails because I get a RuntimeException from the ActivitiEndpoint class:

  void addConsumer(ActivitiConsumer consumer) {
    if (activitiConsumer != null) {
      throw new RuntimeException("Activit consumer already defined for " + getEndpointUri() + "!");
    activitiConsumer = consumer;
I was wondering if the ActivitiEndpoint should even care about adding a consumer when one has already been added? In this case, Camel has it's reasons for replacing the existing consumer.
Is there a reason for addConsumer not being as follows?

  void addConsumer(ActivitiConsumer consumer) {
    activitiConsumer = consumer;

Thanks for reading this to the end!