Hum... I'm already creating the advice in the test (not in the setup). I'll try but isUseAdviceWith seems only not to start the context. So I don't see how this can help me to set my original route back.
On 4 January 2013 18:06, Claus Ibsen <claus.ib...@gmail.com> wrote: > On Fri, Jan 4, 2013 at 6:02 PM, Henri Tremblay <henri.tremb...@gmail.com> > wrote: > > That's what I'm doing. > > > > routeDefinitionUnderTest.adviceWith(context(), new > > AdviceWithRouteBuilder() { > > > > @Override > > public void configure() throws Exception { > > weaveById("doTry*").before().setHeader("JMSMessageID", > > constant("DuplicateID")); > > } > > }); > > > > But I have two tests in my test case. The second one still use the > tainted > > context (yes, if you tell me that another test case won't have the > problem, > > I can separate the tests in two classes). > > > > You can do the advice in the test method itself. Then it ought to be > local to that given test only. > > As we do at > http://camel.apache.org/advicewith.html > > And see the green box about the tip. > > > > > > On 4 January 2013 17:11, Christian Müller <christian.muel...@gmail.com > >wrote: > > > >> You can use adviceWith [1] in your test. In this case you don't have to > >> touch your original route. > >> > >> [1] http://camel.apache.org/advicewith.html > >> > >> Best, > >> Christian > >> > >> On Fri, Jan 4, 2013 at 4:52 PM, Henri Tremblay < > henri.tremb...@gmail.com > >> >wrote: > >> > >> > Hi, > >> > > >> > Happy new year to everyone. > >> > > >> > I'm doing integration tests. I'm reading from a JMS queue and then > doing > >> > some special stuff is the JMSMessageID already exist. > >> > > >> > I want to test that the "special stuff" is correctly called. > >> > > >> > So right now I'm doing this: > >> > - Adding an advice at the beginning of the route that set the > >> JMSMessageID > >> > - Sending two messages > >> > > >> > Everything is fine but since it's an integration tests, my route is > now > >> > dirty and cannot be reused for other tests. So I'm stuck. > >> > > >> > I'm using a org.apache.camel.test.junit4.CamelTestSupport. The camel > >> > context comes from a SingletonBeanFactory somewhere else (I can't > change > >> > that). > >> > > >> > So, I would like a solution to get an "unweaved" route back. > >> > > >> > The solution is can see: > >> > > >> > - But back the original route. (How?) > >> > - Remove the weaving on the route (How?) > >> > - Reload the context with it's original content (How?) > >> > - Set the JMSMessageId without weaving (How?) > >> > - ??? > >> > > >> > Any ideas are welcome > >> > > >> > Cheers, > >> > Henri > >> > > >> > >> > >> > >> -- > >> > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > FuseSource is now part of Red Hat > Email: cib...@redhat.com > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen >