You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by "Otto, Carsten" <ca...@sap.com> on 2016/12/14 08:29:11 UTC

Component tests for Olingo v2

Dear users and developers,

our team faces severe problems adding component tests for Olingo v2. If you have any testable code, we'd love to see it - so far we were unable to find any. The goal is to send REST requests and check the responses, where the server is mocked and run locally as part of the test setup (as fast as possible).

We tried integrating Olingo with JerseyTest. The first obstacle was that the ODataRootLocator depends on HttpServletRequest to be injected. As discussed here (https://stackoverflow.com/questions/17973277/problems-running-jerseytest-when-dealing-with-httpservletresponse) this is not the case for JerseyTest in the default configuration.
We tried mocking the relevant fields and their properties, but ran into a dead end.

Then, we tried adding Olingo using Jersey's GrizzlyWebTestContainerFactory feature. This way the basics seem to work (although the setup isn't nice/clean in any sense). However,  the code seems to depend on the "PathInfo" component of the request set to a non-null value, at least after an internal redirect (see ODataRootLocator. handleRequest). We are unable to set/mock this information when writing the tests, causing the test to fail after 20 internal redirects.

We appreciate comments on these specific issues, but in general we are interested in any reasonable ways to test Olingo without starting a proper server, deploy the application, and run the tests from outside the server.

Currently we use Olingo 2.0.6. The release notes for 2.0.7 do not hint at anything helpful for this question.

Best regards,
Carsten
-- 
Dr. Carsten Otto
Agile Software Engineer
SAP SE, Walldorf, Germany
M +49 152 21864987, E carsten.otto@sap.com

Pflichtangaben/Mandatory Disclosure Statement:
http://www.sap.com/company/legal/impressum.epx

Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten.  Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail.
Vielen Dank.

This e-mail may contain trade secrets or privileged, undisclosed, or otherwise confidential information.  If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal.
Thank you for your cooperation