Re: Camel Spring XML working with variables from xml message

2014-12-16 Thread Claus Ibsen
Hi

If you have all the data in headers, then you can use the simple
language to build a message body
http://camel.apache.org/simple

I guess this is what you attempted with . But constant is
what is says a constant.

 "<2> DateValue Hostname Message"

So try with

 "<2> ${header. DateValue} ${header. Hostname} ${header.
Message}"

On Tue, Dec 16, 2014 at 11:59 PM, mtod09  wrote:
> I'm developing a route that will read the incoming xml message and create a
> new message to pass to an outbound route.
>
> I need to extract some data via xpath then concat the data  elements to send
> to a new route.
>
> Example
>
> 
>My
>home
> 
>
> var1 = data1
> var2 = data2
>
> var3 = var1 + " " + var2
>
> var3 = "My home"
>
> I'm not sure how to do this with Spring XML does any one have an example or
> pointer?
>
> My Route so far:
>
>  xmlns="http://camel.apache.org/schema/spring";>
>
> 
> 
> 
>
> 
> 
>
> 
>  resultType="String">/km:FMIMessage/km:Header/km:Payload/se:SystemEvent/se:EventTime/text()
> 
> 
>  resultType="String">/km:FMIMessage/km:Header/km:Payload/se:SystemEvent/se:LevelID/text()
> 
> 
>  resultType="String">/km:FMIMessage/km:Header/km:Payload/se:SystemEvent/se:ServerName/text()
> 
> 
>  resultType="String">/km:FMIMessage/km:Header/km:Payload/se:SystemEvent/se:MessageText/text()
> 
> 
> "<2> DateValue Hostname Message"
> 
>
>
>
> 
> 
>
>
> 
>
> 
>
> Thanks
>
> Mike
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-Spring-XML-working-with-variables-from-xml-message-tp5760788.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Intermittent error: No content to map due to end-of-input

2014-12-16 Thread Willem Jiang
Did you try to reset the StreamCache before try to read something from it?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On December 16, 2014 at 3:04:45 PM, shanaloh (shana...@gmail.com) wrote:
> hi guys,
>  
> I am quite new to Camel. We are using Camel 2.14.
>  
> I got this intermittent error which is quite annoying. It happens very
> rarely and randomly. If I send the same request again, it will process just
> fine.
>  
> 2014-12-15 17:24:56.700 ERROR 1852673485@qtp-1010937526-2
> common.exception.MTSErrorHandler Received Exception
> com.fasterxml.jackson.databind.JsonMappingException: No content to map due
> to end-of-input
> at Source: org.apache.camel.converter.stream.InputStreamCache@64288413;
> line: 1, column: 1
>  
> After searching this exception, I have seen many places where people suggest
> to use stream caching. However in our case, stream caching is already used.
> I am not sure however if it is set up properly.
>  
> Thanks in advance for any your inputs.
>  
> Cheers
>  
> Shan
>  
> *This is our camel context config*
>  
> > trace="${camel.trace:false}" streamCache="true">
>  
> When project starts up, this line indicates it is enabled:
> 2014-12-16 16:13:04.300 INFO [main] [camel.spring.SpringCamelContext]
> StreamCaching is enabled on CamelContext: camelContext
>  
>  
>  
> *This is our code.*
>  
>  
> RouteDefinition rdRouteDefinition = from( createListeningService()
> ).routeId( getRouteId() );
> rdRouteDefinition.wireTap(
> ABCMaintenanceRouteDefinition.AUDIT_LOGGING.getCamelRoute() );
> rdRouteDefinition
> .process(new Processor() {
>  
> @Override
> public void process(Exchange exchange) throws Exception {
> _log.info("Before unmarshall()" );
> _log.info("exchange body = " + exchange.getIn().getBody());
> _log.info("exchange body size = " +
> exchange.getIn().getBody(InputStreamCache.class).length());
> }
>  
> })
> .unmarshal().json(JsonLibrary.Jackson, ExecutionRequest.class)
> .to(ABCRouteType.VALIDATOR.getRoutePrefix() + requestXsd)
> .convertBodyTo(FIXExecutionReport.class)
> .process(fixMessageProcessor)
> .wireTap( ABCRouteType.LOG.getRoutePrefix() + _log.getName() +
> ABCGenericConstants.LOGGING_ROUTE_OPTIONS )
> .inOnly( routeType.getRoutePrefix() + publishingDestination );
>  
> rdRouteDefinition.wireTap(
> ABCMaintenanceRouteDefinition.AUDIT_LOGGING.getCamelRoute() );
>  
>  
>  
> *This is the logging *
>  
> 2014-12-15 17:24:56.682 INFO 1852673485@qtp-1010937526-2 Before
> unmarshall()
> 2014-12-15 17:24:56.682 INFO 1852673485@qtp-1010937526-2 exchange body =
> org.apache.camel.converter.stream.InputStreamCache@64288413
> 2014-12-15 17:24:56.683 INFO 1852673485@qtp-1010937526-2 exchange body size
> = 646
>  
> 2014-12-15 17:24:56.700 ERROR 1852673485@qtp-1010937526-2
> common.exception.ABCErrorHandler Received Exception
> com.fasterxml.jackson.databind.JsonMappingException: No content to map due
> to end-of-input
> at Source: org.apache.camel.converter.stream.InputStreamCache@64288413;
> line: 1, column: 1
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Intermittent-error-No-content-to-map-due-to-end-of-input-tp5760725.html
>   
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  



Camel Spring XML working with variables from xml message

2014-12-16 Thread mtod09
I'm developing a route that will read the incoming xml message and create a
new message to pass to an outbound route.

I need to extract some data via xpath then concat the data  elements to send
to a new route.

Example


   My
   home


var1 = data1
var2 = data2

var3 = var1 + " " + var2

var3 = "My home"

I'm not sure how to do this with Spring XML does any one have an example or
pointer?

My Route so far:

http://camel.apache.org/schema/spring";>









/km:FMIMessage/km:Header/km:Payload/se:SystemEvent/se:EventTime/text()


/km:FMIMessage/km:Header/km:Payload/se:SystemEvent/se:LevelID/text()


/km:FMIMessage/km:Header/km:Payload/se:SystemEvent/se:ServerName/text()


/km:FMIMessage/km:Header/km:Payload/se:SystemEvent/se:MessageText/text()


"<2> DateValue Hostname Message"












Thanks 

Mike




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Spring-XML-working-with-variables-from-xml-message-tp5760788.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to avoid cxfrs:rserver adding extra header params (accept-encoding) -

2014-12-16 Thread Kumaran
Thanks Sergey it works and removes the unwanted header information.


Sergey Beryozkin-3 wrote
> Hi, AFAIK one needs to activate a header filter strategy that would 
> block copying the input headers
> 
> Cheers, Sergey
> On 15/12/14 23:33, Kumaran wrote:
>> Hi
>>
>> we are using camel cxfrs server to expose our proxy services,  The
>> service
>> is exposer is working fine but if the response is more that certain limit
>> looks like the client is not able to receive getting timed out exception.
>>
>> Then we have identified that the camel service adding some extra header
>> parameter such as accept-encoding.
>>
>> So my question would be how do we avoid these extra header params and
>> send
>> only the actual param.
>>
>> Headers: {Accept=[application/xml], *accept-encoding=[gzip, deflate],*
>> accept-language=[en-us], Authorization=[xx], connection=[keep-alive],
>> Content-Length=[0], Content-Type=[null], host=[localhost:8001],
>> user-agent=[xxx/14.0.0 (x86_64)]}
>>
>>
>> but we dont send the "accept-encoding=" header param but getting added in
>> the cxfrs server
>>
>> how could i remove this extra params and send only the actual param.
>>
>>
>> Thanks
>> Kumaran
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/How-to-avoid-cxfrs-rserver-adding-extra-header-params-accept-encoding-tp5760716.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>





--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-avoid-cxfrs-rserver-adding-extra-header-params-accept-encoding-tp5760716p5760787.html
Sent from the Camel - Users mailing list archive at Nabble.com.


How to Maintain Session with CXF?

2014-12-16 Thread billybobbain
The service I'm using requires that we "login" and maintain the session.
(Yuck, I know!)

I can do this using regular java and CXF, but can't figure out the right way
with Camel & CXF. 

This works with Java / CXF. 

   ((BindingProvider)
port).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY,
true);

I've tried adding a header: 


  true


and using a processor:

