Thanks Guys, @ Alex, I suspect the schema is wrong but as you and Willem mentioned jaxb annotation definition may matter.
@ Willem, i thought not putting required="true" makes it optional, maybe making it optional as you mentioned and what i presumably did changes the output of autogenerated xsd file and then it affects the xml dsl. I will try to go into deep. On Tue, Jun 12, 2018 at 6:57 AM Willem Jiang <willem.ji...@gmail.com> wrote: > I just have a quick look at the code, the schema is updated, but there are > something wrong with the xml file. > As the ThrottleDefinition is extends from ExpressionNode, but the first > element of ExpressionNode is a reference of expression element, not > the correlationExpression > that you want. > So you keep getting the complain message. > > Once I put the correlationExpression as the last element of throttle, I > don't get the error message anymore. (but the test is freeze ). > > <route errorHandlerRef="dlc"> > <from uri="seda:b"/> > <throttle timePeriodMillis="1000"> > <header>max</header> > <to uri="log:result"/> > <to uri="mock:result"/> > <correlationExpression> > <constant>2</constant> > </correlationExpression> > </throttle> > </route> > > We need to address the element order first to fix this issue. > > BTW, I also find an issue in the ThrottleDefinition, to support to old XML > which has no correlationExpression, we need to specify the element as an > optional one. > Just like this : > > @XmlElements({ > @XmlElement(name = "correlationExpression", type = > ExpressionSubElementDefinition.class)} > ) > private ExpressionSubElementDefinition correlationExpression; > > > > > Willem Jiang > > Twitter: willemjiang > Weibo: 姜宁willem > > On Tue, Jun 12, 2018 at 5:23 AM, Alex Dettinger <aldettin...@gmail.com> > wrote: > > > Hi, > > > > I had a quick look and forced the resolution of the schema like this: > > http://camel.apache.org/schema/spring > > /home/aldettinger/.m2/repository/org/apache/camel/ > > camel-spring/2.22.0-SNAPSHOT/camel-spring-2.22.0-SNAPSHOT.xsd > > > > And hit the same issue then you. So I think that the last version of > the > > schema is loaded, but the schema would be wrong then. > > > > Hope this help, > > Alex > > > > On Mon, Jun 11, 2018 at 5:12 PM, Onder SEZGIN <ondersez...@gmail.com> > > wrote: > > > > > Hi, > > > > > > please see the branch in this link. > > > https://github.com/apache/camel/pull/2366#issuecomment-396193135 > > > > > > or this one. > > > > > > > https://github.com/onderson/camel/commit/ae63d64f627ec921c574059aadd1cf > > > 894f5f3e2e > > > > > > > > > On Mon, Jun 11, 2018 at 5:32 PM Willem Jiang <willem.ji...@gmail.com> > > > wrote: > > > > > > > Where is your unit test? > > > > Can you check if you are using the latest built camel-spring jar. > > > > There is a schema definition in the camel-spring[1], please make > sure > > > the > > > > new generated camel-spring.xsd is wrap into the camel-spring.jar > > > > > > > > [1] > > > > > > > > https://github.com/apache/camel/blob/master/components/ > > > camel-spring/src/main/resources/META-INF/spring.schemas > > > > > > > > > > > > Willem Jiang > > > > > > > > Twitter: willemjiang > > > > Weibo: 姜宁willem > > > > > > > > On Mon, Jun 11, 2018 at 9:11 PM, Onder SEZGIN <ond...@apache.org> > > wrote: > > > > > > > > > i did try full build. it did not help in my case :/ > > > > > > > > > > On Mon, Jun 11, 2018 at 12:23 PM Onder SEZGIN < > ondersez...@gmail.com > > > > > > > > wrote: > > > > > > > > > > > no. because it may take very long on my pc. > > > > > > I will try to check. > > > > > > > > > > > > On Mon, Jun 11, 2018 at 12:17 PM Andrea Cosentino > > > > > > <ancosen1...@yahoo.com.invalid> wrote: > > > > > > > > > > > >> Did you try a full rebuild? > > > > > >> > > > > > >> -- > > > > > >> Andrea Cosentino > > > > > >> ---------------------------------- > > > > > >> Apache Camel PMC Chair > > > > > >> Apache Karaf Committer > > > > > >> Apache Servicemix PMC Member > > > > > >> Email: ancosen1...@yahoo.com > > > > > >> Twitter: @oscerd2 > > > > > >> Github: oscerd > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> On Monday, June 11, 2018, 11:15:17 AM GMT+2, Onder SEZGIN < > > > > > >> ond...@apache.org> wrote: > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> Hi Guys, > > > > > >> > > > > > >> I've recently implemented CAMEL-6840 and new xml element is > > > introduced > > > > > as > > > > > >> a > > > > > >> result of it. > > > > > >> I am trying to create a unit test for it under camel-spring to > see > > > if > > > > > the > > > > > >> new element is fine in XML DSL. > > > > > >> and i have this simple xml route. > > > > > >> > > > > > >> <camelContext xmlns="http://camel.apache.org/schema/spring"> > > > > > >> <errorHandler id="dlc" deadLetterUri="mock:dead" > > > > > >> type="DeadLetterChannel"/> > > > > > >> <route errorHandlerRef="dlc"> > > > > > >> <from uri="seda:a"/> > > > > > >> <throttle timePeriodMillis="1000"> > > > > > >> <correlationExpression> > > > > > >> <constant>1</constant> > > > > > >> </correlationExpression> > > > > > >> <header>max</header> > > > > > >> <to uri="log:result"/> > > > > > >> <to uri="mock:result"/> > > > > > >> </throttle> > > > > > >> </route> > > > > > >> > > > > > >> Even though the build of camel-spring is ok and i can see right > > > > > >> definitions > > > > > >> in camel-spring.xsd, i can not run the unit test because of an > > error > > > > as > > > > > >> below. > > > > > >> > > > > > >> My guess is somewhat unit test can not recognize > camel-spring.xsd > > > but > > > > > not > > > > > >> sure. > > > > > >> Any idea? > > > > > >> > > > > > >> Caused by: org.xml.sax.SAXParseException; lineNumber: 34; > > > > columnNumber: > > > > > >> 32; > > > > > >> cvc-complex-type.2.4.a: Invalid content was found starting with > > > > element > > > > > >> 'correlationExpression'. One of > > > > > >> '{"http://camel.apache.org/schema/spring":description, > > > > > >> "http://camel.apache.org/schema/spring":expressionDefinition, " > > > > > >> http://camel.apache.org/schema/spring":constant, " > > > > > >> http://camel.apache.org/schema/spring":el, " > > > > > >> http://camel.apache.org/schema/spring":exchangeProperty, " > > > > > >> http://camel.apache.org/schema/spring":groovy, " > > > > > >> http://camel.apache.org/schema/spring":header, " > > > > > >> http://camel.apache.org/schema/spring":jxpath, " > > > > > >> http://camel.apache.org/schema/spring":javaScript, " > > > > > >> http://camel.apache.org/schema/spring":jsonpath, " > > > > > >> http://camel.apache.org/schema/spring":language, " > > > > > >> http://camel.apache.org/schema/spring":method, " > > > > > >> http://camel.apache.org/schema/spring":mvel, " > > > > > >> http://camel.apache.org/schema/spring":ognl, " > > > > > >> http://camel.apache.org/schema/spring":php, " > > > > > >> http://camel.apache.org/schema/spring":python, " > > > > > >> http://camel.apache.org/schema/spring":ref, " > > > > > >> http://camel.apache.org/schema/spring":ruby, " > > > > > >> http://camel.apache.org/schema/spring":simple, " > > > > > >> http://camel.apache.org/schema/spring":spel, " > > > > > >> http://camel.apache.org/schema/spring":sql, " > > > > > >> http://camel.apache.org/schema/spring":terser, " > > > > > >> http://camel.apache.org/schema/spring":tokenize, " > > > > > >> http://camel.apache.org/schema/spring":xtokenize, " > > > > > >> http://camel.apache.org/schema/spring":xpath, " > > > > > >> http://camel.apache.org/schema/spring":xquery}' is expected. > > > > > >> > > > > > > > > > > > > > > > > > > > > >