404 Error Unit testing Camel CXFRS End Point

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

404 Error Unit testing Camel CXFRS End Point

Aravind Rajasekharan Pillai
Hi


Am trying to write a Camel Test for my CXFRS Endpoint. The endpoint
invocation is happening fine and the CXF out logger logs the success
response however my Producer template returned exchange is always
populated with a 404 exception end point not found.

All the details are added in this post on Stack Overflow

http://stackoverflow.com/questions/39980584/camel-cxf-junit-testing-failing-with-404

Can some one please help as am stuck on this issue for 2 days now.
What throws me off is my code works but camel test fails :).

Regards,
Aravind
Reply | Threaded
Open this post in threaded view
|

Re: 404 Error Unit testing Camel CXFRS End Point

Sergey Beryozkin
Hi

Have a look please at the existing tests:

https://github.com/apache/camel/tree/master/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs

with the the resources located in:

https://github.com/apache/camel/tree/master/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs

Cheers, Sergey

On 11/10/16 16:20, aravind r wrote:

> Hi
>
>
> Am trying to write a Camel Test for my CXFRS Endpoint. The endpoint
> invocation is happening fine and the CXF out logger logs the success
> response however my Producer template returned exchange is always
> populated with a 404 exception end point not found.
>
> All the details are added in this post on Stack Overflow
>
> http://stackoverflow.com/questions/39980584/camel-cxf-junit-testing-failing-with-404
>
> Can some one please help as am stuck on this issue for 2 days now.
> What throws me off is my code works but camel test fails :).
>
> Regards,
> Aravind
>


Reply | Threaded
Open this post in threaded view
|

Re: 404 Error Unit testing Camel CXFRS End Point

Aravind Rajasekharan Pillai
Hi Sergey,

Thanks a lot for the reply. Am following the exact same test. The only
difference i have is that am using cxfrs endpoint instead of jaxrs
endpoint.

The reason am using below is that serviceClass takes an interface and
directly connects it to route but jaxrs needs an implementation.

<!-- Created the CXF End Point For the Gyft Calls to Come IN-->
<cxf:rsServer id="coreEndPoint" address="${core.basePath}"
staticSubresourceResolution="true"
              serviceClass="com..core.incoming.Framework"
              loggingFeatureEnabled="true" loggingSizeLimit="20">
    <cxf:providers>
        <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider">
        </bean>
    </cxf:providers>

    <cxf:inInterceptors>

        <ref bean="loggingInInterceptor"></ref>
    </cxf:inInterceptors>
    <cxf:outInterceptors>

        <ref bean="loggingOutInterceptor"></ref>
    </cxf:outInterceptors>
     <cxf:features >
        <ref bean="swagger2Feature"></ref>
    </cxf:features>
</cxf:rsServer>

Please let me know what other alternatives i have.

Regards,
Aravind

On Tue, Oct 11, 2016 at 11:50 AM, Sergey Beryozkin <[hidden email]> wrote:

> Hi
>
> Have a look please at the existing tests:
>
> https://github.com/apache/camel/tree/master/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs
>
> with the the resources located in:
>
> https://github.com/apache/camel/tree/master/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs
>
> Cheers, Sergey
>
>
> On 11/10/16 16:20, aravind r wrote:
>>
>> Hi
>>
>>
>> Am trying to write a Camel Test for my CXFRS Endpoint. The endpoint
>> invocation is happening fine and the CXF out logger logs the success
>> response however my Producer template returned exchange is always
>> populated with a 404 exception end point not found.
>>
>> All the details are added in this post on Stack Overflow
>>
>>
>> http://stackoverflow.com/questions/39980584/camel-cxf-junit-testing-failing-with-404
>>
>> Can some one please help as am stuck on this issue for 2 days now.
>> What throws me off is my code works but camel test fails :).
>>
>> Regards,
>> Aravind
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: 404 Error Unit testing Camel CXFRS End Point

Sergey Beryozkin
Hi

In latest Camels cxf:rsServer does not need an implementation, interface
is OK.

Can you start from a working test which you can copy from Camel and then
modify it accordingly ?

Cheers, Sergey
On 11/10/16 16:55, aravind r wrote:

> Hi Sergey,
>
> Thanks a lot for the reply. Am following the exact same test. The only
> difference i have is that am using cxfrs endpoint instead of jaxrs
> endpoint.
>
> The reason am using below is that serviceClass takes an interface and
> directly connects it to route but jaxrs needs an implementation.
>
> <!-- Created the CXF End Point For the Gyft Calls to Come IN-->
> <cxf:rsServer id="coreEndPoint" address="${core.basePath}"
> staticSubresourceResolution="true"
>               serviceClass="com..core.incoming.Framework"
>               loggingFeatureEnabled="true" loggingSizeLimit="20">
>     <cxf:providers>
>         <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider">
>         </bean>
>     </cxf:providers>
>
>     <cxf:inInterceptors>
>
>         <ref bean="loggingInInterceptor"></ref>
>     </cxf:inInterceptors>
>     <cxf:outInterceptors>
>
>         <ref bean="loggingOutInterceptor"></ref>
>     </cxf:outInterceptors>
>      <cxf:features >
>         <ref bean="swagger2Feature"></ref>
>     </cxf:features>
> </cxf:rsServer>
>
> Please let me know what other alternatives i have.
>
> Regards,
> Aravind
>
> On Tue, Oct 11, 2016 at 11:50 AM, Sergey Beryozkin <[hidden email]> wrote:
>> Hi
>>
>> Have a look please at the existing tests:
>>
>> https://github.com/apache/camel/tree/master/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs
>>
>> with the the resources located in:
>>
>> https://github.com/apache/camel/tree/master/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs
>>
>> Cheers, Sergey
>>
>>
>> On 11/10/16 16:20, aravind r wrote:
>>>
>>> Hi
>>>
>>>
>>> Am trying to write a Camel Test for my CXFRS Endpoint. The endpoint
>>> invocation is happening fine and the CXF out logger logs the success
>>> response however my Producer template returned exchange is always
>>> populated with a 404 exception end point not found.
>>>
>>> All the details are added in this post on Stack Overflow
>>>
>>>
>>> http://stackoverflow.com/questions/39980584/camel-cxf-junit-testing-failing-with-404
>>>
>>> Can some one please help as am stuck on this issue for 2 days now.
>>> What throws me off is my code works but camel test fails :).
>>>
>>> Regards,
>>> Aravind
>>>
>>
>>


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/
Reply | Threaded
Open this post in threaded view
|

