public class AlfrescoPerson extends AbstractPersonRule
public class YourTestClass
{
// Normally we would initialise the spring application context in another rule.
@ClassRule public static final ApplicationContextInit APP_CONTEXT_RULE = new ApplicationContextInit();
// We pass the rule that creates the spring application context.
// This rule will give us a user with username 'NeilM'.
@Rule public final AlfrescoPerson namedPerson = new AlfrescoPerson(APP_CONTEXT_RULE, "NeilM");
// This rule with give us a user with a GUID-generated name.
@Rule public final AlfrescoPerson guidPerson = new AlfrescoPerson(APP_CONTEXT_RULE);
@Test public void aTestMethod()
{
AuthenticationUtil.setFullyAuthenticatedUser(namedPerson.getUsername());
// etc
}
}
appContext, appContextRule, EMAIL, FIRST_NAME, JOB_TITLE, LAST_NAME, PASSWORD| Constructor and Description |
|---|
AlfrescoPerson(org.springframework.context.ApplicationContext appContext)
Constructs the rule with a spring ApplicationContext.
|
AlfrescoPerson(ApplicationContextInit appContextRule)
Constructs the rule with a reference to a
rule which can be used to retrieve the ApplicationContext. |
AlfrescoPerson(ApplicationContextInit appContextRule,
java.lang.String userName)
Constructs the rule with a reference to a
rule which can be used to retrieve the ApplicationContext. |
AlfrescoPerson(org.springframework.context.ApplicationContext appContext,
java.lang.String userName)
Constructs the rule with a spring ApplicationContext.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
after() |
protected void |
before() |
java.lang.String |
getPassword() |
org.alfresco.service.cmr.repository.NodeRef |
getPersonNode()
Gets the
person node. |
java.lang.String |
getUsername() |
createPerson, deletePerson, getApplicationContextpublic AlfrescoPerson(org.springframework.context.ApplicationContext appContext)
appContext - the spring app context (needed to get at Alfresco services).public AlfrescoPerson(ApplicationContextInit appContextRule)
rule which can be used to retrieve the ApplicationContext.
A GUID-generated username will be used for the test user.appContextRule - a rule which can be used to retrieve the spring app context.public AlfrescoPerson(org.springframework.context.ApplicationContext appContext,
java.lang.String userName)
appContext - the spring app context (needed to get at Alfresco services).userName - the username for the person to be created.public AlfrescoPerson(ApplicationContextInit appContextRule, java.lang.String userName)
rule which can be used to retrieve the ApplicationContext.appContextRule - a rule which can be used to retrieve the spring app context.userName - the username for the person to be created.protected void before()
throws java.lang.Throwable
before in class org.junit.rules.ExternalResourcejava.lang.Throwableprotected void after()
after in class org.junit.rules.ExternalResourcepublic java.lang.String getUsername()
public java.lang.String getPassword()
public org.alfresco.service.cmr.repository.NodeRef getPersonNode()
person node.Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.