On Mon, Jul 6, 2009 at 9:37 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> On Mon, Jul 6, 2009 at 1:20 PM, alloyer<allo...@gmail.com> wrote: > > > > There are one problem to define the assertions in test cases since > sometimes > > we are not sure of an input sentence. For example: > > 1)"to("mock:a","mock:b") and "to("mock:a").to("mock:b") have the same > route > > definition > Yeah this is not possible to know how the original route as defined, > its the same model when Camel builds the model. > > I suggest to use the .to(mock:a).to(mock:b) as its more readable and most > used. +1 > > > > > > > 2) Sometimes we can't use a ".end()" for the choice sentence. But when > > renderring, the ".end()" is a required part. > > Do you have some ideas to deal with it? > > the end() is needed where there is more after the choice block. > > For example: > > from A > choice() > when() to B > when() to C > otherwise() to D > end() > to X > > from A > choice() > when() to B > when() to C > end() > to X > > But if the choice is the last then the end is optional / not needed. > > from A > choice() > when() to B > when() to C > otherwise() to D > > But I would assume for starters it would be easiest to always include it Also, sounds good. +1 This Groovy renderer is really a best effort kinda thing. i.e. its going to be pretty hard to render arbitrary Groovy code. I think a good set of documentation for this will be a necessity. I've created CAMEL-1804 to track this so we don't forget. > > > > > > > JIRA j...@apache.org wrote: > >> > >> > >> [ > >> > https://issues.apache.org/activemq/browse/CAMEL-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52686#action_52686 > >> ] > >> > >> Jonathan Anstey commented on CAMEL-1392: > >> ---------------------------------------- > >> > >> Quickly trying this new code drop out before leaving for the day :) In > the > >> GroovyRendererTest I noticed pretty much all routes defined in the > >> supported list get rendered like > >> "from("direct:start",).to("mock:result")". Example output: > >> > >> {code} > >> dsl: from("direct:start").unmarshal().serialization().to("mock:result") > >> after rendered: > >> import org.apache.camel.language.groovy.GroovyRouteBuilder; > >> class GroovyRoute extends GroovyRouteBuilder { > >> void configure() { > >> from("direct:start",).to("mock:result") > >> } > >> } > >> {code} > >> > >> Not sure if this is a bug in the renderer or the test case. Care to fix > >> that up? > >> > >> Also unit tests typically contain assertions on the output of a piece of > >> code to make sure its operating correctly. In your case the test should > be > >> asserting that the output of the renderer is correct. Currently we have > to > >> verify this by looking at the output. > >> > >>> groovy renderer > >>> --------------- > >>> > >>> Key: CAMEL-1392 > >>> URL: > https://issues.apache.org/activemq/browse/CAMEL-1392 > >>> Project: Apache Camel > >>> Issue Type: Sub-task > >>> Reporter: James Strachan > >>> Assignee: Xueqiang Mi > >>> Attachments: camel-web-20090629.patch, camel-web-20090703.patch > >>> > >>> > >> > >> > >> -- > >> This message is automatically generated by JIRA. > >> - > >> You can reply to this email to add a comment to the issue online. > >> > >> > >> > > > > -- > > View this message in context: > http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24353726.html > > Sent from the Camel Development 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 > -- Cheers, Jon http://janstey.blogspot.com/