com.atlassian.confluence.it.user
Class LoginHelper

java.lang.Object
  extended by com.atlassian.confluence.it.user.LoginHelper

public class LoginHelper
extends Object

Helps to manage the user session for a http client for testing. Use this in preference to com.atlassian.confluence.AbstractConfluenceAcceptanceTest.logout().


Field Summary
protected  org.slf4j.Logger log
           
 
Constructor Summary
LoginHelper(net.sourceforge.jwebunit.junit.WebTester tester)
           
 
Method Summary
 boolean isLoggedInAs(String username)
          Returns true if logged in as the passed user.
 boolean isLoggedInAs(User user)
          Returns true if logged in as the passed user.
 void login(String username, String password, boolean rememberMe)
          Deprecated. since 4.2 Use logInFast(com.atlassian.confluence.it.User), logInDecorated(com.atlassian.confluence.it.User) or logInViaForm(com.atlassian.confluence.it.User).
 void logIn(String username, String password, boolean decorateLogin, boolean rememberMe)
          Log in with a specific username and password plus options.
 void login(User user)
          Deprecated. since 4.2 Use logInFast(com.atlassian.confluence.it.User), logInDecorated(com.atlassian.confluence.it.User) or logInViaForm(com.atlassian.confluence.it.User).
 void logInDecorated(User user)
           
 void logInFast(User user)
           
 void logInViaForm(String username, String password, boolean rememberMe)
           
 void logInViaForm(User user)
           
 void logout()
          Log out to the super-fast test logout screen.
 void logOutAndIn(User user)
          Log out the current user and then log back in with the given user.
 void logOutAndStayAnonymous()
          Log out the current user and then begin a new session as the anonymous user.
 void logOutFast()
          Logs the current user out as quickly as possible.
 void logOutSlowly()
          Log out by clicking the Log Out link in the UI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final transient org.slf4j.Logger log
Constructor Detail

LoginHelper

public LoginHelper(net.sourceforge.jwebunit.junit.WebTester tester)
Method Detail

logOutAndIn

public void logOutAndIn(User user)
Log out the current user and then log back in with the given user. The logIn is a fast decoratorless one.

Parameters:
user - user to log in

logOutAndStayAnonymous

public void logOutAndStayAnonymous()
Log out the current user and then begin a new session as the anonymous user. The beginAt is a fast decoratorless one.


login

public void login(User user)
Deprecated. since 4.2 Use logInFast(com.atlassian.confluence.it.User), logInDecorated(com.atlassian.confluence.it.User) or logInViaForm(com.atlassian.confluence.it.User).


login

public void login(String username,
                  String password,
                  boolean rememberMe)
Deprecated. since 4.2 Use logInFast(com.atlassian.confluence.it.User), logInDecorated(com.atlassian.confluence.it.User) or logInViaForm(com.atlassian.confluence.it.User).


logIn

public void logIn(String username,
                  String password,
                  boolean decorateLogin,
                  boolean rememberMe)
Log in with a specific username and password plus options.

Parameters:
decorateLogin - true to include standard page decoration on the login screen. This makes it possible to click in menus but comes at a large performance cost. By default, pass false.

logInFast

public void logInFast(User user)

logInDecorated

public void logInDecorated(User user)

logout

public void logout()
Log out to the super-fast test logout screen. This logs your user out quickly, freeing up resources, but doesn't return the appropriate result for testing. It also sets up the WebTester by calling WebTester.beginAt(String). You should use this method to log out most of the time, and also to begin tests where Confluence is being used anonymously. But use logOutSlowly() if you're testing log-out functionality specifically.

Note, this method will only actually invalidate your user's existing session on the server if the functest plugin is installed.

See Also:
logOutSlowly()

logOutFast

public void logOutFast()
Logs the current user out as quickly as possible. It does not call WebTester.beginAt(String) so you can not use it to ensure the WebTester is appropriately set up.


logOutSlowly

public void logOutSlowly()
Log out by clicking the Log Out link in the UI. This method assumes you are already on a page with the Log Out menu visible. You can use it to test that the results of clicking that link are appropriate. It does not call WebTester.beginAt(String) so you can not use it to ensure the WebTester is appropriately set up.

See Also:
logout()

isLoggedInAs

public boolean isLoggedInAs(String username)
Returns true if logged in as the passed user.


isLoggedInAs

public boolean isLoggedInAs(User user)
Returns true if logged in as the passed user.


logInViaForm

public void logInViaForm(User user)

logInViaForm

public void logInViaForm(String username,
                         String password,
                         boolean rememberMe)


Copyright © 2003-2012 Atlassian. All Rights Reserved.