5 Replies Latest reply on Aug 21, 2007 4:14 AM by knuwu

    testng unit tests not working with testng eclipse plugin sin

      I had well working testng test in version 1.2.0 sp1, i could execute from ant or inside eclipse with the testng pugling.

      Since 1.2.1 GA i get the following error message when i execute my login tests:

      "[RuleBasedIdentity] no security rule base available - please install a RuleBase with the name 'securityRules' if permission checks are required."
      


      Full stack trace:

      [Parser] Running:
       C:\seat\workspace\aldebaran\src\test\com\swisscom\seat\services\security\test\testngServiceSecurityTest.xml
      
      14:47:08,821 INFO [Scanner] scanning: /C:/seat/workspace/aldebaran/lib/jboss-seam.jar
      14:47:08,837 INFO [Initialization] Namespace: http://jboss.com/products/seam/security, package: org.jboss.seam.security, prefix: org.jboss.seam.security
      14:47:08,837 INFO [Initialization] Namespace: http://jboss.com/products/seam/drools, package: org.jboss.seam.drools, prefix: org.jboss.seam.drools
      14:47:08,837 INFO [Initialization] Namespace: http://jboss.com/products/seam/mail, package: org.jboss.seam.mail, prefix: org.jboss.seam.mail
      14:47:08,837 INFO [Initialization] Namespace: http://jboss.com/products/seam/web, package: org.jboss.seam.web, prefix: org.jboss.seam.web
      14:47:08,837 INFO [Initialization] Namespace: http://jboss.com/products/seam/theme, package: org.jboss.seam.theme, prefix: org.jboss.seam.theme
      14:47:08,837 INFO [Initialization] Namespace: http://jboss.com/products/seam/core, package: org.jboss.seam.core, prefix: org.jboss.seam.core
      14:47:08,837 INFO [Initialization] Namespace: http://jboss.com/products/seam/jms, package: org.jboss.seam.jms, prefix: org.jboss.seam.jms
      14:47:08,837 INFO [Initialization] Namespace: http://jboss.com/products/seam/framework, package: org.jboss.seam.framework, prefix: org.jboss.seam.core.framework
      14:47:08,837 INFO [Scanner] scanning: /C:/seat/workspace/aldebaran/lib/jboss-seam-debug.jar
      14:47:08,837 INFO [Scanner] scanning: /C:/seat/workspace/aldebaran/lib/jboss-seam-ui.jar
      14:47:08,853 INFO [Initialization] reading jar:file:/C:/seat/workspace/aldebaran/lib/jboss-seam.jar!/META-INF/components.xml
      14:47:08,962 INFO [Initialization] reading properties from: /seam.properties
      14:47:08,962 INFO [Initialization] reading properties from: /jndi.properties
      14:47:08,962 INFO [Initialization] initializing Seam
      14:47:08,993 INFO [Scanner] scanning: /C:/seat/workspace/aldebaran/lib/jboss-seam-debug.jar
      14:47:09,071 INFO [Scanner] scanning: /C:/seat/workspace/aldebaran/lib/jboss-seam-ui.jar
      14:47:09,274 INFO [Scanner] scanning: /C:/seat/workspace/aldebaran/lib/jboss-seam.jar
      14:47:10,257 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.persistence.persistenceProvider
      14:47:10,273 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.security.identity
      14:47:10,304 INFO [Component] Component: org.jboss.seam.core.init, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Init
      14:47:10,351 INFO [Initialization] Installing components...
      14:47:10,367 INFO [Component] Component: org.jboss.seam.core.applicationContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.ApplicationContext
      14:47:10,367 INFO [Component] Component: org.jboss.seam.core.businessProcessContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.BusinessProcessContext
      14:47:10,367 INFO [Component] Component: org.jboss.seam.core.conversation, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.Conversation
      14:47:10,367 INFO [Component] Component: org.jboss.seam.core.conversationContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationContext
      14:47:10,367 INFO [Component] Component: org.jboss.seam.core.conversationEntries, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationEntries
      14:47:10,367 INFO [Component] Component: org.jboss.seam.core.conversationList, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationList
      14:47:10,367 INFO [Component] Component: org.jboss.seam.core.conversationStack, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationStack
      14:47:10,382 INFO [Component] Component: org.jboss.seam.core.eventContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.EventContext
      14:47:10,382 INFO [Component] Component: org.jboss.seam.core.events, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.Events
      14:47:10,382 INFO [Component] Component: org.jboss.seam.core.exceptions, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Exceptions
      14:47:10,382 INFO [Component] Component: org.jboss.seam.core.expressions, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Expressions
      14:47:10,382 INFO [Component] Component: org.jboss.seam.core.facesContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.FacesContext
      14:47:10,382 INFO [Component] Component: org.jboss.seam.core.facesMessages, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.FacesMessages
      14:47:10,398 INFO [Component] Component: org.jboss.seam.core.facesPage, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.FacesPage
      14:47:10,398 INFO [Component] Component: org.jboss.seam.core.httpError, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.HttpError
      14:47:10,398 INFO [Component] Component: org.jboss.seam.core.image, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.Image
      14:47:10,398 INFO [Component] Component: org.jboss.seam.core.interpolator, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.Interpolator
      14:47:10,398 INFO [Component] Component: org.jboss.seam.core.isUserInRole, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.IsUserInRole
      14:47:10,398 INFO [Component] Component: org.jboss.seam.core.locale, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.Locale
      14:47:10,398 INFO [Component] Component: org.jboss.seam.core.localeSelector, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.LocaleSelector
      14:47:10,398 INFO [Component] Component: org.jboss.seam.core.manager, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.core.Manager
      14:47:10,413 INFO [Component] Component: org.jboss.seam.core.messages, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.Messages
      14:47:10,413 INFO [Component] Component: org.jboss.seam.core.methodContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.MethodContext
      14:47:10,413 INFO [Component] Component: org.jboss.seam.core.pageContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.PageContext
      14:47:10,413 INFO [Component] Component: org.jboss.seam.core.pages, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Pages
      14:47:10,429 INFO [Component] Component: org.jboss.seam.core.persistenceContexts, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.PersistenceContexts
      14:47:10,460 INFO [Component] Component: org.jboss.seam.core.pojoCache, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.PojoCache
      14:47:10,460 INFO [Component] Component: org.jboss.seam.core.redirect, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.Redirect
      14:47:10,460 INFO [Component] Component: org.jboss.seam.core.renderer, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.ui.facelet.FaceletsRenderer
      14:47:10,476 INFO [Component] Component: org.jboss.seam.core.resourceBundle, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.ResourceBundle
      14:47:10,476 INFO [Component] Component: org.jboss.seam.core.safeActions, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.SafeActions
      14:47:10,476 INFO [Component] Component: org.jboss.seam.core.sessionContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.SessionContext
      14:47:10,476 INFO [Component] Component: org.jboss.seam.core.switcher, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.Switcher
      14:47:10,476 INFO [Component] Component: org.jboss.seam.core.uiComponent, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.UiComponent
      14:47:10,476 INFO [Component] Component: org.jboss.seam.core.userPrincipal, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.UserPrincipal
      14:47:10,476 INFO [Component] Component: org.jboss.seam.core.validation, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.core.Validation
      14:47:10,476 INFO [Component] Component: org.jboss.seam.core.validators, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Validators
      14:47:10,476 INFO [Component] Component: org.jboss.seam.framework.currentDate, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.framework.CurrentDate
      14:47:10,507 INFO [Component] Component: org.jboss.seam.framework.currentDatetime, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.framework.CurrentDatetime
      14:47:10,507 INFO [Component] Component: org.jboss.seam.framework.currentTime, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.framework.CurrentTime
      14:47:10,507 INFO [Component] Component: org.jboss.seam.security.configuration, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.security.Configuration
      14:47:10,507 INFO [Component] Component: org.jboss.seam.security.identity, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.security.RuleBasedIdentity
      14:47:10,507 INFO [Component] Component: org.jboss.seam.servlet.exceptionFilter, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.web.ExceptionFilter
      14:47:10,523 INFO [Component] Component: org.jboss.seam.servlet.multipartFilter, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.web.MultipartFilter
      14:47:10,523 INFO [Component] Component: org.jboss.seam.servlet.redirectFilter, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.web.RedirectFilter
      14:47:10,523 INFO [Component] Component: org.jboss.seam.theme.theme, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.theme.Theme
      14:47:10,523 INFO [Component] Component: org.jboss.seam.theme.themeSelector, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.theme.ThemeSelector
      14:47:10,523 INFO [Component] Component: org.jboss.seam.ui.entityConverter, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.ui.EntityConverter
      14:47:10,523 INFO [Component] Component: org.jboss.seam.ui.entityConverterStore, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.ui.EntityConverterStore
      14:47:10,523 INFO [Component] Component: org.jboss.seam.ui.graphicImage.dynamicImageResource, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.ui.graphicImage.DynamicImageResource
      14:47:10,523 INFO [Component] Component: org.jboss.seam.ui.graphicImage.dynamicImageStore, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.ui.graphicImage.DynamicImageStore
      14:47:10,523 INFO [Component] Component: org.jboss.seam.ui.resource.webResource, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.ui.resource.WebResource
      14:47:10,538 INFO [Lifecycle] starting up: org.jboss.seam.servlet.exceptionFilter
      14:47:10,538 INFO [Lifecycle] starting up: org.jboss.seam.ui.graphicImage.dynamicImageResource
      14:47:10,538 INFO [Lifecycle] starting up: org.jboss.seam.servlet.multipartFilter
      14:47:10,538 INFO [Lifecycle] starting up: org.jboss.seam.ui.resource.webResource
      14:47:10,538 INFO [Lifecycle] starting up: org.jboss.seam.servlet.redirectFilter
      14:47:10,538 INFO [Initialization] done initializing Seam
      14:47:10,679 WARN [RuleBasedIdentity] no security rule base available - please install a RuleBase with the name 'securityRules' if permission checks are required.
      14:47:10,710 ERROR [SeamLoginModule] Error invoking login method
      java.lang.NullPointerException
       at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:104)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
       at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
       at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
       at java.security.AccessController.doPrivileged(Native Method)
       at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
       at javax.security.auth.login.LoginContext.login(LoginContext.java:575)
       at org.jboss.seam.security.Identity.authenticate(Identity.java:247)
       at org.jboss.seam.security.Identity.authenticate(Identity.java:240)
       at org.jboss.seam.security.Identity.login(Identity.java:170)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:174)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:286)
       at org.jboss.seam.util.UnifiedELMethodBinding.invoke(UnifiedELMethodBinding.java:36)
       at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
       at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
       at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
       at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
       at org.jboss.seam.mock.SeamTest$Request.invokeMethod(SeamTest.java:401)
       at com.swisscom.seat.services.security.test.LoginTest$2.invokeApplication(LoginTest.java:39)
       at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:489)
       at com.swisscom.seat.services.security.test.LoginTest.loginTest(LoginTest.java:50)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:645)
       at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:479)
       at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:715)
       at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
       at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
       at org.testng.TestRunner.runWorkers(TestRunner.java:673)
       at org.testng.TestRunner.privateRun(TestRunner.java:620)
       at org.testng.TestRunner.run(TestRunner.java:480)
       at org.testng.SuiteRunner.runTest(SuiteRunner.java:278)
       at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:273)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:253)
       at org.testng.SuiteRunner.run(SuiteRunner.java:168)
       at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:987)
       at org.testng.TestNG.runSuitesLocally(TestNG.java:951)
       at org.testng.TestNG.run(TestNG.java:719)
       at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
       at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:122)
      FAILED: loginTest("tsggora1", "test")
      javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'currentUser'
       at com.sun.el.lang.ELSupport.throwUnhandled(ELSupport.java:52)
       at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:75)
       at com.sun.el.parser.AstValue.getValue(AstValue.java:114)
       at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:195)
       at org.jboss.seam.util.UnifiedELValueBinding.getValue(UnifiedELValueBinding.java:34)
       at org.jboss.seam.mock.SeamTest$Request.getValue(SeamTest.java:366)
       at com.swisscom.seat.services.security.test.LoginTest$2.renderResponse(LoginTest.java:44)
       at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:521)
       at com.swisscom.seat.services.security.test.LoginTest.loginTest(LoginTest.java:50)
      ... Removed 21 stack frames
      
      ===============================================
       Security Tests
       Tests run: 1, Failures: 1, Skips: 0
      ===============================================
      
      
      ===============================================
      Security Tests
      Total tests run: 1, Failures: 1, Skips: 0
      ===============================================
      


      The test class is looking like that:

      package com.swisscom.seat.services.security.test;
      
      import java.util.List;
      
      import org.jboss.seam.Seam;
      import org.jboss.seam.core.Manager;
      import org.jboss.seam.mock.SeamTest;
      import org.testng.annotations.Parameters;
      import org.testng.annotations.Test;
      
      public class LoginTest extends SeamTest {
      
       @Parameters( { "userid", "password" })
       @Test( groups = {"functional"} )
       public void loginTest(final String userid, final String password)
       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}", userid);
       setValue("#{identity.password}", password);
       }
      
       @Override
       protected void invokeApplication() {
       invokeMethod("#{identity.login}");
       }
      
       @Override
       protected void renderResponse() {
       assert getValue("#{currentUser.userid}").equals(userid);
       assert !Manager.instance().isLongRunningConversation();
       assert ((List) getValue("#{currentUser.roles}")).size() > 0;
       assert getValue("#{identity.loggedIn}").equals(true);
       }
      
       }.run();
      
       new FacesRequest() {
      
       @Override
       protected void invokeApplication() {
       assert !isSessionInvalid();
       assert getValue("#{identity.loggedIn}").equals(true);
       }
      
       }.run();
      
       new FacesRequest() {
      
       @Override
       protected void invokeApplication() {
       assert !Manager.instance().isLongRunningConversation();
       assert !isSessionInvalid();
       invokeMethod("#{identity.logout}");
       assert Seam.isSessionInvalid();
       }
      
       @Override
       protected void renderResponse() {
       assert getValue("#{identity.loggedIn}").equals(false);
       assert Seam.isSessionInvalid();
       }
      
       }.run();
      
       }
      
      }