You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Willem Jiang <wi...@gmail.com> on 2011/11/01 04:41:01 UTC

Re: Recommendation for replacing network with mock

Hi,

It's is a interesting test requirement.
As you know CXF using the LocalTransport to avoid using the network 
during the unit test.

If you just want to test the interceptor in unit test, it could be more 
straight if you just mock a message with the Stream that you want to 
feed in.

On Tue Nov  1 06:14:25 2011, RayArturo wrote:
> Hello All,
>
> I have several ValidationEventHandlers as well as custom interceptors for
> fixing or recovering from bad responses on the client side.  Therefore my
> automatic tests need to exercise the entire CXF/JAXB stack.  What I want to
> do is replace the network layer with a mock object that returns hardcoded
> SOAP.
>
> I've looked at Conduit, ConduitSelector, Exchanger, and the Stax I/O
> creation factory.  What is recommended for replacing the network with a mock
> object for testing?
>
> Thanks in advance, Ray
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Recommendation-for-replacing-network-with-mock-tp4953736p4953736.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: Recommendation for replacing network with mock

Posted by RayArturo <ra...@i2group.com>.
Hi Willem.  I do have unit tests for each class.  What I also want is an
integration test that proves that a bad response is fixed.  The closer I get
to the actual production environment, the more confidence I'll have that
everything is working together.  Also, when JAXB or CXF are updated to newer
versions I can quickly and confidently assert that there were not any
breaking changes.  Philosophically I'm trying for integration tests, not
just unit tests.

I haven't seen LocalTransportFactory yet, thanks for the tip.  Can you
please point me to an example on how to get my hardcoded SOAP into the
LocalConduit.  I don't see what is feeding the PipedInputStream.

Thanks, Ray

--
View this message in context: http://cxf.547215.n5.nabble.com/Recommendation-for-replacing-network-with-mock-tp4953736p4955487.html
Sent from the cxf-user mailing list archive at Nabble.com.