Hi,

I seem to have a problem retrieving objects from the database, but only when running a test. I added a model class 'Download' and generated CRUD using the appfuse maven plugin. All works fine when I run with maven.test.skip=true, but if I attempt to run with tests, or try to run the offending test in isolation (mvn test -Dtest=DownloadControllerTest), maven bails out with a test failure.

The problem seems to be that when testing, the call to getAll() on downloadManager (an instance of GenericManager<Download, Long>) in the controller returns an empty List<Download>.

What could be the cause of this happening only when testing?

My DownloadController's handleRequest looks like this:

ModelAndView mav = new ModelAndView();
List<Download> downloads = downloadManager.getAll();
log.debug("in downloadcontroller's handleRequest");
log.debug("list of downloads retrieved from downloadmgr: "+downloads.toString()+"("+downloads.size()+")");
mav.addObject("downloadList", downloads);
return mav;

When I run mvn jetty:run-war -Dmaven.skip.test=true I get this:

[cda]DEBUG [btpool0-1] DownloadController.handleRequest(32) | in downloadcontroller's handleRequest [cda]DEBUG [btpool0-1] DownloadController.handleRequest(33) | list of downloads retrieved from dlmgr: [nl.rivm.cda.model.downl...@89b953...,nl.rivm.cda.model.downl...@abab54...,nl.rivm.cda.model.downl...@7d32cf...](3)

Whereas running mvn test -Dtest=DownloadControllerTest gives:

DEBUG - DownloadController.handleRequest(32) | in downloadcontroller's handleRequest DEBUG - DownloadController.handleRequest(33) | list of downloads retrieved from dlmgr: [](0)

Tia,

Ger-Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to