@Test public final void testShowForm() { try { MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); BindException aError = new BindException(new RoleCommand(), RoleCommand.ACTION_EDIT); this.testSetAgencyUserManager(); this.testSetAuthorityManager(); this.testSetMessageSource(); ModelAndView mav = testInstance.showForm(request, response, aError); assertTrue(mav != null); assertTrue(mav.getViewName().equals("Roles")); List roles = (List)mav.getModel().get(RoleCommand.MDL_ROLES); assertTrue(roles != null); assertFalse(roles.isEmpty()); RoleCommand command = (RoleCommand)mav.getModel().get("command"); assertTrue(command != null); assertTrue(command.getAgencyFilter().equals(AuthUtil.getRemoteUserObject().getAgency().getName())); } 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 { String agencyFilter = (String)aReq.getSession().getAttribute(RoleCommand.PARAM_AGENCY_FILTER); if(agencyFilter == null) { agencyFilter = AuthUtil.getRemoteUserObject().getAgency().getName(); } return defaultView(agencyFilter); }
RoleController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aError) throws Exception { String agencyFilter = (String)aReq.getSession().getAttribute(RoleCommand.PARAM_AGENCY_FILTER); if(agencyFilter == null) { agencyFilter = AuthUtil.getRemoteUserObject().getAgency().getName(); } return defaultView(agencyFilter); } }
RoleController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aError) throws Exception { String agencyFilter = (String)aReq.getSession().getAttribute(RoleCommand.PARAM_AGENCY_FILTER); if(agencyFilter == null) { agencyFilter = AuthUtil.getRemoteUserObject().getAgency().getName(); } return defaultView(agencyFilter); } RoleController(); }
RoleController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aError) throws Exception { String agencyFilter = (String)aReq.getSession().getAttribute(RoleCommand.PARAM_AGENCY_FILTER); if(agencyFilter == null) { agencyFilter = AuthUtil.getRemoteUserObject().getAgency().getName(); } return defaultView(agencyFilter); } RoleController(); @Override void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); ModelAndView defaultView(String agencyFilter); void setAgencyUserManager(AgencyUserManager agencyUserManager); void setMessageSource(MessageSource messageSource); void setAuthorityManager(AuthorityManager authorityManager); }
RoleController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aError) throws Exception { String agencyFilter = (String)aReq.getSession().getAttribute(RoleCommand.PARAM_AGENCY_FILTER); if(agencyFilter == null) { agencyFilter = AuthUtil.getRemoteUserObject().getAgency().getName(); } return defaultView(agencyFilter); } RoleController(); @Override void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); ModelAndView defaultView(String agencyFilter); void setAgencyUserManager(AgencyUserManager agencyUserManager); void setMessageSource(MessageSource messageSource); void setAuthorityManager(AuthorityManager authorityManager);  }