use of org.alfresco.rest.api.tests.client.data.SiteRole in project alfresco-remote-api by Alfresco.
the class RepoService method getSiteMemberships.
public List<MemberOfSite> getSiteMemberships(String personId) {
List<SiteInfo> sites = siteService.listSites(personId);
List<MemberOfSite> memberships = new ArrayList<MemberOfSite>();
for (SiteInfo siteInfo : sites) {
String roleStr = siteService.getMembersRole(siteInfo.getShortName(), personId);
SiteRole role = SiteRole.valueOf(roleStr);
SiteImpl site = new SiteImpl(siteInfo, role, true);
memberships.add(new MemberOfSite(site, role));
}
return memberships;
}
use of org.alfresco.rest.api.tests.client.data.SiteRole in project alfresco-remote-api by Alfresco.
the class TestPersonSites method testSitesWithSameTitles.
// ACE-4823
@Test
public void testSitesWithSameTitles() throws Exception {
// Creates 3 sites
initializeSites();
final String site4_name = "d_" + GUID.generate();
// Same title as site3
final String site4_title = site3_title;
final SiteRole site4_role = SiteRole.SiteCollaborator;
TestSite site4 = TenantUtil.runAsUserTenant(new TenantRunAsWork<TestSite>() {
@Override
public TestSite doWork() throws Exception {
SiteInformation siteInfo = new SiteInformation(site4_name, site4_title, site4_title, SiteVisibility.PRIVATE);
TestSite site = network1.createSite(siteInfo);
site.inviteToSite(person32.getId(), site4_role);
return site;
}
}, person31.getId(), network1.getId());
assertNotNull(site4);
// paging
int totalResults = 4;
Paging paging = getPaging(null, null, totalResults, totalResults);
// get memberships
ListResponse<MemberOfSite> resp = getSiteMembershipsForPerson32(null, null, false);
// check results
List<MemberOfSite> expectedList = new LinkedList<>();
expectedList.add(new MemberOfSite(site2, site2_role));
expectedList.add(new MemberOfSite(site3, site3_role));
expectedList.add(new MemberOfSite(site4, site4_role));
expectedList.add(new MemberOfSite(site1, site1_role));
try {
checkList(expectedList, paging.getExpectedPaging(), resp);
} catch (AssertionError error) {
// Site3 and Site4 have a same title, and as we are sorting on titles (default sorting),
// we can't guarantee the order in which the sites will
// return, hence swap the sites and compare again.
Collections.swap(expectedList, 1, 2);
checkList(expectedList, paging.getExpectedPaging(), resp);
}
}
Aggregations