[jboss-user] [JBoss Seam] - SeamTest.FacesRequest: question

amashtakov do-not-reply at jboss.com
Wed Sep 12 04:02:07 EDT 2007

Hi All,

While writting integration tests I noticed the following behavour
SeamTest mock. In order to update user's profile I have to log-in 
first. So, we need two requests:

new FacesRequest("/login.xhtml") {
	protected void updateModelValues() throws Exception {
		setValue("#{identity.username}", AC_LOGIN);
		setValue("#{identity.password}", AC_PASSWORD);
	protected void invokeApplication() throws Exception {
		assert invokeMethod("#{identity.login}").equals("loggedIn");
		assert (Boolean) getValue("#{identity.loggedIn}");


new FacesRequest("/profile.xhtml") {
	protected void invokeApplication() {
		UserProfile up = (UserProfile) getInstance("pcUserProfile");
		assert (Boolean) getValue("#{identity.loggedIn}");
	protected void renderResponse() {
		assert isLongRunningConversation();

All works fine in case in both requests are in the same method of
test class.

In case of I put each of them in separate methods (for ex: m1 and m2), 
assert (Boolean) getValue("#{identity.loggedIn}") of m2 fails.

Tried to figure out the reason but with no success (in both cases 
FacesContext.getCurrentInstance() points to different objects).

Could you please clarify why does this happen ?

Thank you in advance,

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083319

More information about the jboss-user mailing list