List of usage examples for com.liferay.portal.kernel.service UserLocalServiceUtil unsetOrganizationUsers
public static void unsetOrganizationUsers(long organizationId, long[] userIds) throws com.liferay.portal.kernel.exception.PortalException
From source file:com.liferay.site.service.persistence.test.GroupServiceUserSitesGroupsTest.java
License:Open Source License
@Test public void testOrganizationAncestorsGroups() throws Exception { _user = UserTestUtil.addUser();//from ww w.j av a 2 s .co m Organization parentOrganization = OrganizationTestUtil.addOrganization(true); Group parentOrganizationGroup = parentOrganization.getGroup(); _organizations.addFirst(parentOrganization); Organization organization = OrganizationTestUtil.addOrganization(parentOrganization.getOrganizationId(), RandomTestUtil.randomString(), false); _organizations.addFirst(organization); UserLocalServiceUtil.addOrganizationUsers(organization.getOrganizationId(), new long[] { _user.getUserId() }); try { List<Group> groups = GroupServiceUtil.getUserSitesGroups(_user.getUserId(), null, QueryUtil.ALL_POS); Group organizationGroup = organization.getGroup(); Assert.assertTrue(groups + " does not contain " + parentOrganizationGroup, groups.contains(parentOrganizationGroup)); Assert.assertFalse(groups + " contains " + organizationGroup, groups.contains(organizationGroup)); } finally { UserLocalServiceUtil.unsetOrganizationUsers(organization.getOrganizationId(), new long[] { _user.getUserId() }); } }