[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:

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

2)

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


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,
/Alexander

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