[Geoserver-devel] permission to add new test dependency

Hey all,

I would need to merge a couple patches to the GWC module, that will
result in fixing the cite build failures.

But before doing that I wanted to ask whether there's any inconvenient
in adding a new _test_ scoped dependency over the Moskito library
<http://mockito.org/&gt;\.
It's a 1.4MB jar that I've been using to extend the test coverage for
the gwc module and that's much more pleasant to work with than EasyMock.

Cheers,
Gabriel

--
Gabriel Roldan
groldan@anonymised.com
Expert service straight from the developers

On Mon, Apr 25, 2011 at 8:51 AM, Gabriel Roldán <groldan@anonymised.com> wrote:

Hey all,

I would need to merge a couple patches to the GWC module, that will
result in fixing the cite build failures.

But before doing that I wanted to ask whether there's any inconvenient
in adding a new _test_ scoped dependency over the Moskito library
<http://mockito.org/&gt;\.
It's a 1.4MB jar that I've been using to extend the test coverage for
the gwc module and that's much more pleasant to work with than EasyMock.

Humm... why not, it's just a one time download...
yet that leaves us with two ways to do mock tests around.

Do you have some time to tell us how Mockito is better than EasyMock?

Also, mock testing did not get much traction in the codebase due to
its fragility
and effort to set it up, is Mockito going to be better in this respect?

In case we would like to migrate everything to Mockito, would it be hard (as in,
is there a straight migration path?)
A quick search shows that mocking is mostly used in the authorization subsystem
testing (my fault :-p):

find . -name "*.java" -exec grep -l -H EasyMock {} \; | sort
./community/geoxacml/src/test/java/org/geoserver/xacml/geoxacml/GeoXACMLGeometryTest.java
./community/geoxacml/src/test/java/org/geoserver/xacml/geoxacml/XACMLURLMatchingTest.java
./community/gss/src/test/java/org/geoserver/gss/SynchronizationManagerTest.java
./community/gss/src/test/java/org/geoserver/gss/xml/GSSXMLTestSupport.java
./community/monitoring/src/test/java/org/geoserver/monitor/ows/MonitorCallbackTest.java
./community/python/src/test/java/org/geoserver/python/PythonCatalogDataTest.java
./community/python/src/test/java/org/geoserver/python/PythonCatalogModTest.java
./extension/wfsv/src/test/java/org/geoserver/wfsv/security/ReadOnlyVersioningDataStoreTest.java
./extension/wfsv/src/test/java/org/geoserver/wfsv/security/ReadOnlyVersioningFeatureStoreTest.java
./main/src/test/java/org/geoserver/feature/retype/FullyRetypingDataStoreTest.java
./main/src/test/java/org/geoserver/feature/retype/RetypingDataStoreTest.java
./main/src/test/java/org/geoserver/security/decorators/ReadOnlyDataAccessTest.java
./main/src/test/java/org/geoserver/security/decorators/ReadOnlyDataStoreTest.java
./main/src/test/java/org/geoserver/security/decorators/SecuredFeatureCollectionTest.java
./main/src/test/java/org/geoserver/security/decorators/SecuredFeatureSourceTest.java
./main/src/test/java/org/geoserver/security/impl/AbstractAuthorizationTest.java
./main/src/test/java/org/geoserver/security/impl/DataAccessRuleDAOTest.java
./main/src/test/java/org/geoserver/security/impl/DefaultDataAccessManagerTreeTest.java
./main/src/test/java/org/geoserver/security/impl/SecureCatalogImplTest.java
./platform/src/test/java/org/geoserver/platform/GeoServerExtensionsTest.java
./wms/src/test/java/org/geoserver/wms/wms_1_1_1/GetFeatureInfoRestrictedTest.java
./wms/src/test/java/org/geoserver/wms/WMSExtensionsTest.java

Cheers
Andrea

--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

