cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamal Bhatt <kbh...@tt.com.au>
Subject Re: Mock webservices - possible use for Cocoon 3.0
Date Tue, 30 Sep 2008 21:43:49 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Reinhard P&ouml;tz wrote:
<blockquote cite="mid:48E248E6.3030806@apache.org" type="cite">
  <pre wrap="">Luca Morandini wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Kamal wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Hi,
I have been thinking about testing REST based web services of late. It
occurred to me that these web services are very difficult to test 
      </pre>
    </blockquote>
    <pre wrap="">Really ? My impression is the opposite: a REST-style web service should
be usable by humans and machines alike, which makes them easier to test
 (easier then the RPC-style web services, anyway).
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Same impression here.

The Cocoon 3 integration tests should give you some hints how the
testing can be done via HTTP. See the cocoon-sample and
cocoon-sample-webapp module.
  </pre>
</blockquote>
OK, I should clarify. The problem with REST style web services are the
same for non-REST style web services. My above statement was probably
not the best one. In many cases, you do not own the service. For
example, it may be impossible to force certain error conditions. Even
for systems that are in your control,&nbsp; may not be easily mocked. Here
is a (fictional) use case. I have a weather forcast interface that
relies specifies dates. That is, you specify a date, then you get
returned the weather for that day. I could setup requests for a
particular date, but those dates may become irrelevant in a couple of
months (because the interface only supports forecasting). To make
things more difficult, the weather service may return your date in the
response. Now, if you could take the request, work out what date it
selected and then create a mock response based on those dates, you can
unit test your interface. <br>
<br>
I realise that Cocoon 2.1 and 2.2 may support this, but I think the
syntax described is very, well, cocoon-y. It may be great for those who
have been working with Cocoon for years, but it isn't user friendly for
the intended purpose. That is why I was thinking about some other
process we could use.<br>
<br>
Now, all that said, after some more Googling, I did find the following:<br>
<br>
<a class="moz-txt-link-freetext" href="http://synapse.apache.org/index.html">http://synapse.apache.org/index.html</a><br>
<br>
So maybe what I want to do is look at that (though the documentation
seems a little confusing to me, but only because my understanding of
SOAP based interfaces is pretty poor).<br>
<br>
<blockquote cite="mid:48E248E6.3030806@apache.org" type="cite">
  <pre wrap="">
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">against. I was thinking that maybe there is some funky way of mocking
a web service, using XPath and regexes to match on the requst, and use
a templating language to generate the response (based on variables
generated from the XPath and regexes). I was thinking maybe Cocoon 3.0
might help me here.
      </pre>
    </blockquote>
    <pre wrap="">I think you could do the same with 2.1 or 2.2 as well.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Yes, or you can use the Cocoon 3 REST module which provides a JSR311
inspired controller implementation. Also see
<a class="moz-txt-link-freetext" href="http://cocoon.apache.org/3.0/features.html">http://cocoon.apache.org/3.0/features.html</a>
for a basic example.
  </pre>
</blockquote>
OK, that is nicer. I may look at that.<br>
<blockquote cite="mid:48E248E6.3030806@apache.org" type="cite">
  <pre wrap="">
Regarding your testing question above, those REST controller classes can
be unit tested easily.

  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Kamal Bhatt
</pre>
</body>
</html>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message