How to mock a processor

2013-10-17 Thread Olaf
Hello, I'm trying to test a simple route which downloads emails and then split attachments, replace body and sends each attachment to an another email. Now, ReplaceBodyProcessor does some network calls and I'd like to mock it out and simulate its work, to avoid external calls. What is the right wa

Re: How to mock a processor

2013-10-17 Thread Olaf
Thanks! That helps a lot. Somehow, I can only mock with weaveBeId method: weaveById("ReplaceBodyProcessor").replace().to("mock:ReplaceBodyProcessor"); then it is ReplaceBodyProcessor is skipped in test. If using weaveByToString(".*ReplaceBodyProcessor.*").replace().to("mock:ReplaceBodyProces

Re: How to mock a processor

2013-10-17 Thread Olaf
I did add the id later, so it worked, but weaveByToString does not work. Anyway, I'm going to use ids -- View this message in context: http://camel.465427.n5.nabble.com/How-to-mock-a-processor-tp5741786p5741801.html Sent from the Camel - Users mailing list archive at Nabble.com.

error: cannot find symbol when using split() in choice()

2013-10-18 Thread Olaf
Hello, why does this route not work? I'm getting error: cannot find symbol. from("file:data/inbox") .choice() .when(header("CamelFileName").endsWith(".xml")) .to("file:data/outbox/xml") .wh

Re: error: cannot find symbol when using split() in choice()

2013-10-19 Thread Olaf
Source http://pastebin.com/mrHNKF2c at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1344) at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:297) at org.springframework.context.event.SimpleA

Re: error: cannot find symbol when using split() in choice()

2013-10-19 Thread Olaf
Thanks! endChoice did the trick. May be this exception message should be added to the FAQ, so it can be found by google and co. -- View this message in context: http://camel.465427.n5.nabble.com/error-cannot-find-symbol-when-using-split-in-choice-tp5741857p5741893.html Sent from the Camel - Us

error while testing: duplicate id detected

2013-10-22 Thread Olaf
Hello, I have a simple route, which works fine from("file://data/inbox?noop=true") .beanRef("someProcessor") .process(new SomeOtherProcessor()).id("otherProcessor") .to("log:foo").id("loggingFoo"); But testing doesn't work. As one can s

define properties in context.xml

2013-10-23 Thread Olaf
Hello, is it possible to define properties in spring xml directly without using a .properties file? And then use them in java like that: from(imap://imap.server.com?username={{user}}&password={{pass}}) or from({{imapUri}}) I'd like to have only one xml config file Thanks for help! -- View

Re: define properties in context.xml

2013-10-23 Thread Olaf
Thanks! I'll try that -- View this message in context: http://camel.465427.n5.nabble.com/define-properties-in-context-xml-tp5742054p5742060.html Sent from the Camel - Users mailing list archive at Nabble.com.

Re: error while testing: duplicate id detected

2013-10-23 Thread Olaf
Oh, no... Thank you very much! -- View this message in context: http://camel.465427.n5.nabble.com/error-while-testing-duplicate-id-detected-tp5742041p5742102.html Sent from the Camel - Users mailing list archive at Nabble.com.

Downloading IMAP attachments fails on karaf

2013-10-25 Thread Olaf
Hello, downloading attachments (about 1Mb in size) fails if I deploy my application to karaf. If I start my application locally it uses mail-1.4.7.jar. I can see it in exception trace, because messages cannot be copied: javax.mail.MessagingException: A17 NO Error in IMAP command received by serv

count of processed messages when using aggregation

2013-11-05 Thread Olaf
Hello, is there an easy way to count and sum all processed lines by an aggregator? Suppose, my file has lines, the route split it into 100 lines chunks and send them to a remote system. The goal is, to gather statistics of all sent lines. In the example below, .log() would always print the ag

Re: count of processed messages when using aggregation

2013-11-05 Thread Olaf
Hello, thanks! CamelSplitSize is useful. I'd add then .to("remote") .choice() .when(property("CamelSplitComplete").isEqualTo("true")) .log("splitted ${property.CamelSplitSize} records") .otherwise()

Re: count of processed messages when using aggregation

2013-11-13 Thread Olaf
Hello, I still didn't find a solution. Somehow, I need to now, when all of aggregated portions have been completed. .aggregate(constant("id"), new Aggregator()).completionSize(100).completionTimeout(1).to("remote") and after that I could log, that the file is completed. Ideally I'd use .g

Re: count of processed messages when using aggregation

2013-11-13 Thread Olaf
Suppose I have 102 lines and first 100 lines need processing time more than 1 second. Then last 2 lines arrive .to("remote") as first aggregated chunk and the exchange has CamelSplitComplete property set, which is misleading in this case, because 100 lines are not processed yet completely. I cannot

Re: count of processed messages when using aggregation

2013-11-13 Thread Olaf
I'll try that. However, it will probably make the overall process slower, because the aggregator must wait until all splitted messages are processed. Anyway, thanks for help! -- View this message in context: http://camel.465427.n5.nabble.com/count-of-processed-messages-when-using-aggregation-tp

Re: count of processed messages when using aggregation

2013-11-14 Thread Olaf
There is also onComplete() but it is triggered right after aggregator processed last message, not after the route has completed the last message. Isn't it a bug? Anyway it wouldn't have the counter in question, I'd only know route has finished @Override public void configure() throws Ex

re-use route definition

2013-11-22 Thread Olaf
Hello, what is the best way to reuse a route with different parameters? Let's say I have many classes implementing RouteBuilder interface and add them all in camel-context.xml http://camel.apache.org/schema/spring";> ... Almost in every Route clas

Re: re-use route definition

2013-11-22 Thread Olaf
Thanks for hint! What about composition of objects? Test doesn't work :( @Test() public void testRoute() throws Exception { template.sendBodyAndHeader("file:data", "foo bar", Exchange.FILE_NAME, "foo.txt"); Thread.sleep(3000); File target = new File("data/process

Re: re-use route definition

2013-11-22 Thread Olaf
the right way :) @Override public void configure() throws Exception { from("file:data").to("file:data/output"); getContext().addRoutes(fileRoute);//can be injected } -- View this message in context: http://camel.465427.n5.nabble.com/re-use-route-definition-tp5743696

move files if message fails

2014-03-20 Thread Olaf
Hello, In my route below I'd like to move only a successfully processed file into 'done' folder. If any exception occurs or message is routed to dead letter channel I want to move the input file into failed folder. I've used &moveFailed=failed option, but it does not work. The file is just moved t

Re: move files if message fails

2014-03-20 Thread Olaf
Thank you very much! I need deadLetterChannel, because of custom error logging logic, which saves message with all errors into db. I think I have to do the following: onException(IOException.class) .handled(true).maximumRedeliveries(10) .retryAttemptedLogLevel(LoggingLevel.WARN).redeli

bean members with parallel processing

2014-03-20 Thread Olaf
Hello, would the following route work correctly with multiple threads? In beanRef("TestProcessor", "step2") the instance variable mapper is used, so I suppose it is not thread safe, right? Should I set the mapper as a property of the exchange? from(inputsource) .beanRef("TestP

simple language Unix timestamp

2014-03-27 Thread Olaf
Hello, I know there is simple("${date:now:MMdd}") or other date formats. How can I print just current Unix timestamp? Does simple support it? Thanks! -- View this message in context: http://camel.465427.n5.nabble.com/simple-language-Unix-timestamp-tp5749433.html Sent from the Camel - User

RE: simple language Unix timestamp

2014-03-27 Thread Olaf
thanks! it works producing java currentTimeMillis. What I need is currentTimeMillis / 1000L Can simple evaluate it? -- View this message in context: http://camel.465427.n5.nabble.com/simple-language-Unix-timestamp-tp5749433p5749439.html Sent from the Camel - Users mailing list archive at Nabble

how to set null body

2014-03-28 Thread Olaf
Hello, at some point in my route I need to make a GET request. According to the documentation the body must be null for GET. Asserting null body however does not work. from("") ... ... .setBody(simple(null)).to("http://example.com/id/1) .process(new MyProcessor()).to("mock:target"); TEST: httpE

whenAnyExchangeReceived is never called

2014-03-28 Thread Olaf
Hello, in one of my tests, I just cannot get it working... expectedMessageCount works fine and I see 3 incoming messages. I'd like to overwrite output bodies to mock http call results, but whenAnyExchangeReceived is never called and thus I cannot assert the final message content to be "foobar". Wh

Re: how to set null body

2014-03-28 Thread Olaf
constant(null) works fine. Thank you very much! -- View this message in context: http://camel.465427.n5.nabble.com/how-to-set-null-body-tp5749484p5749492.html Sent from the Camel - Users mailing list archive at Nabble.com.

Re: whenAnyExchangeReceived is never called

2014-03-28 Thread Olaf
Source code for class, failing test and configuration file 'test-http.xml' http://pastebin.com/GHsiqR1t Would be great, if someone could tell me what is wrong here -- View this message in context: http://camel.465427.n5.nabble.com/whenAnyExchangeReceived-is-never-called-tp5749491p5749501.ht

Re: whenAnyExchangeReceived is never called

2014-03-31 Thread Olaf
template.sendBody("direct:in", body); was called before mock assertions definitions. -- View this message in context: http://camel.465427.n5.nabble.com/whenAnyExchangeReceived-is-never-called-tp5749491p5749558.html Sent from the Camel - Users mailing list archive at Nabble.com.

how set dynamic header values

2014-03-31 Thread Olaf
Hello! what is the correct way to set dynamic header values? I often need to set value concatenated form a prefix and xpath result. But it seems not work; setHeader("ISBN", getMyGetter() + ns.xpath("c:book/isbn", String.class)) So as workaround I do> .setHeader("ISBNValue", ns.xpath("c:book/isb

Re: whenAnyExchangeReceived is never called

2014-04-01 Thread Olaf
It was only for demonstration. As I said above, template was sent to early. That was the problem -- View this message in context: http://camel.465427.n5.nabble.com/whenAnyExchangeReceived-is-never-called-tp5749491p5749606.html Sent from the Camel - Users mailing list archive at Nabble.com.

Which EPI to use?

2014-04-01 Thread Olaf
Hello, I have an input message which containts id of a FilesObject and urls of files to be downloaded for this object: {"filesObjectId":1, "file1":"url", "customFiles": [{"id":1,"name":"Foo"}, {"id":2, "name":"Bar"}]} The task is to load Files object by id and download only new files if they not

Bug in documentation: methodName should be method in bean: uri

2009-08-19 Thread Olaf Bergner
. the parameter's name is method, not methodName. Had to study the source code to figure that out. Leaves me wondering why nobody pointed this out before, though. Cheers, Olaf -- View this message in context: http://www.nabble.com/Bug-in-documentation%3A-methodName-should-be-method-in-b