I would sort of push us to stay with easymock unless there is a very compelling reason to switch to mockito. Tests are just like code and often we have to debug them when things fail. And having two mock libraries makes that harder imo so I would vote we try to pick one and stick with it.

2c.

On Mon, Apr 25, 2011 at 2:26 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Mon, Apr 25, 2011 at 8:51 AM, Gabriel Roldán <groldan@…1501…> wrote:

Hey all,

I would need to merge a couple patches to the GWC module, that will
result in fixing the cite build failures.

But before doing that I wanted to ask whether there’s any inconvenient
in adding a new test scoped dependency over the Moskito library
<http://mockito.org/>.
It’s a 1.4MB jar that I’ve been using to extend the test coverage for
the gwc module and that’s much more pleasant to work with than EasyMock.

Humm… why not, it’s just a one time download…
yet that leaves us with two ways to do mock tests around.

Do you have some time to tell us how Mockito is better than EasyMock?

Also, mock testing did not get much traction in the codebase due to
its fragility
and effort to set it up, is Mockito going to be better in this respect?

In case we would like to migrate everything to Mockito, would it be hard (as in,
is there a straight migration path?)
A quick search shows that mocking is mostly used in the authorization subsystem
testing (my fault :-p):

find . -name “*.java” -exec grep -l -H EasyMock {} ; | sort
./community/geoxacml/src/test/java/org/geoserver/xacml/geoxacml/GeoXACMLGeometryTest.java
./community/geoxacml/src/test/java/org/geoserver/xacml/geoxacml/XACMLURLMatchingTest.java
./community/gss/src/test/java/org/geoserver/gss/SynchronizationManagerTest.java
./community/gss/src/test/java/org/geoserver/gss/xml/GSSXMLTestSupport.java
./community/monitoring/src/test/java/org/geoserver/monitor/ows/MonitorCallbackTest.java
./community/python/src/test/java/org/geoserver/python/PythonCatalogDataTest.java
./community/python/src/test/java/org/geoserver/python/PythonCatalogModTest.java
./extension/wfsv/src/test/java/org/geoserver/wfsv/security/ReadOnlyVersioningDataStoreTest.java
./extension/wfsv/src/test/java/org/geoserver/wfsv/security/ReadOnlyVersioningFeatureStoreTest.java
./main/src/test/java/org/geoserver/feature/retype/FullyRetypingDataStoreTest.java
./main/src/test/java/org/geoserver/feature/retype/RetypingDataStoreTest.java
./main/src/test/java/org/geoserver/security/decorators/ReadOnlyDataAccessTest.java
./main/src/test/java/org/geoserver/security/decorators/ReadOnlyDataStoreTest.java
./main/src/test/java/org/geoserver/security/decorators/SecuredFeatureCollectionTest.java
./main/src/test/java/org/geoserver/security/decorators/SecuredFeatureSourceTest.java
./main/src/test/java/org/geoserver/security/impl/AbstractAuthorizationTest.java
./main/src/test/java/org/geoserver/security/impl/DataAccessRuleDAOTest.java
./main/src/test/java/org/geoserver/security/impl/DefaultDataAccessManagerTreeTest.java
./main/src/test/java/org/geoserver/security/impl/SecureCatalogImplTest.java
./platform/src/test/java/org/geoserver/platform/GeoServerExtensionsTest.java
./wms/src/test/java/org/geoserver/wms/wms_1_1_1/GetFeatureInfoRestrictedTest.java
./wms/src/test/java/org/geoserver/wms/WMSExtensionsTest.java

Cheers
Andrea

Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf



Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been
demonstrated beyond question. Learn why your peers are replacing JEE
containers with lightweight application servers - and what you can gain
from the move. http://p.sf.net/sfu/vmware-sfemails


Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

On Mon, 2011-04-25 at 08:43 -0600, Justin Deoliveira wrote:

