Example usage for com.liferay.portal.kernel.comment CommentManagerUtil hasDiscussion

List of usage examples for com.liferay.portal.kernel.comment CommentManagerUtil hasDiscussion

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.comment CommentManagerUtil hasDiscussion.

Prototype

public static boolean hasDiscussion(String className, long classPK) throws PortalException 

Source Link

Usage

From source file:com.liferay.blogs.service.impl.test.BlogsEntryLocalServiceImplTest.java

License:Open Source License

@Test
public void testDeleteDiscussion() throws Exception {
    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext();

    BlogsEntry blogsEntry = BlogsEntryLocalServiceUtil.addEntry(TestPropsValues.getUserId(),
            StringUtil.randomString(), StringUtil.randomString(), new Date(), serviceContext);

    _blogsEntries.add(blogsEntry);/*from ww  w  . j a v a  2 s .  c o m*/

    CommentManagerUtil.addComment(TestPropsValues.getUserId(), TestPropsValues.getGroupId(),
            BlogsEntry.class.getName(), blogsEntry.getEntryId(), StringUtil.randomString(),
            new IdentityServiceContextFunction(serviceContext));

    Assert.assertTrue(CommentManagerUtil.hasDiscussion(BlogsEntry.class.getName(), blogsEntry.getEntryId()));

    CommentManagerUtil.deleteDiscussion(BlogsEntry.class.getName(), blogsEntry.getEntryId());

    Assert.assertFalse(CommentManagerUtil.hasDiscussion(BlogsEntry.class.getName(), blogsEntry.getEntryId()));
}