Example usage for com.liferay.portal.kernel.messaging DestinationNames DOCUMENT_LIBRARY_IMAGE_PROCESSOR

List of usage examples for com.liferay.portal.kernel.messaging DestinationNames DOCUMENT_LIBRARY_IMAGE_PROCESSOR

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.messaging DestinationNames DOCUMENT_LIBRARY_IMAGE_PROCESSOR.

Prototype

String DOCUMENT_LIBRARY_IMAGE_PROCESSOR

To view the source code for com.liferay.portal.kernel.messaging DestinationNames DOCUMENT_LIBRARY_IMAGE_PROCESSOR.

Click Source Link

Usage

From source file:com.liferay.adaptive.media.document.library.thumbnails.internal.commands.test.AdaptiveMediaThumbnailsOSGiCommandsTest.java

License:Open Source License

@Test
public void testCleanUpDeletesImageThumbnails() throws Exception {
    try (DestinationReplacer destinationReplacer = new DestinationReplacer(
            DestinationNames.DOCUMENT_LIBRARY_IMAGE_PROCESSOR, _ADAPTIVE_MEDIA_PROCESSOR)) {

        int count = _getThumbnailCount();

        _addPNGFileEntry();/*from w  w w . ja va2  s. com*/

        Assert.assertEquals(count + 1, _getThumbnailCount());

        _cleanUp();

        Assert.assertEquals(count, _getThumbnailCount());
    }
}

From source file:com.liferay.adaptive.media.document.library.thumbnails.internal.commands.test.AdaptiveMediaThumbnailsOSGiCommandsTest.java

License:Open Source License

@Test
public void testCleanUpDeletesOnlyImageThumbnails() throws Exception {
    try (DestinationReplacer destinationReplacer = new DestinationReplacer(
            DestinationNames.DOCUMENT_LIBRARY_IMAGE_PROCESSOR, _ADAPTIVE_MEDIA_PROCESSOR)) {

        int count = _getThumbnailCount();

        _addPDFFileEntry();//w  w w  . ja va2 s  .  c om
        _addPNGFileEntry();

        Assert.assertEquals(count + 2, _getThumbnailCount());

        _cleanUp();

        Assert.assertEquals(count + 1, _getThumbnailCount());
    }
}

From source file:com.liferay.adaptive.media.document.library.thumbnails.internal.commands.test.AdaptiveMediaThumbnailsOSGiCommandsTest.java

License:Open Source License

@Test
public void testMigrateDoesNotRemoveThumbnails() throws Exception {
    try (DestinationReplacer destinationReplacer = new DestinationReplacer(
            DestinationNames.DOCUMENT_LIBRARY_IMAGE_PROCESSOR, _ADAPTIVE_MEDIA_PROCESSOR)) {

        int count = _getThumbnailCount();

        _addPDFFileEntry();//from   ww w  .j  a  va 2 s . c  om
        _addPNGFileEntry();

        Assert.assertEquals(count + 2, _getThumbnailCount());

        _migrate();

        Assert.assertEquals(count + 2, _getThumbnailCount());
    }
}

From source file:com.liferay.adaptive.media.document.library.thumbnails.internal.commands.test.AdaptiveMediaThumbnailsOSGiCommandsTest.java

License:Open Source License

@Test
public void testMigrateOnlyProcessesImages() throws Exception {
    try (DestinationReplacer destinationReplacer = new DestinationReplacer(
            DestinationNames.DOCUMENT_LIBRARY_IMAGE_PROCESSOR, _ADAPTIVE_MEDIA_PROCESSOR);
            PropsValuesReplacer propsValuesReplacer1 = new PropsValuesReplacer(
                    "DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_HEIGHT", 100);
            PropsValuesReplacer propsValuesReplacer2 = new PropsValuesReplacer(
                    "DL_FILE_ENTRY_THUMBNAIL_CUSTOM_1_MAX_WIDTH", 100)) {

        FileEntry pdfFileEntry = _addPDFFileEntry();
        FileEntry pngFileEntry = _addPNGFileEntry();

        _migrate();/*from w  ww.  j  av  a 2  s  . c  om*/

        Assert.assertEquals(0, _getAdaptiveMediaCount(pdfFileEntry));
        Assert.assertEquals(2, _getAdaptiveMediaCount(pngFileEntry));
    }
}

From source file:com.liferay.adaptive.media.document.library.thumbnails.internal.commands.test.AdaptiveMediaThumbnailsOSGiCommandsTest.java

License:Open Source License

@Test(expected = InvocationTargetException.class)
public void testMigrateThrowsExceptionWhenNoValidConfiguration() throws Exception {

    try (DestinationReplacer destinationReplacer = new DestinationReplacer(
            DestinationNames.DOCUMENT_LIBRARY_IMAGE_PROCESSOR, _ADAPTIVE_MEDIA_PROCESSOR);
            PropsValuesReplacer propsValuesReplacer1 = new PropsValuesReplacer(
                    "DL_FILE_ENTRY_THUMBNAIL_MAX_HEIGHT", 999);
            PropsValuesReplacer propsValuesReplacer2 = new PropsValuesReplacer(
                    "DL_FILE_ENTRY_THUMBNAIL_MAX_HEIGHT", 999)) {

        _addPNGFileEntry();//  w w w. j  ava2s  .  c  o  m

        _migrate();
    }
}

From source file:com.liferay.portlet.documentlibrary.util.ImageProcessorImpl.java

License:Open Source License

private void _queueGeneration(FileVersion fileVersion) {
    if (!_fileVersionIds.contains(fileVersion.getFileVersionId()) && isSupported(fileVersion)
            && !_hasImages(fileVersion)) {
        _fileVersionIds.add(fileVersion.getFileVersionId());

        if (PropsValues.DL_FILE_ENTRY_PROCESSORS_TRIGGER_SYNCHRONOUSLY) {
            try {
                MessageBusUtil.sendSynchronousMessage(DestinationNames.DOCUMENT_LIBRARY_IMAGE_PROCESSOR,
                        fileVersion);//from   w w  w.  j  a  va 2  s  . co  m
            } catch (MessageBusException mbe) {
                if (_log.isWarnEnabled()) {
                    _log.warn(mbe, mbe);
                }
            }
        } else {
            MessageBusUtil.sendMessage(DestinationNames.DOCUMENT_LIBRARY_IMAGE_PROCESSOR, fileVersion);
        }
    }
}