I would sort of push us to stay with easymock unless there is a very
compelling reason to switch to mockito. Tests are just like code and
often we have to debug them when things fail. And having two mock
libraries makes that harder imo so I would vote we try to pick one and
stick with it.

oh, I just committed before seeing this reply cause my email client was
having authentication issues.

I'm not proposing to switch everything to mockito right away, but just
that I'm finding it way easier to work with than Easymock, and as such I
at least chose it for the gwc module tests.
I don't think that should be a problem as I'm committed to keep them up.
And I want to have both unit (making sure a single class makes the right
thing) as integration/system tests (make sure the system does the right
thing).
I tried developing the following test suite with easymock and it was
pretty difficult, while with mockito it's even straight forward to read:
<https://svn.codehaus.org/geoserver/trunk/src/gwc/src/test/java/org/geoserver/gwc/layer/CatalogLayerEventListenerTest.java&gt;

We don't have a single "mocking" library even without mockito. We have
both easymock and easymock classextension, plus mockrunner.

I think we agree easymock was too hard to work with and as I found this
one out that claims to get rid of the easymock hurdle I gave it a try
and found it really useful.
So I really don't see a reason not to use it, as it allows me to writ
tons of unit tests in a pretty straight forward way?

Cheers,
Gabriel

2c.

On Mon, Apr 25, 2011 at 2:26 AM, Andrea Aime
<andrea.aime@anonymised.com> wrote:
        On Mon, Apr 25, 2011 at 8:51 AM, Gabriel Roldán
        <groldan@anonymised.com> wrote:
        > Hey all,
        >
        > I would need to merge a couple patches to the GWC module,
        that will
        > result in fixing the cite build failures.
        >
        > But before doing that I wanted to ask whether there's any
        inconvenient
        > in adding a new _test_ scoped dependency over the Moskito
        library
        > <http://mockito.org/&gt;\.
        > It's a 1.4MB jar that I've been using to extend the test
        coverage for
        > the gwc module and that's much more pleasant to work with
        than EasyMock.
        
        Humm... why not, it's just a one time download...
        yet that leaves us with two ways to do mock tests around.
        
        Do you have some time to tell us how Mockito is better than
        EasyMock?
        
        Also, mock testing did not get much traction in the codebase
        due to
        its fragility
        and effort to set it up, is Mockito going to be better in this
        respect?
        
        In case we would like to migrate everything to Mockito, would
        it be hard (as in,
        is there a straight migration path?)
        A quick search shows that mocking is mostly used in the
        authorization subsystem
        testing (my fault :-p):
        
        find . -name "*.java" -exec grep -l -H EasyMock {} \; | sort
        ./community/geoxacml/src/test/java/org/geoserver/xacml/geoxacml/GeoXACMLGeometryTest.java
        ./community/geoxacml/src/test/java/org/geoserver/xacml/geoxacml/XACMLURLMatchingTest.java
        ./community/gss/src/test/java/org/geoserver/gss/SynchronizationManagerTest.java
        ./community/gss/src/test/java/org/geoserver/gss/xml/GSSXMLTestSupport.java
        ./community/monitoring/src/test/java/org/geoserver/monitor/ows/MonitorCallbackTest.java
        ./community/python/src/test/java/org/geoserver/python/PythonCatalogDataTest.java
        ./community/python/src/test/java/org/geoserver/python/PythonCatalogModTest.java
        ./extension/wfsv/src/test/java/org/geoserver/wfsv/security/ReadOnlyVersioningDataStoreTest.java
        ./extension/wfsv/src/test/java/org/geoserver/wfsv/security/ReadOnlyVersioningFeatureStoreTest.java
        ./main/src/test/java/org/geoserver/feature/retype/FullyRetypingDataStoreTest.java
        ./main/src/test/java/org/geoserver/feature/retype/RetypingDataStoreTest.java
        ./main/src/test/java/org/geoserver/security/decorators/ReadOnlyDataAccessTest.java
        ./main/src/test/java/org/geoserver/security/decorators/ReadOnlyDataStoreTest.java
        ./main/src/test/java/org/geoserver/security/decorators/SecuredFeatureCollectionTest.java
        ./main/src/test/java/org/geoserver/security/decorators/SecuredFeatureSourceTest.java
        ./main/src/test/java/org/geoserver/security/impl/AbstractAuthorizationTest.java
        ./main/src/test/java/org/geoserver/security/impl/DataAccessRuleDAOTest.java
        ./main/src/test/java/org/geoserver/security/impl/DefaultDataAccessManagerTreeTest.java
        ./main/src/test/java/org/geoserver/security/impl/SecureCatalogImplTest.java
        ./platform/src/test/java/org/geoserver/platform/GeoServerExtensionsTest.java
        ./wms/src/test/java/org/geoserver/wms/wms_1_1_1/GetFeatureInfoRestrictedTest.java
        ./wms/src/test/java/org/geoserver/wms/WMSExtensionsTest.java
        
        Cheers
        Andrea
        
        --
        -------------------------------------------------------
        Ing. Andrea Aime
        GeoSolutions S.A.S.
        Tech lead
        
        Via Poggio alle Viti 1187
        55054 Massarosa (LU)
        Italy
        
        phone: +39 0584 962313
        fax: +39 0584 962313
        
        http://www.geo-solutions.it
        http://geo-solutions.blogspot.com/
        http://www.youtube.com/user/GeoSolutionsIT
        http://www.linkedin.com/in/andreaaime
        http://twitter.com/geowolf
        
        -------------------------------------------------------
        
        ------------------------------------------------------------------------------
        Fulfilling the Lean Software Promise
        Lean software platforms are now widely adopted and the
        benefits have been
        demonstrated beyond question. Learn why your peers are
        replacing JEE
        containers with lightweight application servers - and what you
        can gain
        from the move. http://p.sf.net/sfu/vmware-sfemails
        _______________________________________________
        Geoserver-devel mailing list
        Geoserver-devel@lists.sourceforge.net
        https://lists.sourceforge.net/lists/listinfo/geoserver-devel
        
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

