@Test public final void testShowForm() { try { MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); BindException aError = new BindException(new UserCommand(), UserCommand.ACTION_EDIT); this.testSetAgencyUserManager(); this.testSetAuthorityManager(); this.testSetMessageSource(); ModelAndView mav = testInstance.showForm(request, response, aError); assertTrue(mav != null); String agencyFilter = (String)mav.getModel().get(UserCommand.MDL_AGENCYFILTER); assertTrue(agencyFilter != null); assertTrue(agencyFilter.equals(AuthUtil.getRemoteUserObject().getAgency().getName())); request = new MockHttpServletRequest(); response = new MockHttpServletResponse(); aError = new BindException(new UserCommand(), UserCommand.ACTION_EDIT); request.getSession().setAttribute(UserCommand.MDL_AGENCYFILTER, ""); mav = testInstance.showForm(request, response, aError); assertTrue(mav != null); agencyFilter = (String)mav.getModel().get(UserCommand.MDL_AGENCYFILTER); assertTrue(agencyFilter != null); assertTrue(agencyFilter.equals("")); } catch (Exception e) { String message = e.getClass().toString() + " - " + e.getMessage(); log.debug(message); fail(message); } }
@Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aError) throws Exception { ModelAndView mav = new ModelAndView(); String agencyFilter = (String)aReq.getSession().getAttribute(UserCommand.MDL_AGENCYFILTER); if(agencyFilter == null) { agencyFilter = AuthUtil.getRemoteUserObject().getAgency().getName(); } mav.addObject(UserCommand.MDL_AGENCYFILTER, agencyFilter); populateUserList(mav); return mav; }
UserController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aError) throws Exception { ModelAndView mav = new ModelAndView(); String agencyFilter = (String)aReq.getSession().getAttribute(UserCommand.MDL_AGENCYFILTER); if(agencyFilter == null) { agencyFilter = AuthUtil.getRemoteUserObject().getAgency().getName(); } mav.addObject(UserCommand.MDL_AGENCYFILTER, agencyFilter); populateUserList(mav); return mav; } }
UserController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aError) throws Exception { ModelAndView mav = new ModelAndView(); String agencyFilter = (String)aReq.getSession().getAttribute(UserCommand.MDL_AGENCYFILTER); if(agencyFilter == null) { agencyFilter = AuthUtil.getRemoteUserObject().getAgency().getName(); } mav.addObject(UserCommand.MDL_AGENCYFILTER, agencyFilter); populateUserList(mav); return mav; } UserController(); }
UserController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aError) throws Exception { ModelAndView mav = new ModelAndView(); String agencyFilter = (String)aReq.getSession().getAttribute(UserCommand.MDL_AGENCYFILTER); if(agencyFilter == null) { agencyFilter = AuthUtil.getRemoteUserObject().getAgency().getName(); } mav.addObject(UserCommand.MDL_AGENCYFILTER, agencyFilter); populateUserList(mav); return mav; } UserController(); void setAgencyUserManager(AgencyUserManager agencyUserManager); void setMessageSource(MessageSource messageSource); void setAuthorityManager(AuthorityManager authorityManager); }
UserController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aError) throws Exception { ModelAndView mav = new ModelAndView(); String agencyFilter = (String)aReq.getSession().getAttribute(UserCommand.MDL_AGENCYFILTER); if(agencyFilter == null) { agencyFilter = AuthUtil.getRemoteUserObject().getAgency().getName(); } mav.addObject(UserCommand.MDL_AGENCYFILTER, agencyFilter); populateUserList(mav); return mav; } UserController(); void setAgencyUserManager(AgencyUserManager agencyUserManager); void setMessageSource(MessageSource messageSource); void setAuthorityManager(AuthorityManager authorityManager);  }