Re: Camel Spring Unit Testing with Mocks

2016-10-15 Thread Tomohisa Igarashi

I'm not sure if it's a bug or misuse, but expectedBodyReceived().body().isEqualTo("expected") 
doesn't work as expected. expectedBodiesReceived("expected") or 
expectedBodyReceived().constant("expected") works fine.
https://github.com/igarashitm/issues/blob/master/camel/misc/src/test/java/ExpectedBodyReceivedTest.java
only testBodyIsEqualTo() fails.

No idea yet for your second issue, but it sounds like the all endpoints are 
intercepted regardless of the RouteDefinition you invoked adviceWith().

Thanks,
Tomo

On 10/15/2016 02:06 AM, catequil wrote:

Ok, so it appears that I understand and have a working copy.  There are
however a few remaining questions.  If you feel they are no longer relevant
in this thread let me know and I will create a new thread.

In the code below I expected it to grab the "myRouteMiddle" route and find
the endpoint(direct:end) intercept it and mock the direct:end as
mock:direct:end.

In the assertions I expected it to to have a body of "peace world!", but the
test passed with a body of "hello world!".

Am I misunderstanding how the intercepts and/or getRouteDefinition work?

On a second issue I intercepted "log:input" and the test failed saying there
were 3 messages.  I expected it to only have one based on the following
criteria:
1. the "skipSendToOriginalEndpoint" should have stopped the last "log:input"
from being activated.
2. the getRouteDefinition was set to get "myMiddleRoute" which in my mind
should have gotten just the middle route and not the start route making the
total messages just 1.

Do you know why this works this way?  Is this a bug?  Or am I miss
understanding how it works?

Thanks





--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Spring-Unit-Testing-with-Mocks-tp5788635p5788814.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Camel Spring Unit Testing with Mocks

2016-10-15 Thread Tomohisa Igarashi

Actually interceptSendToEndpoint applies over route collections, but not on a 
specific route
https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java#L259

On 10/15/2016 03:36 PM, Tomohisa Igarashi wrote:

I'm not sure if it's a bug or misuse, but expectedBodyReceived().body().isEqualTo("expected") 
doesn't work as expected. expectedBodiesReceived("expected") or 
expectedBodyReceived().constant("expected") works fine.
https://github.com/igarashitm/issues/blob/master/camel/misc/src/test/java/ExpectedBodyReceivedTest.java
only testBodyIsEqualTo() fails.

No idea yet for your second issue, but it sounds like the all endpoints are 
intercepted regardless of the RouteDefinition you invoked adviceWith().

Thanks,
Tomo

On 10/15/2016 02:06 AM, catequil wrote:

Ok, so it appears that I understand and have a working copy.  There are
however a few remaining questions.  If you feel they are no longer relevant
in this thread let me know and I will create a new thread.

In the code below I expected it to grab the "myRouteMiddle" route and find
the endpoint(direct:end) intercept it and mock the direct:end as
mock:direct:end.

In the assertions I expected it to to have a body of "peace world!", but the
test passed with a body of "hello world!".

Am I misunderstanding how the intercepts and/or getRouteDefinition work?

On a second issue I intercepted "log:input" and the test failed saying there
were 3 messages.  I expected it to only have one based on the following
criteria:
1. the "skipSendToOriginalEndpoint" should have stopped the last "log:input"
from being activated.
2. the getRouteDefinition was set to get "myMiddleRoute" which in my mind
should have gotten just the middle route and not the start route making the
total messages just 1.

Do you know why this works this way?  Is this a bug?  Or am I miss
understanding how it works?

Thanks





--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Spring-Unit-Testing-with-Mocks-tp5788635p5788814.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Avro component example

2016-10-15 Thread owain
Have you a simple example you could share?

Sent from my iPhone

> On 15 Oct 2016, at 03:11, Vitalii Tymchyshyn [via Camel] 
>  wrote:
> 
> We are using avro quite succesfully. 
> 
> Чт, 13 жовт. 2016 07:25 користувач owain <[hidden email]> 
> пише: 
> 
> > Hi, 
> > 
> > Has anyone had any success converting a body (pojo) to an avro message via 
> > the avro component.  I have generated the avro serialiser for the avro 
> > message bit I am struggling with the documentation and questions online.  I 
> > am planning to send the avro message to some other routes via kakfa and 
> > avro 
> > seems like a good choice to reduce the coupling of the subsequent routes 
> > (services) on the domain model. 
> > 
> > I am using Blueprint. 
> > 
> > Thanks, 
> > 
> > O. 
> > 
> > 
> > 
> > 
> > -- 
> > View this message in context: 
> > http://camel.465427.n5.nabble.com/Avro-component-example-tp5788728.html
> > Sent from the Camel - Users mailing list archive at Nabble.com. 
> > 
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://camel.465427.n5.nabble.com/Avro-component-example-tp5788728p5788829.html
> To unsubscribe from Avro component example, click here.
> NAML




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

