You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mary Cochran <mc...@redhat.com> on 2018/05/17 18:20:11 UTC

unit test advicewith sql-stored

I am having some issues when I am trying to use adviceWith in my unit test
to intercept my sql-stored endpoint.  I am fine with skipping this
endpoint, but haven't been able to get anything to work.  Below is the
exception even when I can see the logging for advice with is there.

*Logging:*
InterceptSendToEndpoint[sql-stored:* -> [To[mock:sql-stored:test],
Transform[constant{Result=SUCCESS}]]],

Exception:
Caused by: org.hsqldb.HsqlException: user lacks privilege or object not
found: <Stored proc name>

*Route:*



*from(ROUTE_SB_AND_RESPOND).routeId(ROUTE_SB_AND_RESPOND_ID).to("sql-stored:<stored
proc name>(VARCHAR ${headers.correlationId})").id("stored-proc")*

*Test:*












* - context.getRouteDefinition(""route-name").adviceWith(context, new
AdviceWithRouteBuilder() { @Override public void configure() throws
Exception {
interceptSendToEndpoint("https4://endpoint1*").to("mock:https4/endpoint1").skipSendToOriginalEndpoint().transform(constant(json));
interceptSendToEndpoint("https4://endpoint2*").to("mock:https4/endpoint2").skipSendToOriginalEndpoint().transform(constant(json2));
//weaveById("stored-proc"); //weaveByToString("sql-stored*");
//.to("mock:sql-stored:test").transform(constant("Result=SUCCESS"));
interceptSendToEndpoint("sql-stored:*").to("mock:sql-stored:test").skipSendToOriginalEndpoint().transform(constant("Result=SUCCESS"));}
});*
Note that the other interceptSendToEndpoints are working properly. Any
thoughts?

Thanks!
Mary Cochran
Red Hat Consulting
mcochran@redhat.com
(419) 543-0531

Re: unit test advicewith sql-stored

Posted by Mary Cochran <mc...@redhat.com>.
Found the issue.  My route being tested is pretty large, so there are
multiple route builders and routeids along the way.  I needed to use a
different routeId for the advice with.

Thanks,
Mary


Mary Cochran
Red Hat Consulting
mcochran@redhat.com
(419) 543-0531

On Fri, May 18, 2018 at 2:18 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> If you can build a small sample project that reproduces this problem
> without client confidential details, then you are welcome to do so,
> and maybe put it on github, or log a JIRA and attach a zip file etc.
>
> Then its easier for others to dive into and help.
>
> I am traveling this week and will be back in my office on tuesday.
>
> On Thu, May 17, 2018 at 10:41 PM, Mary Cochran <mc...@redhat.com>
> wrote:
> > Hi Claus,
> >
> > Camel version 2.20.2. I get the exception when it gets to that point in
> the
> > route (not on startup). I can't easily post the whole exception here due
> to
> > it containing client information.  I started to print off the camel
> context
> > endpoints after it started and it is still containing the real sql-stored
> > endpoint and also the mock endpoint. It is very odd.
> >
> > Thanks,
> > Mary Cochran
> >
> >
> >
> > On Thu, May 17, 2018, 3:35 PM Claus Ibsen <cl...@gmail.com> wrote:
> >
> >> Hi Mary
> >>
> >> What version of Camel do you use?
> >>
> >> And at what time do you get that exdeption, maybe you can post the
> >> full stacktrace?
> >>
> >> I suspect it may be during startup of Camel that the sql-store
> >> component does some init logic that then fails, before
> >> even any endpoints is created.
> >>
> >>
> >>
> >> On Thu, May 17, 2018 at 8:20 PM, Mary Cochran <mc...@redhat.com>
> wrote:
> >> > I am having some issues when I am trying to use adviceWith in my unit
> >> test
> >> > to intercept my sql-stored endpoint.  I am fine with skipping this
> >> > endpoint, but haven't been able to get anything to work.  Below is the
> >> > exception even when I can see the logging for advice with is there.
> >> >
> >> > *Logging:*
> >> > InterceptSendToEndpoint[sql-stored:* -> [To[mock:sql-stored:test],
> >> > Transform[constant{Result=SUCCESS}]]],
> >> >
> >> > Exception:
> >> > Caused by: org.hsqldb.HsqlException: user lacks privilege or object
> not
> >> > found: <Stored proc name>
> >> >
> >> > *Route:*
> >> >
> >> >
> >> >
> >> >
> >> *from(ROUTE_SB_AND_RESPOND).routeId(ROUTE_SB_AND_RESPOND_
> ID).to("sql-stored:<stored
> >> > proc name>(VARCHAR ${headers.correlationId})").id("stored-proc")*
> >> >
> >> > *Test:*
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > * - context.getRouteDefinition(""route-name").adviceWith(context, new
> >> > AdviceWithRouteBuilder() { @Override public void configure() throws
> >> > Exception {
> >> >
> >> interceptSendToEndpoint("https4://endpoint1*").to("
> mock:https4/endpoint1").skipSendToOriginalEndpoint().
> transform(constant(json));
> >> >
> >> interceptSendToEndpoint("https4://endpoint2*").to("
> mock:https4/endpoint2").skipSendToOriginalEndpoint().
> transform(constant(json2));
> >> > //weaveById("stored-proc"); //weaveByToString("sql-stored*");
> >> > //.to("mock:sql-stored:test").transform(constant("Result=SUCCESS"));
> >> >
> >> interceptSendToEndpoint("sql-stored:*").to("mock:sql-stored:test").
> skipSendToOriginalEndpoint().transform(constant("Result=SUCCESS"));}
> >> > });*
> >> > Note that the other interceptSendToEndpoints are working properly. Any
> >> > thoughts?
> >> >
> >> > Thanks!
> >> > Mary Cochran
> >> > Red Hat Consulting
> >> > mcochran@redhat.com
> >> > (419) 543-0531
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> http://davsclaus.com @davsclaus
> >> Camel in Action 2: https://www.manning.com/ibsen2
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Re: unit test advicewith sql-stored

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

If you can build a small sample project that reproduces this problem
without client confidential details, then you are welcome to do so,
and maybe put it on github, or log a JIRA and attach a zip file etc.

Then its easier for others to dive into and help.

I am traveling this week and will be back in my office on tuesday.

On Thu, May 17, 2018 at 10:41 PM, Mary Cochran <mc...@redhat.com> wrote:
> Hi Claus,
>
> Camel version 2.20.2. I get the exception when it gets to that point in the
> route (not on startup). I can't easily post the whole exception here due to
> it containing client information.  I started to print off the camel context
> endpoints after it started and it is still containing the real sql-stored
> endpoint and also the mock endpoint. It is very odd.
>
> Thanks,
> Mary Cochran
>
>
>
> On Thu, May 17, 2018, 3:35 PM Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi Mary
>>
>> What version of Camel do you use?
>>
>> And at what time do you get that exdeption, maybe you can post the
>> full stacktrace?
>>
>> I suspect it may be during startup of Camel that the sql-store
>> component does some init logic that then fails, before
>> even any endpoints is created.
>>
>>
>>
>> On Thu, May 17, 2018 at 8:20 PM, Mary Cochran <mc...@redhat.com> wrote:
>> > I am having some issues when I am trying to use adviceWith in my unit
>> test
>> > to intercept my sql-stored endpoint.  I am fine with skipping this
>> > endpoint, but haven't been able to get anything to work.  Below is the
>> > exception even when I can see the logging for advice with is there.
>> >
>> > *Logging:*
>> > InterceptSendToEndpoint[sql-stored:* -> [To[mock:sql-stored:test],
>> > Transform[constant{Result=SUCCESS}]]],
>> >
>> > Exception:
>> > Caused by: org.hsqldb.HsqlException: user lacks privilege or object not
>> > found: <Stored proc name>
>> >
>> > *Route:*
>> >
>> >
>> >
>> >
>> *from(ROUTE_SB_AND_RESPOND).routeId(ROUTE_SB_AND_RESPOND_ID).to("sql-stored:<stored
>> > proc name>(VARCHAR ${headers.correlationId})").id("stored-proc")*
>> >
>> > *Test:*
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > * - context.getRouteDefinition(""route-name").adviceWith(context, new
>> > AdviceWithRouteBuilder() { @Override public void configure() throws
>> > Exception {
>> >
>> interceptSendToEndpoint("https4://endpoint1*").to("mock:https4/endpoint1").skipSendToOriginalEndpoint().transform(constant(json));
>> >
>> interceptSendToEndpoint("https4://endpoint2*").to("mock:https4/endpoint2").skipSendToOriginalEndpoint().transform(constant(json2));
>> > //weaveById("stored-proc"); //weaveByToString("sql-stored*");
>> > //.to("mock:sql-stored:test").transform(constant("Result=SUCCESS"));
>> >
>> interceptSendToEndpoint("sql-stored:*").to("mock:sql-stored:test").skipSendToOriginalEndpoint().transform(constant("Result=SUCCESS"));}
>> > });*
>> > Note that the other interceptSendToEndpoints are working properly. Any
>> > thoughts?
>> >
>> > Thanks!
>> > Mary Cochran
>> > Red Hat Consulting
>> > mcochran@redhat.com
>> > (419) 543-0531
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>



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

Re: unit test advicewith sql-stored

Posted by Mary Cochran <mc...@redhat.com>.
Hi Claus,

Camel version 2.20.2. I get the exception when it gets to that point in the
route (not on startup). I can't easily post the whole exception here due to
it containing client information.  I started to print off the camel context
endpoints after it started and it is still containing the real sql-stored
endpoint and also the mock endpoint. It is very odd.

Thanks,
Mary Cochran



On Thu, May 17, 2018, 3:35 PM Claus Ibsen <cl...@gmail.com> wrote:

> Hi Mary
>
> What version of Camel do you use?
>
> And at what time do you get that exdeption, maybe you can post the
> full stacktrace?
>
> I suspect it may be during startup of Camel that the sql-store
> component does some init logic that then fails, before
> even any endpoints is created.
>
>
>
> On Thu, May 17, 2018 at 8:20 PM, Mary Cochran <mc...@redhat.com> wrote:
> > I am having some issues when I am trying to use adviceWith in my unit
> test
> > to intercept my sql-stored endpoint.  I am fine with skipping this
> > endpoint, but haven't been able to get anything to work.  Below is the
> > exception even when I can see the logging for advice with is there.
> >
> > *Logging:*
> > InterceptSendToEndpoint[sql-stored:* -> [To[mock:sql-stored:test],
> > Transform[constant{Result=SUCCESS}]]],
> >
> > Exception:
> > Caused by: org.hsqldb.HsqlException: user lacks privilege or object not
> > found: <Stored proc name>
> >
> > *Route:*
> >
> >
> >
> >
> *from(ROUTE_SB_AND_RESPOND).routeId(ROUTE_SB_AND_RESPOND_ID).to("sql-stored:<stored
> > proc name>(VARCHAR ${headers.correlationId})").id("stored-proc")*
> >
> > *Test:*
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > * - context.getRouteDefinition(""route-name").adviceWith(context, new
> > AdviceWithRouteBuilder() { @Override public void configure() throws
> > Exception {
> >
> interceptSendToEndpoint("https4://endpoint1*").to("mock:https4/endpoint1").skipSendToOriginalEndpoint().transform(constant(json));
> >
> interceptSendToEndpoint("https4://endpoint2*").to("mock:https4/endpoint2").skipSendToOriginalEndpoint().transform(constant(json2));
> > //weaveById("stored-proc"); //weaveByToString("sql-stored*");
> > //.to("mock:sql-stored:test").transform(constant("Result=SUCCESS"));
> >
> interceptSendToEndpoint("sql-stored:*").to("mock:sql-stored:test").skipSendToOriginalEndpoint().transform(constant("Result=SUCCESS"));}
> > });*
> > Note that the other interceptSendToEndpoints are working properly. Any
> > thoughts?
> >
> > Thanks!
> > Mary Cochran
> > Red Hat Consulting
> > mcochran@redhat.com
> > (419) 543-0531
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Re: unit test advicewith sql-stored

Posted by Claus Ibsen <cl...@gmail.com>.
Hi Mary

What version of Camel do you use?

And at what time do you get that exdeption, maybe you can post the
full stacktrace?

I suspect it may be during startup of Camel that the sql-store
component does some init logic that then fails, before
even any endpoints is created.



On Thu, May 17, 2018 at 8:20 PM, Mary Cochran <mc...@redhat.com> wrote:
> I am having some issues when I am trying to use adviceWith in my unit test
> to intercept my sql-stored endpoint.  I am fine with skipping this
> endpoint, but haven't been able to get anything to work.  Below is the
> exception even when I can see the logging for advice with is there.
>
> *Logging:*
> InterceptSendToEndpoint[sql-stored:* -> [To[mock:sql-stored:test],
> Transform[constant{Result=SUCCESS}]]],
>
> Exception:
> Caused by: org.hsqldb.HsqlException: user lacks privilege or object not
> found: <Stored proc name>
>
> *Route:*
>
>
>
> *from(ROUTE_SB_AND_RESPOND).routeId(ROUTE_SB_AND_RESPOND_ID).to("sql-stored:<stored
> proc name>(VARCHAR ${headers.correlationId})").id("stored-proc")*
>
> *Test:*
>
>
>
>
>
>
>
>
>
>
>
>
> * - context.getRouteDefinition(""route-name").adviceWith(context, new
> AdviceWithRouteBuilder() { @Override public void configure() throws
> Exception {
> interceptSendToEndpoint("https4://endpoint1*").to("mock:https4/endpoint1").skipSendToOriginalEndpoint().transform(constant(json));
> interceptSendToEndpoint("https4://endpoint2*").to("mock:https4/endpoint2").skipSendToOriginalEndpoint().transform(constant(json2));
> //weaveById("stored-proc"); //weaveByToString("sql-stored*");
> //.to("mock:sql-stored:test").transform(constant("Result=SUCCESS"));
> interceptSendToEndpoint("sql-stored:*").to("mock:sql-stored:test").skipSendToOriginalEndpoint().transform(constant("Result=SUCCESS"));}
> });*
> Note that the other interceptSendToEndpoints are working properly. Any
> thoughts?
>
> Thanks!
> Mary Cochran
> Red Hat Consulting
> mcochran@redhat.com
> (419) 543-0531



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