public class SessionProcessor implements Processor {
  @Override
  public void process(Exchange exchange) throws Exception {
// set up the response context which force start document
Map map = (Map)
exchange.getOut().getHeader(Client.REQUEST_CONTEXT);
if (map == null) {
  map = new HashMap();
  exchange.getOut().setHeader(Client.REQUEST_CONTEXT, map);
}
map.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
  }

but, I think I'm doing it too late. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-Maintain-Session-with-CXF-tp5760786.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Can't find the BindingOperationInfo with operation name {urn:...}login.

2014-12-16 Thread billybobbain
That was it. Thanks for your help. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Can-t-find-the-BindingOperationInfo-with-operation-name-urn-login-tp5760654p5760783.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Sending to Syslog

2014-12-16 Thread mtod09
Ok I have the solution now.

I added sync=false to the uri

 

It was using request / reply model and waiting for a response.

Thanks for all the help.

Mike



--
View this message in context: 
http://camel.465427.n5.nabble.com/Sending-to-Syslog-tp5760517p5760780.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Sending to Syslog

2014-12-16 Thread Claus Ibsen
Hi

When you get this kind of error it can indicate mixed versions.

Can you make sure the version of the Camel JARs are the same version
as the version of Camel that was shipped with ActiveMQ.


On Tue, Dec 16, 2014 at 7:28 PM, mtod09  wrote:
> I have it working I guess I was missing some more Jar's.
>
> Interesting the 1st message seems to work but the second one times out then
> works.
>
> Error Message:
>
> ERROR | Failed delivery for (MessageId:
> queue_syslogMessages_ID_FM-WLTP082-60537-1418754256058-7_1_1_1_1 on
> ExchangeId: ID-FM-WLTP082-60535-1418754255614-0-1). Exhausted after delivery
> attempt: 1 caught: org.apache.camel.ExchangeTimed OutException: The OUT
> message was not received within: 3 millis.
> Exchange[JmsMessage[JmsMessageID:
> ID:FM-WLTP082-60537-1418754256058-7:1:1:1:1]]
>
> I'm not sure why this would have an issue both systems are local.
>
> Thanks
>
> Mike
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Sending-to-Syslog-tp5760517p5760776.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Problem with InOnly exchange pattern using with RestDSL

2014-12-16 Thread gabfssilva
Hello! Thanks for answering.

Well, actually it did work! But, I thought that wire tap was not appropriate
for this case. Anyway, do you know why the rest return gets messed up when I
try to send an inOnly message?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-InOnly-exchange-pattern-using-with-RestDSL-tp5760717p5760772.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Sending to Syslog

2014-12-16 Thread mtod09
I have it working I guess I was missing some more Jar's.

Interesting the 1st message seems to work but the second one times out then
works.

Error Message:

ERROR | Failed delivery for (MessageId:
queue_syslogMessages_ID_FM-WLTP082-60537-1418754256058-7_1_1_1_1 on
ExchangeId: ID-FM-WLTP082-60535-1418754255614-0-1). Exhausted after delivery
attempt: 1 caught: org.apache.camel.ExchangeTimed OutException: The OUT
message was not received within: 3 millis.
Exchange[JmsMessage[JmsMessageID:
ID:FM-WLTP082-60537-1418754256058-7:1:1:1:1]]

I'm not sure why this would have an issue both systems are local.

Thanks 

Mike




--
View this message in context: 
http://camel.465427.n5.nabble.com/Sending-to-Syslog-tp5760517p5760776.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Sending to Syslog

2014-12-16 Thread mtod09
Thanks

I have added the Jar's things are looking better.
The route is running now when I send it a formatted message I get the
following error:

*Message:* <2>Jul 10 12:00:00 192.168.1.1 SyslogGen MESSAGE TEXT

ERROR | Failed delivery for (MessageId:
ID:FM-WLTP082-56545-1418751719052-7:1:1:1:1 on ExchangeId:
ID-FM-WLTP082-56542-1418751718711-0-1). Exhausted after delivery attempt: 1
caught: org.apache.camel.TypeConversionException: Error during type
conversion from type: java.lang.String to the required type:
org.apache.camel.component.syslog.SyslogMessage with value <2>Jul 10
12:00:00 192.168.1.1 SyslogGen MESSAGE TEXT due java.lang.NoSuchMethodError:
org.apache.camel.component.syslog.SyslogMessage.setTimestamp(Ljava/util/Calendar;)V


Seems like I'm missing something.


My Route:




http://www.springframework.org/schema/beans";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:camel="http://camel.apache.org/schema/spring";
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
   http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd";>

http://camel.apache.org/schema/spring";>















Thanks

Mike



--
View this message in context: 
http://camel.465427.n5.nabble.com/Sending-to-Syslog-tp5760517p5760775.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Quickfix - UserRequest after session logon

2014-12-16 Thread Archis.Kulkarni
Hi,

We’re working with an exchange that requires us to follow a 2 step logon 
process for establishing the connection.
The message sequence is shown below.

1.   Send session logon request (35=A)

2.   Receive session logon response(35=A) and SessionStatus message (35=h)

3.   Send UserRequest(35=BE)

4.   Receive UserResponse(35=BF) and SessionStatus message (35=h)

5.   Start receiving the trade confirmations

I tried searching around in the forums but I’m not getting how I can achieve 
this with the camel quickfix. In all our other connections we just need to send 
the first session logon request and that just works out of the box.

Can someone please explain if there’s a way to extend the camel quickfix to 
send the UserRequest as depicted below in response to the session logon?

20141215-16:02:20.834850 : 
8=FIX.4.4|9=83|35=A|49=abcd|56=efgh|34=1|52=20141215-16:02:20.517|98=0|108=30|141=Y|554=temp|10=099|
20141215-16:02:20.835329 : Received logon request
20141215-16:02:20.835370 : 
8=FIX.4.4|9=72|35=A|34=1|49=abcd|52=20141215-16:02:20.835|56=efgh|98=0|108=30|141=Y|10=018|
20141215-16:02:20.835386 : Responding to logon request
20141215-16:02:20.835426 : 
8=FIX.4.4|9=116|35=h|34=2|49=abcd|52=20141215-16:02:20.835|56=efgh|325=Y|336=1|340=2|341=20141214-22:45:00|345=20141215-22:35:00|10=208|
20141215-16:02:44.211340 : 
8=FIX.4.4|9=110|35=BE|49=abcd|56=efgh|34=2|50=user1|52=20141215-16:02:43.892|923=Login195|924=1|553=user1|554=temp|10=022|
20141215-16:02:44.211444 : 
8=FIX.4.4|9=99|35=BF|34=3|49=efgh|52=20141215-16:02:44.211|56=abcd|57=user1|553=user1|923=Login195|926=1|10=161|
20141215-16:02:44.211484 : 
8=FIX.4.4|9=128|35=h|34=4|49=efgh|52=20141215-16:02:44.211|56=abcd|57=user1|325=Y|336=1|340=2|341=20141214-22:45:00|345=20141215-22:35:00|10=185|

Thanks,
Archis


PLEASE READ: This message is for the named person's use only. It may contain 
confidential, proprietary or legally privileged information. No confidentiality 
or privilege is waived or lost by any mistransmission. If you receive this 
message in error, please delete it and all copies from your system, destroy any 
hard copies and notify the sender. You must not, directly or indirectly, use, 
disclose, distribute, print, or copy any part of this message if you are not 
the intended recipient. Nomura Holding America Inc., Nomura Securities 
International, Inc, and their respective subsidiaries each reserve the right to 
monitor all e-mail communications through its networks. Any views expressed in 
this message are those of the individual sender, except where the message 
states otherwise and the sender is authorized to state the views of such 
entity. Unless otherwise stated, any pricing information in this message is 
indicative only, is subject to change and does not constitute an offer to deal 
at any price quoted. Any reference to the terms of executed transactions should 
be treated as preliminary only and subject to our formal written confirmation.



Re: AW: camel - xsd

2014-12-16 Thread Aki Yoshida
@Jan,
I just missed your previous replies.
I just saw you also have provided the JDK info already.
thanks.

2014-12-16 14:25 GMT+01:00 Aki Yoshida :
> It's good to hear it is working in your environment.
>
> by the way, I saw your camael doc update regarding the concrete error
> example you saw.
> We need to formulate that differently.
> There is a small sanity check before starting the tokenization (not
> comparing the impl name itself but trying to infer its conformance by
> its initial behavior). That check was working for Oracle JDK 7 on OSX.
> I would like to know which JDK that you use. In any case, we can
> either make the initial sanity check to detect this incompatible
> behavior and detect it later if it is not detected at the beginning.
> In either way, we can throw an exception at some point.
>
> regards, aki
>
> 2014-12-16 10:18 GMT+01:00 Jan Matèrne (jhm) :
>> Sorry for my late answer, I was ill :(
>>
>> Thanks for your sample project, I investigated into it now.
>> All tests passed. (Camel 2.14.0)
>>
>> But your test used the XMLTokenExpressionIterator directly I migrated my own
>> test class (using the RouteBuilder) into your project.
>> - added the test class
>> - added the xsd
>> - added the dependency to commons-io + camel-test-spring
>> - changed the paths in my test class to fit your directory layout
>> Now this also passed.
>>
>> It's good to see that there is no bug in Camel. ;)
>>
>>
>> Because my example still fails in my other environment I check that ...
>>
>>
>> Jan
>>
>>
>>> -Ursprüngliche Nachricht-
>>> Von: Aki Yoshida [mailto:elak...@gmail.com]
>>> Gesendet: Mittwoch, 10. Dezember 2014 23:57
>>> An: users@camel.apache.org
>>> Betreff: Re: AW: camel - xsd
>>>
>>> i meant woodstox-core-asl (e.g., woodstox-core-asl-4.4.1.jar).
>>> its maven coordinate is
>>>
>>> mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1
>>>
>>> you need to have woodstox or some other parser that reliably reports
>>> the offset location at each parse event.
>>> Sjsxp (sun/oracle implementation included in JDK) doesn't do that, so
>>> you can't use it.
>>>
>>> jmtest.tar.gz contains a maven project that can be executed directly by
>>> typing mvn test at the console or can be imported into your eclipse
>>> IDE.
>>>
>>> 2014-12-10 13:13 GMT+01:00 Aki Yoshida :
>>> > i just created a test that uses your data and verified that it is
>>> working fine.
>>> > please take a look at this file at my dropbox.
>>> > https://www.dropbox.com/s/pfgvs9si9bvujxo/jmtest.tar.gz?dl=0
>>> > just extract the files into camel-core and run JMNewsTest.
>>> > and see if that works in your environment, (i believe it does).
>>> >
>>> > in that case, we need to find out the difference to your case.
>>> > do you have woodstox-api in your class path?
>>> >
>>> >
>>> > 2014-12-10 12:15 GMT+01:00 Aki Yoshida :
>>> >> okay.
>>> >> let me take a look.
>>> >>
>>> >>
>>> >> 2014-12-10 12:02 GMT+01:00 Jan Matèrne (jhm) :
>>> >>> No, input is valid xml.
>>> >>> After invoking xtokenize() the xml is invalid.
>>> >>>
>>> >>> CAMEL-8106 is very  short. I can't see whether it is related.
>>> >>>
>>> >>>
>>> >>> I posted an example on the user list
>>> >>> http://mail-archives.apache.org/mod_mbox/camel-
>>> users/201412.mbox/%3C
>>> >>> 002b01d01452%24e8ee27a0%24baca76e0%24%40de%3E
>>> >>>
>>> >>> I had done a 'workaround' for this special example
>>> >>> // Workaround of a bug?? in XMLTokenizerExpression
>>> >>> .setBody(simple("${body.replace('news:Newsletter>',
>>> 'news:Newsletter>')}"))
>>> >>> .setBody(simple("${body.replace('',
>>> >>> 'news:Newsletter>')}"))
>>> >>>
>>> >>> Without that the split messages have wrong end tags.
>>> >>>
>>> >>>
>>> >>> Jan
>>> >>>
>>> >>>
>>>  -Ursprüngliche Nachricht-
>>>  Von: Aki Yoshida [mailto:elak...@gmail.com]
>>>  Gesendet: Mittwoch, 10. Dezember 2014 10:34
>>>  An: users@camel.apache.org
>>>  Betreff: Re: AW: camel - xsd
>>> 
>>>  you are talking about the invalid-xml parsing bug in xtokenzier.
>>>  that has been fixe with CAMEL-8106. It should be part of the new
>>>  2.14.1, which is to be released shortly.
>>> 
>>>  regards, aki
>>> 
>>>  2014-12-10 9:25 GMT+01:00 Jan Matèrne (jhm) :
>>>  > I played a little bit.
>>>  >
>>>  > Jan
>>>  >
>>>  >
>>>  > public class XmlTest extends CamelTestSupport {
>>>  >
>>>  > @EndpointInject(uri="mock:valid")
>>>  > MockEndpoint valid;
>>>  >
>>>  > @EndpointInject(uri="mock:validationError")
>>>  > MockEndpoint validationError;
>>>  >
>>>  >
>>>  >
>>>  > @Test
>>>  > public void validNewsfeed() throws Exception {
>>>  > // Newsfeed contains 2 news
>>>  > valid.expectedMessageCount(2);
>>>  > valid.expectedMessagesMatches(
>>>  > // Use helper methods from the static imported
>>>  PredicateBuilder
>>>  >  

Re: AW: camel - xsd

2014-12-16 Thread Aki Yoshida
It's good to hear it is working in your environment.

by the way, I saw your camael doc update regarding the concrete error
example you saw.
We need to formulate that differently.
There is a small sanity check before starting the tokenization (not
comparing the impl name itself but trying to infer its conformance by
its initial behavior). That check was working for Oracle JDK 7 on OSX.
I would like to know which JDK that you use. In any case, we can
either make the initial sanity check to detect this incompatible
behavior and detect it later if it is not detected at the beginning.
In either way, we can throw an exception at some point.

regards, aki

2014-12-16 10:18 GMT+01:00 Jan Matèrne (jhm) :
> Sorry for my late answer, I was ill :(
>
> Thanks for your sample project, I investigated into it now.
> All tests passed. (Camel 2.14.0)
>
> But your test used the XMLTokenExpressionIterator directly I migrated my own
> test class (using the RouteBuilder) into your project.
> - added the test class
> - added the xsd
> - added the dependency to commons-io + camel-test-spring
> - changed the paths in my test class to fit your directory layout
> Now this also passed.
>
> It's good to see that there is no bug in Camel. ;)
>
>
> Because my example still fails in my other environment I check that ...
>
>
> Jan
>
>
>> -Ursprüngliche Nachricht-
>> Von: Aki Yoshida [mailto:elak...@gmail.com]
>> Gesendet: Mittwoch, 10. Dezember 2014 23:57
>> An: users@camel.apache.org
>> Betreff: Re: AW: camel - xsd
>>
>> i meant woodstox-core-asl (e.g., woodstox-core-asl-4.4.1.jar).
>> its maven coordinate is
>>
>> mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1
>>
>> you need to have woodstox or some other parser that reliably reports
>> the offset location at each parse event.
>> Sjsxp (sun/oracle implementation included in JDK) doesn't do that, so
>> you can't use it.
>>
>> jmtest.tar.gz contains a maven project that can be executed directly by
>> typing mvn test at the console or can be imported into your eclipse
>> IDE.
>>
>> 2014-12-10 13:13 GMT+01:00 Aki Yoshida :
>> > i just created a test that uses your data and verified that it is
>> working fine.
>> > please take a look at this file at my dropbox.
>> > https://www.dropbox.com/s/pfgvs9si9bvujxo/jmtest.tar.gz?dl=0
>> > just extract the files into camel-core and run JMNewsTest.
>> > and see if that works in your environment, (i believe it does).
>> >
>> > in that case, we need to find out the difference to your case.
>> > do you have woodstox-api in your class path?
>> >
>> >
>> > 2014-12-10 12:15 GMT+01:00 Aki Yoshida :
>> >> okay.
>> >> let me take a look.
>> >>
>> >>
>> >> 2014-12-10 12:02 GMT+01:00 Jan Matèrne (jhm) :
>> >>> No, input is valid xml.
>> >>> After invoking xtokenize() the xml is invalid.
>> >>>
>> >>> CAMEL-8106 is very  short. I can't see whether it is related.
>> >>>
>> >>>
>> >>> I posted an example on the user list
>> >>> http://mail-archives.apache.org/mod_mbox/camel-
>> users/201412.mbox/%3C
>> >>> 002b01d01452%24e8ee27a0%24baca76e0%24%40de%3E
>> >>>
>> >>> I had done a 'workaround' for this special example
>> >>> // Workaround of a bug?? in XMLTokenizerExpression
>> >>> .setBody(simple("${body.replace('news:Newsletter>',
>> 'news:Newsletter>')}"))
>> >>> .setBody(simple("${body.replace('',
>> >>> 'news:Newsletter>')}"))
>> >>>
>> >>> Without that the split messages have wrong end tags.
>> >>>
>> >>>
>> >>> Jan
>> >>>
>> >>>
>>  -Ursprüngliche Nachricht-
>>  Von: Aki Yoshida [mailto:elak...@gmail.com]
>>  Gesendet: Mittwoch, 10. Dezember 2014 10:34
>>  An: users@camel.apache.org
>>  Betreff: Re: AW: camel - xsd
>> 
>>  you are talking about the invalid-xml parsing bug in xtokenzier.
>>  that has been fixe with CAMEL-8106. It should be part of the new
>>  2.14.1, which is to be released shortly.
>> 
>>  regards, aki
>> 
>>  2014-12-10 9:25 GMT+01:00 Jan Matèrne (jhm) :
>>  > I played a little bit.
>>  >
>>  > Jan
>>  >
>>  >
>>  > public class XmlTest extends CamelTestSupport {
>>  >
>>  > @EndpointInject(uri="mock:valid")
>>  > MockEndpoint valid;
>>  >
>>  > @EndpointInject(uri="mock:validationError")
>>  > MockEndpoint validationError;
>>  >
>>  >
>>  >
>>  > @Test
>>  > public void validNewsfeed() throws Exception {
>>  > // Newsfeed contains 2 news
>>  > valid.expectedMessageCount(2);
>>  > valid.expectedMessagesMatches(
>>  > // Use helper methods from the static imported
>>  PredicateBuilder
>>  > and(
>>  > header("newsfeed.date").isEqualTo("2014.12.09
>>  14:15"),
>>  > header("news.author").isEqualTo("Jan"),
>>  >
>>  >
>> 
>> body().contains("xmlns:news=\"http://www.materne.de/camel/test/xml/
>>  com
>>  > plex/\
>> 

Use different aggregation strategy in camel depending on some header

2014-12-16 Thread umang
Hi,

What is the correct way to use different aggregation strategy in camel
depending on some header? Is the following way fine or is there any other
cleaner approach to do this?

from("direct:start")
 .choice()
 .when(header("foo").equalTo("bar"))
.aggregate(header("id"), new
BodyInAggregatingStrategy()).completionTimeout(3000)
 .when(header("foobar").equalTo("foobar"))
.aggregate(header("id"), new
BodyOutAggregatingStrategy()).completionTimeout(3000)
 .to("mock:aggregated");



--
View this message in context: 
http://camel.465427.n5.nabble.com/Use-different-aggregation-strategy-in-camel-depending-on-some-header-tp5760766.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Testing REST Service

2014-12-16 Thread fabrizio.spataro
Sure... i can use any rest tool but my idea is create a set of regression
test to help me on the future. 

ps. i am moving  to maven central. Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Testing-REST-Service-tp5760757p5760764.html
Sent from the Camel - Users mailing list archive at Nabble.com.


AW: AW: camel - xsd

2014-12-16 Thread jhm
I also published the demo
https://github.com/janmaterne/CamelXtokenizer

Jan

> -Ursprüngliche Nachricht-
> Von: Jan Matèrne (jhm) [mailto:apa...@materne.de]
> Gesendet: Dienstag, 16. Dezember 2014 12:45
> An: users@camel.apache.org
> Betreff: AW: AW: camel - xsd
> 
> done
> 
> Jan
> 
> > -Ursprüngliche Nachricht-
> > Von: Claus Ibsen [mailto:claus.ib...@gmail.com]
> > Gesendet: Dienstag, 16. Dezember 2014 12:11
> > An: users@camel.apache.org
> > Betreff: Re: AW: camel - xsd
> >
> > Hi
> >
> > Ya sure its a good idea to update the docs with your findings.
> >
> > On Tue, Dec 16, 2014 at 11:09 AM, Jan Matèrne (jhm)
> > 
> > wrote:
> > > I stripped down my own example and did a cross check to yours:
> > >
> > > When running on Java 1.8.0_20-ea-b20 the test failed.
> > > When I add Woodstox 4.4.1 as dependency the test passed.
> > >
> > > Same results when using Java 1.9.0-ea-b06.
> > >
> > > https://camel.apache.org/splitter.html sais "Note that this StAX
> > based
> > > tokenizer's uses StAX Location API and requires a StAX Reader
> > implementation (e.g., woodstox) that correctly returns the offset
> > position pointing to the beginning of each event triggering segment
> > (e.g., the offset position of '<' at each start and end element
> > event)."
> > >
> > >
> > > As we found the reason for the "error", should I update that
> > paragraph to say something about the consequences of a missing StAX-
> > with-Location?
> > >
> > >
> > > Jan
> > >
> > >
> > >
> > >> -Ursprüngliche Nachricht-
> > >> Von: Jan Matèrne (jhm) [mailto:apa...@materne.de]
> > >> Gesendet: Dienstag, 16. Dezember 2014 10:19
> > >> An: users@camel.apache.org
> > >> Betreff: AW: AW: camel - xsd
> > >>
> > >> Sorry for my late answer, I was ill :(
> > >>
> > >> Thanks for your sample project, I investigated into it now.
> > >> All tests passed. (Camel 2.14.0)
> > >>
> > >> But your test used the XMLTokenExpressionIterator directly I
> > migrated
> > >> my own test class (using the RouteBuilder) into your project.
> > >> - added the test class
> > >> - added the xsd
> > >> - added the dependency to commons-io + camel-test-spring
> > >> - changed the paths in my test class to fit your directory layout
> > Now
> > >> this also passed.
> > >>
> > >> It's good to see that there is no bug in Camel. ;)
> > >>
> > >>
> > >> Because my example still fails in my other environment I check
> that
> > ...
> > >>
> > >>
> > >> Jan
> > >>
> > >>
> > >> > -Ursprüngliche Nachricht-
> > >> > Von: Aki Yoshida [mailto:elak...@gmail.com]
> > >> > Gesendet: Mittwoch, 10. Dezember 2014 23:57
> > >> > An: users@camel.apache.org
> > >> > Betreff: Re: AW: camel - xsd
> > >> >
> > >> > i meant woodstox-core-asl (e.g., woodstox-core-asl-4.4.1.jar).
> > >> > its maven coordinate is
> > >> >
> > >> > mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1
> > >> >
> > >> > you need to have woodstox or some other parser that reliably
> > >> > reports the offset location at each parse event.
> > >> > Sjsxp (sun/oracle implementation included in JDK) doesn't do
> > >> > that, so you can't use it.
> > >> >
> > >> > jmtest.tar.gz contains a maven project that can be executed
> > >> > directly by typing mvn test at the console or can be imported
> > >> > into your
> > >> eclipse
> > >> > IDE.
> > >> >
> > >> > 2014-12-10 13:13 GMT+01:00 Aki Yoshida :
> > >> > > i just created a test that uses your data and verified that it
> > is
> > >> > working fine.
> > >> > > please take a look at this file at my dropbox.
> > >> > > https://www.dropbox.com/s/pfgvs9si9bvujxo/jmtest.tar.gz?dl=0
> > >> > > just extract the files into camel-core and run JMNewsTest.
> > >> > > and see if that works in your environment, (i believe it
> does).
> > >> > >
> > >> > > in that case, we need to find out the difference to your case.
> > >> > > do you have woodstox-api in your class path?
> > >> > >
> > >> > >
> > >> > > 2014-12-10 12:15 GMT+01:00 Aki Yoshida :
> > >> > >> okay.
> > >> > >> let me take a look.
> > >> > >>
> > >> > >>
> > >> > >> 2014-12-10 12:02 GMT+01:00 Jan Matèrne (jhm)
> > :
> > >> > >>> No, input is valid xml.
> > >> > >>> After invoking xtokenize() the xml is invalid.
> > >> > >>>
> > >> > >>> CAMEL-8106 is very  short. I can't see whether it is
> > related.
> > >> > >>>
> > >> > >>>
> > >> > >>> I posted an example on the user list
> > >> > >>> http://mail-archives.apache.org/mod_mbox/camel-
> > >> > users/201412.mbox/%3C
> > >> > >>> 002b01d01452%24e8ee27a0%24baca76e0%24%40de%3E
> > >> > >>>
> > >> > >>> I had done a 'workaround' for this special example
> > >> > >>> // Workaround of a bug?? in XMLTokenizerExpression
> > >> > >>> .setBody(simple("${body.replace('news:Newsletter>',
> > >> > 'news:Newsletter>')}"))
> > >> > >>> .setBody(simple("${body.replace('',
> > >> > >>> 'news:Newsletter>')}"))
> > >> > >>>
> > >> > >>> Without that the split messages have wrong end tags.
> > >> > >>>
> > >> > >>>
> > >> > >>> Jan
>

Re: missing region property in aws-sns component

2014-12-16 Thread Willem Jiang
I just went through the code we need to setup the endpoint before creating the 
new topic.
Here is the JIRA[1] I just created.

[1]https://issues.apache.org/jira/browse/CAMEL-8156

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On December 15, 2014 at 3:31:58 PM, Claus Ibsen (claus.ib...@gmail.com) wrote:
> On Sun, Dec 14, 2014 at 11:05 AM, JakubKahovec wrote:
> > Hello,
> >
> > I'm having a similar issue, using Camel-2.14.1-SNAPSHOT and aws-sns.
> > TopicArn is being created for the default region us-east instead of eu-west
> > although being specified through the amazonSNSEndpoint parameter.
> >
> > Here is my SNS endpoint:
> >
> > > > uri="aws-sns://ipex-b2b?amazonSNSEndpoint=https://sns.eu-west-1.amazonaws.com&subject=event&accessKey=&secretKey="/>
> > > >   
> >
> > I looked at the Camel-SNS code and I suspect that the problem lies in
> > SnsEndpoint.java, method doStart.
> > At the moment the SNS client is creating a topic it doesn't have the
> > endpoint from configuration set yet (it's being set late, at the end of the
> > method) so it creates the topic in the default region rather than in the one
> > specified in the endpoint.
> >
>  
> Ah thanks for spotting this. You are welcome to log a JIRA ticket about this 
> bug
> http://camel.apache.org/support.html
>  
> And we love contributions, so you are welcome to work on a fix.
> http://camel.apache.org/contributing.html
>  
>  
> > Jakub
> >
> >
> >
> >
> >
> >
> >
> > --
> > View this message in context: 
> > http://camel.465427.n5.nabble.com/missing-region-property-in-aws-sns-component-tp4303687p5760674.html
> >   
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>  
>  
>  
> --
> Claus Ibsen
> -
> Red Hat, Inc.
> Email: cib...@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>  



Re: Testing REST Service

2014-12-16 Thread Claus Ibsen
And btw Camel 2.14.1 is now synced in Maven central, so if you use
maven you can upgrade.

On Tue, Dec 16, 2014 at 11:57 AM, fabrizio.spataro
 wrote:
> Hello,
>
> i am using camel 2.14.1 (snapshot) to aim use newest camel rest component
> (using REST DSL).
>
> I am writing more rest services and i would test it using camel test java
> class.
>
> My main idea is write java class extends CamelTestSupport and use http camel
> component to invoke my REST services.
>
> Is it possible?
>
> There is another best testing strategy?
>
> Thanks
>
> FabryProg
>
> http://www.fabryprog.it
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Testing-REST-Service-tp5760757.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Testing REST Service

2014-12-16 Thread Claus Ibsen
Hi

Yeah sure you can use any http client, or some of the http client that
are native to rest, such as camel-restlet.
You can also see the unit tests of the various rest-dsl how we test it
itself, eg in camel-jetty, camel-restlet, camel-rest-spark etc.

Also you do not need to use a Camel component to send a REST message,
in case you have found a favorite rest client you want to use.



On Tue, Dec 16, 2014 at 11:57 AM, fabrizio.spataro
 wrote:
> Hello,
>
> i am using camel 2.14.1 (snapshot) to aim use newest camel rest component
> (using REST DSL).
>
> I am writing more rest services and i would test it using camel test java
> class.
>
> My main idea is write java class extends CamelTestSupport and use http camel
> component to invoke my REST services.
>
> Is it possible?
>
> There is another best testing strategy?
>
> Thanks
>
> FabryProg
>
> http://www.fabryprog.it
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Testing-REST-Service-tp5760757.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


AW: AW: camel - xsd

2014-12-16 Thread jhm
done

Jan

> -Ursprüngliche Nachricht-
> Von: Claus Ibsen [mailto:claus.ib...@gmail.com]
> Gesendet: Dienstag, 16. Dezember 2014 12:11
> An: users@camel.apache.org
> Betreff: Re: AW: camel - xsd
> 
> Hi
> 
> Ya sure its a good idea to update the docs with your findings.
> 
> On Tue, Dec 16, 2014 at 11:09 AM, Jan Matèrne (jhm) 
> wrote:
> > I stripped down my own example and did a cross check to yours:
> >
> > When running on Java 1.8.0_20-ea-b20 the test failed.
> > When I add Woodstox 4.4.1 as dependency the test passed.
> >
> > Same results when using Java 1.9.0-ea-b06.
> >
> > https://camel.apache.org/splitter.html sais "Note that this StAX
> based
> > tokenizer's uses StAX Location API and requires a StAX Reader
> implementation (e.g., woodstox) that correctly returns the offset
> position pointing to the beginning of each event triggering segment
> (e.g., the offset position of '<' at each start and end element
> event)."
> >
> >
> > As we found the reason for the "error", should I update that
> paragraph to say something about the consequences of a missing StAX-
> with-Location?
> >
> >
> > Jan
> >
> >
> >
> >> -Ursprüngliche Nachricht-
> >> Von: Jan Matèrne (jhm) [mailto:apa...@materne.de]
> >> Gesendet: Dienstag, 16. Dezember 2014 10:19
> >> An: users@camel.apache.org
> >> Betreff: AW: AW: camel - xsd
> >>
> >> Sorry for my late answer, I was ill :(
> >>
> >> Thanks for your sample project, I investigated into it now.
> >> All tests passed. (Camel 2.14.0)
> >>
> >> But your test used the XMLTokenExpressionIterator directly I
> migrated
> >> my own test class (using the RouteBuilder) into your project.
> >> - added the test class
> >> - added the xsd
> >> - added the dependency to commons-io + camel-test-spring
> >> - changed the paths in my test class to fit your directory layout
> Now
> >> this also passed.
> >>
> >> It's good to see that there is no bug in Camel. ;)
> >>
> >>
> >> Because my example still fails in my other environment I check that
> ...
> >>
> >>
> >> Jan
> >>
> >>
> >> > -Ursprüngliche Nachricht-
> >> > Von: Aki Yoshida [mailto:elak...@gmail.com]
> >> > Gesendet: Mittwoch, 10. Dezember 2014 23:57
> >> > An: users@camel.apache.org
> >> > Betreff: Re: AW: camel - xsd
> >> >
> >> > i meant woodstox-core-asl (e.g., woodstox-core-asl-4.4.1.jar).
> >> > its maven coordinate is
> >> >
> >> > mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1
> >> >
> >> > you need to have woodstox or some other parser that reliably
> >> > reports the offset location at each parse event.
> >> > Sjsxp (sun/oracle implementation included in JDK) doesn't do that,
> >> > so you can't use it.
> >> >
> >> > jmtest.tar.gz contains a maven project that can be executed
> >> > directly by typing mvn test at the console or can be imported into
> >> > your
> >> eclipse
> >> > IDE.
> >> >
> >> > 2014-12-10 13:13 GMT+01:00 Aki Yoshida :
> >> > > i just created a test that uses your data and verified that it
> is
> >> > working fine.
> >> > > please take a look at this file at my dropbox.
> >> > > https://www.dropbox.com/s/pfgvs9si9bvujxo/jmtest.tar.gz?dl=0
> >> > > just extract the files into camel-core and run JMNewsTest.
> >> > > and see if that works in your environment, (i believe it does).
> >> > >
> >> > > in that case, we need to find out the difference to your case.
> >> > > do you have woodstox-api in your class path?
> >> > >
> >> > >
> >> > > 2014-12-10 12:15 GMT+01:00 Aki Yoshida :
> >> > >> okay.
> >> > >> let me take a look.
> >> > >>
> >> > >>
> >> > >> 2014-12-10 12:02 GMT+01:00 Jan Matèrne (jhm)
> :
> >> > >>> No, input is valid xml.
> >> > >>> After invoking xtokenize() the xml is invalid.
> >> > >>>
> >> > >>> CAMEL-8106 is very  short. I can't see whether it is
> related.
> >> > >>>
> >> > >>>
> >> > >>> I posted an example on the user list
> >> > >>> http://mail-archives.apache.org/mod_mbox/camel-
> >> > users/201412.mbox/%3C
> >> > >>> 002b01d01452%24e8ee27a0%24baca76e0%24%40de%3E
> >> > >>>
> >> > >>> I had done a 'workaround' for this special example
> >> > >>> // Workaround of a bug?? in XMLTokenizerExpression
> >> > >>> .setBody(simple("${body.replace('news:Newsletter>',
> >> > 'news:Newsletter>')}"))
> >> > >>> .setBody(simple("${body.replace('',
> >> > >>> 'news:Newsletter>')}"))
> >> > >>>
> >> > >>> Without that the split messages have wrong end tags.
> >> > >>>
> >> > >>>
> >> > >>> Jan
> >> > >>>
> >> > >>>
> >> >  -Ursprüngliche Nachricht-
> >> >  Von: Aki Yoshida [mailto:elak...@gmail.com]
> >> >  Gesendet: Mittwoch, 10. Dezember 2014 10:34
> >> >  An: users@camel.apache.org
> >> >  Betreff: Re: AW: camel - xsd
> >> > 
> >> >  you are talking about the invalid-xml parsing bug in
> xtokenzier.
> >> >  that has been fixe with CAMEL-8106. It should be part of the
> >> >  new 2.14.1, which is to be released shortly.
> >> > 
> >> >  regards, aki
> >> > 
> >> >  2014-12-10 9:

Testing REST Service

2014-12-16 Thread fabrizio.spataro
Hello,

i am using camel 2.14.1 (snapshot) to aim use newest camel rest component
(using REST DSL).

I am writing more rest services and i would test it using camel test java
class.

My main idea is write java class extends CamelTestSupport and use http camel
component to invoke my REST services.

Is it possible? 

There is another best testing strategy?

Thanks

FabryProg

http://www.fabryprog.it



--
View this message in context: 
http://camel.465427.n5.nabble.com/Testing-REST-Service-tp5760757.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: AW: camel - xsd

2014-12-16 Thread Claus Ibsen
Hi

Ya sure its a good idea to update the docs with your findings.

On Tue, Dec 16, 2014 at 11:09 AM, Jan Matèrne (jhm)  wrote:
> I stripped down my own example and did a cross check to yours:
>
> When running on Java 1.8.0_20-ea-b20 the test failed.
> When I add Woodstox 4.4.1 as dependency the test passed.
>
> Same results when using Java 1.9.0-ea-b06.
>
> https://camel.apache.org/splitter.html sais
> "Note that this StAX based tokenizer's uses StAX Location API and requires a 
> StAX Reader implementation (e.g., woodstox) that correctly returns the offset 
> position pointing to the beginning of each event triggering segment (e.g., 
> the offset position of '<' at each start and end element event)."
>
>
> As we found the reason for the "error", should I update that paragraph to say 
> something about the consequences of a missing StAX-with-Location?
>
>
> Jan
>
>
>
>> -Ursprüngliche Nachricht-
>> Von: Jan Matèrne (jhm) [mailto:apa...@materne.de]
>> Gesendet: Dienstag, 16. Dezember 2014 10:19
>> An: users@camel.apache.org
>> Betreff: AW: AW: camel - xsd
>>
>> Sorry for my late answer, I was ill :(
>>
>> Thanks for your sample project, I investigated into it now.
>> All tests passed. (Camel 2.14.0)
>>
>> But your test used the XMLTokenExpressionIterator directly I migrated
>> my own test class (using the RouteBuilder) into your project.
>> - added the test class
>> - added the xsd
>> - added the dependency to commons-io + camel-test-spring
>> - changed the paths in my test class to fit your directory layout Now
>> this also passed.
>>
>> It's good to see that there is no bug in Camel. ;)
>>
>>
>> Because my example still fails in my other environment I check that ...
>>
>>
>> Jan
>>
>>
>> > -Ursprüngliche Nachricht-
>> > Von: Aki Yoshida [mailto:elak...@gmail.com]
>> > Gesendet: Mittwoch, 10. Dezember 2014 23:57
>> > An: users@camel.apache.org
>> > Betreff: Re: AW: camel - xsd
>> >
>> > i meant woodstox-core-asl (e.g., woodstox-core-asl-4.4.1.jar).
>> > its maven coordinate is
>> >
>> > mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1
>> >
>> > you need to have woodstox or some other parser that reliably reports
>> > the offset location at each parse event.
>> > Sjsxp (sun/oracle implementation included in JDK) doesn't do that, so
>> > you can't use it.
>> >
>> > jmtest.tar.gz contains a maven project that can be executed directly
>> > by typing mvn test at the console or can be imported into your
>> eclipse
>> > IDE.
>> >
>> > 2014-12-10 13:13 GMT+01:00 Aki Yoshida :
>> > > i just created a test that uses your data and verified that it is
>> > working fine.
>> > > please take a look at this file at my dropbox.
>> > > https://www.dropbox.com/s/pfgvs9si9bvujxo/jmtest.tar.gz?dl=0
>> > > just extract the files into camel-core and run JMNewsTest.
>> > > and see if that works in your environment, (i believe it does).
>> > >
>> > > in that case, we need to find out the difference to your case.
>> > > do you have woodstox-api in your class path?
>> > >
>> > >
>> > > 2014-12-10 12:15 GMT+01:00 Aki Yoshida :
>> > >> okay.
>> > >> let me take a look.
>> > >>
>> > >>
>> > >> 2014-12-10 12:02 GMT+01:00 Jan Matèrne (jhm) :
>> > >>> No, input is valid xml.
>> > >>> After invoking xtokenize() the xml is invalid.
>> > >>>
>> > >>> CAMEL-8106 is very  short. I can't see whether it is related.
>> > >>>
>> > >>>
>> > >>> I posted an example on the user list
>> > >>> http://mail-archives.apache.org/mod_mbox/camel-
>> > users/201412.mbox/%3C
>> > >>> 002b01d01452%24e8ee27a0%24baca76e0%24%40de%3E
>> > >>>
>> > >>> I had done a 'workaround' for this special example
>> > >>> // Workaround of a bug?? in XMLTokenizerExpression
>> > >>> .setBody(simple("${body.replace('news:Newsletter>',
>> > 'news:Newsletter>')}"))
>> > >>> .setBody(simple("${body.replace('',
>> > >>> 'news:Newsletter>')}"))
>> > >>>
>> > >>> Without that the split messages have wrong end tags.
>> > >>>
>> > >>>
>> > >>> Jan
>> > >>>
>> > >>>
>> >  -Ursprüngliche Nachricht-
>> >  Von: Aki Yoshida [mailto:elak...@gmail.com]
>> >  Gesendet: Mittwoch, 10. Dezember 2014 10:34
>> >  An: users@camel.apache.org
>> >  Betreff: Re: AW: camel - xsd
>> > 
>> >  you are talking about the invalid-xml parsing bug in xtokenzier.
>> >  that has been fixe with CAMEL-8106. It should be part of the new
>> >  2.14.1, which is to be released shortly.
>> > 
>> >  regards, aki
>> > 
>> >  2014-12-10 9:25 GMT+01:00 Jan Matèrne (jhm) :
>> >  > I played a little bit.
>> >  >
>> >  > Jan
>> >  >
>> >  >
>> >  > public class XmlTest extends CamelTestSupport {
>> >  >
>> >  > @EndpointInject(uri="mock:valid")
>> >  > MockEndpoint valid;
>> >  >
>> >  > @EndpointInject(uri="mock:validationError")
>> >  > MockEndpoint validationError;
>> >  >
>> >  >
>> >  >
>> >  > @Test
>> >  > public void vali

Re: How to avoid cxfrs:rserver adding extra header params (accept-encoding) -

2014-12-16 Thread Sergey Beryozkin
Hi, AFAIK one needs to activate a header filter strategy that would 
block copying the input headers


Cheers, Sergey
On 15/12/14 23:33, Kumaran wrote:

Hi

we are using camel cxfrs server to expose our proxy services,  The service
is exposer is working fine but if the response is more that certain limit
looks like the client is not able to receive getting timed out exception.

Then we have identified that the camel service adding some extra header
parameter such as accept-encoding.

So my question would be how do we avoid these extra header params and send
only the actual param.

Headers: {Accept=[application/xml], *accept-encoding=[gzip, deflate],*
accept-language=[en-us], Authorization=[xx], connection=[keep-alive],
Content-Length=[0], Content-Type=[null], host=[localhost:8001],
user-agent=[xxx/14.0.0 (x86_64)]}


but we dont send the "accept-encoding=" header param but getting added in
the cxfrs server

how could i remove this extra params and send only the actual param.


Thanks
Kumaran



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-avoid-cxfrs-rserver-adding-extra-header-params-accept-encoding-tp5760716.html
Sent from the Camel - Users mailing list archive at Nabble.com.





AW: AW: camel - xsd

2014-12-16 Thread jhm
I stripped down my own example and did a cross check to yours:

When running on Java 1.8.0_20-ea-b20 the test failed.
When I add Woodstox 4.4.1 as dependency the test passed.

Same results when using Java 1.9.0-ea-b06.

https://camel.apache.org/splitter.html sais
"Note that this StAX based tokenizer's uses StAX Location API and requires a 
StAX Reader implementation (e.g., woodstox) that correctly returns the offset 
position pointing to the beginning of each event triggering segment (e.g., the 
offset position of '<' at each start and end element event)."


As we found the reason for the "error", should I update that paragraph to say 
something about the consequences of a missing StAX-with-Location?


Jan



> -Ursprüngliche Nachricht-
> Von: Jan Matèrne (jhm) [mailto:apa...@materne.de]
> Gesendet: Dienstag, 16. Dezember 2014 10:19
> An: users@camel.apache.org
> Betreff: AW: AW: camel - xsd
> 
> Sorry for my late answer, I was ill :(
> 
> Thanks for your sample project, I investigated into it now.
> All tests passed. (Camel 2.14.0)
> 
> But your test used the XMLTokenExpressionIterator directly I migrated
> my own test class (using the RouteBuilder) into your project.
> - added the test class
> - added the xsd
> - added the dependency to commons-io + camel-test-spring
> - changed the paths in my test class to fit your directory layout Now
> this also passed.
> 
> It's good to see that there is no bug in Camel. ;)
> 
> 
> Because my example still fails in my other environment I check that ...
> 
> 
> Jan
> 
> 
> > -Ursprüngliche Nachricht-
> > Von: Aki Yoshida [mailto:elak...@gmail.com]
> > Gesendet: Mittwoch, 10. Dezember 2014 23:57
> > An: users@camel.apache.org
> > Betreff: Re: AW: camel - xsd
> >
> > i meant woodstox-core-asl (e.g., woodstox-core-asl-4.4.1.jar).
> > its maven coordinate is
> >
> > mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1
> >
> > you need to have woodstox or some other parser that reliably reports
> > the offset location at each parse event.
> > Sjsxp (sun/oracle implementation included in JDK) doesn't do that, so
> > you can't use it.
> >
> > jmtest.tar.gz contains a maven project that can be executed directly
> > by typing mvn test at the console or can be imported into your
> eclipse
> > IDE.
> >
> > 2014-12-10 13:13 GMT+01:00 Aki Yoshida :
> > > i just created a test that uses your data and verified that it is
> > working fine.
> > > please take a look at this file at my dropbox.
> > > https://www.dropbox.com/s/pfgvs9si9bvujxo/jmtest.tar.gz?dl=0
> > > just extract the files into camel-core and run JMNewsTest.
> > > and see if that works in your environment, (i believe it does).
> > >
> > > in that case, we need to find out the difference to your case.
> > > do you have woodstox-api in your class path?
> > >
> > >
> > > 2014-12-10 12:15 GMT+01:00 Aki Yoshida :
> > >> okay.
> > >> let me take a look.
> > >>
> > >>
> > >> 2014-12-10 12:02 GMT+01:00 Jan Matèrne (jhm) :
> > >>> No, input is valid xml.
> > >>> After invoking xtokenize() the xml is invalid.
> > >>>
> > >>> CAMEL-8106 is very  short. I can't see whether it is related.
> > >>>
> > >>>
> > >>> I posted an example on the user list
> > >>> http://mail-archives.apache.org/mod_mbox/camel-
> > users/201412.mbox/%3C
> > >>> 002b01d01452%24e8ee27a0%24baca76e0%24%40de%3E
> > >>>
> > >>> I had done a 'workaround' for this special example
> > >>> // Workaround of a bug?? in XMLTokenizerExpression
> > >>> .setBody(simple("${body.replace('news:Newsletter>',
> > 'news:Newsletter>')}"))
> > >>> .setBody(simple("${body.replace('',
> > >>> 'news:Newsletter>')}"))
> > >>>
> > >>> Without that the split messages have wrong end tags.
> > >>>
> > >>>
> > >>> Jan
> > >>>
> > >>>
> >  -Ursprüngliche Nachricht-
> >  Von: Aki Yoshida [mailto:elak...@gmail.com]
> >  Gesendet: Mittwoch, 10. Dezember 2014 10:34
> >  An: users@camel.apache.org
> >  Betreff: Re: AW: camel - xsd
> > 
> >  you are talking about the invalid-xml parsing bug in xtokenzier.
> >  that has been fixe with CAMEL-8106. It should be part of the new
> >  2.14.1, which is to be released shortly.
> > 
> >  regards, aki
> > 
> >  2014-12-10 9:25 GMT+01:00 Jan Matèrne (jhm) :
> >  > I played a little bit.
> >  >
> >  > Jan
> >  >
> >  >
> >  > public class XmlTest extends CamelTestSupport {
> >  >
> >  > @EndpointInject(uri="mock:valid")
> >  > MockEndpoint valid;
> >  >
> >  > @EndpointInject(uri="mock:validationError")
> >  > MockEndpoint validationError;
> >  >
> >  >
> >  >
> >  > @Test
> >  > public void validNewsfeed() throws Exception {
> >  > // Newsfeed contains 2 news
> >  > valid.expectedMessageCount(2);
> >  > valid.expectedMessagesMatches(
> >  > // Use helper methods from the static imported
> >  PredicateBuilder

Re: configuring Camel with XML DSL and Guice in tomcat

2014-12-16 Thread Willem Jiang
I don’t think you need to dependency injection in your XML DSL, as we just look 
up the instance from the registry. Can you give an example that you need to use 
Guice to do the DI work?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On December 13, 2014 at 9:45:32 PM, yogu13 (yogesh@synechron.com) wrote:
> Here is my understanding of things that needs to be done if Guice - Camel and
> XML DSL have to work together
>  
> 1. create a ServletContextListener which would do the following
> a. extracts Routes from the XML
> b. create a JNDI Registry instance (GuiceyFruit implementation)
> c. pass in the routes to create the injector as below
> Injector injector = Guice.createInjector(new
> CamelModuleWithRouteTypes(Set<>));
> d. create a CamelContext
> CamelContext camelContext = injector.getInstance(CamelContext.class);
> e. set the context in servletcontext which can be looked up and used later
>  
> 2. use existing servlet module as an entry point for triggering rest:// and
> servlet:// endpoints
>  
>  
> Let me know if my understanding is correct here..
>  
> Appreciate the help!
>  
> Regards,
> -Yogesh
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/configuring-Camel-with-XML-DSL-and-Guice-in-tomcat-tp5760657.html
>   
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  



Re: camel jetty form data not working

2014-12-16 Thread Willem Jiang
How did you submit the attachments?
camel-jetty supports multipart/form out of box.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On December 15, 2014 at 2:48:14 PM, vvsh (vvs...@gmail.com) wrote:
> Hello.
>  
> I am using camel-rest with jetty.
>  
>  
>  
> uploadFromFileProcessor:
>  
>  
>  
> But this does not work.
> Can you help?
> Thaks
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-jetty-form-data-not-working-tp5760662.html
>   
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  



Re: AW: AW: camel - xsd

2014-12-16 Thread smilevasu6
Thanks Jan for your prompt response.

It will be easy for me if you can provide the java classes.





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-xsd-tp5760376p5760745.html
Sent from the Camel - Users mailing list archive at Nabble.com.


AW: AW: camel - xsd

2014-12-16 Thread jhm
Sorry for my late answer, I was ill :(

Thanks for your sample project, I investigated into it now.
All tests passed. (Camel 2.14.0)

But your test used the XMLTokenExpressionIterator directly I migrated my own
test class (using the RouteBuilder) into your project.
- added the test class
- added the xsd
- added the dependency to commons-io + camel-test-spring
- changed the paths in my test class to fit your directory layout
Now this also passed.

It's good to see that there is no bug in Camel. ;)


Because my example still fails in my other environment I check that ...


Jan


> -Ursprüngliche Nachricht-
> Von: Aki Yoshida [mailto:elak...@gmail.com]
> Gesendet: Mittwoch, 10. Dezember 2014 23:57
> An: users@camel.apache.org
> Betreff: Re: AW: camel - xsd
> 
> i meant woodstox-core-asl (e.g., woodstox-core-asl-4.4.1.jar).
> its maven coordinate is
> 
> mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1
> 
> you need to have woodstox or some other parser that reliably reports
> the offset location at each parse event.
> Sjsxp (sun/oracle implementation included in JDK) doesn't do that, so
> you can't use it.
> 
> jmtest.tar.gz contains a maven project that can be executed directly by
> typing mvn test at the console or can be imported into your eclipse
> IDE.
> 
> 2014-12-10 13:13 GMT+01:00 Aki Yoshida :
> > i just created a test that uses your data and verified that it is
> working fine.
> > please take a look at this file at my dropbox.
> > https://www.dropbox.com/s/pfgvs9si9bvujxo/jmtest.tar.gz?dl=0
> > just extract the files into camel-core and run JMNewsTest.
> > and see if that works in your environment, (i believe it does).
> >
> > in that case, we need to find out the difference to your case.
> > do you have woodstox-api in your class path?
> >
> >
> > 2014-12-10 12:15 GMT+01:00 Aki Yoshida :
> >> okay.
> >> let me take a look.
> >>
> >>
> >> 2014-12-10 12:02 GMT+01:00 Jan Matèrne (jhm) :
> >>> No, input is valid xml.
> >>> After invoking xtokenize() the xml is invalid.
> >>>
> >>> CAMEL-8106 is very  short. I can't see whether it is related.
> >>>
> >>>
> >>> I posted an example on the user list
> >>> http://mail-archives.apache.org/mod_mbox/camel-
> users/201412.mbox/%3C
> >>> 002b01d01452%24e8ee27a0%24baca76e0%24%40de%3E
> >>>
> >>> I had done a 'workaround' for this special example
> >>> // Workaround of a bug?? in XMLTokenizerExpression
> >>> .setBody(simple("${body.replace('news:Newsletter>',
> 'news:Newsletter>')}"))
> >>> .setBody(simple("${body.replace('',
> >>> 'news:Newsletter>')}"))
> >>>
> >>> Without that the split messages have wrong end tags.
> >>>
> >>>
> >>> Jan
> >>>
> >>>
>  -Ursprüngliche Nachricht-
>  Von: Aki Yoshida [mailto:elak...@gmail.com]
>  Gesendet: Mittwoch, 10. Dezember 2014 10:34
>  An: users@camel.apache.org
>  Betreff: Re: AW: camel - xsd
> 
>  you are talking about the invalid-xml parsing bug in xtokenzier.
>  that has been fixe with CAMEL-8106. It should be part of the new
>  2.14.1, which is to be released shortly.
> 
>  regards, aki
> 
>  2014-12-10 9:25 GMT+01:00 Jan Matèrne (jhm) :
>  > I played a little bit.
>  >
>  > Jan
>  >
>  >
>  > public class XmlTest extends CamelTestSupport {
>  >
>  > @EndpointInject(uri="mock:valid")
>  > MockEndpoint valid;
>  >
>  > @EndpointInject(uri="mock:validationError")
>  > MockEndpoint validationError;
>  >
>  >
>  >
>  > @Test
>  > public void validNewsfeed() throws Exception {
>  > // Newsfeed contains 2 news
>  > valid.expectedMessageCount(2);
>  > valid.expectedMessagesMatches(
>  > // Use helper methods from the static imported
>  PredicateBuilder
>  > and(
>  > header("newsfeed.date").isEqualTo("2014.12.09
>  14:15"),
>  > header("news.author").isEqualTo("Jan"),
>  >
>  >
> 
> body().contains("xmlns:news=\"http://www.materne.de/camel/test/xml/
>  com
>  > plex/\
>  > "")
>  > )
>  > );
>  > // no error expected
>  > validationError.expectedMessageCount(0);
>  >
>  > // Read xml from classpath and send to Camel route
>  > String xml =
>  >
> 
> IOUtils.toString(getClass().getResourceAsStream("/de/materne/camel/
>  tes
>  > t/xml/
>  > complex/validNewsfeed.xml"));
>  > sendBody("direct:in", xml);
>  >
>  > // 'execute' all tests
>  > assertMockEndpointsSatisfied();
>  > }
>  >
>  >
>  > @Test
>  > public void invalidXml() throws Exception {
>  > valid.expectedMessageCount(0);
>  > validationError.expectedMessageCount(1);
>  >
>  > String xml = "";
>  > sendBody("direct:in",

Re: Junit Test Failing with AdviceWith

2014-12-16 Thread Claus Ibsen
Hi

See the javadoc of the start method and class javadoc of CamelContext

On Tue, Dec 16, 2014 at 9:54 AM, ManishGupta  wrote:
> Thanks for the Prompt reply Claus , I know about the mockEndpoint (assertions
> and Expectations) , It is very well explained in the book  I didn't use them
> to make it simpler at first.
>
> I didn't get your point on
> //"You need to run the test for a longer time. The start method is non
> blocking."
>
> Can you please elaborate or give me another hint.
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Junit-Test-Failing-with-AdviceWith-tp5760732p5760735.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Junit Test Failing with AdviceWith

2014-12-16 Thread ManishGupta
Thanks for the Prompt reply Claus , I know about the mockEndpoint (assertions
and Expectations) , It is very well explained in the book  I didn't use them
to make it simpler at first. 

I didn't get your point on 
//"You need to run the test for a longer time. The start method is non
blocking."

Can you please elaborate or give me another hint.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Junit-Test-Failing-with-AdviceWith-tp5760732p5760735.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Date format issue in xstream marshalling.

2014-12-16 Thread Claus Ibsen
Hi

I suggest to check
http://xstream.codehaus.org/

And see how you configure/control dates

On Mon, Dec 15, 2014 at 11:36 AM, sayed_india
 wrote:
> Hello,
> Can any one please help in retaining the date value instead converting to
> GMT?
>
> Thanks,
> Sayed
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Date-format-issue-in-xstream-marshalling-tp5758860p5760697.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Junit Test Failing with AdviceWith

2014-12-16 Thread Claus Ibsen
Hi

You need to run the test for a longer time. The start method is non
blocking. And for testing you may want to use mocks to set
expectations and whatnot.

Since you got the book, then read the entire testing chapter to learn more.



On Tue, Dec 16, 2014 at 9:24 AM, ManishGupta  wrote:
> Afternoon all,
>
> I have created Junit for existing production routes , Requirement was not to
> change anything from the route and test it with dummy data. From
> cameInAction and camel.apache.org i found the best approach will be to use
> adviceWith. I am using camel 2.10.
>
> When i run the Junit it starts of with replacing the From using
> replaceFromWith , New Route is created with changes from AdviceWith after
> the ContextStart ( I use isUseAdviceWith = True) and as soon as it starts it
> starts shutting down. The Route is not executed as expected , Please help.
>
> Given Below is my Test class :
>
> @UseAdviceWith
> public class AMSTest extends CamelSpringTestSupport{
>
> @Override
> protected AbstractApplicationContext createApplicationContext() {
> return new ClassPathXmlApplicationContext(
> "ams-context.xml");
> }
>
>
> @Override
> public boolean isUseAdviceWith() {
> return true;
> }
>
> @Test
> public void testLAMS() throws Exception
> {
>
> 
> context.getRouteDefinition("compare-request").adviceWith(context, new
> AdviceWithRouteBuilder() {
> @Override
> public void configure() throws Exception {
>
>
> replaceFromWith("file:/home/manish/cameldata/Compare?fileName=STARTCOMPARE");
> }
> });
>
> context.start();
> }
> }
>
> StackTrace :
>
> 12:05:19,213 DEBUG AMSTest:240 - setUp test
> 12:05:19,231 DEBUG AMSTest:297 - Using created route builder: Routes: []
> 12:05:19,232  INFO AMSTest:304 - Skipping starting CamelContext as
> isUseAdviceWith is set to true.
> 12:05:19,232 DEBUG AMSTest:311 - Routing Rules are: []
> 12:05:19,236  INFO AdviceWithTasks:313 - AdviceWith replace input from
> [file:{{outbound_home}}/Compare?fileName=STARTCOMPARE&move={{data_home}}]
> --> [file:/home/manish/cameldata/Compare?fileName=STARTCOMPARE]
> 12:05:19,237  INFO RouteDefinition:267 - AdviceWith route after: "NEW Route
> With Changes"
> 12:05:19,650  INFO SpringCamelContext:1381 - Apache Camel 2.10.0
> (CamelContext: myCamel) is starting
> 12:05:19,686  INFO DefaultManagementAgent:431 - JMX Connector thread started
> and listening at:
> service:jmx:rmi:///jndi/rmi://ubuntu12-virtual-machine:8000/jmxrmi/camel
> 12:05:19,690  INFO DefaultManagementLifecycleStrategy:849 - StatisticsLevel
> at All so enabling load performance statistics
> 12:05:20,269  INFO FileConsumer:27 - using Oceanview FileConsumer
> 12:05:20,688  INFO SpringCamelContext:2015 - Route: compare-request started
> and consuming from:
> Endpoint[file:///home/manish/cameldata/Compare?fileName=STARTCOMPARE]
> 12:05:20,691  INFO SpringCamelContext:1416 - Total 1 routes, of which 1 is
> started.
> 12:05:20,692  INFO SpringCamelContext:1417 - Apache Camel 2.10.0
> (CamelContext: myCamel) started in 1.042 seconds
> 12:05:20,692  INFO AMSTest:322 -
> 
> 12:05:20,692  INFO AMSTest:323 - Testing done:
> testAMS(com.ocean.ams.AMSTest)
> 12:05:20,692  INFO AMSTest:324 - Took: 1.460 seconds (1460 millis)
> 12:05:20,693  INFO AMSTest:325 -
> 
> 12:05:20,693  INFO SpringCamelContext:1557 - Apache Camel 2.10.0
> (CamelContext: myCamel) is shutting down
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Junit-Test-Failing-with-AdviceWith-tp5760732.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Junit Test Failing with AdviceWith

2014-12-16 Thread ManishGupta
Afternoon all,

I have created Junit for existing production routes , Requirement was not to
change anything from the route and test it with dummy data. From
cameInAction and camel.apache.org i found the best approach will be to use
adviceWith. I am using camel 2.10.

When i run the Junit it starts of with replacing the From using
replaceFromWith , New Route is created with changes from AdviceWith after
the ContextStart ( I use isUseAdviceWith = True) and as soon as it starts it
starts shutting down. The Route is not executed as expected , Please help.

Given Below is my Test class :

@UseAdviceWith
public class AMSTest extends CamelSpringTestSupport{

@Override
protected AbstractApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext(
"ams-context.xml");
}


@Override
public boolean isUseAdviceWith() {
return true;
}

@Test
public void testLAMS() throws Exception 
{


context.getRouteDefinition("compare-request").adviceWith(context, new
AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {


replaceFromWith("file:/home/manish/cameldata/Compare?fileName=STARTCOMPARE");
}
});

context.start();
}
}

StackTrace :

12:05:19,213 DEBUG AMSTest:240 - setUp test
12:05:19,231 DEBUG AMSTest:297 - Using created route builder: Routes: []
12:05:19,232  INFO AMSTest:304 - Skipping starting CamelContext as
isUseAdviceWith is set to true.
12:05:19,232 DEBUG AMSTest:311 - Routing Rules are: []
12:05:19,236  INFO AdviceWithTasks:313 - AdviceWith replace input from
[file:{{outbound_home}}/Compare?fileName=STARTCOMPARE&move={{data_home}}]
--> [file:/home/manish/cameldata/Compare?fileName=STARTCOMPARE]
12:05:19,237  INFO RouteDefinition:267 - AdviceWith route after: "NEW Route
With Changes"
12:05:19,650  INFO SpringCamelContext:1381 - Apache Camel 2.10.0
(CamelContext: myCamel) is starting
12:05:19,686  INFO DefaultManagementAgent:431 - JMX Connector thread started
and listening at:
service:jmx:rmi:///jndi/rmi://ubuntu12-virtual-machine:8000/jmxrmi/camel
12:05:19,690  INFO DefaultManagementLifecycleStrategy:849 - StatisticsLevel
at All so enabling load performance statistics
12:05:20,269  INFO FileConsumer:27 - using Oceanview FileConsumer
12:05:20,688  INFO SpringCamelContext:2015 - Route: compare-request started
and consuming from:
Endpoint[file:///home/manish/cameldata/Compare?fileName=STARTCOMPARE]
12:05:20,691  INFO SpringCamelContext:1416 - Total 1 routes, of which 1 is
started.
12:05:20,692  INFO SpringCamelContext:1417 - Apache Camel 2.10.0
(CamelContext: myCamel) started in 1.042 seconds
12:05:20,692  INFO AMSTest:322 -

12:05:20,692  INFO AMSTest:323 - Testing done:
testAMS(com.ocean.ams.AMSTest)
12:05:20,692  INFO AMSTest:324 - Took: 1.460 seconds (1460 millis)
12:05:20,693  INFO AMSTest:325 -

12:05:20,693  INFO SpringCamelContext:1557 - Apache Camel 2.10.0
(CamelContext: myCamel) is shutting down



--
View this message in context: 
http://camel.465427.n5.nabble.com/Junit-Test-Failing-with-AdviceWith-tp5760732.html
Sent from the Camel - Users mailing list archive at Nabble.com.