--
Gabriel Roldan
groldan@anonymised.com
Expert service straight from the developers

It’s no problem. It was not a strong opinion by any means. Just that proliferation of libraries makes the codebase harder to use and understand imo.

Looking at the code I don’t see too much of a difference readability wise… although admittedly i have not used easymock or any other mocking library extensively.

Anyways, no problem. Next time i need to mock I might just give mockito a whirl.

On Mon, Apr 25, 2011 at 9:59 AM, Gabriel Roldán <groldan@anonymised.com> wrote:

On Mon, 2011-04-25 at 08:43 -0600, Justin Deoliveira wrote:

I would sort of push us to stay with easymock unless there is a very
compelling reason to switch to mockito. Tests are just like code and
often we have to debug them when things fail. And having two mock
libraries makes that harder imo so I would vote we try to pick one and
stick with it.

oh, I just committed before seeing this reply cause my email client was
having authentication issues.

I’m not proposing to switch everything to mockito right away, but just
that I’m finding it way easier to work with than Easymock, and as such I
at least chose it for the gwc module tests.
I don’t think that should be a problem as I’m committed to keep them up.
And I want to have both unit (making sure a single class makes the right
thing) as integration/system tests (make sure the system does the right
thing).
I tried developing the following test suite with easymock and it was
pretty difficult, while with mockito it’s even straight forward to read:
<https://svn.codehaus.org/geoserver/trunk/src/gwc/src/test/java/org/geoserver/gwc/layer/CatalogLayerEventListenerTest.java>

We don’t have a single “mocking” library even without mockito. We have
both easymock and easymock classextension, plus mockrunner.

I think we agree easymock was too hard to work with and as I found this
one out that claims to get rid of the easymock hurdle I gave it a try
and found it really useful.
So I really don’t see a reason not to use it, as it allows me to writ
tons of unit tests in a pretty straight forward way?

