Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 57744 invoked from network); 13 Jan 2009 15:07:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jan 2009 15:07:03 -0000 Received: (qmail 44118 invoked by uid 500); 13 Jan 2009 15:07:03 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 44100 invoked by uid 500); 13 Jan 2009 15:07:03 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Received: (qmail 44089 invoked by uid 99); 13 Jan 2009 15:07:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jan 2009 07:07:03 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jan 2009 15:06:54 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1LMkqf-0000yM-JW for camel-user@activemq.apache.org; Tue, 13 Jan 2009 07:06:33 -0800 Message-ID: <21437517.post@talk.nabble.com> Date: Tue, 13 Jan 2009 07:06:33 -0800 (PST) From: cmoulliard To: camel-user@activemq.apache.org Subject: Re: only testMocksAreValid is executed by Camel/Spring unit test !! In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: cmoulliard@gmail.com References: <21436628.post@talk.nabble.com> <21437293.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org Indeed, I use junit4. Do you prefer that I switch to Junit3 for the test ? James.Strachan wrote: > > I'd not noticed you'd used junit4; all the Camel examples still use > JUnit3. > > To run a test case in JUnit4 the name of the method is irrelevant - > you have to use @Test to make it a test > > > 2009/1/13 cmoulliard : >> >> Using the following syntax, the test is executed : >> >> package org.apache.camel.bindy.csv; >> >> import org.apache.camel.EndpointInject; >> import org.apache.camel.Produce; >> import org.apache.camel.ProducerTemplate; >> import org.apache.camel.builder.RouteBuilder; >> import org.apache.camel.component.mock.MockEndpoint; >> import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration; >> import org.apache.commons.logging.Log; >> import org.apache.commons.logging.LogFactory; >> import org.junit.Test; >> import org.springframework.config.java.annotation.Bean; >> import org.springframework.config.java.annotation.Configuration; >> import org.springframework.config.java.test.JavaConfigContextLoader; >> import org.springframework.test.annotation.DirtiesContext; >> import org.springframework.test.context.ContextConfiguration; >> import >> org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; >> >> @ContextConfiguration(locations = >> "org.apache.camel.bindy.csv.BindyCSVUnmarshallTest$ContextConfig", >> loader = JavaConfigContextLoader.class) >> public class BindyCSVUnmarshallTest extends >> AbstractJUnit4SpringContextTests >> { >> >> private static final transient Log LOG = LogFactory >> .getLog(BindyCSVUnmarshallTest.class); >> >> String record = "01,A,Albert,Cartier,BE12345678,Belgacom Ventage >> 10/10,1500,EUR,08-01-2009"; >> >> @EndpointInject(uri = "mock:result") >> protected MockEndpoint resultEndpoint; >> >> @Produce(uri = "direct:start") >> protected ProducerTemplate template; >> >> @Test >> public void testMarshallMessage() throws Exception { >> >> resultEndpoint.expectedBodiesReceived(record); >> template.sendBody(record); >> >> resultEndpoint.assertIsSatisfied(); >> >> } >> >> >> @Configuration >> public static class ContextConfig extends >> SingleRouteCamelConfiguration { >> >> CamelDataFormat camelDataFormat = new >> CamelDataFormat("org.apache.camel.bindy.model"); >> >> @Bean >> public RouteBuilder route() { >> return new RouteBuilder() { >> public void configure() { >> from("direct:start") >> //from("file://src/test/data/") >> .unmarshal(camelDataFormat) >> .to("mock:result"); >> } >> }; >> } >> } >> >> } >> >> >> BUT junit reports the following error : >> >> main INFO >> [org.springframework.beans.factory.support.DefaultListableBeanFactory] - >> Destroying singletons in >> org.springframework.beans.factory.support.DefaultListableBeanFactory@1e78c96: >> defining beans >> [org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,camelBeanPostProcessor]; >> parent: >> org.springframework.beans.factory.support.DefaultListableBeanFactory@105d88a >> org.apache.maven.surefire.booter.SurefireExecutionException: >> org/junit/Assume$AssumptionViolatedException; nested exception is >> java.lang.NoClassDefFoundError: >> org/junit/Assume$AssumptionViolatedException >> java.lang.NoClassDefFoundError: >> org/junit/Assume$AssumptionViolatedException >> at >> org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:240) >> at >> org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333) >> at >> org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217) >> at >> org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197) >> at >> org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143) >> at >> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160) >> at >> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:59) >> at >> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:52) >> at >> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34) >> at >> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44) >> at >> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:50) >> at >> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97) >> at >> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) >> at >> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) >> at >> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) >> at org.apache.maven.surefire.Surefire.run(Surefire.java:177) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:585) >> at >> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338) >> at >> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997) >> [ERROR] >> >> James.Strachan wrote: >>> >>> Ah... >>> >>> >>> 2009/1/13 cmoulliard : >>> [snip] >>> >>> >>>> @ContextConfiguration(locations = >>>> "org.apache.camel.spring.javaconfig.patterns.FilterTest$ContextConfig", >>> >>> The above annotation is the name of the class to create for your >>> ApplicationContext - not the one inside BindyCSVUnmarshallTest. >>> >>> Currently JavaConfig and Spring Test don't work that nicely together >>> so you have to use a fully qualified class name unfortunatley >>> >>> -- >>> James >>> ------- >>> http://macstrac.blogspot.com/ >>> >>> Open Source Integration >>> http://fusesource.com/ >>> >>> >> >> >> ----- >> Charles Moulliard >> SOA Architect >> >> My Blog : http://cmoulliard.blogspot.com/ >> http://cmoulliard.blogspot.com/ >> -- >> View this message in context: >> http://www.nabble.com/only-testMocksAreValid-is-executed-by-Camel-Spring-unit-test-%21%21-tp21436628s22882p21437293.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > James > ------- > http://macstrac.blogspot.com/ > > Open Source Integration > http://fusesource.com/ > > ----- Charles Moulliard SOA Architect My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ -- View this message in context: http://www.nabble.com/only-testMocksAreValid-is-executed-by-Camel-Spring-unit-test-%21%21-tp21436628s22882p21437517.html Sent from the Camel - Users mailing list archive at Nabble.com.