1 Reply Latest reply on Aug 14, 2008 12:15 PM by hasan

    SeamTest - Target Unreachable

    Mike Schulze Newbie

      Hi - I've written a small SeamTest with an included FacesRequest to test my Application. Everthing works fine until I get to a Point where a Seam-component is referenced, that was not referenced in my original JSF-page.

      JSF-page -- uses Seam-component1 -- uses Seam-component2

      this is my stacktrace



      java.lang.AssertionError: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'permission' resolved to null
           at org.jboss.seam.mock.BaseSeamTest$Request.onException(BaseSeamTest.java:488)
           at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:537)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:524)
           at com.solarfix.user.permission.PermissionCreateTest.testAddArtist(PermissionCreateTest.java:88)
      Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'permission' resolved to null
           at org.jboss.el.parser.AstValue.getTarget(AstValue.java:38)
           at org.jboss.el.parser.AstValue.setValue(AstValue.java:83)
           at org.jboss.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
           at org.jboss.seam.mock.BaseSeamTest$Request.setValue(BaseSeamTest.java:463)
           at com.solarfix.user.permission.PermissionCreateTest$1.updateModelValues(PermissionCreateTest.java:59)
           at org.jboss.seam.mock.BaseSeamTest$Request.updateModelValuesPhase(BaseSeamTest.java:684)
           at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(BaseSeamTest.java:606)
           at org.jboss.seam.mock.BaseSeamTest$Request.access$300(BaseSeamTest.java:184)
           at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:530)
           ... 42 more
      ... Removed 22 stack frames





      How do I load the last component? I've tried getInstance(..) but it throws a ClassCastException, so I think I might have chosen a  wrong way. I do not want to mock the second component, because it contains essential funtionality.

      Thx - Mike

        • 1. Re: SeamTest - Target Unreachable
          hasan Newbie

          if u are accessing a property of a seam component then u can do it in two ways


          1 -

          getValue("#{seamComponentName.propertyName}")



          don't forget to add getter and setter methods of ur property in the seam component


          2 -

          MyClass myClass = (MyClass)getInstance("propertyName")




          if u are accesing the property of an Entity then


          getValue("#{entityName.propertyName}")



          in this case I imagine u already have getters and setters for ur property