Works for me.
On Sat, May 25, 2013 at 3:54 AM, Andrea Aime
<andrea.a...@geo-solutions.it>wrote:
> On Tue, May 21, 2013 at 2:34 PM, Justin Deoliveira
> <jdeol...@opengeo.org>wrote:
>
>> I agree mocking would be the ideal approach. Can you be more specific
>> about the issues in resourcepool? Imo an ugly hack, as long as its not
>> spread out in too many places for testing purposes , would be worth it to
>> avoid adding more moving parts to the build.
>>
>
> Ok, followed the suggestion and had a second look to ResourcePool and the
> classes that are talking to external http services,
> in particular WebMapServer and the WFS store.
> In both cases there is an option to ingest a user provided http client, so
> we can inject a mock driven one like the MockHttpClient
> that we have in GeoTools in the gt-wfs module.
>
> Here is how I believe things could be setup. In order to identify that we
> actually want to talk to a mock client
> we could use some special URLs, for example, anything starting with
> http://mockserver/... would automatically
> be wired up with a mock http client.
>
> Now, the other issue is how to setup the mock http client, some non
> trivial tests would need more than one.
> For this case, I guess we can use the path in the url to make a different,
> eg.., mock1 bound to http://mockserver/mock1/...
> and mock2 bound to http://mockserver/mock2.
> There would be a MockHttpFactory that has static methods to bind the mock
> http client to a path and retrieve them,
> e.g.:
>
> MockHttpFactory {
>
> public static void bind(HttpClient client, String path);
>
> public HttpClient get(String path);
>
> public void clear();
>
> }
>
> The clear() method would remove all bindings to inadvertent cross-test
> contamination, and I would be tempted
> to call it from GeoServerBaseTest automatically in an @After method.
>
> The tests would be then free to setup their mocks. Having one
> implementtion with a WireMock like stubbing API would
> be nice of course (http://wiremock.org/stubbing.html) but I'm not
> considering writing one right away.
>
> Opinions?
>
> Cheers
> Andrea
>
> --
> ==
> GeoServer training in Milan, 6th & 7th June 2013! Visit
> http://geoserver.geo-solutions.it for more information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054 Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax: +39 0584 1660272
> mob: +39 339 8844549
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel