org.alfresco.util
Class TestWithUserUtils

java.lang.Object
  extended by org.alfresco.util.TestWithUserUtils

public abstract class TestWithUserUtils
extends java.lang.Object

Utility class containing some useful methods to help when writing tests that require authenticated users


Constructor Summary
TestWithUserUtils()
           
 
Method Summary
static void authenticateUser(java.lang.String userName, java.lang.String password, MutableAuthenticationService authenticationService, AuthenticationComponent authenticationComponent)
          Authenticate as the given user.
static void authenticateUser(java.lang.String userName, java.lang.String password, org.alfresco.service.cmr.repository.NodeRef rootNodeRef, AuthenticationService authenticationService)
          Authenticate the user with the specified password
static void createUser(java.lang.String userName, java.lang.String password, org.alfresco.service.cmr.repository.NodeRef rootNodeRef, org.alfresco.service.cmr.repository.NodeService nodeService, MutableAuthenticationService authenticationService)
          Create a new user, including the corresponding person node.
static void createUser(java.lang.String userName, java.lang.String password, java.lang.String email, org.alfresco.service.cmr.repository.NodeRef rootNodeRef, org.alfresco.service.cmr.repository.NodeService nodeService, MutableAuthenticationService authenticationService)
           
static void deleteUser(java.lang.String user_name, java.lang.String pwd, org.alfresco.service.cmr.repository.NodeRef ref, org.alfresco.service.cmr.repository.NodeService service, MutableAuthenticationService service2)
           
static java.lang.String getCurrentUser(AuthenticationService authenticationService)
          Get the current user node reference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestWithUserUtils

public TestWithUserUtils()
Method Detail

createUser

public static void createUser(java.lang.String userName,
                              java.lang.String password,
                              org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
                              org.alfresco.service.cmr.repository.NodeService nodeService,
                              MutableAuthenticationService authenticationService)
Create a new user, including the corresponding person node.

Parameters:
userName - the user name
password - the password
rootNodeRef - the root node reference
nodeService - the node service
authenticationService - the authentication service

createUser

public static void createUser(java.lang.String userName,
                              java.lang.String password,
                              java.lang.String email,
                              org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
                              org.alfresco.service.cmr.repository.NodeService nodeService,
                              MutableAuthenticationService authenticationService)

authenticateUser

public static void authenticateUser(java.lang.String userName,
                                    java.lang.String password,
                                    org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
                                    AuthenticationService authenticationService)
Authenticate the user with the specified password

Parameters:
userName - the user name
password - the password
rootNodeRef - the root node reference
authenticationService - the authentication service

authenticateUser

public static void authenticateUser(java.lang.String userName,
                                    java.lang.String password,
                                    MutableAuthenticationService authenticationService,
                                    AuthenticationComponent authenticationComponent)
Authenticate as the given user. If the user does not exist, then authenticate as the system user and create the authentication first.


getCurrentUser

public static java.lang.String getCurrentUser(AuthenticationService authenticationService)
Get the current user node reference

Parameters:
authenticationService - the authentication service
Returns:
the currenlty authenticated user's node reference

deleteUser

public static void deleteUser(java.lang.String user_name,
                              java.lang.String pwd,
                              org.alfresco.service.cmr.repository.NodeRef ref,
                              org.alfresco.service.cmr.repository.NodeService service,
                              MutableAuthenticationService service2)


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.