public class TestPerson extends Object
Modifier and Type | Method and Description |
---|---|
void |
addRole(RoleUnitName roleUnit)
Adds a given role.
|
void |
addRole(String role)
Adds a given role.
|
static TestPerson |
admin()
Returns the predefined person 'admin'.
|
void |
assignSecurityRoles(String... roles)
Assign security roles.
|
boolean |
exists()
Checks if the person exists.
|
static TestPerson |
findOrCreate(String login)
Finds a person with a given login, if not found, it creates one.
|
String |
getId()
Returns the person id.
|
String |
getLoginName()
Returns person login name.
|
Set<RoleUnitName> |
getRoleUnitNames()
Returns a set of assigned role unit names.
|
static TestPerson |
guest()
Returns the predefined person 'guest'.
|
void |
removeAllRoles()
Removes all roles.
|
void |
removeAllSubstitutes()
Removes all substitutes.
|
void |
removeRole(RoleUnitName roleUnit)
Removes a given role.
|
void |
removeRole(String role)
Removes a given role.
|
void |
setPassword(String password)
Update persons password.
|
void |
setRoleUnitNames(Collection<RoleUnitName> roles)
Sets roles to this person.
|
void |
setSubstitutes(TestPerson substitute)
Sets one substitute to the person.
|
String |
toString() |
public static TestPerson admin()
public static TestPerson guest()
public static TestPerson findOrCreate(String login)
login
- public String getId()
public String getLoginName()
public boolean exists()
true
if the person exists, false
otherwisepublic Set<RoleUnitName> getRoleUnitNames()
public void setRoleUnitNames(Collection<RoleUnitName> roles) throws Exception
roles
- Exception
public void addRole(String role) throws Exception
role
- Exception
public void addRole(RoleUnitName roleUnit) throws Exception
roleUnit
- Exception
public void removeRole(String role) throws Exception
role
- Exception
public void removeRole(RoleUnitName roleUnit) throws Exception
roleUnit
- Exception
public void setSubstitutes(TestPerson substitute) throws Exception
substitute
- Exception
public void removeAllSubstitutes() throws Exception
Exception
public void setPassword(String password) throws InvalidPasswordException, PersonNotFoundException
password
- InvalidPasswordException
PersonNotFoundException
public void assignSecurityRoles(String... roles) throws SecurityRoleNotFoundException, PersonNotFoundException
roles
- SecurityRoleNotFoundException
PersonNotFoundException
Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.