Hi,

  

I have a simple wire-tap root and I am unit testing it using
CamelBlueprintTestSupport.  I can run the test and it passes but in the log I
get:

  

2016-09-15 11:10:40,542 [int Extender: 2] ERROR BlueprintContainerImpl
\- Unable to start blueprint container for bundle i4ip-order/1.0.0.SNAPSHOT  
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to
validate xml  
at org.apache.aries.blueprint.parser.Parser.validate(Parser.java:317)[org.apac
he.aries.blueprint.core-1.4.4.jar:1.4.4]  
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(Blueprint
ContainerImpl.java:321)[org.apache.aries.blueprint.core-1.4.4.jar:1.4.4]  
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintCo
ntainerImpl.java:269)[org.apache.aries.blueprint.core-1.4.4.jar:1.4.4]  
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.
8.0_77]  
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_77]  
at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorSer
viceWrapper.java:106)[org.apache.aries.blueprint.core-1.4.4.jar:1.4.4]  
at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(Dis
cardableRunnable.java:48)[org.apache.aries.blueprint.core-1.4.4.jar:1.4.4]  
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.
8.0_77]  
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_77]  
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access
$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_77]  
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Sc
heduledThreadPoolExecutor.java:293)[:1.8.0_77]  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1
142)[:1.8.0_77]  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:
617)[:1.8.0_77]  
at java.lang.Thread.run(Thread.java:745)[:1.8.0_77]  

  

Full log here:
https://gist.github.com/owain68/ea09215d7120dd8dc616e237a158a0f8

  

I cannot for the life of me see what the problem is.  The route runs, the test
passes.  Is it some sort of timing issue on starting the container, route or
context.

  

Any ideas where I should start looking for some more information?

  

Thanks.

  

O.

  

  

![](https://link.nylas.com/open/ez36v71u7uh7qiundny4ougdd/local-
76d7c519-5549?r=dXNlcnNAY2FtZWwuYXBhY2hlLm9yZw==)

Attachment: i4ip-order-publish-route.xml
Description: XML document

Attachment: i4ip-order-publish-test-properties.xml
Description: XML document

Attachment: i4ip-order-publish-test-context.xml
Description: XML document

package technology.integration.i4ip.order;

import org.apache.camel.builder.AdviceWithRouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.io.FileReader;
import java.util.Properties;

public class PublishOrderTest extends CamelBlueprintTestSupport {


  private static final String I4IP_ORDER_PUBLISH_CFG = "src/test/resources/blueprint/i4ip-order-publish" +
          ".cfg";

  private Properties properties;

  @Before
  public void setUp() throws Exception{
    super.setUp();
    properties = new Properties();
    properties.load(new FileReader(new File(I4IP_ORDER_PUBLISH_CFG)));
  }

  @After
  public void tearDown() throws Exception {
    super.tearDown();
  }

  @Override
  protected String getBlueprintDescriptor() {

    return  "blueprint/i4ip-order-publish-test-properties.xml,"+
            "blueprint/i4ip-order-publish-test-context.xml," +
            "OSGI-INF/blueprint/i4ip-order-publish-route.xml";
  }

  @Override
  protected String[] loadConfigAdminConfigurationFile() {
    return new String[]{
            I4IP_ORDER_PUBLISH_CFG,
            "technology.integration.i4ip.order"     // Persistent ID
    };
  }

  @Override
  public boolean isUseAdviceWith() {
    return true;
  }

  @Test
  public void testMessageReceived() throws Exception {

    context.getRouteDefinition("i4ip-order-publish-route").adviceWith(context, new AdviceWithRouteBuilder() {
      @Override
      public void configure() throws Exception {
        replaceFromWith("direct:in");
        weaveById("publishedMessage").after().to("mock:increment");
      }
    });

    final String BODY = "Hello";
    MockEndpoint mockOut = getMockEndpoint("mock:increment");
    mockOut.setExpectedMessageCount(1);

    context.start();
    template.sendBody("direct:in", BODY);

    assertMockEndpointsSatisfied();
    assertEquals(BODY, mockOut.getExchanges().get(0).getIn().getBody());

  }

}

Reply via email to