List of usage examples for com.liferay.portal.kernel.comment CommentManagerUtil getCommentsCount
public static int getCommentsCount(String className, long classPK)
From source file:com.liferay.blogs.service.impl.test.BlogsEntryLocalServiceImplTest.java
License:Open Source License
@Test public void testAddDiscussion() throws Exception { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(); BlogsEntry blogsEntry = BlogsEntryLocalServiceUtil.addEntry(TestPropsValues.getUserId(), StringUtil.randomString(), StringUtil.randomString(), new Date(), serviceContext); _blogsEntries.add(blogsEntry);/*from w ww. j ava 2 s . com*/ long initialCommentsCount = CommentManagerUtil.getCommentsCount(BlogsEntry.class.getName(), blogsEntry.getEntryId()); CommentManagerUtil.addComment(TestPropsValues.getUserId(), TestPropsValues.getGroupId(), BlogsEntry.class.getName(), blogsEntry.getEntryId(), StringUtil.randomString(), new IdentityServiceContextFunction(serviceContext)); Assert.assertEquals(initialCommentsCount + 1, CommentManagerUtil.getCommentsCount(BlogsEntry.class.getName(), blogsEntry.getEntryId())); }
From source file:com.liferay.blogs.trackback.test.TrackbackImplTest.java
License:Open Source License
@Test public void testAddTrackback() throws Exception { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(); _blogsEntry = BlogsEntryLocalServiceUtil.addEntry(TestPropsValues.getUserId(), StringUtil.randomString(), StringUtil.randomString(), new Date(), serviceContext); IdentityServiceContextFunction serviceContextFunction = new IdentityServiceContextFunction(serviceContext); CommentManagerUtil.addComment(TestPropsValues.getUserId(), TestPropsValues.getGroupId(), BlogsEntry.class.getName(), _blogsEntry.getEntryId(), StringUtil.randomString(), serviceContextFunction);/*from w w w . ja va 2 s . c om*/ int initialCommentsCount = CommentManagerUtil.getCommentsCount(BlogsEntry.class.getName(), _blogsEntry.getEntryId()); Trackback trackback = new TrackbackImpl(); ThemeDisplay themeDisplay = new ThemeDisplay(); Company company = CompanyLocalServiceUtil.getCompany(TestPropsValues.getCompanyId()); themeDisplay.setCompany(company); trackback.addTrackback(_blogsEntry, themeDisplay, StringUtil.randomString(), StringUtil.randomString(), StringUtil.randomString(), StringUtil.randomString(), serviceContextFunction); Assert.assertEquals(initialCommentsCount + 1, CommentManagerUtil.getCommentsCount(BlogsEntry.class.getName(), _blogsEntry.getEntryId())); LinkbackConsumerUtil.verifyNewTrackbacks(); }
From source file:com.liferay.blogs.util.BlogsUtil.java
License:Open Source License
public static int getCommentsCount(BlogsEntry entry) { return CommentManagerUtil.getCommentsCount(BlogsEntry.class.getName(), entry.getEntryId()); }