コード例 #1
0
  /**
   * Test of authenticate method, of class
   * com.rift.coad.lib.interceptor.authenticator.UserPasswordAuthenticator.
   */
  public void testAuthenticate() throws Exception {
    System.out.println("authenticate");

    // init the session information
    ThreadsPermissionContainer permissions = new ThreadsPermissionContainer();
    SessionManager.init(permissions);
    UserStoreManager userStoreManager = new UserStoreManager();
    UserSessionManager sessionManager = new UserSessionManager(permissions, userStoreManager);
    LoginManager.init(sessionManager, userStoreManager);
    // instanciate the thread manager
    CoadunationThreadGroup threadGroup =
        new CoadunationThreadGroup(sessionManager, userStoreManager);

    // add a user to the session for the current thread
    RoleManager.getInstance();

    InterceptorFactory.init(permissions, sessionManager, userStoreManager);

    TestInterceptor testInterceptor = new TestInterceptor();

    Login login = new Login("test", "112233");

    testInterceptor.createSession(login);

    ThreadPermissionSession threadSession = permissions.getSession();

    if (!threadSession.getUser().getName().equals("test")) {
      fail("The user name is not test");
    }

    testInterceptor.release();
  }
コード例 #2
0
 protected void onSetUp() throws Exception {
   testAspectForTestImpl1.count = 0;
   testAspectForAbstractTestImpl.count = 0;
   testInterceptor.count = 0;
   super.onSetUp();
 }