Hi
 Earlier we were using CamelSpringTestSupport based Junit test cases to test
the Camel route based on Camel 2.11 and everything worked fine. Recently we
upgraded Camel to 2.13 and we started getting the below error. Could you
please advice?

java.lang.IncompatibleClassChangeError
at org.apache.camel.util.IOHelper.close(IOHelper.java:326)
at org.apache.camel.util.IOHelper.close(IOHelper.java:390)
at
org.apache.camel.test.spring.CamelSpringTestSupport.tearDown(CamelSpringTestSupport.java:118)
at
com.xxx.phoenix.fms.routes.FMSOutboundRoutesTest.tearDown(FMSOutboundRoutesTest.java:62)
........................
.......................


Gist of FMSOutboundRoutesTest.java:
------------------------------------------------
//@SuppressWarnings("UnusedDeclaration")
public class FMSOutboundRoutesTest extends CamelSpringTestSupport {

    private BrokerService brokerService;

    //Todo: I would like to be able to get this from the exchange
    @SuppressWarnings("FieldCanBeLocal")
    private static final String TEST_PATH = "\\99\\99\\99999999\\";

    @Override
    public void setUp() throws Exception {
        super.setUp();

        TestUtils.resetPathProperties(context());

       
System.getProperties().load(ClassLoader.getSystemResourceAsStream("activemq.properties"));
        String uri =
String.valueOf(ClassLoader.getSystemResource("activemq.xml").toURI()).replace("file:","xbean:");
        brokerService = BrokerFactory.createBroker(uri);
        context.addComponent("edifecs", new EdifecsValidationComponent());
        /*RouteDefinition routeDefinition =
context.getRouteDefinition("InFMSReaderSMTPRoute");
        routeDefinition.adviceWith(context, new RouteBuilder()
        {
            @Override
            public void configure() throws Exception
            {
                interceptSendToEndpoint("smtp://{{fmsSys.SMTP.userId}}*")
                        .skipSendToOriginalEndpoint()
                        .log("Testing InFMSReader")
                        .to("mock:InFMSReaSMTP");
            }
        });*/
    }

    @Override
    protected AbstractApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("CamelSpring.xml");
    }

    @Override
    public void tearDown() throws Exception { // Stop the broker when
testing is done.
        super.tearDown();
        if (brokerService != null) {
            brokerService.stop();
            brokerService = null;
        }
    }

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

    @Test
    public void testClientOutboxReader() throws Exception {
        RouteDefinition routeDefinition =
context.getRouteDefinition("PeteOutboxReader");
        routeDefinition.adviceWith(context, new RouteBuilder()
        {
            @Override
            public void configure() throws Exception
            {
                interceptSendToEndpoint("seda:LoadFileMessageFromFile")
                        .skipSendToOriginalEndpoint()
                        .log("Testing ClientOutboxReader")
                        .to("mock:copy");
            }
        });

        //Now start it...since we are overwriting isUseAdviceWith (returning
true), we have to start it manually
        context.start();

        //Get rid of any files in the test path already
        deleteDirectory(CamelUtils.getCamelSystemProperty(context,
"fmsSys.root.File.InProgress.Out").concat(TEST_PATH));

        //Send the files -- I want make sure the files are there before it
start to pick up
       
template.sendBodyAndHeader("file:{{fmsSys.root.PETE.Outbox}}".concat(TEST_PATH).concat("rec"),
                "<xml>test<xml>", Exchange.FILE_NAME, "test1.xml");
       
template.sendBodyAndHeader("file:{{fmsSys.root.PETE.Outbox}}".concat(TEST_PATH).concat("infms"),
                "<xml>test<xml>", Exchange.FILE_NAME, "test2.xml");
       
template.sendBodyAndHeader("file:{{fmsSys.root.PETE.Outbox}}".concat(TEST_PATH).concat("infms"),
                "<xml>test<xml>", Exchange.FILE_NAME, "test3.xml");
       
template.sendBodyAndHeader("file:{{fmsSys.root.PETE.Outbox}}".concat(TEST_PATH).concat("rec"),
                "<xml>test<xml>", Exchange.FILE_NAME, "test4.xml");

        //Now Let's validate all the conditions
        //There should be one Message
        MockEndpoint mock = getMockEndpoint("mock:copy");
        //This test is now sending only one message...we are sending really
3, but the other 2 should not be picked up
        //since they are in the exclude folders
        mock.expectedMessageCount(2);
        //Todo: Figure out how to get this path dynamically rather than hard
coded...from the header
        //The file should be in the IN PROGRESS root
        mock.expectedFileExists(CamelUtils.getCamelSystemProperty(context,
"fmsSys.root.File.InProgress.Out") +
                TEST_PATH + "rec\\test1.xml");
        mock.expectedFileExists(CamelUtils.getCamelSystemProperty(context,
"fmsSys.root.File.InProgress.Out") +
                TEST_PATH + "rec\\test4.xml");
        //files should be read the older  file first -- I have to use
ascending since it compares who is bigger not older
        mock.expectsAscending(header("CamelFileLastModified"));

        //Let's give it a couple of seconds
        Thread.sleep(2000);
        //Check all the conditions for me please ma'am
        assertMockEndpointsSatisfied();
    }

................
...............
}

The error happens in the tearDown's super.tearDown() call.



--
View this message in context: 
http://camel.465427.n5.nabble.com/IncompatibleClassChangeError-tp5752456.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to