4 Replies Latest reply on Sep 14, 2007 5:28 AM by Alexander Mashtakov

    SeamTest.FacesRequest: question

    Alexander Mashtakov Newbie

      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,