camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Unit Tests without jndi.properties
Date Thu, 07 May 2009 15:44:06 GMT
Hi

I had time so I have created the ticket CAMEL-1590 and committed a fix
to Camel trunk.

Thanks for reporting.
A workaround is to put a empty jndi.properties in your own
src/test/resources folder.


On Thu, May 7, 2009 at 5:30 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> Hi
>
> Thanks for reporting. Yeah looks like its missing in the
> camel-test.jar distribution.
>
> camel-test.jar is meant for unit testing as its a regular maven .jar
> (eg not a testjar type).
>
> If you have the time feel free to ceate a ticket in JIRA so we wont
> forget, to fix it.
>
>
>
> On Thu, May 7, 2009 at 5:24 PM, jpcook <jonathan.cook@erars.plus.com> wrote:
>>
>> I have upgraded to Camel 2 and I'm trying to write a unit test.
>>
>> Before I just extended from ContextTestSupport but now it seems I have to
>> extend from CamelTestSupport.
>>
>> I have a really simple unit test:
>> public void testObservationsRouteBuilder() throws InterruptedException {
>>                //log.debug("testGroovy()");
>>
>>        /*MockEndpoint resultEndpoint = context.getEndpoint("mock:After",
>> MockEndpoint.class);
>>        resultEndpoint.expectedBodiesReceived(
>>                        "/mobile/fixtures/index.wml"
>>                        ,"/mobile/fixtures/1/index.wml"
>>                        );
>>
>>        sendBody("seda:groovytest", "testbody");
>>
>>        resultEndpoint.assertIsSatisfied();*/
>>        }
>>
>>        @Override
>>    protected RouteBuilder createRouteBuilder() throws Exception {
>>        return new ObservationsRouteBuilder();
>>    }
>>
>> But it just blows up complaining that it can't find jndi.properties on the
>> classpath. I've looked at the source for CamelTestSupport and seems this is
>> the problem.
>>
>> protected Context createJndiContext() throws Exception {
>>        InputStream in =
>> getClass().getClassLoader().getResourceAsStream("jndi.properties");
>>        assertNotNull("Cannot find jndi.properties on the classpath!", in);
>>        Properties properties = new Properties();
>>        properties.load(in);
>>        return new InitialContext(new Hashtable(properties));
>>    }
>>
>> Do I really have to have this file which was part of
>> camel-core-1.4.0-tests.jar and if so why and where do I put it now?
>>
>> Thanks
>> --
>> View this message in context: http://www.nabble.com/Unit-Tests-without-jndi.properties-tp23428533p23428533.html
>> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> Apache Camel Reference Card:
> http://refcardz.dzone.com/refcardz/enterprise-integration
> Interview with me:
> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress

Mime
View raw message