From 942e080e90d83e7853ad64f88bc9cd4ab6508699 Mon Sep 17 00:00:00 2001 From: michael-conway Date: Thu, 17 Dec 2015 07:44:00 -0500 Subject: [PATCH] #165 remove old, useless thumbnail code --- ...SThumbnailProcessUnavailableException.java | 70 --- .../datautils/image/ImageServiceFactory.java | 26 -- .../image/ImageServiceFactoryImpl.java | 43 -- .../datautils/image/MediaHandlingUtils.java | 150 ------- .../datautils/image/ThumbnailService.java | 91 ---- .../datautils/image/ThumbnailServiceImpl.java | 284 ------------- .../jargon/datautils/image/package-info.java | 5 - .../image/ImageServiceFactoryImplTest.java | 49 --- .../image/MediaHandlingUtilsTest.java | 102 ----- .../image/ThumbnailServiceImplTest.java | 401 ------------------ .../jargon/datautils/unittest/AllTests.java | 6 +- pom.xml | 13 - 12 files changed, 1 insertion(+), 1239 deletions(-) delete mode 100644 jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/IRODSThumbnailProcessUnavailableException.java delete mode 100644 jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ImageServiceFactory.java delete mode 100644 jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ImageServiceFactoryImpl.java delete mode 100644 jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/MediaHandlingUtils.java delete mode 100644 jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ThumbnailService.java delete mode 100644 jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ThumbnailServiceImpl.java delete mode 100644 jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/package-info.java delete mode 100644 jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/ImageServiceFactoryImplTest.java delete mode 100644 jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/MediaHandlingUtilsTest.java delete mode 100644 jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/ThumbnailServiceImplTest.java diff --git a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/IRODSThumbnailProcessUnavailableException.java b/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/IRODSThumbnailProcessUnavailableException.java deleted file mode 100644 index ce4e2b8ac..000000000 --- a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/IRODSThumbnailProcessUnavailableException.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.irods.jargon.datautils.image; - -import org.irods.jargon.core.exception.JargonException; - -/** - * Indicates that rule-driven thumbnail services are not available on the given - * iRODS server. - * - * @author Mike Conway - DICE (www.irods.org) - * - */ -public class IRODSThumbnailProcessUnavailableException extends JargonException { - - /** - * - */ - private static final long serialVersionUID = 6228909626014709002L; - - /** - * @param message - */ - public IRODSThumbnailProcessUnavailableException(final String message) { - super(message); - } - - /** - * @param message - * @param cause - */ - public IRODSThumbnailProcessUnavailableException(final String message, - final Throwable cause) { - super(message, cause); - } - - /** - * @param cause - */ - public IRODSThumbnailProcessUnavailableException(final Throwable cause) { - super(cause); - } - - /** - * @param message - * @param cause - * @param underlyingIRODSExceptionCode - */ - public IRODSThumbnailProcessUnavailableException(final String message, - final Throwable cause, final int underlyingIRODSExceptionCode) { - super(message, cause, underlyingIRODSExceptionCode); - } - - /** - * @param cause - * @param underlyingIRODSExceptionCode - */ - public IRODSThumbnailProcessUnavailableException(final Throwable cause, - final int underlyingIRODSExceptionCode) { - super(cause, underlyingIRODSExceptionCode); - } - - /** - * @param message - * @param underlyingIRODSExceptionCode - */ - public IRODSThumbnailProcessUnavailableException(final String message, - final int underlyingIRODSExceptionCode) { - super(message, underlyingIRODSExceptionCode); - } - -} diff --git a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ImageServiceFactory.java b/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ImageServiceFactory.java deleted file mode 100644 index e05ae8cee..000000000 --- a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ImageServiceFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.irods.jargon.datautils.image; - -import org.irods.jargon.core.connection.IRODSAccount; - -/** - * Factory for various services that support image processing for iRODS - * applications - * - * @author Mike Conway - DICE (www.irods.org) - * - */ -public interface ImageServiceFactory { - - /** - * Retrieve an instance of ImageServiceFactory that supports - * image processing for iRODS - * - * @param irodsAccount - * IRODSAccount describing the user and desired - * iRODS host - * @return {@link ImageServiceFactory} implementation - */ - public abstract ThumbnailService instanceThumbnailService( - final IRODSAccount irodsAccount); - -} \ No newline at end of file diff --git a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ImageServiceFactoryImpl.java b/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ImageServiceFactoryImpl.java deleted file mode 100644 index 982484a67..000000000 --- a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ImageServiceFactoryImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.irods.jargon.datautils.image; - -import org.irods.jargon.core.connection.IRODSAccount; -import org.irods.jargon.core.pub.IRODSAccessObjectFactory; - -/** - * Factory for different image service classes - * - * @author Mike Conway - DICE (www.irods.org) - * - */ -public class ImageServiceFactoryImpl implements ImageServiceFactory { - - private final IRODSAccessObjectFactory irodsAccessObjectFactory; - - public ImageServiceFactoryImpl( - final IRODSAccessObjectFactory irodsAccessObjectFactory) { - if (irodsAccessObjectFactory == null) { - throw new IllegalArgumentException( - "irodsAccessObjectFactory is null"); - } - - this.irodsAccessObjectFactory = irodsAccessObjectFactory; - - } - - /* - * (non-Javadoc) - * - * @see - * org.irods.jargon.datautils.image.ImageServiceFactory#instanceThumbnailService - * (org.irods.jargon.core.connection.IRODSAccount) - */ - @Override - public ThumbnailService instanceThumbnailService( - final IRODSAccount irodsAccount) { - if (irodsAccount == null) { - throw new IllegalArgumentException("null irodsAccount"); - } - return new ThumbnailServiceImpl(irodsAccessObjectFactory, irodsAccount); - } - -} diff --git a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/MediaHandlingUtils.java b/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/MediaHandlingUtils.java deleted file mode 100644 index 9a2768aec..000000000 --- a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/MediaHandlingUtils.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.irods.jargon.datautils.image; - -import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry; -import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry.ObjectType; -import org.irods.jargon.core.utils.LocalFileUtils; - -/** - * General utilities for dealing with media files. - * - * @author Mike Conway - DICE (www.irods.org) - * - */ -public class MediaHandlingUtils { - - public static final String[] QUICKTIME_MEDIA = { ".aif", ".aiff", ".aac", - ".au", ".gsm", ".mov", ".mid", ".midi", ".mpg", ".mpeg", ".mp4", - ".m4a", ".psd", ".qt", ".qtif", ".qif", ".qti", ".snd", ".tif", - ".tiff", ".wav", ".3g2", ".3pg" }; - public static final String[] FLASH_MEDIA = { ".flv", ".mp3", ".swf" }; - public static final String[] WINDOWS_MEDIA = { ".asx", ".asf", ".avi", - ".wma", ".wmv" }; - public static final String[] IFRAME_CONTENT = { ".html", ".pdf" }; - - /** - * Right now no public constructor - */ - private MediaHandlingUtils() { - } - - /** - * Is the given CollectionAndDataObjectListingEntry an image. - * - * @param collectionAndDataObjectListingEntry - * {@link CollectionAndDataObjectListingEntry} - * @return boolean if the given object is an image. - */ - public static boolean isImageFile( - final CollectionAndDataObjectListingEntry collectionAndDataObjectListingEntry) { - boolean isImage = false; - if (collectionAndDataObjectListingEntry != null) { - if (collectionAndDataObjectListingEntry.getObjectType() == ObjectType.DATA_OBJECT) { - isImage = isImageFile(collectionAndDataObjectListingEntry - .getFormattedAbsolutePath()); - } - } - return isImage; - } - - /** - * Is the given CollectionAndDataObjectListingEntry an image. - * - * @param absolutePath - * String assumed to be a data object absolute path - * - * @return boolean if the given object is an image. - */ - public static boolean isImageFile(final String absolutePath) { - boolean isImage = false; - - String extension = LocalFileUtils.getFileExtension(absolutePath) - .toUpperCase(); - - if (extension.equals(".JPG") || extension.equals(".GIF") - || extension.equals(".JPEG") || extension.equals(".PNG") - || extension.equals(".TIFF") || extension.equals(".TIF")) { - - isImage = true; - } - - return isImage; - } - - /** - * Inspects the file extension and determines if the file is one that has an - * associated media player. This version returns a simple - * boolean value so that image brower applications know that a - * media player applies. - * - * @param collectionAndDataObjectListingEntry - * {@link CollectionAndDataObjectListingEntry} - * @return boolean if the given object is an object that should - * utilize a media player. - */ - public static boolean isMediaFile( - final CollectionAndDataObjectListingEntry collectionAndDataObjectListingEntry) { - - boolean isMedia = false; - if (collectionAndDataObjectListingEntry != null) { - if (collectionAndDataObjectListingEntry.getObjectType() == ObjectType.DATA_OBJECT) { - isMedia = isMediaFile(collectionAndDataObjectListingEntry - .getPathOrName()); - } - } - return isMedia; - } - - /** - * Inspects the file extension and determines if the file is one that has an - * associated media player. This version returns a simple - * boolean value so that image brower applications know that a - * media player applies. - * - * @param absolutePath - * String that is assumed to be a data object - * absolute path {@link CollectionAndDataObjectListingEntry} - * @return boolean if the given object is an object that should - * utilize a media player. - */ - public static boolean isMediaFile(final String absolutePath) { - - boolean isMedia = false; - - // is a data object, classify by extension - - String extension = LocalFileUtils.getFileExtension(absolutePath - .toLowerCase()); - - for (String type : QUICKTIME_MEDIA) { - if (extension.equals(type)) { - isMedia = true; - break; - } - } - - if (!isMedia) { - for (String type : FLASH_MEDIA) { - if (extension.equals(type)) { - isMedia = true; - break; - } - } - } - - if (!isMedia) { - for (String type : WINDOWS_MEDIA) { - if (extension.equals(type)) { - isMedia = true; - break; - } - } - } - /* - * temp comment out for pdf media if (!isMedia) { for (String type : - * IFRAME_CONTENT) { if (extension.equals(type)) { isMedia = true; - * break; } } } - */ - - return isMedia; - } -} diff --git a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ThumbnailService.java b/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ThumbnailService.java deleted file mode 100644 index c91eafaf7..000000000 --- a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ThumbnailService.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.irods.jargon.datautils.image; - -import java.io.File; -import java.io.InputStream; - -import org.irods.jargon.core.exception.JargonException; - -/** - * Manage the creation and maintenance of thumbnail images for image files - * stored in iRODS. - * - * Note that local processing of tiff files requires JAI - see - * http://java.net/projects/jai-core/ and see - * http://java.sun.com/products/java-media/jai/downloads/download-1_1_2.html for - * download The JAI libraries may need to be installed on the client or mid-tier - * machine - * - * @author Mike Conway - DICE (www.irods.org) - * - */ -public interface ThumbnailService { - - public static final String THUMBNAIL_RULE_DATA_PARAMETER = "*StdoutStr"; - - /** - * Given a File that represents a local working directory, ask - * iRODS to generate a thumbnail image for the iRODS data object at the - * given absolute path. This temporary thumbnail file is then returned to - * the caller. - *

