List of usage examples for com.liferay.portal.kernel.service UserLocalServiceUtil addOrganizationUser
public static void addOrganizationUser(long organizationId, com.liferay.portal.kernel.model.User user)
From source file:com.liferay.site.service.persistence.test.GroupServiceUserSitesGroupsTest.java
License:Open Source License
@Test public void testOrganizationUser() throws Exception { _user = UserTestUtil.addUser();//from w w w .ja va 2 s . c om Organization organization = OrganizationTestUtil.addOrganization(true); _organizations.addFirst(organization); UserLocalServiceUtil.addOrganizationUser(organization.getOrganizationId(), _user); Group organizationGroup = organization.getGroup(); LayoutTestUtil.addLayout(organizationGroup); List<Group> groups = GroupServiceUtil.getUserSitesGroups(_user.getUserId(), null, QueryUtil.ALL_POS); Assert.assertTrue(groups + " does not contain " + organizationGroup, groups.contains(organizationGroup)); }