0 Replies Latest reply on Apr 18, 2010 6:47 PM by William Woodman

    conversation doesnt start from testing - cant see why not

    William Woodman Master

      having real basic problems with conversations.  can any one help

      got to this cos something i was trying to do wasnt working.

      when i call a method from testNG i dont get continuity in conversation context.  I get a new conversation every time.

      heres my test class component

      package org.domain.forsterslist.richfaces.datamodel;
      import java.io.Serializable;
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.AutoCreate;
      import org.jboss.seam.annotations.Begin;
      import org.jboss.seam.annotations.Create;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.core.Conversation;
      import org.jboss.seam.log.Log;
      @Name ("simpleConv")
      @Scope (ScopeType.CONVERSATION)
      public class SimpleConv  implements Serializable
           private static final long serialVersionUID = 1L;
           /** */
          Log log;
          public void init()
          @Begin (join=true)
          public String sayHello (int reqNum)
                String cid = Conversation.instance().getId();
                log.info("say hello with cid=#0, convLongRunning=#1 on reqNum#2", cid,Conversation.instance().isLongRunning() ,  reqNum);
                return "hello will";

      i then create testNG test like this

      import org.jboss.seam.mock.SeamTest;
      import org.testng.annotations.Test;
      public class TestSimpleConv extends SeamTest
           public void uiTestDummyConv () throws Exception
                new FacesRequest () 
                     protected void invokeApplication ()
                          String res = (String) invokeMethod ("#{simpleConv.sayHello(1)}");
                          assert res.equals("hello will");
                }.run ();
                new FacesRequest () 

      which when get the trace says this .

      [Parser] Running:
      WARN  [org.jboss.seam.security.permission.PersistentPermissionResolver] no permission store available - please install a PermissionStore with the name 'org.jboss.seam.security.jpaPermissionStore' if persistent permissions are required.
      INFO  [org.domain.forsterslist.richfaces.datamodel.SimpleConv] say hello with cid=1, convLongRunning=false on reqNum1
      INFO  [org.domain.forsterslist.richfaces.datamodel.SimpleConv] say hello with cid=2, convLongRunning=false on reqNum2
      PASSED: uiTestDummyConv
          Tests run: 1, Failures: 0, Skips: 0
      Total tests run: 1, Failures: 0, Skips: 0

      as you can see i get a fresh conversation every time.  Why is that ?

      cant move anywhere till i understand why this is - as my other work assumes conversations get created and mainatined - my integration tests all fail in crucial ways cos this doesnt appear to be true.

      frustrated of ipswich