mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
119558 gcornwell: Merged code coverage improvements to 5.1-MC1 (5.1.0) r117774 gjames: RA-567: Increase /workflow/processes API code coverage r117773 gjames: RA-567: /workflow/processes coverage, removed unused ActivitiTypeConverter r116883 gjames: RA-531: reapplied change after merge, for MultiTServiceImpl test coverage r116629 gjames: RA-568 Increase /workflow/process-definitions API code coverage r116574 gjames: RA-569 Increase /workflow/tasks API code coverage r116286 gjames: RA-567: Increase /workflow/processes API code coverage r115853 gjames: RA-566: Increasing /people api coverage (description field) r115811 gjames: RA-566: Increasing /people api coverage r113007 gjames: Adding additional test coverage for DictionaryNamespaceComponent and DynamicNamespacePrefixResolver RA-521 r113006 gjames: Adding additional test coverage for DictionaryNamespaceComponent and DictionaryComponent RA-514 r112969 gjames: Adding additional test coverage for TemplateServiceImpl RA-530 r112960 gjames: Alternative test approach for ModuleServiceImpl RA-520 r112703 gjames: Adding additional test coverage for NodeLocatorService RA-522 r112702 gjames: Adding additional test coverage for JobLockServiceImpl RA-516 r112699 gjames: Adding additional test coverage for ModuleServiceImpl RA-520 r112508 gjames: Adding additional test coverage for RenditionServiceImpl RA-526 r112476 gjames: Adding additional test coverage for ContentServiceImpl RA-513 r112475 gjames: Adding additional test coverage for MimetypeMap RA-519 r112238 gjames: Adding additional test coverage for MimetypeMap RA-519 r112237 gjames: Adding additional test coverage for TaggingService RA-529 r112236 gjames: Adding additional test coverage for MultiTServiceImpl RA-531 r112206 gjames: Adding additional test coverage for ContentServiceImpl RA-513 r112167 gcornwell: RA-523: Increase NodeService code coverage (removed redundant code that was testing a version store we no longer use) r112102 gjames: Reverted changes to PermissionServiceImpl for RA-524 r112048 gjames: Temporarily removed some PermissionServiceImpl code. I need to put it back. r111620 gjames: Adding additional test coverage for PermissionService RA-524 r111619 gjames: Added some @Override to make Sonar happier r111456 gjames: Adding additional test coverage for AuthenticationService RA-509 r111427 gjames: Adding additional test coverage for AttributeService RA-509 r111317 gjames: Adding additional test coverage for WorkflowService RA-533 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@119945 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
90 lines
3.2 KiB
Java
90 lines
3.2 KiB
Java
package org.alfresco.rest.api.tests;
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertNotNull;
|
|
import static org.junit.Assert.fail;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import org.alfresco.model.ContentModel;
|
|
import org.alfresco.repo.tenant.TenantUtil;
|
|
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
|
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
|
import org.alfresco.rest.api.tests.RepoService.SiteInformation;
|
|
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
|
|
import org.alfresco.rest.api.tests.RepoService.TestSite;
|
|
import org.alfresco.rest.api.tests.client.PublicApiClient.People;
|
|
import org.alfresco.rest.api.tests.client.PublicApiException;
|
|
import org.alfresco.rest.api.tests.client.RequestContext;
|
|
import org.alfresco.rest.api.tests.client.data.Person;
|
|
import org.alfresco.rest.api.tests.client.data.SiteRole;
|
|
import org.alfresco.service.cmr.site.SiteVisibility;
|
|
import org.apache.commons.httpclient.HttpStatus;
|
|
import org.junit.Test;
|
|
|
|
public class TestPeople extends EnterpriseTestApi
|
|
{
|
|
@Test
|
|
public void testPeople() throws Exception
|
|
{
|
|
Iterator<TestNetwork> accountsIt = getTestFixture().getNetworksIt();
|
|
final TestNetwork account1 = accountsIt.next();
|
|
Iterator<String> personIt1 = account1.getPersonIds().iterator();
|
|
final String person1 = personIt1.next();
|
|
final String person2 = personIt1.next();
|
|
|
|
final TestNetwork account2 = accountsIt.next();
|
|
Iterator<String> personIt2 = account2.getPersonIds().iterator();
|
|
final String person3 = personIt2.next();
|
|
|
|
People peopleProxy = publicApiClient.people();
|
|
|
|
// Test Case cloud-2192
|
|
// should be able to see oneself
|
|
{
|
|
publicApiClient.setRequestContext(new RequestContext(account1.getId(), person1));
|
|
Person resp = peopleProxy.getPerson(person1);
|
|
Person person1Entity = repoService.getPerson(person1);
|
|
check(person1Entity, resp);
|
|
}
|
|
|
|
// should be able to see another user in the same domain, and be able to see full profile
|
|
{
|
|
publicApiClient.setRequestContext(new RequestContext(account1.getId(), person2));
|
|
Person resp = peopleProxy.getPerson(person1);
|
|
Person person1Entity = repoService.getPerson(person1);
|
|
check(person1Entity, resp);
|
|
}
|
|
|
|
// "-me-" user
|
|
{
|
|
publicApiClient.setRequestContext(new RequestContext(account1.getId(), person1));
|
|
Person resp = peopleProxy.getPerson(org.alfresco.rest.api.People.DEFAULT_USER);
|
|
Person person1Entity = repoService.getPerson(person1);
|
|
check(person1Entity, resp);
|
|
}
|
|
|
|
// shouldn't be able to see another user in another domain
|
|
publicApiClient.setRequestContext(new RequestContext(account1.getId(), person3));
|
|
try
|
|
{
|
|
peopleProxy.getPerson(person1);
|
|
fail("");
|
|
}
|
|
catch(PublicApiException e)
|
|
{
|
|
assertEquals(HttpStatus.SC_UNAUTHORIZED, e.getHttpResponse().getStatusCode());
|
|
}
|
|
|
|
RepoService.TestPerson testP = account1.createUser();
|
|
String personId = testP.getId();
|
|
String desc = "<B>Nice person</B>";
|
|
account1.addUserDescription(personId, desc);
|
|
publicApiClient.setRequestContext(new RequestContext(account1.getId(), personId));
|
|
Person resp = publicApiClient.people().getPerson(personId);
|
|
assertEquals(resp.getId(), personId);
|
|
assertEquals(resp.getDescription(), desc);
|
|
}
|
|
|
|
}
|