TestNG测试登陆模块的问题

qiaopang 2009-03-12
今天用testng测试简单的登录模块问题,遇到莫名其妙的异常:
“ERROR [org.jboss.seam.security.jaas.SeamLoginModule] No authentication method defined - please define authenticate-method for <security:identity/> in components.xml”
可是在components.xml中已经写入
<security:identity security-rules="#{securityRules}" authenticate-method="#{authenticator.authenticate}"  remember-me="true"/>
不知道问什么,请教大家如何解决?
AuthenticatorTest.java代码如下:
package com.salas.test;

import org.jboss.seam.core.Manager;
import org.jboss.seam.mock.SeamTest;
import org.testng.annotations.Test;

public class AuthenticateTest extends SeamTest {


   @Test
   public void testLogin() throws Exception
   {
     
      new FacesRequest() {
        
         @Override
         protected void invokeApplication()
         {
            assert !isSessionInvalid();
            assert getValue("#{identity.loggedIn}").equals(false);
         }
        
      }.run();


      new FacesRequest() {

          @Override
          protected void updateModelValues() throws Exception
          {
             assert !isSessionInvalid();
             setValue("#{identity.username}", "liuyan");
             setValue("#{identity.password}", "password");
          }

          @Override
          protected void invokeApplication()
          {
             invokeAction("#{identity.login}");
          }

          @Override
          protected void renderResponse()
          {
          
             assert getValue("#{identity.loggedIn}").equals(true);
          }
         
       }.run();
   }
}
Global site tag (gtag.js) - Google Analytics