Example usage for com.liferay.portal.kernel.util DigesterUtil digestBase64

List of usage examples for com.liferay.portal.kernel.util DigesterUtil digestBase64

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util DigesterUtil digestBase64.

Prototype

public static String digestBase64(String text) 

Source Link

Usage

From source file:com.liferay.blogs.attachments.test.BlogsEntryAttachmentFileEntryHelperTest.java

License:Open Source License

@Test
public void testAddBlogsEntryAttachmentFileEntries() throws Exception {
    FileEntry tempFileEntry = TempFileEntryUtil.addTempFileEntry(_group.getGroupId(), _user.getUserId(),
            _TEMP_FOLDER_NAME, "image.jpg", getInputStream(), ContentTypes.IMAGE_JPEG);

    List<BlogsEntryAttachmentFileEntryReference> blogsEntryAttachmentFileEntryReferences = getBlogsEntryAttachmentFileEntryReferences(
            tempFileEntry);//from  w w  w  .  ja  v a  2s . com

    Assert.assertEquals(1, blogsEntryAttachmentFileEntryReferences.size());

    BlogsEntryAttachmentFileEntryReference blogsEntryAttachmentFileEntryReference = blogsEntryAttachmentFileEntryReferences
            .get(0);

    Assert.assertEquals(tempFileEntry.getFileEntryId(),
            blogsEntryAttachmentFileEntryReference.getTempBlogsEntryAttachmentFileEntryId());

    FileEntry fileEntry = blogsEntryAttachmentFileEntryReference.getBlogsEntryAttachmentFileEntry();

    Assert.assertEquals(tempFileEntry.getTitle(), fileEntry.getTitle());
    Assert.assertEquals(tempFileEntry.getMimeType(), fileEntry.getMimeType());
    Assert.assertEquals(DigesterUtil.digestBase64(tempFileEntry.getContentStream()),
            DigesterUtil.digestBase64(fileEntry.getContentStream()));
}