Re: SMS Router, a fully functional example with camel-smpp

2016-10-15 Thread engin
hello Daniel,

i was trying to build an smpp service with camel, after a few searching, i
saw your post.

there are multiple smpp message center gateways which i want to apply some
filters before routing; 
- health check
- weighting delivery rate for last xx mins
- weighting on some kind of response metrics

and some other routing filters based on message content;
- country based gateway filtering
- cheapest route selection

there might be lots of metrics so i'm planning to use redis. in every
operation i will be feeding redis nicely. after all these pre-processing,
the destination smpp mc gateway should be selected. then i want to load
balance and send messages with rate limiting (like 100 msg per/sec)

i'm kinda experienced backend developer. but, really newbie for the camel
and java world.

is the apache camel right tool for me?
can i go with your sms router project?

thanks in advance,

engin dumlu



--
View this message in context: 
http://camel.465427.n5.nabble.com/SMS-Router-a-fully-functional-example-with-camel-smpp-tp5784879p5788839.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: No HTTP response when using onException with BeanValidationException

2016-10-15 Thread Remco Schoen
Hi,

I did a little more testing and found that there seems to be a conflict in the 
headers.

When I add this to the XML it works:
http://remco.local:8080/custom_webapi/hello/world, 
CamelServletContextPath=/custom_webapi/hello/world, Connection=keep-alive, 
Content-Length=3, Content-Type=application/json, Host=remco.local:8080, 
Origin=http://petstore.swagger.io, 
Referer=http://petstore.swagger.io/?url=http://remco.local:8080/custom_webapi/api-docs/helloWorld,
 User-Agent=Mozilla/5.0}
"

That would explain why in some cases it works, the request was already routed 
to another webserver, so the headers were already changed before the exception.

--

Met vriendelijke groet,


Remco Schoen

Op 14 okt. 2016, om 16:36 heeft Remco Schoen 
> het volgende geschreven:

Hi,

I’m trying to use the REST DSL and do validation on the incoming object with 
the Bean Validation Component.

I have configured my Spring XML like this:


 
org.apache.camel.component.bean.validator.BeanValidationException
 
   true
 
 
   422
 
 
   Validation error.\n\Message:\n${exception.message}
 


But when I use the Swagger UI to send a message to my endpoint, I get no body 
or HTTP response code. For other exceptions this approach works.

Should this work with this exception?

I’m using version 2.17.3

Kind regards,

Remco Schoen



Re: file component polling files

2016-10-15 Thread Brad Johnson
I'm not quite sure what you are attempting to do here.  You poll every 30
seconds and seem to only want to pick up 1 file but then say you want it to
pick up a "large amount of files every poll".  Are you trying to pick up
just 1 file every 30 seconds or are you trying to read all the files when
the poll fires?  If you want to pick up everything it will do that
normally.  Are you unmarshaling these files at some point? Speeding things
up can be accomplished via thread pools and getting them off the file
reader can be accomplished by something as simple as a SEDA queue with a
thread pool.  But you also have to be aware of how much data you have in
each file and make sure it doesn't exceed your memory settings.  That
usually means tremendously big files because folks usually overestimate how
much data a file represents.

"thinking  that the file component will pick up a single file every 30 secs
but it seems to consume the files like normal. Any idea why is it doing that
or am i doing something wrong? My idea is to use the maxMessagesPerPoll to
make the file component pick up a large amount of files every poll. Is that
going to speed up the consumption?"

On Fri, Oct 14, 2016 at 3:48 AM, redpower1989 
wrote:

> I tried maxMessagesPerPoll = 1 and delay 30 secs and it wasn't picking 1
> file
> every 30 secs and i am wondering if i am setting something wrong on the
> consumer.
>
> By the way i found a way to speed up the file processing and it is the use
> of threads. Be careful that you need to find a balance for the poolsize
> value.
> http://camel.apache.org/async.html
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/file-component-polling-files-tp5788570p5788775.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>