use of org.alfresco.service.cmr.security.PersonService in project alfresco-remote-api by Alfresco.
the class TestPeople method setUp.
@Before
public void setUp() throws Exception {
people = publicApiClient.people();
accountsIt = getTestFixture().getNetworksIt();
account1 = accountsIt.next();
account2 = accountsIt.next();
// Networks are very expensive to create, so do this once only and store statically.
if (account3 == null) {
account3 = createNetwork("account3");
}
if (account4 == null) {
// Use account 4 only for the sorting and paging tests, so that the data doesn't change between tests.
account4 = createNetwork("account4");
account4Admin = "admin@" + account4.getId();
publicApiClient.setRequestContext(new RequestContext(account4.getId(), account4Admin, "admin"));
personAlice = new Person();
personAlice.setUserName("alice@" + account4.getId());
personAlice.setId("alice@" + account4.getId());
personAlice.setFirstName("Alice");
personAlice.setLastName("Smith");
personAlice.setEmail("alison.smith@example.com");
personAlice.setPassword("password");
personAlice.setEnabled(true);
personAlice.setProperties(Collections.singletonMap("papi:lunch", "Magical sandwich"));
people.create(personAlice);
personAliceD = new Person();
personAliceD.setUserName("aliced@" + account4.getId());
personAliceD.setId("aliced@" + account4.getId());
personAliceD.setFirstName("Alice");
personAliceD.setLastName("Davis");
personAliceD.setEmail("alison.davis@example.com");
personAliceD.setPassword("password");
personAliceD.setEnabled(true);
people.create(personAliceD);
personBen = new Person();
personBen.setUserName("ben@" + account4.getId());
personBen.setId("ben@" + account4.getId());
personBen.setFirstName("Ben");
personBen.setLastName("Carson");
personBen.setEmail("ben.smythe@example.com");
personBen.setPassword("password");
personBen.setEnabled(true);
people.create(personBen);
}
account1Admin = "admin@" + account1.getId();
account2Admin = "admin@" + account2.getId();
account3Admin = "admin@" + account3.getId();
account1PersonIt = account1.getPersonIds().iterator();
account2PersonIt = account2.getPersonIds().iterator();
nodeService = applicationContext.getBean("NodeService", NodeService.class);
personService = applicationContext.getBean("PersonService", PersonService.class);
// Capture authentication pre-test, so we can restore it again afterwards.
AuthenticationUtil.pushAuthentication();
}
Aggregations