Besides the Unit tests, There are also some integration tests, including some focused on REST. They are in the gwc-web module in the RestIT class. They work against a full GWC instance in Jetty.
They are not run as part of the normal unit tests, but you can have Maven run them with 'mvn verify' On 8/3/17 14:17, Nuno Oliveira wrote: > Hi, > > Great news, thanks David ! > > Unfortunately next weeks I will not have any free time to help :( > > The issue with GWC is that most of the tests (if not all) use mocks > and don't setup > a real Spring context. I had the same struggle when testing the > operations REST > interface of the SQLite module[1]. > > The solution I come up with was to rely on Spring tests support, > basically two > things are needed: > > 1. a bunch of annotation in the test class that will define a spring > context [2] > 2. a configuration class were you can define the necessary beans > using mocks if needed [3] > > The nice thing about this solutions is that the already existing mocks > can be reused, > the no so nice thing is that you will have to hunt down the beans you > need. > > I hope it helps. > > Regards, > > Nuno Oliveira > > [1] > https://github.com/GeoWebCache/geowebcache/blob/master/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/OperationsRestTest.java > [2] > https://github.com/GeoWebCache/geowebcache/blob/master/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/OperationsRestTest.java#L56-L59 > [3] > https://github.com/GeoWebCache/geowebcache/blob/master/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/OperationsRestWebConfig.java > > On 08/03/2017 09:32 PM, David Vick wrote: >> Hi All, >> >> I participated in the Rest API upgrade for GeoServer in Italy and am >> trying to get GWC done before the code freeze. I have much of the >> Restlet 'controllers' converted over to Spring 4 MVC Rest but am >> struggling to get the test environment set up so I can get the unit >> tests written and ensure I have full test coverage before I issue a >> PR. Included is the link to the branch I am working off of, any help >> or comments is much appreciated. >> >> https://github.com/vickdw/geowebcache/tree/rest-api-update >> >> David Vick >> >> Professional Services Engineer | Boundless <http://www.boundlessgeo.com> >> [email protected] <mailto:[email protected]> >> mobile: +1-636-698-3174 >> >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> >> >> _______________________________________________ >> Geoserver-devel mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/geoserver-devel > > -- > Regards, > Nuno Oliveira > == > GeoServer Professional Services from the experts! Visit http://goo.gl/it488V > for more information. > == > > Nuno Miguel Carvalho Oliveira > @nmcoliveira > Software Engineer > > GeoSolutions S.A.S. > Via di Montramito 3/A > 55054 Massarosa (LU) > Italy > phone: +39 0584 962313 > fax: +39 0584 1660272 > > http://www.geo-solutions.it > http://twitter.com/geosolutions_it > > ------------------------------------------------------- > AVVERTENZE AI SENSI DEL D.Lgs. 196/2003 > Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i > file/s allegato/i sono da considerarsi strettamente riservate. Il loro > utilizzo è consentito esclusivamente al destinatario del messaggio, per le > finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio > senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia > via e-mail e di procedere alla distruzione del messaggio stesso, > cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo > anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per > finalità diverse, costituisce comportamento contrario ai principi dettati dal > D.Lgs. 196/2003. > > The information in this message and/or attachments, is intended solely for > the attention and use of the named addressee(s) and may be confidential or > proprietary in nature or covered by the provisions of privacy act > (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection > Code).Any use not in accord with its purpose, any disclosure, reproduction, > copying, distribution, or either dissemination, either whole or partial, is > strictly forbidden except previous formal approval of the named addressee(s). > If you are not the intended recipient, please contact immediately the sender > by telephone, fax or e-mail and delete the information in this message that > has been received in error. The sender does not give any warranty or accept > liability as the content, accuracy or completeness of sent messages and > accepts no responsibility for changes made after they were sent or for other > risks which arise as a result of e-mail transmission, viruses, etc. > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > Geoserver-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geoserver-devel -- Kevin Michael Smith <[email protected]>
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Geoserver-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-devel
