OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mocking future routes


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 <claus.ibsen@xxxxxxxxx>:

> 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
> <yacov.schondorf@xxxxxxxxx> 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 <http://keywords-4-websites.com/home.jsp>

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