"Reset" the faces context

  8 posts   Feedicon  
Replies: 7 - Last Post: May 29, 2009 07:22
by: IngoHofmann
showing 1 - 8 of 8
 
Posted: May 25, 2009 14:42 by IngoHofmann
Hi,

For some test cases I would like to have the possibility to "reset" the faces context.
Until, I guess, release 0.2 I could invoke:

facesTester.getFacesTester()

.. what always created a new context. Now you fixed the mistakable behavior of this method (what is a good idea, actually). However, my tests don't run green any more. Smile

How do I "reset" the faces context now, without initializing the whole other stuff? If there is no way, a method like this would be awesome:


public FacesContext createNewFacesContext() {
return facesContextBuilder.createFacesContext("/dummyPage.xhtml", "GET", lifecycle);
}


Greets,
Ingo
 
Posted: May 26, 2009 14:37 by IngoHofmann
I am sorry:

facesTester.getFacesTester()

should mean:

facesTester.getFacesContext()
 
Posted: May 28, 2009 13:54 by Jason Lee
I typically create a new FacesTester object for each test. The Mojarra initialization is done only on the first instantiation, so subsequent creations are very quick:

@Before
public void setUp() {
facesTester = new FacesTester();
}


Seems to do the trick for me.
 
Posted: May 28, 2009 14:47 by IngoHofmann
Hmm, in our case not that suitable. However, we could already change our tests, so a "reset" wasn't really necessary.
 
Posted: May 28, 2009 15:44 by Jason Lee
Fair enough. Can you explain (if you have time Wink how that's not suitable? I'd like to understand your situation to see if we can come up with a better solution WRT the FacesTester code.

Thanks! Smile
 
Posted: May 28, 2009 16:05 by IngoHofmann
Since the FacesTester does not pass the requests through our filters, I tinkered a sort of facade that, more or less, do that. The FacesTester itself must be initialized only once by using the @BeforeClass annotation (instead of @Before).

A better solution is just to get listeners and filters working. Smile
 
Posted: May 28, 2009 18:03 by Jason Lee
That makes sense. Listeners and filters are next on the list. Smile
 
Posted: May 29, 2009 07:22 by IngoHofmann
thumbs up!
showing 1 - 8 of 8
Replies: 7 - Last Post: May 29, 2009 07:22
by: IngoHofmann
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close