3 Replies Latest reply on May 20, 2008 8:10 AM by Ales Justin

    Seam Component Returning Null In Seam Testing

    Sudarsana Reddy M Newbie

      my Action class

      @Stateful
      @Name("catalogueMasterSearch")
      @Scope(ScopeType.CONVERSATION)
      public class CatalogueMasterSearchAction implements CatalogueMasterSearch{
      @Create
      @Begin(join = true)
      public String create() {
      return "true";
      }
      @Destroy
      @Remove @End
      public void destroy() {
      }
      public void searchItem() {
      }
      -------------------------------------------------------------------------------------
      Test Class

      public class CatalogueMasterSearchActionTest extends BaseTest{

      @Test
      public void testSearchItem() throws Exception
      {
      CatalogueMasterSearchAction catalogueMasterSearch;
      new Script()
      {

      @Override
      protected void invokeApplication() throws Exception {
      Contexts.getConversationContext().set("itemSearch;", new ItemSearch())
      }

      }.run();
      new Script("/jsf/catalogue/rate_master.xhtml") {
      @Override
      protected void invokeApplication() throws Exception {
      CatalogueMasterSearchAction catalogueMasterSearch=(CatalogueMasterSearchAction)Component.getInstance("catalogueMasterSearch");
      invokeMethod("#{catalogueMasterSearch.searchItem}");
      }
      @Override
      protected void renderResponse() throws Exception {
      DataModel itemRateList = (DataModel) Contexts.getSessionContext().get("itemRateContractList");
      assert itemRateList.getRowCount()>=1;
      }

      }.run();
      }
      }
      -------------------------------------------------------------------------------------
      when i am executing my test class i am getting propery not found exception


      *********** INVOKED METHODS

      org.jboss.seam.mock.SeamTest.init() 5506056
      com.hp.eproc.test.CatalogueMasterSearchActionTest.testSearchItem() 5506056
      org.jboss.seam.mock.SeamTest.cleanup() 5506056

      ***********

      Creating C:\trunkworkspace\test-output\eprocurement\com.hp.eproc.test.CatalogueMasterSearchActionTest.html
      FAILED: testSearchItem
      javax.el.PropertyNotFoundException: Target Unreachable, identifier 'catalogueMasterSearch' resolved to null
      at com.sun.el.parser.AstValue.getTarget(AstValue.java:66)
      at com.sun.el.parser.AstValue.invoke(AstValue.java:147)
      at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
      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.hp.eproc.test.CatalogueMasterSearchActionTest$2.invokeApplication(CatalogueMasterSearchActionTest.java:66)
      at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:489)
      at com.hp.eproc.test.CatalogueMasterSearchActionTest.testSearchItem(CatalogueMasterSearchActionTest.java:75)
      ... Removed 22 stack frames

      ===============================================
      com.hp.eproc.test.CatalogueMasterSearchActionTest
      Tests run: 1, Failures: 1, Skips: 0
      ===============================================


      ===============================================
      eprocurement
      Total tests run: 1, Failures: 1, Skips: 0
      ===============================================

      Creating C:\trunkworkspace\test-output\eprocurement\toc.html
      Creating C:\trunkworkspace\test-output\eprocurement\com.hp.eproc.test.CatalogueMasterSearchActionTest.properties
      Creating C:\trunkworkspace\test-output\eprocurement\index.html
      Creating C:\trunkworkspace\test-output\eprocurement\main.html
      Creating C:\trunkworkspace\test-output\eprocurement\groups.html
      Creating C:\trunkworkspace\test-output\eprocurement\methods.html
      Creating C:\trunkworkspace\test-output\eprocurement\methods-alphabetical.html
      Creating C:\trunkworkspace\test-output\eprocurement\classes.html
      Creating C:\trunkworkspace\test-output\eprocurement\reporter-output.html
      Creating C:\trunkworkspace\test-output\eprocurement\methods-not-run.html
      Creating C:\trunkworkspace\test-output\eprocurement\testng.xml.html
      Creating C:\trunkworkspace\test-output\index.html
      Creating C:\trunkworkspace\test-output\testng-failed.xml
      Creating C:\trunkworkspace\test-output\eprocurement\testng-failed.xml
      Creating C:\trunkworkspace\test-output\testng-results.xml


      Please Help me
      thanks in advance
      my mailid:m.sudha549@gmail.com