This is the part of my bean:
@Name("register")
  | @Stateful
  | @Scope(ScopeType.CONVERSATION)
  | public class RegisterBean extends Controller implements IRegister {
  | 
  |     private static final long serialVersionUID = 7559006461204534425L;
  | 
  |     @PersistenceContext(type = PersistenceContextType.EXTENDED)
  |     private EntityManager em;
  | 
  |     /**
  |      * @see de.llynch.kingpin.IRegister#begin()
  |      */
  |     @Begin(join = true, pageflow = "register")
  |     public void begin() {
  |     }
  | 
  | ....
This is the testcase (I'm using JUnit):
        /**
  |      * @throws Exception
  |      */
  |     @Test
  |     @SuppressWarnings("synthetic-access")
  |     public void testRegister() throws Exception {
  |             String id = new NonFacesRequest("/public/register.xhtml") {
  | 
  |                     @Override
  |                     protected void renderResponse() throws Exception {
  |                             invokeMethod("#{register.begin}");
  |                             Pageflow pageflow = Pageflow.instance();
  |                             assertEquals("register", 
pageflow.getNode().getName());
  |                             assertTrue(isLongRunningConversation());
  |                             assertEquals("/public/register.xhtml", 
getRenderedViewId());
  |                     }
  | 
  |             }.run();
  | 
  |             id = new FacesRequest("/public/register.xhtml", id) {
  | 
  |                     @Override
  |                     protected void invokeApplication() throws Exception {
  |                             Pageflow pageflow = Pageflow.instance();
  |                             pageflow.navigate(getFacesContext(), "next");
  |                             assertEquals("confirm", 
pageflow.getNode().getName());
  |                     }
  | 
  |                     @Override
  |                     protected void renderResponse() throws Exception {
  |                             assertEquals("/public/confirm.xhtml", 
getViewId());
  |                             assertTrue(isLongRunningConversation());
  |                     }
  | 
  |             }.run();
  | 
  |             id = new FacesRequest("/public/confirm.xhtml", id) {
  | 
  |                     @Override
  |                     protected void invokeApplication() throws Exception {
  |                             Pageflow pageflow = Pageflow.instance();
  |                             assertTrue(pageflow.isInProcess());
  |                             assertEquals("confirm", 
pageflow.getNode().getName());
  |                             pageflow.navigate(getFacesContext(), "next");
  |                             assertEquals("invite", 
pageflow.getNode().getName());
  |                     }
  | 
  |                     @Override
  |                     protected void renderResponse() throws Exception {
  |                             assertEquals("/public/secure/invite.xhtml", 
getViewId());
  |                             assertFalse(isLongRunningConversation());
  |                     }
  | 
  |             }.run();
  |     }
  | 
  | 


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058148#4058148

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058148
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to