- * This method will call an image processing routine on the iRODS server, - * and the thumbnail data will be streamed back to this method. The - * resulting thumbnail is stored underneath the temporary thumbnail - * directory based on an internal scheme. The File that is - * returned from this method points to this thumbnail image. - * - * @param workingDirectory - * File with the path to the top level of a working - * directory to hold the thumbnail image. - * @param irodsAbsolutePathToGenerateThumbnailFor - * String that is the absolute path to the iRODS - * file for which a thumbnail will be generated. - * @return File that points to the thumbnail image. - * @throws IRODSThumbnailProcessUnavailableException - * if thumbnail processing is not set up on iRODS (imagemagik - * services) - * @throws JargonException - */ - File generateThumbnailForIRODSPathViaRule(final File workingDirectory, - final String irodsAbsolutePathToGenerateThumbnailFor) - throws IRODSThumbnailProcessUnavailableException, JargonException; - - /** - * Given an iRODS absolute path to a data object, retrieve an - * InputStream which is a thumbnail of the given file at the - * iRODS path. - *

- * Currently, this is done by generating the thumbnail when requested, - * later, this can include a caching scheme, and alternative cache locations - * (local verus in iRODS AVU, etc). Consider this a first approximation. - * - * @param irodsAbsolutePathToGenerateThumbnailFor - * String that is the absolute path to the iRODS - * file for which a thumbnail will be generated. - * @return InputStream that is the thumbnail image data. No - * buffering is done to the stream that is returned. - * @throws JargonException - */ - InputStream retrieveThumbnailByIRODSAbsolutePathViaRule( - - final String irodsAbsolutePathToGenerateThumbnailFor) - throws JargonException; - - /** - * Do a check to see whether the thumbnail service is available on the iRODS - * server. If it is not available, the mid-tier fallback can be used - * createThumbnailLocally(). - *

- * Note that it is not efficient to call this method repeatedly, rather, a - * client service should call once for an iRODS server and cache the result. - * - * @return true if the iRODS server has support for imagemagik - * thumbnail generation. If the hueristic cannot determine, it will - * return false. The current heuristic is to use the listCommands.sh - * script, which must be added to the /server/bin/cmd directory, - * along with the makeThumbnail.py script. - * @throws JargonException - */ - boolean isIRODSThumbnailGeneratorAvailable() throws JargonException; - -} \ No newline at end of file diff --git a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ThumbnailServiceImpl.java b/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ThumbnailServiceImpl.java deleted file mode 100644 index 58eb9d705..000000000 --- a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/ThumbnailServiceImpl.java +++ /dev/null @@ -1,284 +0,0 @@ -package org.irods.jargon.datautils.image; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; - -import org.irods.jargon.core.connection.IRODSAccount; -import org.irods.jargon.core.exception.DataNotFoundException; -import org.irods.jargon.core.exception.JargonException; -import org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO; -import org.irods.jargon.core.pub.EnvironmentalInfoAO; -import org.irods.jargon.core.pub.IRODSAccessObjectFactory; -import org.irods.jargon.core.pub.RuleProcessingAO; -import org.irods.jargon.core.pub.domain.ObjStat; -import org.irods.jargon.core.pub.domain.ObjStat.SpecColType; -import org.irods.jargon.core.pub.domain.RemoteCommandInformation; -import org.irods.jargon.core.rule.IRODSRuleExecResult; -import org.irods.jargon.core.utils.Base64; -import org.irods.jargon.datautils.AbstractDataUtilsServiceImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Manage the creation and maintenance of thumb-nail images for image files - * stored in iRODS. - * - * @author Mike Conway - DICE (www.irods.org) - * - */ -public class ThumbnailServiceImpl extends AbstractDataUtilsServiceImpl - implements ThumbnailService { - - public static final Logger log = LoggerFactory - .getLogger(ThumbnailServiceImpl.class); - - /** - * Constructor with required dependencies - * - * @param irodsAccessObjectFactory - * {@link IRODSAccessObjectFactory} that can create necessary - * objects - * @param irodsAccount - * {@link IRODSAccount} that contains the login information - */ - public ThumbnailServiceImpl( - final IRODSAccessObjectFactory irodsAccessObjectFactory, - final IRODSAccount irodsAccount) { - super(irodsAccessObjectFactory, irodsAccount); - } - - /** - * Default (no-values) constructor. - */ - public ThumbnailServiceImpl() { - super(); - } - - /* - * (non-Javadoc) - * - * @see org.irods.jargon.datautils.image.ThumbnailService# - * isIRODSThumbnailGeneratorAvailable() - */ - @Override - public boolean isIRODSThumbnailGeneratorAvailable() throws JargonException { - log.info("isIRODSThumbnailGeneratorAvailable()"); - boolean found = false; - EnvironmentalInfoAO environmentalInfoAO = irodsAccessObjectFactory - .getEnvironmentalInfoAO(getIrodsAccount()); - try { - log.info("listing available scripts..."); - List scripts = environmentalInfoAO - .listAvailableRemoteCommands(); - - for (RemoteCommandInformation script : scripts) { - if (script.getCommand().equals("makeThumbnail.py")) { - found = true; - break; - } - } - - return found; - - } catch (DataNotFoundException e) { - log.info("no ability to list commands, assume no thumbnail service"); - return false; - } - - } - - /* - * (non-Javadoc) - * - * @see org.irods.jargon.datautils.image.ThumbnailService# - * generateThumbnailForIRODSPathViaRule(java.io.File, java.lang.String) - */ - @Override - public File generateThumbnailForIRODSPathViaRule( - final File workingDirectory, - final String irodsAbsolutePathToGenerateThumbnailFor) - throws IRODSThumbnailProcessUnavailableException, JargonException { - - log.info("generateThumbnailForIRODSPathViaRule()"); - - if (workingDirectory == null) { - throw new IllegalArgumentException("null workingDirectory"); - } - - if (irodsAbsolutePathToGenerateThumbnailFor == null - || irodsAbsolutePathToGenerateThumbnailFor.isEmpty()) { - throw new IllegalArgumentException( - "nul irodsAbsolutePathToGenerateThumbnailFor"); - } - - CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = getIrodsAccessObjectFactory() - .getCollectionAndDataObjectListAndSearchAO(irodsAccount); - ObjStat objStat = collectionAndDataObjectListAndSearchAO - .retrieveObjectStatForPath(irodsAbsolutePathToGenerateThumbnailFor); - - String myPath; - if (objStat.getSpecColType() == SpecColType.LINKED_COLL) { - myPath = objStat.getObjectPath(); - } else { - myPath = irodsAbsolutePathToGenerateThumbnailFor; - } - - File targetTempFile = createWorkingDirectoryImageFile(workingDirectory, - irodsAbsolutePathToGenerateThumbnailFor); - - if (targetTempFile.exists()) { - targetTempFile.delete(); - } - - InputStream is = retrieveThumbnailByIRODSAbsolutePathViaRule(myPath); - try { - OutputStream fos = new BufferedOutputStream(new FileOutputStream( - targetTempFile)); - log.info("have image data, stream to temp file"); - byte[] buffer = new byte[1024]; - int len = is.read(buffer); - while (len != -1) { - fos.write(buffer, 0, len); - len = is.read(buffer); - } - fos.flush(); - fos.close(); - is.close(); - return targetTempFile; - } catch (FileNotFoundException e) { - log.error("file not found exception for temp image output stream", - e); - throw new JargonException( - "no file found when generating temp image output stream", e); - } catch (IOException e) { - log.error("IOException for temp image output stream", e); - throw new JargonException( - "IOException when generating temp image output stream", e); - } - } - - /** - * Create any necessary directories in the working directory to house the - * generated image. - * - * @param workingDirectory - * @param irodsAbsolutePathToGenerateThumbnailFor - * @return - * @throws JargonException - */ - private File createWorkingDirectoryImageFile(final File workingDirectory, - final String irodsAbsolutePathToGenerateThumbnailFor) - throws JargonException { - - log.info("createWorkingDirectoryImageFile(), working directory is:{}", - workingDirectory); - log.info("irodsAbsolutePathToGenerateThumbnailFor:{}", - irodsAbsolutePathToGenerateThumbnailFor); - if (workingDirectory.exists()) { - if (workingDirectory.isDirectory()) { - // OK - } else { - throw new IllegalArgumentException("workingDirectory is a file"); - } - } else { - log.info("mkdirs on working directory"); - workingDirectory.mkdirs(); - } - - File targetTempFile = new File(workingDirectory, - irodsAbsolutePathToGenerateThumbnailFor); - targetTempFile.getParentFile().mkdirs(); - - log.info("thumbnail target temp file:${}", - targetTempFile.getAbsolutePath()); - return targetTempFile; - } - - /* - * (non-Javadoc) - * - * @see org.irods.jargon.datautils.image.ThumbnailService# - * retrieveThumbnailByIRODSAbsolutePathViaRule(java.lang.String) - */ - @Override - public InputStream retrieveThumbnailByIRODSAbsolutePathViaRule( - final String irodsAbsolutePathToGenerateThumbnailFor) - throws JargonException { - - log.info("retrieveThumbnailByIRODSAbsolutePath()"); - - if (irodsAbsolutePathToGenerateThumbnailFor == null - || irodsAbsolutePathToGenerateThumbnailFor.isEmpty()) { - throw new IllegalArgumentException( - "null or empty irodsAbsolutePathToGenerateThumbnailFor"); - } - - log.info("irodsAbsolutePathToGenerateThumbnailFor:{}", - irodsAbsolutePathToGenerateThumbnailFor); - - CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = getIrodsAccessObjectFactory() - .getCollectionAndDataObjectListAndSearchAO(irodsAccount); - ObjStat objStat = collectionAndDataObjectListAndSearchAO - .retrieveObjectStatForPath(irodsAbsolutePathToGenerateThumbnailFor); - log.info("objStat for photo:{}", objStat); - String myPath; - if (objStat.getSpecColType() == SpecColType.LINKED_COLL) { - myPath = objStat.getObjectPath(); - } else { - myPath = irodsAbsolutePathToGenerateThumbnailFor; - } - - log.info("using path:{}", myPath); - - // get Base64 Encoded data from a rule invocation, this represents the - // generated thumbnail - - StringBuilder sb = new StringBuilder(); - sb.append("@external\n makeThumbnailFromObj {\n"); - sb.append("msiSplitPath(*objPath,*collName,*objName);\n"); - sb.append(" msiAddSelectFieldToGenQuery(\"DATA_PATH\", \"null\", *GenQInp);\n"); - sb.append("msiAddSelectFieldToGenQuery(\"RESC_LOC\", \"null\", *GenQInp);\n"); - sb.append(" msiAddConditionToGenQuery(\"COLL_NAME\", \"=\", *collName, *GenQInp);\n"); - sb.append("msiAddConditionToGenQuery(\"DATA_NAME\", \"=\", *objName, *GenQInp);\n"); - sb.append("msiAddConditionToGenQuery(\"DATA_RESC_NAME\",\"=\", *resource, *GenQInp);\n"); - sb.append("msiExecGenQuery(*GenQInp, *GenQOut);\n"); - sb.append("foreach (*GenQOut)\n{\n"); - sb.append(" msiGetValByKey(*GenQOut, \"DATA_PATH\", *data_path);\n"); - sb.append("msiGetValByKey(*GenQOut, \"RESC_LOC\", *resc_loc);\n}\n"); - sb.append("msiExecCmd(\"makeThumbnail.py\", \"'*data_path'\", *resc_loc, \"null\", \"null\", *CmdOut);\n"); - sb.append("msiGetStdoutInExecCmdOut(*CmdOut, *StdoutStr);\n"); - sb.append(" writeLine(\"stdout\", *StdoutStr);\n}\n"); - sb.append("INPUT *objPath=\'"); - sb.append(myPath.trim()); - sb.append("\',*resource=\'"); - sb.append(irodsAccount.getDefaultStorageResource()); - sb.append("'\n"); - sb.append("OUTPUT "); - sb.append(THUMBNAIL_RULE_DATA_PARAMETER); - RuleProcessingAO ruleProcessingAO = getIrodsAccessObjectFactory() - .getRuleProcessingAO(getIrodsAccount()); - IRODSRuleExecResult result = ruleProcessingAO - .executeRule(sb.toString()); - - String execOut; - try { - execOut = (String) result.getOutputParameterResults() - .get(THUMBNAIL_RULE_DATA_PARAMETER).getResultObject(); - } catch (NullPointerException npe) { - throw new IRODSThumbnailProcessUnavailableException( - "no iRODS rule-based thumbnail generation available"); - } - - InputStream is = new java.io.ByteArrayInputStream( - Base64.fromString(execOut)); - return is; - - } - -} diff --git a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/package-info.java b/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/package-info.java deleted file mode 100644 index 1cded7a49..000000000 --- a/jargon-data-utils/src/main/java/org/irods/jargon/datautils/image/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * This utility package provides tools for image manipulation in iRODS. A specific example is the creation of thumbnail images on the server - */ -package org.irods.jargon.datautils.image; - diff --git a/jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/ImageServiceFactoryImplTest.java b/jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/ImageServiceFactoryImplTest.java deleted file mode 100644 index 29a1b07ba..000000000 --- a/jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/ImageServiceFactoryImplTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.irods.jargon.datautils.image; - -import java.util.Properties; - -import junit.framework.Assert; - -import org.irods.jargon.core.pub.IRODSAccessObjectFactory; -import org.irods.jargon.testutils.TestingPropertiesHelper; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; -import org.mockito.Mockito; - -public class ImageServiceFactoryImplTest { - private static Properties testingProperties = new Properties(); - private static TestingPropertiesHelper testingPropertiesHelper = new TestingPropertiesHelper(); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - TestingPropertiesHelper testingPropertiesLoader = new TestingPropertiesHelper(); - testingProperties = testingPropertiesLoader.getTestProperties(); - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testInstanceThumbnailService() { - IRODSAccessObjectFactory irodsAccessObjectFactory = Mockito - .mock(IRODSAccessObjectFactory.class); - ImageServiceFactory factory = new ImageServiceFactoryImpl( - irodsAccessObjectFactory); - ThumbnailService service = factory - .instanceThumbnailService(testingPropertiesHelper - .buildIRODSAccountFromTestProperties(testingProperties)); - Assert.assertNotNull("no service returned", service); - } - - @Test(expected = IllegalArgumentException.class) - public void testInstanceThumbnailServiceNullAccount() { - IRODSAccessObjectFactory irodsAccessObjectFactory = Mockito - .mock(IRODSAccessObjectFactory.class); - ImageServiceFactory factory = new ImageServiceFactoryImpl( - irodsAccessObjectFactory); - factory.instanceThumbnailService(null); - } - -} diff --git a/jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/MediaHandlingUtilsTest.java b/jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/MediaHandlingUtilsTest.java deleted file mode 100644 index c44a2ace6..000000000 --- a/jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/MediaHandlingUtilsTest.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.irods.jargon.datautils.image; - -import junit.framework.Assert; - -import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry; -import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry.ObjectType; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -public class MediaHandlingUtilsTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public final void testIsImageFile() { - CollectionAndDataObjectListingEntry entry = new CollectionAndDataObjectListingEntry(); - entry.setPathOrName("image.jpg"); - entry.setObjectType(ObjectType.DATA_OBJECT); - boolean actual = MediaHandlingUtils.isImageFile(entry); - Assert.assertTrue("did not identify as image", actual); - } - - @Test - public final void testIsImageFileWhenDoc() { - CollectionAndDataObjectListingEntry entry = new CollectionAndDataObjectListingEntry(); - entry.setPathOrName("image.doc"); - entry.setObjectType(ObjectType.DATA_OBJECT); - boolean actual = MediaHandlingUtils.isImageFile(entry); - Assert.assertFalse("should not identify as image", actual); - } - - @Test - public final void testIsImageFileWhenCollection() { - CollectionAndDataObjectListingEntry entry = new CollectionAndDataObjectListingEntry(); - entry.setPathOrName("image.doc"); - entry.setObjectType(ObjectType.COLLECTION); - boolean actual = MediaHandlingUtils.isImageFile(entry); - Assert.assertFalse("should not identify collection as image", actual); - } - - @Test - public final void testIsImageFileWhenNull() { - CollectionAndDataObjectListingEntry entry = null; - boolean actual = MediaHandlingUtils.isImageFile(entry); - Assert.assertFalse("should not identify collection as image", actual); - } - - @Test - public final void testIsMediaFileWhenDoc() { - CollectionAndDataObjectListingEntry entry = new CollectionAndDataObjectListingEntry(); - entry.setPathOrName("image.doc"); - entry.setObjectType(ObjectType.DATA_OBJECT); - boolean actual = MediaHandlingUtils.isMediaFile(entry); - Assert.assertFalse("should not identify as media", actual); - } - - @Test - public final void testIsMediaFileQuicktime() { - CollectionAndDataObjectListingEntry entry = new CollectionAndDataObjectListingEntry(); - entry.setPathOrName("image.mp4"); - entry.setObjectType(ObjectType.DATA_OBJECT); - boolean actual = MediaHandlingUtils.isMediaFile(entry); - Assert.assertTrue("did not identify as media", actual); - } - - @Test - public final void testIsMediaFileFlash() { - CollectionAndDataObjectListingEntry entry = new CollectionAndDataObjectListingEntry(); - entry.setPathOrName("image.mp3"); - entry.setObjectType(ObjectType.DATA_OBJECT); - boolean actual = MediaHandlingUtils.isMediaFile(entry); - Assert.assertTrue("did not identify as media", actual); - } - - @Test - public final void testIsMediaFileWindows() { - CollectionAndDataObjectListingEntry entry = new CollectionAndDataObjectListingEntry(); - entry.setPathOrName("image.avi"); - entry.setObjectType(ObjectType.DATA_OBJECT); - boolean actual = MediaHandlingUtils.isMediaFile(entry); - Assert.assertTrue("did not identify as media", actual); - } - - @Ignore - // pdf processing temp removed - public final void testIsMediaFileIframe() { - CollectionAndDataObjectListingEntry entry = new CollectionAndDataObjectListingEntry(); - entry.setPathOrName("image.pdf"); - entry.setObjectType(ObjectType.DATA_OBJECT); - boolean actual = MediaHandlingUtils.isMediaFile(entry); - Assert.assertTrue("did not identify as media", actual); - } - -} diff --git a/jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/ThumbnailServiceImplTest.java b/jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/ThumbnailServiceImplTest.java deleted file mode 100644 index ecfe9412d..000000000 --- a/jargon-data-utils/src/test/java/org/irods/jargon/datautils/image/ThumbnailServiceImplTest.java +++ /dev/null @@ -1,401 +0,0 @@ -package org.irods.jargon.datautils.image; - -import java.io.File; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import junit.framework.Assert; - -import org.apache.commons.codec.binary.Base64InputStream; -import org.irods.jargon.core.connection.IRODSAccount; -import org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO; -import org.irods.jargon.core.pub.EnvironmentalInfoAO; -import org.irods.jargon.core.pub.IRODSAccessObjectFactory; -import org.irods.jargon.core.pub.IRODSFileSystem; -import org.irods.jargon.core.pub.RuleProcessingAO; -import org.irods.jargon.core.pub.domain.ObjStat; -import org.irods.jargon.core.pub.domain.RemoteCommandInformation; -import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry.ObjectType; -import org.irods.jargon.core.rule.IRODSRule; -import org.irods.jargon.core.rule.IRODSRuleExecResult; -import org.irods.jargon.core.rule.IRODSRuleExecResultOutputParameter; -import org.irods.jargon.core.rule.IRODSRuleExecResultOutputParameter.OutputParamType; -import org.irods.jargon.core.rule.IRODSRuleParameter; -import org.irods.jargon.testutils.TestingPropertiesHelper; -import org.irods.jargon.testutils.filemanip.ScratchFileUtils; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; -import org.mockito.Matchers; -import org.mockito.Mockito; - -public class ThumbnailServiceImplTest { - - private static Properties testingProperties = new Properties(); - private static TestingPropertiesHelper testingPropertiesHelper = new TestingPropertiesHelper(); - private static IRODSFileSystem irodsFileSystem; - public static final String IRODS_TEST_SUBDIR_PATH = "ThumbnailServiceImplTest"; - private static org.irods.jargon.testutils.IRODSTestSetupUtilities irodsTestSetupUtilities = null; - private static final String IMAGE_FILE_NAME = "img/irodsimg.png"; - private static ScratchFileUtils scratchFileUtils = null; - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - TestingPropertiesHelper testingPropertiesLoader = new TestingPropertiesHelper(); - testingProperties = testingPropertiesLoader.getTestProperties(); - scratchFileUtils = new ScratchFileUtils(testingProperties); - scratchFileUtils - .clearAndReinitializeScratchDirectory(IRODS_TEST_SUBDIR_PATH); - irodsFileSystem = IRODSFileSystem.instance(); - irodsTestSetupUtilities = new org.irods.jargon.testutils.IRODSTestSetupUtilities(); - irodsTestSetupUtilities.clearIrodsScratchDirectory(); - irodsTestSetupUtilities.initializeIrodsScratchDirectory(); - irodsTestSetupUtilities - .initializeDirectoryForTest(IRODS_TEST_SUBDIR_PATH); - } - - @After - public void tearDown() throws Exception { - irodsFileSystem.closeAndEatExceptions(); - } - - @Test - public void testGenerateThumbnailForIRODSPath() throws Exception { - - /* - * Grab the test image, base64 encode as a string and emulate return - * from iRODS. - */ - String testDir = "testGenerateThumbnailForIRODSPathWorkingDir"; - String sourceIRODSPath = "/source/irods/path/image.png"; - - String absPath = scratchFileUtils - .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH - + "/" + testDir); - File workingDirAsFile = new File(absPath); - - ClassLoader loader = this.getClass().getClassLoader(); - InputStream sourceStream = loader.getResourceAsStream(IMAGE_FILE_NAME); - - InputStreamReader testInput = new InputStreamReader( - new Base64InputStream(sourceStream, true)); - - // Base64 encoded stream dumped into string - - String dataAsString = null; - - StringWriter writer = new StringWriter(); - char[] buffer = new char[1024]; - int len = testInput.read(buffer); - while (len != -1) { - writer.write(buffer, 0, len); - len = testInput.read(buffer); - } - - dataAsString = writer.toString(); - - testInput.close(); - writer.close(); - - /* - * build mock framework to emulate rule running - */ - - String testRule = "testRule"; - String fileParam = ThumbnailService.THUMBNAIL_RULE_DATA_PARAMETER; - List inputParms = new ArrayList(); - List outputParms = new ArrayList(); - IRODSRuleParameter outputParm = new IRODSRuleParameter(fileParam); - outputParms.add(outputParm); - IRODSRule irodsRule = IRODSRule.instance(testRule, inputParms, - inputParms, "body"); - - IRODSRuleExecResultOutputParameter outputResultParm = IRODSRuleExecResultOutputParameter - .instance(fileParam, OutputParamType.STRING, dataAsString); - Map outputResultParms = new HashMap(); - outputResultParms.put(fileParam, outputResultParm); - - IRODSRuleExecResult result = IRODSRuleExecResult.instance(irodsRule, - outputResultParms); - - IRODSAccount irodsAccount = testingPropertiesHelper - .buildIRODSAccountFromTestProperties(testingProperties); - IRODSAccessObjectFactory irodsAccessObjectFactory = Mockito - .mock(IRODSAccessObjectFactory.class); - RuleProcessingAO ruleProcessingAO = Mockito - .mock(RuleProcessingAO.class); - Mockito.when(ruleProcessingAO.executeRule(Matchers.any(String.class))) - .thenReturn(result); - Mockito.when(irodsAccessObjectFactory.getRuleProcessingAO(irodsAccount)) - .thenReturn(ruleProcessingAO); - - CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = Mockito - .mock(CollectionAndDataObjectListAndSearchAO.class); - Mockito.when( - irodsAccessObjectFactory - .getCollectionAndDataObjectListAndSearchAO(irodsAccount)) - .thenReturn(collectionAndDataObjectListAndSearchAO); - - ObjStat objStat = new ObjStat(); - objStat.setAbsolutePath(sourceIRODSPath); - objStat.setObjectType(ObjectType.DATA_OBJECT); - objStat.setCollectionPath(sourceIRODSPath); - Mockito.when( - collectionAndDataObjectListAndSearchAO - .retrieveObjectStatForPath(sourceIRODSPath)) - .thenReturn(objStat); - - ThumbnailService thumbnailService = new ThumbnailServiceImpl( - irodsAccessObjectFactory, irodsAccount); - File actual = thumbnailService.generateThumbnailForIRODSPathViaRule( - workingDirAsFile, sourceIRODSPath); - Assert.assertNotNull("null file returned", actual); - Assert.assertTrue("file does not exist as file", actual.exists() - && actual.isFile()); - - } - - @Test - public void testIsIRODSThumbnailGeneratorAvailable() throws Exception { - IRODSAccount irodsAccount = testingPropertiesHelper - .buildIRODSAccountFromTestProperties(testingProperties); - IRODSAccessObjectFactory irodsAccessObjectFactory = Mockito - .mock(IRODSAccessObjectFactory.class); - EnvironmentalInfoAO environmentalInfoAO = Mockito - .mock(EnvironmentalInfoAO.class); - List scripts = new ArrayList(); - RemoteCommandInformation info = new RemoteCommandInformation(); - info.setCommand("makeThumbnail.py"); - scripts.add(info); - Mockito.when(environmentalInfoAO.listAvailableRemoteCommands()) - .thenReturn(scripts); - Mockito.when( - irodsAccessObjectFactory.getEnvironmentalInfoAO(irodsAccount)) - .thenReturn(environmentalInfoAO); - ThumbnailService thumbnailService = new ThumbnailServiceImpl( - irodsAccessObjectFactory, irodsAccount); - boolean isThumbnailGenerator = thumbnailService - .isIRODSThumbnailGeneratorAvailable(); - Assert.assertTrue("should have said yes to thumbnail service", - isThumbnailGenerator); - } - - @Test - public void testIsIRODSThumbnailGeneratorNotAvailable() throws Exception { - IRODSAccount irodsAccount = testingPropertiesHelper - .buildIRODSAccountFromTestProperties(testingProperties); - IRODSAccessObjectFactory irodsAccessObjectFactory = Mockito - .mock(IRODSAccessObjectFactory.class); - EnvironmentalInfoAO environmentalInfoAO = Mockito - .mock(EnvironmentalInfoAO.class); - List scripts = new ArrayList(); - RemoteCommandInformation info = new RemoteCommandInformation(); - info.setCommand("dontMakeThumbnail.py"); - scripts.add(info); - Mockito.when(environmentalInfoAO.listAvailableRemoteCommands()) - .thenReturn(scripts); - Mockito.when( - irodsAccessObjectFactory.getEnvironmentalInfoAO(irodsAccount)) - .thenReturn(environmentalInfoAO); - ThumbnailService thumbnailService = new ThumbnailServiceImpl( - irodsAccessObjectFactory, irodsAccount); - boolean isThumbnailGenerator = thumbnailService - .isIRODSThumbnailGeneratorAvailable(); - Assert.assertFalse("should have said no to thumbnail service", - isThumbnailGenerator); - } - - @Test - public void testGenerateThumbnailForIRODSPathTwice() throws Exception { - - /* - * Grab the test image, base64 encode as a string and emulate return - * from iRODS. - */ - String testDir = "testGenerateThumbnailForIRODSPathTwice"; - String sourceIRODSPath = "/source/irods/path/image.png"; - - String absPath = scratchFileUtils - .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH - + "/" + testDir); - File workingDirAsFile = new File(absPath); - - ClassLoader loader = this.getClass().getClassLoader(); - InputStream sourceStream = loader.getResourceAsStream(IMAGE_FILE_NAME); - - InputStreamReader testInput = new InputStreamReader( - new Base64InputStream(sourceStream, true)); - - // Base64 encoded stream dumped into string - - String dataAsString = null; - - StringWriter writer = new StringWriter(); - char[] buffer = new char[1024]; - int len = testInput.read(buffer); - while (len != -1) { - writer.write(buffer, 0, len); - len = testInput.read(buffer); - } - - dataAsString = writer.toString(); - - testInput.close(); - writer.close(); - - /* - * build mock framework to emulate rule running - */ - - String testRule = "testRule"; - String fileParam = ThumbnailService.THUMBNAIL_RULE_DATA_PARAMETER; - List inputParms = new ArrayList(); - List outputParms = new ArrayList(); - IRODSRuleParameter outputParm = new IRODSRuleParameter(fileParam); - outputParms.add(outputParm); - IRODSRule irodsRule = IRODSRule.instance(testRule, inputParms, - inputParms, "body"); - - IRODSRuleExecResultOutputParameter outputResultParm = IRODSRuleExecResultOutputParameter - .instance(fileParam, OutputParamType.STRING, dataAsString); - Map outputResultParms = new HashMap(); - outputResultParms.put(fileParam, outputResultParm); - - IRODSRuleExecResult result = IRODSRuleExecResult.instance(irodsRule, - outputResultParms); - - IRODSAccount irodsAccount = testingPropertiesHelper - .buildIRODSAccountFromTestProperties(testingProperties); - IRODSAccessObjectFactory irodsAccessObjectFactory = Mockito - .mock(IRODSAccessObjectFactory.class); - RuleProcessingAO ruleProcessingAO = Mockito - .mock(RuleProcessingAO.class); - Mockito.when(ruleProcessingAO.executeRule(Matchers.any(String.class))) - .thenReturn(result); - Mockito.when(irodsAccessObjectFactory.getRuleProcessingAO(irodsAccount)) - .thenReturn(ruleProcessingAO); - CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = Mockito - .mock(CollectionAndDataObjectListAndSearchAO.class); - Mockito.when( - irodsAccessObjectFactory - .getCollectionAndDataObjectListAndSearchAO(irodsAccount)) - .thenReturn(collectionAndDataObjectListAndSearchAO); - - ObjStat objStat = new ObjStat(); - objStat.setAbsolutePath(sourceIRODSPath); - objStat.setObjectType(ObjectType.DATA_OBJECT); - objStat.setCollectionPath(sourceIRODSPath); - Mockito.when( - collectionAndDataObjectListAndSearchAO - .retrieveObjectStatForPath(sourceIRODSPath)) - .thenReturn(objStat); - - ThumbnailService thumbnailService = new ThumbnailServiceImpl( - irodsAccessObjectFactory, irodsAccount); - File actual = thumbnailService.generateThumbnailForIRODSPathViaRule( - workingDirAsFile, sourceIRODSPath); - actual = thumbnailService.generateThumbnailForIRODSPathViaRule( - workingDirAsFile, sourceIRODSPath); - Assert.assertNotNull("null file returned", actual); - Assert.assertTrue("file does not exist as file", actual.exists() - && actual.isFile()); - - } - - @Test(expected = IRODSThumbnailProcessUnavailableException.class) - public void testGenerateThumbnailForIRODSPathNoService() throws Exception { - - /* - * Grab the test image, base64 encode as a string and emulate return - * from iRODS. - */ - String testDir = "testGenerateThumbnailForIRODSPathNoService"; - String sourceIRODSPath = "/source/irods/path/image.png"; - - String absPath = scratchFileUtils - .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH - + "/" + testDir); - File workingDirAsFile = new File(absPath); - - ClassLoader loader = this.getClass().getClassLoader(); - InputStream sourceStream = loader.getResourceAsStream(IMAGE_FILE_NAME); - - InputStreamReader testInput = new InputStreamReader( - new Base64InputStream(sourceStream, true)); - - // Base64 encoded stream dumped into string - - StringWriter writer = new StringWriter(); - char[] buffer = new char[1024]; - int len = testInput.read(buffer); - while (len != -1) { - writer.write(buffer, 0, len); - len = testInput.read(buffer); - } - - writer.toString(); - - testInput.close(); - writer.close(); - - /* - * build mock framework to emulate rule running - */ - - String testRule = "testRule"; - String fileParam = ThumbnailService.THUMBNAIL_RULE_DATA_PARAMETER; - List inputParms = new ArrayList(); - List outputParms = new ArrayList(); - IRODSRuleParameter outputParm = new IRODSRuleParameter(fileParam); - outputParms.add(outputParm); - IRODSRule irodsRule = IRODSRule.instance(testRule, inputParms, - inputParms, "body"); - - Map outputResultParms = new HashMap(); - - IRODSRuleExecResult result = IRODSRuleExecResult.instance(irodsRule, - outputResultParms); - - IRODSAccount irodsAccount = testingPropertiesHelper - .buildIRODSAccountFromTestProperties(testingProperties); - IRODSAccessObjectFactory irodsAccessObjectFactory = Mockito - .mock(IRODSAccessObjectFactory.class); - RuleProcessingAO ruleProcessingAO = Mockito - .mock(RuleProcessingAO.class); - Mockito.when(ruleProcessingAO.executeRule(Matchers.any(String.class))) - .thenReturn(result); - Mockito.when(irodsAccessObjectFactory.getRuleProcessingAO(irodsAccount)) - .thenReturn(ruleProcessingAO); - - CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = Mockito - .mock(CollectionAndDataObjectListAndSearchAO.class); - Mockito.when( - irodsAccessObjectFactory - .getCollectionAndDataObjectListAndSearchAO(irodsAccount)) - .thenReturn(collectionAndDataObjectListAndSearchAO); - - ObjStat objStat = new ObjStat(); - objStat.setAbsolutePath(sourceIRODSPath); - objStat.setObjectType(ObjectType.DATA_OBJECT); - objStat.setCollectionPath(sourceIRODSPath); - Mockito.when( - collectionAndDataObjectListAndSearchAO - .retrieveObjectStatForPath(sourceIRODSPath)) - .thenReturn(objStat); - - ThumbnailService thumbnailService = new ThumbnailServiceImpl( - irodsAccessObjectFactory, irodsAccount); - File actual = thumbnailService.generateThumbnailForIRODSPathViaRule( - workingDirAsFile, sourceIRODSPath); - Assert.assertNotNull("null file returned", actual); - Assert.assertTrue("file does not exist as file", actual.exists() - && actual.isFile()); - - } -} diff --git a/jargon-data-utils/src/test/java/org/irods/jargon/datautils/unittest/AllTests.java b/jargon-data-utils/src/test/java/org/irods/jargon/datautils/unittest/AllTests.java index b2769bec5..fcceba81d 100644 --- a/jargon-data-utils/src/test/java/org/irods/jargon/datautils/unittest/AllTests.java +++ b/jargon-data-utils/src/test/java/org/irods/jargon/datautils/unittest/AllTests.java @@ -7,9 +7,6 @@ import org.irods.jargon.datautils.filearchive.LocalFileGzipCompressorTest; import org.irods.jargon.datautils.filearchive.LocalTarFileArchiverTest; import org.irods.jargon.datautils.filesampler.FileSamplerServiceImplTest; -import org.irods.jargon.datautils.image.ImageServiceFactoryImplTest; -import org.irods.jargon.datautils.image.MediaHandlingUtilsTest; -import org.irods.jargon.datautils.image.ThumbnailServiceImplTest; import org.irods.jargon.datautils.sharing.AnonymousAccessServiceImplTest; import org.irods.jargon.datautils.shoppingcart.FileShoppingCartTest; import org.irods.jargon.datautils.shoppingcart.ShoppingCartEntryTest; @@ -31,9 +28,8 @@ DataCacheServiceImplTest.class, ConnectionCreatingPoolableObjectFactoryTest.class, TempPasswordCachingProtocolManagerTest.class, - ThumbnailServiceImplTest.class, ImageServiceFactoryImplTest.class, ShoppingCartEntryTest.class, FileShoppingCartTest.class, - MediaHandlingUtilsTest.class, ShoppingCartServiceImplTest.class, + ShoppingCartServiceImplTest.class, AnonymousAccessServiceImplTest.class, UploadsServiceImplTest.class, DiffTreePostProcessorTest.class, FileTreeIteratorVisitorInvokerTest.class, diff --git a/pom.xml b/pom.xml index 2279a80e3..a4d369081 100644 --- a/pom.xml +++ b/pom.xml @@ -49,19 +49,6 @@ - - ibiblio.repository - ibiblio.repository - http://mirrors.ibiblio.org/pub/mirrors/maven2 - - true - - - false - never - fail - - osgeo Open Source Geospatial Foundation Repository