@Test public void testShowForm() { try { MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); BindException aError = new BindException(new GeneratePermissionTemplateCommand(), GeneratePermissionTemplateCommand.ACTION_GENERATE_TEMPLATE); SiteManager sitemanager = new MockSiteManagerImpl(testFile); PermissionTemplateManager permissionTemplateManager = new MockPermissionTemplateManagerImpl(testFile); testInstance.setSiteManager(sitemanager); testInstance.setPermissionTemplateManager(permissionTemplateManager); request.addParameter("siteOid", "9000"); ModelAndView mav = testInstance.showForm(request, response, aError); assert(mav != null); assert(mav.getModel().values() != null); assert(mav.getViewName().equals("select-permission")); } catch (Exception e) { String message = e.getClass().toString() + " - " + e.getMessage(); log.debug(message); fail(message); } }
@Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aErrors) throws Exception { String siteOid = aReq.getParameter("siteOid"); Long oid= Long.valueOf(siteOid); ModelAndView mav = new ModelAndView(); Site aSite = siteManager.getSite(oid,true); Set permissions = aSite.getPermissions(); mav.addObject("permissions", permissions); List templates = permissionTemplateManager.getTemplates(AuthUtil.getRemoteUserObject()); mav.addObject(GeneratePermissionTemplateCommand.MDL_TEMPLATES, templates); mav.setViewName("select-permission"); return mav; }
GeneratePermissionTemplateController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aErrors) throws Exception { String siteOid = aReq.getParameter("siteOid"); Long oid= Long.valueOf(siteOid); ModelAndView mav = new ModelAndView(); Site aSite = siteManager.getSite(oid,true); Set permissions = aSite.getPermissions(); mav.addObject("permissions", permissions); List templates = permissionTemplateManager.getTemplates(AuthUtil.getRemoteUserObject()); mav.addObject(GeneratePermissionTemplateCommand.MDL_TEMPLATES, templates); mav.setViewName("select-permission"); return mav; } }
GeneratePermissionTemplateController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aErrors) throws Exception { String siteOid = aReq.getParameter("siteOid"); Long oid= Long.valueOf(siteOid); ModelAndView mav = new ModelAndView(); Site aSite = siteManager.getSite(oid,true); Set permissions = aSite.getPermissions(); mav.addObject("permissions", permissions); List templates = permissionTemplateManager.getTemplates(AuthUtil.getRemoteUserObject()); mav.addObject(GeneratePermissionTemplateCommand.MDL_TEMPLATES, templates); mav.setViewName("select-permission"); return mav; } GeneratePermissionTemplateController(); }
GeneratePermissionTemplateController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aErrors) throws Exception { String siteOid = aReq.getParameter("siteOid"); Long oid= Long.valueOf(siteOid); ModelAndView mav = new ModelAndView(); Site aSite = siteManager.getSite(oid,true); Set permissions = aSite.getPermissions(); mav.addObject("permissions", permissions); List templates = permissionTemplateManager.getTemplates(AuthUtil.getRemoteUserObject()); mav.addObject(GeneratePermissionTemplateCommand.MDL_TEMPLATES, templates); mav.setViewName("select-permission"); return mav; } GeneratePermissionTemplateController(); void setSiteManager(SiteManager siteManager); void setPermissionTemplateManager(
            PermissionTemplateManager permissionTemplateManager); void setMailServer(MailServer mailServer); void setMessageSource(MessageSource messageSource); }
GeneratePermissionTemplateController extends AbstractFormController { @Override protected ModelAndView showForm(HttpServletRequest aReq, HttpServletResponse aRes, BindException aErrors) throws Exception { String siteOid = aReq.getParameter("siteOid"); Long oid= Long.valueOf(siteOid); ModelAndView mav = new ModelAndView(); Site aSite = siteManager.getSite(oid,true); Set permissions = aSite.getPermissions(); mav.addObject("permissions", permissions); List templates = permissionTemplateManager.getTemplates(AuthUtil.getRemoteUserObject()); mav.addObject(GeneratePermissionTemplateCommand.MDL_TEMPLATES, templates); mav.setViewName("select-permission"); return mav; } GeneratePermissionTemplateController(); void setSiteManager(SiteManager siteManager); void setPermissionTemplateManager(
            PermissionTemplateManager permissionTemplateManager); void setMailServer(MailServer mailServer); void setMessageSource(MessageSource messageSource);  }