Cheers,
Gabriel

2c.

On Mon, Apr 25, 2011 at 2:26 AM, Andrea Aime
<andrea.aime@anonymised.com> wrote:
On Mon, Apr 25, 2011 at 8:51 AM, Gabriel Roldán
<groldan@anonymised.com501…> wrote:

Hey all,

I would need to merge a couple patches to the GWC module,
that will
result in fixing the cite build failures.

But before doing that I wanted to ask whether there’s any
inconvenient
in adding a new test scoped dependency over the Moskito
library
<http://mockito.org/>.
It’s a 1.4MB jar that I’ve been using to extend the test
coverage for
the gwc module and that’s much more pleasant to work with
than EasyMock.

Humm… why not, it’s just a one time download…
yet that leaves us with two ways to do mock tests around.

Do you have some time to tell us how Mockito is better than
EasyMock?

Also, mock testing did not get much traction in the codebase
due to
its fragility
and effort to set it up, is Mockito going to be better in this
respect?

In case we would like to migrate everything to Mockito, would
it be hard (as in,
is there a straight migration path?)
A quick search shows that mocking is mostly used in the
authorization subsystem
testing (my fault :-p):

find . -name “*.java” -exec grep -l -H EasyMock {} ; | sort
./community/geoxacml/src/test/java/org/geoserver/xacml/geoxacml/GeoXACMLGeometryTest.java
./community/geoxacml/src/test/java/org/geoserver/xacml/geoxacml/XACMLURLMatchingTest.java
./community/gss/src/test/java/org/geoserver/gss/SynchronizationManagerTest.java
./community/gss/src/test/java/org/geoserver/gss/xml/GSSXMLTestSupport.java
./community/monitoring/src/test/java/org/geoserver/monitor/ows/MonitorCallbackTest.java
./community/python/src/test/java/org/geoserver/python/PythonCatalogDataTest.java
./community/python/src/test/java/org/geoserver/python/PythonCatalogModTest.java
./extension/wfsv/src/test/java/org/geoserver/wfsv/security/ReadOnlyVersioningDataStoreTest.java
./extension/wfsv/src/test/java/org/geoserver/wfsv/security/ReadOnlyVersioningFeatureStoreTest.java
./main/src/test/java/org/geoserver/feature/retype/FullyRetypingDataStoreTest.java
./main/src/test/java/org/geoserver/feature/retype/RetypingDataStoreTest.java
./main/src/test/java/org/geoserver/security/decorators/ReadOnlyDataAccessTest.java
./main/src/test/java/org/geoserver/security/decorators/ReadOnlyDataStoreTest.java
./main/src/test/java/org/geoserver/security/decorators/SecuredFeatureCollectionTest.java
./main/src/test/java/org/geoserver/security/decorators/SecuredFeatureSourceTest.java
./main/src/test/java/org/geoserver/security/impl/AbstractAuthorizationTest.java
./main/src/test/java/org/geoserver/security/impl/DataAccessRuleDAOTest.java
./main/src/test/java/org/geoserver/security/impl/DefaultDataAccessManagerTreeTest.java
./main/src/test/java/org/geoserver/security/impl/SecureCatalogImplTest.java
./platform/src/test/java/org/geoserver/platform/GeoServerExtensionsTest.java
./wms/src/test/java/org/geoserver/wms/wms_1_1_1/GetFeatureInfoRestrictedTest.java
./wms/src/test/java/org/geoserver/wms/WMSExtensionsTest.java

Cheers
Andrea

Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf



Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the
benefits have been
demonstrated beyond question. Learn why your peers are
replacing JEE
containers with lightweight application servers - and what you
can gain
from the move. http://p.sf.net/sfu/vmware-sfemails


Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.


Gabriel Roldan
groldan@anonymised.com
Expert service straight from the developers


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.