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 2016/03/18 19:23:08 UTC
unit test with advice
Can someone point me to why I am getting a NPE on context.start() ? Its
line 63 of the attached. I have verified before that line that context is
not null with my print statements. The test is for the route here:
https://github.com/rhtconsulting/fuse-quickstarts/blob/jboss-fuse-6.2.1/karaf/rest_dsl_basic_auth/src/main/java/com/redhat/consulting/fusequickstarts/karaf/rest/auth/basic/dsl/route/RestDslRoute.java
thanks,
Mary Cochran
Re: unit test with advice
Posted by Mary Cochran <mc...@redhat.com>.
Thanks Andy!
That information is super helpful. I was struggling to find a good example
that used basic auth and/or unit test with advice.
Thanks,
Mary Cochran
On Sun, Mar 20, 2016 at 12:38 PM, Andrew Block <an...@gmail.com> wrote:
> Mary,
>
> The NPE on context.start() may have been a bit of a red herring as the
> primary cause of the issue was that there was no json library was on the
> class path (specifically camel-jackson in this case). Once this dependency
> was added, another issue developed surrounding the the authentication in
> Jetty. There were a few pieces of configuration omitted from the test class
> that were required, such as Constraint/ConstraintMapping. I went ahead and
> configured those elements and added a test realm resource.
>
> Once those changes were implemented, the testGetDirect class passed. A
> minor tweak to how the context was started in the testDirectPost was needed
> on line 116, but once that was implemented, the test class passed
> successfully.
>
> The test class and realm resource are attached.
>
> Thanks,
> Andy
>
> --
> Andrew Block
>
> On March 18, 2016 at 3:07:06 PM, Mary Cochran (mcochran@redhat.com) wrote:
>
> Sure! Here is the class file as well as the txt version again.
>
> Thanks,
> Mary Cochran
>
> On Fri, Mar 18, 2016 at 3:30 PM, Andrew Block <an...@gmail.com>
> wrote:
>
>> Mary,
>>
>> Would you be able to validate the attachment of the test class file?
>>
>> Thanks,
>> Andy
>>
>> --
>> Andrew Block
>>
>> On March 18, 2016 at 1:23:19 PM, Mary Cochran (mcochran@redhat.com)
>> wrote:
>>
>> Can someone point me to why I am getting a NPE on context.start() ? Its
>> line 63 of the attached. I have verified before that line that context is
>> not null with my print statements. The test is for the route here:
>>
>> https://github.com/rhtconsulting/fuse-quickstarts/blob/jboss-fuse-6.2.1/karaf/rest_dsl_basic_auth/src/main/java/com/redhat/consulting/fusequickstarts/karaf/rest/auth/basic/dsl/route/RestDslRoute.java
>>
>> thanks,
>> Mary Cochran
>>
>
> ------------------------------
>
>
Re: unit test with advice
Posted by Andrew Block <an...@gmail.com>.
Mary,
The NPE on context.start() may have been a bit of a red herring as the primary cause of the issue was that there was no json library was on the class path (specifically camel-jackson in this case). Once this dependency was added, another issue developed surrounding the the authentication in Jetty. There were a few pieces of configuration omitted from the test class that were required, such as Constraint/ConstraintMapping. I went ahead and configured those elements and added a test realm resource.
Once those changes were implemented, the testGetDirect class passed. A minor tweak to how the context was started in the testDirectPost was needed on line 116, but once that was implemented, the test class passed successfully.
The test class and realm resource are attached.
Thanks,
Andy
--
Andrew Block
On March 18, 2016 at 3:07:06 PM, Mary Cochran (mcochran@redhat.com) wrote:
Sure! Here is the class file as well as the txt version again.
Thanks,
Mary Cochran
On Fri, Mar 18, 2016 at 3:30 PM, Andrew Block <an...@gmail.com> wrote:
Mary,
Would you be able to validate the attachment of the test class file?
Thanks,
Andy
--
Andrew Block
On March 18, 2016 at 1:23:19 PM, Mary Cochran (mcochran@redhat.com) wrote:
Can someone point me to why I am getting a NPE on context.start() ? Its line 63 of the attached. I have verified before that line that context is not null with my print statements. The test is for the route here:
https://github.com/rhtconsulting/fuse-quickstarts/blob/jboss-fuse-6.2.1/karaf/rest_dsl_basic_auth/src/main/java/com/redhat/consulting/fusequickstarts/karaf/rest/auth/basic/dsl/route/RestDslRoute.java
thanks,
Mary Cochran
Re: unit test with advice
Posted by Mary Cochran <mc...@redhat.com>.
Sure! Here is the class file as well as the txt version again.
Thanks,
Mary Cochran
On Fri, Mar 18, 2016 at 3:30 PM, Andrew Block <an...@gmail.com> wrote:
> Mary,
>
> Would you be able to validate the attachment of the test class file?
>
> Thanks,
> Andy
>
> --
> Andrew Block
>
> On March 18, 2016 at 1:23:19 PM, Mary Cochran (mcochran@redhat.com) wrote:
>
> Can someone point me to why I am getting a NPE on context.start() ? Its
> line 63 of the attached. I have verified before that line that context is
> not null with my print statements. The test is for the route here:
>
> https://github.com/rhtconsulting/fuse-quickstarts/blob/jboss-fuse-6.2.1/karaf/rest_dsl_basic_auth/src/main/java/com/redhat/consulting/fusequickstarts/karaf/rest/auth/basic/dsl/route/RestDslRoute.java
>
> thanks,
> Mary Cochran
>
Re: unit test with advice
Posted by Andrew Block <an...@gmail.com>.
Mary,
Would you be able to validate the attachment of the test class file?
Thanks,
Andy
--
Andrew Block
On March 18, 2016 at 1:23:19 PM, Mary Cochran (mcochran@redhat.com) wrote:
Can someone point me to why I am getting a NPE on context.start() ? Its line 63 of the attached. I have verified before that line that context is not null with my print statements. The test is for the route here:
https://github.com/rhtconsulting/fuse-quickstarts/blob/jboss-fuse-6.2.1/karaf/rest_dsl_basic_auth/src/main/java/com/redhat/consulting/fusequickstarts/karaf/rest/auth/basic/dsl/route/RestDslRoute.java
thanks,
Mary Cochran