@Test public void addAcmUserToSession() throws Exception { String userId = "userId"; AcmUser theUser = new AcmUser(); expect(mockAuthentication.getName()).andReturn(userId); expect(mockRequest.getSession(true)).andReturn(mockSession); expect(mockUserDao.findByUserId(userId)).andReturn(theUser); mockSession.setAttribute("acm_user", theUser); replayAll(); unit.addAcmUserToSession(mockRequest, mockAuthentication); verifyAll(); }
protected String addAcmUserToSession(HttpServletRequest request, Authentication authentication) { String userId = authentication.getName(); AcmUser user = getUserDao().findByUserId(userId); HttpSession session = request.getSession(true); session.setAttribute("acm_user", user); return user.getUserId(); }
AcmLoginSuccessOperations { protected String addAcmUserToSession(HttpServletRequest request, Authentication authentication) { String userId = authentication.getName(); AcmUser user = getUserDao().findByUserId(userId); HttpSession session = request.getSession(true); session.setAttribute("acm_user", user); return user.getUserId(); } }
AcmLoginSuccessOperations { protected String addAcmUserToSession(HttpServletRequest request, Authentication authentication) { String userId = authentication.getName(); AcmUser user = getUserDao().findByUserId(userId); HttpSession session = request.getSession(true); session.setAttribute("acm_user", user); return user.getUserId(); }  }
AcmLoginSuccessOperations { protected String addAcmUserToSession(HttpServletRequest request, Authentication authentication) { String userId = authentication.getName(); AcmUser user = getUserDao().findByUserId(userId); HttpSession session = request.getSession(true); session.setAttribute("acm_user", user); return user.getUserId(); }  void onSuccessfulAuthentication(HttpServletRequest request, Authentication authentication); AcmPluginManager getAcmPluginManager(); void setAcmPluginManager(AcmPluginManager acmPluginManager); AcmApplication getAcmApplication(); void setAcmApplication(AcmApplication acmApplication); UserDao getUserDao(); void setUserDao(UserDao userDao); AuditPropertyEntityAdapter getAuditPropertyEntityAdapter(); void setAuditPropertyEntityAdapter(AuditPropertyEntityAdapter auditPropertyEntityAdapter); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter); }
AcmLoginSuccessOperations { protected String addAcmUserToSession(HttpServletRequest request, Authentication authentication) { String userId = authentication.getName(); AcmUser user = getUserDao().findByUserId(userId); HttpSession session = request.getSession(true); session.setAttribute("acm_user", user); return user.getUserId(); }  void onSuccessfulAuthentication(HttpServletRequest request, Authentication authentication); AcmPluginManager getAcmPluginManager(); void setAcmPluginManager(AcmPluginManager acmPluginManager); AcmApplication getAcmApplication(); void setAcmApplication(AcmApplication acmApplication); UserDao getUserDao(); void setUserDao(UserDao userDao); AuditPropertyEntityAdapter getAuditPropertyEntityAdapter(); void setAuditPropertyEntityAdapter(AuditPropertyEntityAdapter auditPropertyEntityAdapter); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter);  }