AbstractIeatTestCase.java 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* ===================================================================
  2. * AbstractIeatTestCase.java
  3. *
  4. * Created Oct 3, 2005 9:54:56 PM
  5. *
  6. * Copyright (c) 2005 Matt Magoffin (spamsqr@msqr.us)
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  21. * 02111-1307 USA
  22. * ===================================================================
  23. * $Id: AbstractIeatTestCase.java 74 2009-05-15 04:44:37Z msqr $
  24. * ===================================================================
  25. */
  26. package magoffin.matt.ieat;
  27. import magoffin.matt.ieat.biz.BizContext;
  28. import magoffin.matt.ieat.biz.DomainObjectFactory;
  29. import magoffin.matt.ieat.dao.UserDao;
  30. import magoffin.matt.ieat.test.AppContextInitializer;
  31. import magoffin.matt.ieat.test.TestBizContext;
  32. import magoffin.matt.xweb.util.AppContextSupport;
  33. /**
  34. * Ieat helper base class for test cases.
  35. *
  36. * @author Matt Magoffin (spamsqr@msqr.us)
  37. * @version $Revision: 74 $ $Date: 2009-05-15 16:44:37 +1200 (Fri, 15 May 2009) $
  38. */
  39. public abstract class AbstractIeatTestCase extends AbstractSpringEnabledTransactionalTest {
  40. @Override
  41. public boolean isPopulateProtectedVariables() {
  42. return true;
  43. }
  44. /**
  45. * @return a TestBizContext
  46. */
  47. protected BizContext getBizContext() {
  48. AppContextSupport appContextSupport = getAppContextSupport();
  49. return new TestBizContext(appContextSupport,getDummyUser());
  50. }
  51. /**
  52. * @return the DomainObjectFactory
  53. */
  54. protected DomainObjectFactory getDomainObjectFactory() {
  55. return (DomainObjectFactory)getBaseContext().getBean("domainObjectFactory");
  56. }
  57. /**
  58. * @return the AppContextSupport
  59. */
  60. protected AppContextSupport getAppContextSupport() {
  61. AppContextInitializer init = (AppContextInitializer)getBaseContext()
  62. .getBean("applicationInitializer",AppContextInitializer.class);
  63. return init.getAppContextSupport();
  64. }
  65. /**
  66. * @return the UserDao
  67. */
  68. protected UserDao getUserDao() {
  69. return (UserDao)getBaseContext().getBean("userDao");
  70. }
  71. }