Re: 404 Error Unit testing Camel CXFRS End Point

Aravind Rajasekharan Pillai
Hi Sergey,

it worked for me. The reason for failure was the Dependencies in POM i suppose.

 <!-- http client tests -->
 <dependency>
     <groupId>org.apache.camel</groupId>
     <artifactId>camel-http</artifactId>
     <scope>test</scope>
     <version>${camel-version}</version>
 </dependency>

 <dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-jetty</artifactId>
    <version>${camel-version}</version>
 <!--   use the same version as your Camel core version-->
</dependency>

 <!--  Test Dependencies -->
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-core-xml</artifactId>
    <scope>test</scope>
    <version>${camel-version}</version>
</dependency>
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-test</artifactId>
    <version>${camel-version}</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-test-spring</artifactId>
    <version>${camel-version}</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-ws-rm</artifactId>
    <version>${cxf-version}</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <scope>test</scope>
    <version>4.5.2</version>
</dependency>
<dependency>
    <groupId>org.easymock</groupId>
    <artifactId>easymockclassextension</artifactId>
    <scope>test</scope>
    <version>3.2</version>
</dependency>

I added these and it started working. I have to see which one does
that magic, For now am good.

Thanks for the help.

Regards,
Aravind

On Tue, Oct 11, 2016 at 12:01 PM, Sergey Beryozkin <[hidden email]> wrote:

> Hi
>
> In latest Camels cxf:rsServer does not need an implementation, interface is
> OK.
>
> Can you start from a working test which you can copy from Camel and then
> modify it accordingly ?
>
> Cheers, Sergey
>
> On 11/10/16 16:55, aravind r wrote:
>>
>> Hi Sergey,
>>
>> Thanks a lot for the reply. Am following the exact same test. The only
>> difference i have is that am using cxfrs endpoint instead of jaxrs
>> endpoint.
>>
>> The reason am using below is that serviceClass takes an interface and
>> directly connects it to route but jaxrs needs an implementation.
>>
>> <!-- Created the CXF End Point For the Gyft Calls to Come IN-->
>> <cxf:rsServer id="coreEndPoint" address="${core.basePath}"
>> staticSubresourceResolution="true"
>>               serviceClass="com..core.incoming.Framework"
>>               loggingFeatureEnabled="true" loggingSizeLimit="20">
>>     <cxf:providers>
>>         <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider">
>>         </bean>
>>     </cxf:providers>
>>
>>     <cxf:inInterceptors>
>>
>>         <ref bean="loggingInInterceptor"></ref>
>>     </cxf:inInterceptors>
>>     <cxf:outInterceptors>
>>
>>         <ref bean="loggingOutInterceptor"></ref>
>>     </cxf:outInterceptors>
>>      <cxf:features >
>>         <ref bean="swagger2Feature"></ref>
>>     </cxf:features>
>> </cxf:rsServer>
>>
>> Please let me know what other alternatives i have.
>>
>> Regards,
>> Aravind
>>
>> On Tue, Oct 11, 2016 at 11:50 AM, Sergey Beryozkin <[hidden email]>
>> wrote:
>>>
>>> Hi
>>>
>>> Have a look please at the existing tests:
>>>
>>>
>>> https://github.com/apache/camel/tree/master/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs
>>>
>>> with the the resources located in:
>>>
>>>
>>> https://github.com/apache/camel/tree/master/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs
>>>
>>> Cheers, Sergey
>>>
>>>
>>> On 11/10/16 16:20, aravind r wrote:
>>>>
>>>>
>>>> Hi
>>>>
>>>>
>>>> Am trying to write a Camel Test for my CXFRS Endpoint. The endpoint
>>>> invocation is happening fine and the CXF out logger logs the success
>>>> response however my Producer template returned exchange is always
>>>> populated with a 404 exception end point not found.
>>>>
>>>> All the details are added in this post on Stack Overflow
>>>>
>>>>
>>>>
>>>> http://stackoverflow.com/questions/39980584/camel-cxf-junit-testing-failing-with-404
>>>>
>>>> Can some one please help as am stuck on this issue for 2 days now.
>>>> What throws me off is my code works but camel test fails :).
>>>>
>>>> Regards,
>>>> Aravind
>>>>
>>>
>>>
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/