mocking future routes

2018-01-17 Thread Yacov Schondorf
Hi,
I know how to mock/advise existing routes. But what do I do if one of my
routes creates new routes? For example, I can send a configuration message
to a configuration route which has an activeMQ From endpoint. The endpoint
is advised and replaced with direct:a, so I send a configuration message in
my test. The route continues by creating a new route from
activeMQ:someTopic to kafka:someTopic. This route fails to create because
there is no real ssl-enabled kafka and activeMQ in the test environment. Is
there anything that can be done?


Re: mocking future routes

2018-02-01 Thread Claus Ibsen
You can try when you create the new route, to add "stub:" as the
prefix for your endpoints. Then you can use the stub component to mock
them.
http://camel.apache.org/stub

On Wed, Jan 17, 2018 at 6:10 PM, Yacov Schondorf
 wrote:
> Hi,
> I know how to mock/advise existing routes. But what do I do if one of my
> routes creates new routes? For example, I can send a configuration message
> to a configuration route which has an activeMQ From endpoint. The endpoint
> is advised and replaced with direct:a, so I send a configuration message in
> my test. The route continues by creating a new route from
> activeMQ:someTopic to kafka:someTopic. This route fails to create because
> there is no real ssl-enabled kafka and activeMQ in the test environment. Is
> there anything that can be done?



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: mocking future routes

2018-04-24 Thread Yacov Schondorf
Hi,
So sorry for the late response; only now I was able to get back to this
issue.
I don't see how the stub component can help me here. This is a real route I
need to mock in a production code.
Consider this use case:
1. My route (let's call it route 1)  has a Jetty start endpoint, and is a
configuration service so that an incoming call would cause a configuration
change to the system. If the incoming call has some "flag" set to "true"
then a new route needs to be created (route 2). Route 2 has a Kafka
endpoint which I need to mock because the connection parameters are not
relevant at test time.
2. On my test, I advise route 1, and replace the Jetty endpoint with a
start endpoint, and send a message that should trigger creation of route 2.
Creation of route 2 fails because of the wrong Kafka parameters.

If I add "stub:" in route 2 ("Stub:kafka...") then in non-test time the
route will not work.

Any solution for this?


2018-02-01 18:58 GMT+02:00 Claus Ibsen :

> You can try when you create the new route, to add "stub:" as the
> prefix for your endpoints. Then you can use the stub component to mock
> them.
> http://camel.apache.org/stub
>
> On Wed, Jan 17, 2018 at 6:10 PM, Yacov Schondorf
>  wrote:
> > Hi,
> > I know how to mock/advise existing routes. But what do I do if one of my
> > routes creates new routes? For example, I can send a configuration
> message
> > to a configuration route which has an activeMQ From endpoint. The
> endpoint
> > is advised and replaced with direct:a, so I send a configuration message
> in
> > my test. The route continues by creating a new route from
> > activeMQ:someTopic to kafka:someTopic. This route fails to create because
> > there is no real ssl-enabled kafka and activeMQ in the test environment.
> Is
> > there anything that can be done?
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>



-- 
יעקב שיינדורף
מנכ"ל ומנהל פיתוח,
מילות מפתח לאתרים
054-5750201
http://keywords-4-websites.com 

יעקב שיינדורף
מנהל מוסיקלי StyleBrass
054-5750201
http://www.stylebrass.co.il


Re: mocking future routes

2018-04-24 Thread Willem Jiang
Hi,

As the endpoint uri is string, you can change the prefix with some kind of
profile.
If you want to use it in the test, you can simply set the prefix to be
"stub".
In the production world, you can just set the prefix to be an empty string.


Willem Jiang

Blog: http://willemjiang.blogspot.com (English)
  http://jnn.iteye.com  (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem

On Wed, Apr 25, 2018 at 4:20 AM, Yacov Schondorf 
wrote:

> Hi,
> So sorry for the late response; only now I was able to get back to this
> issue.
> I don't see how the stub component can help me here. This is a real route I
> need to mock in a production code.
> Consider this use case:
> 1. My route (let's call it route 1)  has a Jetty start endpoint, and is a
> configuration service so that an incoming call would cause a configuration
> change to the system. If the incoming call has some "flag" set to "true"
> then a new route needs to be created (route 2). Route 2 has a Kafka
> endpoint which I need to mock because the connection parameters are not
> relevant at test time.
> 2. On my test, I advise route 1, and replace the Jetty endpoint with a
> start endpoint, and send a message that should trigger creation of route 2.
> Creation of route 2 fails because of the wrong Kafka parameters.
>
> If I add "stub:" in route 2 ("Stub:kafka...") then in non-test time the
> route will not work.
>
> Any solution for this?
>
>
> 2018-02-01 18:58 GMT+02:00 Claus Ibsen :
>
> > You can try when you create the new route, to add "stub:" as the
> > prefix for your endpoints. Then you can use the stub component to mock
> > them.
> > http://camel.apache.org/stub
> >
> > On Wed, Jan 17, 2018 at 6:10 PM, Yacov Schondorf
> >  wrote:
> > > Hi,
> > > I know how to mock/advise existing routes. But what do I do if one of
> my
> > > routes creates new routes? For example, I can send a configuration
> > message
> > > to a configuration route which has an activeMQ From endpoint. The
> > endpoint
> > > is advised and replaced with direct:a, so I send a configuration
> message
> > in
> > > my test. The route continues by creating a new route from
> > > activeMQ:someTopic to kafka:someTopic. This route fails to create
> because
> > > there is no real ssl-enabled kafka and activeMQ in the test
> environment.
> > Is
> > > there anything that can be done?
> >
> >
> >
> > --
> > Claus Ibsen
> > -
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >
>
>
>
> --
> יעקב שיינדורף
> מנכ"ל ומנהל פיתוח,
> מילות מפתח לאתרים
> 054-5750201
> http://keywords-4-websites.com 
>
> יעקב שיינדורף
> מנהל מוסיקלי StyleBrass
> 054-5750201
> http://www.stylebrass.co.il
>