List of usage examples for com.liferay.portal.kernel.service GroupLocalServiceUtil deleteGroup
public static com.liferay.portal.kernel.model.Group deleteGroup(long groupId) throws com.liferay.portal.kernel.exception.PortalException
From source file:com.liferay.adaptive.media.document.library.thumbnails.internal.commands.test.AdaptiveMediaThumbnailsOSGiCommandsTest.java
License:Open Source License
@After public void tearDown() throws Exception { _adaptiveMediaImageConfigurationHelper.forceDeleteAdaptiveMediaImageConfigurationEntry( _company.getCompanyId(), _THUMBNAIL_CONFIGURATION + 100); _adaptiveMediaImageConfigurationHelper.forceDeleteAdaptiveMediaImageConfigurationEntry( _company.getCompanyId(), _THUMBNAIL_CONFIGURATION + 300); FileVersion latestFileVersion = _pngFileEntry.getFileVersion(); AdaptiveMediaImageEntryLocalServiceUtil.deleteAdaptiveMediaImageEntryFileVersion(latestFileVersion); GroupLocalServiceUtil.deleteGroup(_group); CompanyLocalServiceUtil.deleteCompany(_company); ServiceContextThreadLocal.popServiceContext(); }
From source file:com.liferay.adaptive.media.document.library.thumbnails.internal.osgi.commands.test.AMThumbnailsOSGiCommandsTest.java
License:Open Source License
@After public void tearDown() throws Exception { _amImageConfigurationHelper.forceDeleteAMImageConfigurationEntry(_company.getCompanyId(), _THUMBNAIL_CONFIGURATION + 100); _amImageConfigurationHelper.forceDeleteAMImageConfigurationEntry(_company.getCompanyId(), _THUMBNAIL_CONFIGURATION + 300); FileVersion latestFileVersion = _pngFileEntry.getFileVersion(); AMImageEntryLocalServiceUtil.deleteAMImageEntryFileVersion(latestFileVersion); GroupLocalServiceUtil.deleteGroup(_group); CompanyLocalServiceUtil.deleteCompany(_company); ServiceContextThreadLocal.popServiceContext(); }
From source file:com.liferay.asset.publisher.lar.test.AssetPublisherExportImportTest.java
License:Open Source License
@Test public void testChildLayoutScopeIds() throws Exception { Map<String, String[]> preferenceMap = new HashMap<>(); Group childGroup = GroupTestUtil.addGroup(group.getGroupId()); preferenceMap.put("scopeIds", new String[] { AssetPublisherHelper.SCOPE_ID_CHILD_GROUP_PREFIX + childGroup.getGroupId() }); try {//w w w . j av a 2 s .co m PortletPreferences portletPreferences = getImportedPortletPreferences(preferenceMap); Assert.assertEquals(null, portletPreferences.getValue("scopeId", null)); Assert.assertTrue("The child group ID should have been filtered out on import", ArrayUtil.isEmpty(portletPreferences.getValues("scopeIds", null))); } finally { GroupLocalServiceUtil.deleteGroup(childGroup); } }
From source file:com.liferay.asset.service.test.AssetTagFinderTest.java
License:Open Source License
@After public void tearDown() throws Exception { GroupLocalServiceUtil.deleteGroup(_scopeGroup); GroupLocalServiceUtil.deleteGroup(_group); }
From source file:com.liferay.bookmarks.internal.exportimport.data.handler.test.BookmarksPortletDataHandlerTest.java
License:Open Source License
@Test public void testDeleteAllFolders() throws Exception { Group group = GroupTestUtil.addGroup(); BookmarksFolder parentFolder = BookmarksTestUtil.addFolder(group.getGroupId(), "parent"); BookmarksFolder childFolder = BookmarksTestUtil.addFolder(group.getGroupId(), parentFolder.getFolderId(), "child"); BookmarksFolderServiceUtil.moveFolderToTrash(childFolder.getPrimaryKey()); BookmarksFolderServiceUtil.moveFolderToTrash(parentFolder.getPrimaryKey()); BookmarksFolderServiceUtil.deleteFolder(parentFolder.getFolderId()); GroupLocalServiceUtil.deleteGroup(group); List<BookmarksFolder> folders = BookmarksFolderLocalServiceUtil.getFolders(group.getGroupId()); Assert.assertEquals(folders.toString(), 0, folders.size()); }
From source file:com.liferay.bookmarks.lar.test.BookmarksPortletDataHandlerTest.java
License:Open Source License
@Test public void testDeleteAllFolders() throws Exception { Group group = GroupTestUtil.addGroup(); BookmarksFolder parentFolder = BookmarksTestUtil.addFolder(group.getGroupId(), "parent"); BookmarksFolder childFolder = BookmarksTestUtil.addFolder(group.getGroupId(), parentFolder.getFolderId(), "child"); BookmarksFolderServiceUtil.moveFolderToTrash(childFolder.getPrimaryKey()); BookmarksFolderServiceUtil.moveFolderToTrash(parentFolder.getPrimaryKey()); BookmarksFolderServiceUtil.deleteFolder(parentFolder.getFolderId()); GroupLocalServiceUtil.deleteGroup(group); List<BookmarksFolder> folders = BookmarksFolderLocalServiceUtil.getFolders(group.getGroupId()); Assert.assertEquals(0, folders.size()); }
From source file:com.liferay.calendar.service.test.CalendarServiceTest.java
License:Open Source License
@Sync @Test/*from w w w . ja va 2 s . c om*/ public void testIsManageableFromGroup() throws Exception { Group liveGroup = GroupTestUtil.addGroup(); GroupTestUtil.enableLocalStaging(liveGroup); Group notStagedGroup = GroupTestUtil.addGroup(); Group stagingGroup = liveGroup.getStagingGroup(); User adminUser = UserTestUtil.addOmniAdminUser(); try (ContextUserReplace contextUserReplacer = new ContextUserReplace(adminUser)) { Calendar notStagedCalendar = getGroupCalendar(notStagedGroup); Assert.assertTrue(CalendarServiceUtil.isManageableFromGroup(notStagedCalendar.getCalendarId(), notStagedGroup.getGroupId())); Assert.assertTrue(CalendarServiceUtil.isManageableFromGroup(notStagedCalendar.getCalendarId(), liveGroup.getGroupId())); Assert.assertTrue(CalendarServiceUtil.isManageableFromGroup(notStagedCalendar.getCalendarId(), stagingGroup.getGroupId())); Calendar liveCalendar = getGroupCalendar(liveGroup); Assert.assertFalse(CalendarServiceUtil.isManageableFromGroup(liveCalendar.getCalendarId(), notStagedGroup.getGroupId())); Assert.assertFalse(CalendarServiceUtil.isManageableFromGroup(liveCalendar.getCalendarId(), liveGroup.getGroupId())); Assert.assertFalse(CalendarServiceUtil.isManageableFromGroup(liveCalendar.getCalendarId(), stagingGroup.getGroupId())); Calendar stagingCalendar = getGroupCalendar(stagingGroup); Assert.assertFalse(CalendarServiceUtil.isManageableFromGroup(stagingCalendar.getCalendarId(), notStagedGroup.getGroupId())); Assert.assertFalse(CalendarServiceUtil.isManageableFromGroup(stagingCalendar.getCalendarId(), liveGroup.getGroupId())); Assert.assertTrue(CalendarServiceUtil.isManageableFromGroup(stagingCalendar.getCalendarId(), stagingGroup.getGroupId())); } finally { GroupLocalServiceUtil.deleteGroup(liveGroup); GroupLocalServiceUtil.deleteGroup(notStagedGroup); UserLocalServiceUtil.deleteUser(adminUser); } }
From source file:com.liferay.document.library.search.test.DLFileEntryIndexerLocalizedContentTest.java
License:Open Source License
@Test public void testSiteLocale() throws Exception { Group testGroup = GroupTestUtil.addGroup(); List<String> japaneseContentStrings = new ArrayList<>(Collections.singletonList("content_ja_JP")); List<String> englishContentStrings = new ArrayList<>(Collections.singletonList("content_en_US")); try {/*from ww w. j a va2s . c o m*/ GroupTestUtil.updateDisplaySettings(_group.getGroupId(), null, LocaleUtil.JAPAN); GroupTestUtil.updateDisplaySettings(testGroup.getGroupId(), null, LocaleUtil.US); addFileEntry("locale_ja.txt", _group.getGroupId()); addFileEntry("locale_en.txt", testGroup.getGroupId()); Document japenseDocument = _search("?", LocaleUtil.JAPAN, _group.getGroupId()); assertLocalization(japaneseContentStrings, japenseDocument); Document englishDocument = _search("Locale Test", LocaleUtil.ENGLISH, testGroup.getGroupId()); assertLocalization(englishContentStrings, englishDocument); } finally { GroupLocalServiceUtil.deleteGroup(testGroup); } }
From source file:com.liferay.document.library.service.test.DLFileEntryLocalServiceTest.java
License:Open Source License
@Test(expected = NoSuchFolderException.class) public void testMoveFileEntryToInvalidDLFolder() throws Exception { DLFolder originDLFolder = DLTestUtil.addDLFolder(_group.getGroupId()); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId()); DLFileEntry dlFileEntry = DLFileEntryLocalServiceUtil.addFileEntry(TestPropsValues.getUserId(), originDLFolder.getGroupId(), originDLFolder.getRepositoryId(), originDLFolder.getFolderId(), StringUtil.randomString(), ContentTypes.TEXT_PLAIN, StringUtil.randomString(), StringPool.BLANK, StringPool.BLANK, DLFileEntryTypeConstants.FILE_ENTRY_TYPE_ID_BASIC_DOCUMENT, new HashMap<String, DDMFormValues>(), null, new ByteArrayInputStream(new byte[0]), 0, serviceContext);//from ww w . java2 s. c om Group destinationGroup = GroupTestUtil.addGroup(); DLFolder destinationDLFolder = DLTestUtil.addDLFolder(destinationGroup.getGroupId()); try { DLFileEntryLocalServiceUtil.moveFileEntry(TestPropsValues.getUserId(), dlFileEntry.getFileEntryId(), destinationDLFolder.getFolderId(), serviceContext); } finally { GroupLocalServiceUtil.deleteGroup(destinationGroup); } }
From source file:com.liferay.document.library.web.exportimport.data.handler.test.DLPortletDataHandlerTest.java
License:Open Source License
@Test public void testDeleteAllFolders() throws Exception { Group group = GroupTestUtil.addGroup(); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(group.getGroupId(), TestPropsValues.getUserId()); Folder parentFolder = DLAppServiceUtil.addFolder(group.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, "parent", RandomTestUtil.randomString(), serviceContext);//from w ww .ja va 2 s . c o m Folder childFolder = DLAppServiceUtil.addFolder(group.getGroupId(), parentFolder.getFolderId(), "child", RandomTestUtil.randomString(), serviceContext); DLTrashServiceUtil.moveFolderToTrash(childFolder.getFolderId()); DLTrashServiceUtil.moveFolderToTrash(parentFolder.getFolderId()); DLAppServiceUtil.deleteFolder(parentFolder.getFolderId()); GroupLocalServiceUtil.deleteGroup(group); int foldersCount = DLFolderLocalServiceUtil.getFoldersCount(group.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID); Assert.assertEquals(0, foldersCount); }