You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by amber <am...@hotmail.fr> on 2014/02/21 11:37:03 UTC

testing url call and openEJB

Hi,

we are using OpenEJB to test EJB classes (works just fine) and now we want
to test some Url calls (http call or socket open) and mock responses. 
I guess openEJb don't do that (web container).
Should we mix openEJB with TommEE or Jetty or what ?

thx !



--
View this message in context: http://openejb.979440.n4.nabble.com/testing-url-call-and-openEJB-tp4667946.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: testing url call and openEJB

Posted by Romain Manni-Bucau <rm...@gmail.com>.
wrote https://github.com/rmannibucau/featured-mock some months ago if
it can help
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-02-21 15:00 GMT+01:00 amber <am...@hotmail.fr>:
> I actually thought I could do this with an embedded Web server but the mock
> way seems better (based on the nice
> http://blog.newsplore.com/2010/02/09/unit-testing-with-httpclient)
>
> Thank you for the time spent answering me Romain!
>
>
>
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/testing-url-call-and-openEJB-tp4667946p4667951.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: testing url call and openEJB

Posted by amber <am...@hotmail.fr>.
I actually thought I could do this with an embedded Web server but the mock
way seems better (based on the nice
http://blog.newsplore.com/2010/02/09/unit-testing-with-httpclient) 

Thank you for the time spent answering me Romain!





--
View this message in context: http://openejb.979440.n4.nabble.com/testing-url-call-and-openEJB-tp4667946p4667951.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: testing url call and openEJB

Posted by Romain Manni-Bucau <rm...@gmail.com>.
so either mock the caller code or expected response, no?
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-02-21 13:48 GMT+01:00 amber <am...@hotmail.fr>:
> Hi Romain,
>
>
>
> We want to Junit/test and mock url call like :
>
> PostMethod effectiveMethod = method;
> HttpClient client = new HttpClient();
> ..
> httpCode = client.executeMethod(method);
> ...
>
> Or opening Socket :
> SocketAddress sockaddr = new InetSocketAddress(....);
> socket = new Socket();
> socket.connect(sockaddr);
> ...
>
> For WebServices, our need is to mock a Ws that we call (not our WS that are
> tested with OpenEJB)
>
>
>
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/testing-url-call-and-openEJB-tp4667946p4667949.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: testing url call and openEJB

Posted by amber <am...@hotmail.fr>.
Hi Romain,



We want to Junit/test and mock url call like :

PostMethod effectiveMethod = method;
HttpClient client = new HttpClient();
..
httpCode = client.executeMethod(method);
...

Or opening Socket :
SocketAddress sockaddr = new InetSocketAddress(....);
socket = new Socket();
socket.connect(sockaddr);
...

For WebServices, our need is to mock a Ws that we call (not our WS that are
tested with OpenEJB)





--
View this message in context: http://openejb.979440.n4.nabble.com/testing-url-call-and-openEJB-tp4667946p4667949.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: testing url call and openEJB

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

would need more details but here
http://tomee.apache.org/examples-trunk/ you'll find sample on how to
test jaxws, jaxrs...If you need servlet and websockets you can just
use tomee (maybe with arquillian)
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-02-21 11:37 GMT+01:00 amber <am...@hotmail.fr>:
> Hi,
>
> we are using OpenEJB to test EJB classes (works just fine) and now we want
> to test some Url calls (http call or socket open) and mock responses.
> I guess openEJb don't do that (web container).
> Should we mix openEJB with TommEE or Jetty or what ?
>
> thx !
>
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/testing-url-call-and-openEJB-tp4667946.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.