@Test public void testSearchAndDeleteFolderAndSearch() throws Exception { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId()); BookmarksFolder folder = BookmarksTestUtil.addFolder(_group.getGroupId(), RandomTestUtil.randomString()); BookmarksEntry entry = BookmarksTestUtil.addEntry(folder.getFolderId(), true, serviceContext); long companyId = entry.getCompanyId(); long groupId = entry.getFolder().getGroupId(); long folderId = entry.getFolderId(); String keywords = "test"; SearchContext searchContext = BookmarksTestUtil.getSearchContext(companyId, groupId, folderId, keywords); Indexer indexer = IndexerRegistryUtil.getIndexer(BookmarksEntry.class); Hits hits = indexer.search(searchContext); Assert.assertEquals(1, hits.getLength()); BookmarksFolderLocalServiceUtil.deleteFolder(folderId); hits = indexer.search(searchContext); Query query = hits.getQuery(); Assert.assertEquals(query.toString(), 0, hits.getLength()); }
@Override protected void addSubscriptionContainerModel(long containerModelId) throws Exception { BookmarksFolderLocalServiceUtil.subscribeFolder( TestPropsValues.getUserId(), group.getGroupId(), containerModelId); }