|
From: Rod J. <rod...@in...> - 2003-03-20 04:19:21
|
Thanks for this, Juergen. I agree with the idea of making mock objects generic. The old package names were a quick hack I forgot to change before I did the initial CVS drop. A couple of thoughts: - The EJB mocks (from memory) aren't complete and I was considering dropping them. In my experience using mock objects is about the only way to unit test EJBs properly, but unit testing EJBs is still prohibitively difficult. One of the many things wrong with EJB. Moving forward I see Spring offering an *alternative* to EJB, via AOP. - I've increasingly started to use EasyMock rather than custom mocks, with very good results. As in the JdbcTemplate test suite, which no longer uses the JDBC test classes. Rod ----- Original Message ----- From: "jürgen höller [werk3AT]" <jue...@we...> To: <spr...@li...> Sent: Friday, March 14, 2003 6:52 PM Subject: [Springframework-developer] mock objects Hi everybody, I'm currently trying to integrate the basic mock objects from the test tree into the src tree, on the occasion of writing some test suites for an application project that uses Spring. The rationale behind this is that most of the mock objects are not just useful for Spring tests but also for application tests. This demands including them in the Spring distribution, and thus moving them to the main source tree. Besides, the "servletapi", "mo.ejb", and "jdbc" package names in the test tree aren't proper anyway. My main need are the JNDI mocks that allow for building a JNDI tree with the application's environment, containing JDBC data sources and in our case Hibernate session factories - completely without any container. To achieve this, I've created a new SimpleDataSource mock that simply returns new connections on every getConnection call - which works nicely with Hibernate (BTW, in contrast to SingleConnectionDataSource that cannot handle standard Connection.close calls). TestDataSource is now in com.interface21.jdbc.core in the test tree, derived from SimpleDataSource. Thus, I've moved the JNDI mocks to com.interface21.jndi.mock, and the JDBC mocks (SimpleDataSource and SingleConnectionDataSource) to com.interface21.jdbc.mock. Consequently, I've additionally moved the 2 EJB mocks to com.interface21.ejb.mock, and the Servlet mocks to com.interface21.web.mock. I don't use the latter 2 for application tests currently, but I might choose to do so sometime. Of course, this step adds a few classes to the main source tree and to the distribution JARS, but that couple of KBs is hardly worth thinking about. I'd mainly like to know if anyone objects to moving these mock objects to the main source tree as a matter of principle, and if the new package names would be OK. Regards, Juergen DI Jürgen Höller Senior System Architect __________________________________ werk3ATS - division systementwicklung part of werk3AT internetmedien oeg europaplatz 4 A - 4020 linz t. +43 (0) 732 71 65 29 f. +43 (0) 732 71 65 29 3 jue...@we... www.werk3at.com __________________________________ werk3ATS - WIR ENTWICKELN ERFOLG ------------------------------------------------------- This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |