public void testServiceFailure() throws ApsSystemException { RequestContext reqCtx = this.getRequestContext(); Role role = new Role(); role.setName("testRole"); User user = new User(); user.addAutority(role); reqCtx.getRequest().getSession().setAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER, user); Page page = new Page(); page.setCode("login"); page.setGroup("free"); page.setModel(new PageModel()); reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE, page); Lang lang = new Lang(); lang.setCode("it"); reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG, lang); MockHttpServletRequest request = (MockHttpServletRequest) reqCtx.getRequest(); request.setRemoteAddr("255.255.255.255"); request.addHeader("Referer", "homeTest"); request.addHeader("User-Agent", "Mio Test Browser"); request.addHeader("accept-language", "sardo"); int status = _statMonitor.service(reqCtx, ControllerManager.CONTINUE); assertEquals(status, ControllerManager.CONTINUE); this.deleteStatsRecord(); }
protected boolean validateSetAssignableParams(Ticket ticket) { boolean allowed = false; String roleName = this.getRoleName(); if (null != roleName) { Role role = this.getRoleManager().getRole(roleName); if (null != role && role.hasPermission(JpWttSystemConstants.WTT_OPERATOR_PERMISSION)) { allowed = true; } } if (!allowed) { this.addFieldError("roleName", this.getText("Errors.ticketSetAssiglable.roleNotFound")); } return allowed; }