Skip to content

Commit

Permalink
Removes the name component module from modules called module
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Ronge committed Nov 26, 2018
1 parent aa50429 commit e4e4423
Show file tree
Hide file tree
Showing 42 changed files with 98 additions and 124 deletions.
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.api.validation.longtimepreservation;
package org.kitodo.api.validation.longtermpreservation;

/**
* Determines the file types supported by the module.
Expand Down
Expand Up @@ -9,18 +9,18 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.api.validation.longtimepreservation;
package org.kitodo.api.validation.longtermpreservation;

import java.net.URI;

import org.kitodo.api.validation.ValidationInterface;
import org.kitodo.api.validation.ValidationResult;

/** Validation for LongTimePreservation. */
public interface LongTimePreservationValidationInterface extends ValidationInterface {
/** Validation for long-term preservation. */
public interface LongTermPreservationValidationInterface extends ValidationInterface {

/**
* Validates a file for longTimePreservation.
* Validates a file for long-term preservation.
*
* @param fileUri
* The uri to the image, which should be validated.
Expand Down
Expand Up @@ -84,7 +84,7 @@ public static String getParameter(ParameterInterface key) {
* @throws NoSuchElementException
* if parameter taken from config file is null or exception occurred
*/
//TODO: there is still ImageManagementModule where it is needed
//TODO: there is still image management where it is needed
public static String getParameter(String key) {
try {
return getConfig().getString(key);
Expand Down
Expand Up @@ -21,8 +21,8 @@
</parent>

<modelVersion>4.0.0</modelVersion>
<name>Kitodo - Image Management Module</name>
<artifactId>kitodo-ImageManagementModule</artifactId>
<name>Kitodo - Image Management</name>
<artifactId>kitodo-image-management</artifactId>

<dependencies>
<dependency>
Expand Down
Expand Up @@ -13,10 +13,10 @@

public enum ParameterImageManagement implements ParameterInterface {

DIR_TMP("ImageManagementModule.tmpDir"),
SEARCH_PATH("ImageManagementModule.searchPath"),
TIMEOUT_SEC("ImageManagementModule.timeoutSec"),
SSH_HOST("ImageManagementModule.sshHosts");
DIR_TMP("ImageManagement.tmpDir"),
SEARCH_PATH("ImageManagement.searchPath"),
TIMEOUT_SEC("ImageManagement.timeoutSec"),
SSH_HOST("ImageManagement.sshHosts");

private String name;

Expand Down
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.imagemanagementmodule;
package org.kitodo.imagemanagement;

import java.io.ByteArrayOutputStream;
import java.io.File;
Expand Down
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.imagemanagementmodule;
package org.kitodo.imagemanagement;

import java.util.LinkedList;
import java.util.List;
Expand Down
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.imagemanagementmodule;
package org.kitodo.imagemanagement;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -106,7 +106,7 @@ FutureDerivative addResult(URI path, ImageFileFormat resultFileFormat) {
/**
* Reads further arguments from the configuration and passes them to
* ImageMagick. Arguments can be added to the configuration with the prefix
* {@code ImageManagementModule.param.}.
* {@code ImageManagement.param.}.
*
* <p>
* Examples:
Expand All @@ -118,15 +118,15 @@ FutureDerivative addResult(URI path, ImageFileFormat resultFileFormat) {
* <th>Arguments sent to ImageMagick</th>
* </tr>
* <tr>
* <td><code>ImageManagementModule.param.limit.memory=40MB</code></td>
* <td><code>ImageManagement.param.limit.memory=40MB</code></td>
* <td><code>-limit memory 40MB</code></td>
* </tr>
* <tr>
* <td><code>ImageManagementModule.param.+set=date\:create</code></td>
* <td><code>ImageManagement.param.+set=date\:create</code></td>
* <td><code>+set date:create</code></td>
* </tr>
* <tr>
* <td><code>ImageManagementModule.param.quiet=</code></td>
* <td><code>ImageManagement.param.quiet=</code></td>
* <td><code>-quiet</code></td>
* </tr>
* </table>
Expand All @@ -135,7 +135,7 @@ FutureDerivative addResult(URI path, ImageFileFormat resultFileFormat) {
* command line to which to add the arguments
*/
private static void configureImageMagick(IMOperation commandLine) {
final String configOptionsPrefix = "ImageManagementModule.param.";
final String configOptionsPrefix = "ImageManagement.param.";
Iterator<?> keys = KitodoConfig.getConfig().getKeys(configOptionsPrefix);
while (keys.hasNext()) {
Object keyObject = keys.next();
Expand Down
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.imagemanagementmodule;
package org.kitodo.imagemanagement;

import java.awt.Image;
import java.io.File;
Expand All @@ -31,8 +31,8 @@
/**
* An ImageManagementInterface implementation using ImageMagick.
*/
public class ImageManagementModule implements ImageManagementInterface {
private static final Logger logger = LogManager.getLogger(ImageManagementModule.class);
public class ImageManagement implements ImageManagementInterface {
private static final Logger logger = LogManager.getLogger(ImageManagement.class);

/**
* Image format used internally to create image derivatives, optimized for
Expand Down
Expand Up @@ -15,7 +15,7 @@
* <p>
* To use this plug-in, ImageMagick must be available on the system’s search
* path, or the ImageMagick home must be configured as
* <code>ImageManagementModule.searchPath</code> in
* <code>ImageManagement.searchPath</code> in
* <code>kitodo_config.properties</code>.
*/
package org.kitodo.imagemanagementmodule;
package org.kitodo.imagemanagement;
Expand Up @@ -9,4 +9,4 @@
# GPL3-License.txt file that was distributed with this source code.
#

org.kitodo.imagemanagementmodule.ImageManagementModule
org.kitodo.imagemanagement.ImageManagement
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.imagemanagementmodule;
package org.kitodo.imagemanagement;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
Expand All @@ -33,9 +33,10 @@
import org.kitodo.api.imagemanagement.ImageManagementInterface;
import org.kitodo.config.KitodoConfig;
import org.kitodo.config.enums.ParameterImageManagement;
import org.kitodo.imagemanagement.ImageManagement;

/**
* Tests the Image Management Module.
* Tests the Image Management.
*
* <p>
* To successfully run this test on Windows, create the file
Expand All @@ -44,9 +45,9 @@
* ImageMagick program folder in it, like:
*
* <p>
* {@code ImageManagementModule.searchPath=C:\\Program Files\\ImageMagick-7.0.7-Q16}
* {@code ImageManagement.searchPath=C:\\Program Files\\ImageMagick-7.0.7-Q16}
*/
public class ImageManagementModuleIT {
public class ImageManagementIT {
/**
* Folder for test resources (images).
*/
Expand Down Expand Up @@ -90,7 +91,7 @@ public static void createTestTiff() throws IOException, InterruptedException, IM
@Test
public void testGetScaledWebImage() throws IOException, InfoException {
assert new File(_00000001_TIF).exists();
ImageManagementInterface module = new ImageManagementModule();
ImageManagementInterface module = new ImageManagement();
Image scaledWebImage = module.getScaledWebImage(new File(_00000001_TIF).toURI(), 0.3);
assertThat(scaledWebImage.getWidth(null),
is((int) Math.round(0.3 * new Info(_00000001_TIF, true).getImageWidth())));
Expand All @@ -100,7 +101,7 @@ public void testGetScaledWebImage() throws IOException, InfoException {
public void testCreateDerivative() throws IOException, InfoException {
assert new File(_00000001_TIF).exists();
File maxDerivative = new File(_00000001_MAX_JPG);
ImageManagementInterface module = new ImageManagementModule();
ImageManagementInterface module = new ImageManagement();
assertThat(
module.createDerivative(new File(_00000001_TIF).toURI(), 1.0, maxDerivative.toURI(), ImageFileFormat.JPEG),
is(true));
Expand All @@ -112,7 +113,7 @@ public void testCreateDerivative() throws IOException, InfoException {
@Test
public void testChangeDpi() throws IOException, InfoException {
assert new File(_00000001_TIF).exists();
ImageManagementInterface module = new ImageManagementModule();
ImageManagementInterface module = new ImageManagement();
Image image = module.changeDpi(new File(_00000001_TIF).toURI(), 300);
assertThat(72 * image.getWidth(null) / new Info(_00000001_TIF, true).getImageWidth(), is(equalTo(300)));

Expand All @@ -121,7 +122,7 @@ public void testChangeDpi() throws IOException, InfoException {
@Test
public void testGetSizedWebImage() throws IOException {
assert new File(_00000001_TIF).exists();
ImageManagementInterface module = new ImageManagementModule();
ImageManagementInterface module = new ImageManagement();
Image scaledWebImage = module.getSizedWebImage(new File(_00000001_TIF).toURI(), 150);
assertThat(scaledWebImage.getWidth(null), is(equalTo(150)));
}
Expand Down
Expand Up @@ -21,8 +21,8 @@
</parent>

<modelVersion>4.0.0</modelVersion>
<name>Kitodo - Long Time Preservation Validation Module</name>
<artifactId>kitodo-LongTimePreservationValidationModule</artifactId>
<name>Kitodo - Long Term Preservation Validation</name>
<artifactId>kitodo-longtermpreservation-validation</artifactId>

<dependencies>
<dependency>
Expand Down
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.longtimepreservationvalidationmodule;
package org.kitodo.longtermpreservationvalidation;

import edu.harvard.hul.ois.jhove.App;
import edu.harvard.hul.ois.jhove.JhoveBase;
Expand Down
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.longtimepreservationvalidationmodule;
package org.kitodo.longtermpreservationvalidation;

import edu.harvard.hul.ois.jhove.App;
import edu.harvard.hul.ois.jhove.HandlerBase;
Expand Down
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.longtimepreservationvalidationmodule;
package org.kitodo.longtermpreservationvalidation;

import java.net.URI;
import java.util.Arrays;
Expand All @@ -18,13 +18,13 @@
import java.util.Map;

import org.kitodo.api.validation.ValidationResult;
import org.kitodo.api.validation.longtimepreservation.FileType;
import org.kitodo.api.validation.longtimepreservation.LongTimePreservationValidationInterface;
import org.kitodo.api.validation.longtermpreservation.FileType;
import org.kitodo.api.validation.longtermpreservation.LongTermPreservationValidationInterface;

/**
* An LongTimePreservationValidationInterface implementation using Jhove.
* A LongTermPreservationValidationInterface implementation using Jhove.
*/
public class LongTimePreservationValidationModule implements LongTimePreservationValidationInterface {
public class LongTermPreservationValidation implements LongTermPreservationValidationInterface {
/**
* Returns the matching module name for the given file type.
*/
Expand Down
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.longtimepreservationvalidationmodule;
package org.kitodo.longtermpreservationvalidation;

import java.util.stream.Stream;

Expand Down
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.longtimepreservationvalidationmodule;
package org.kitodo.longtermpreservationvalidation;

import edu.harvard.hul.ois.jhove.RepInfo;

Expand Down
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.longtimepreservationvalidationmodule;
package org.kitodo.longtermpreservationvalidation;

import org.kitodo.api.validation.State;
import org.kitodo.config.KitodoConfig;
Expand Down
Expand Up @@ -9,4 +9,4 @@
# GPL3-License.txt file that was distributed with this source code.
#

org.kitodo.longtimepreservationvalidationmodule.LongTimePreservationValidationModule
org.kitodo.longtermpreservationvalidation.LongTermPreservationValidation
Expand Up @@ -9,7 +9,7 @@
* GPL3-License.txt file that was distributed with this source code.
*/

package org.kitodo.longtimepreservationvalidationmodule;
package org.kitodo.longtermpreservationvalidation;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
Expand All @@ -24,10 +24,10 @@
import org.junit.Test;
import org.kitodo.api.validation.State;
import org.kitodo.api.validation.ValidationResult;
import org.kitodo.api.validation.longtimepreservation.FileType;
import org.kitodo.api.validation.longtimepreservation.LongTimePreservationValidationInterface;
import org.kitodo.api.validation.longtermpreservation.FileType;
import org.kitodo.api.validation.longtermpreservation.LongTermPreservationValidationInterface;

public class LongTimePreservationValidationModuleIT {
public class LongTermPreservationValidationIT {
private static final String NEITHER_WELL_FORMED_NOR_VALID = "Examination result: not well-formed, not valid";
private static final List<String> WELL_FORMED_AND_VALID = Arrays.asList("Examination result: well-formed, valid");
private static final URI CORRUPTED_TIF_URI, GIF_URI, JAVA_URI, JP2_URI, JPG_URI, PDF_URI, PNG_URI, TIF_URI;
Expand All @@ -37,7 +37,7 @@ public class LongTimePreservationValidationModuleIT {
CORRUPTED_TIF_URI = new URI("src/test/resources/corrupted.tif");
GIF_URI = new URI("src/test/resources/rose.gif");
JAVA_URI = new URI(
"src/test/java/org/kitodo/longtimepreservationvalidationmodule/LongTimePreservationValidationModuleIT.java");
"src/test/java/org/kitodo/longtermpreservationvalidation/LongTermPreservationValidationIT.java");
JP2_URI = new URI("src/test/resources/rose.jp2");
JPG_URI = new URI("src/test/resources/rose.jpg");
PDF_URI = new URI("src/test/resources/rose.pdf");
Expand All @@ -50,7 +50,7 @@ public class LongTimePreservationValidationModuleIT {

@Test
public void testThatACorruptedFileDoesNotValidate() {
LongTimePreservationValidationInterface validator = new LongTimePreservationValidationModule();
LongTermPreservationValidationInterface validator = new LongTermPreservationValidation();
ValidationResult validationResult = validator.validate(CORRUPTED_TIF_URI, FileType.TIFF);
assertThat(validationResult.getState(), is(equalTo(State.ERROR)));
assertThat(validationResult.getResultMessages(),
Expand All @@ -59,7 +59,7 @@ public void testThatACorruptedFileDoesNotValidate() {

@Test
public void testThatFilesOfTheWrongTypeDoNotValidate() {
LongTimePreservationValidationInterface validator = new LongTimePreservationValidationModule();
LongTermPreservationValidationInterface validator = new LongTermPreservationValidation();

ValidationResult validationResult = validator.validate(JAVA_URI, FileType.PDF);
assertThat(validationResult.getState(), is(equalTo(State.ERROR)));
Expand All @@ -84,7 +84,7 @@ public void testThatFilesOfTheWrongTypeDoNotValidate() {

@Test
public void testThatValidFilesValidateWithDefaultModules() {
LongTimePreservationValidationInterface validator = new LongTimePreservationValidationModule();
LongTermPreservationValidationInterface validator = new LongTermPreservationValidation();
ValidationResult validationResult = validator.validate(GIF_URI, FileType.GIF);
assertThat(validationResult.getState(), is(equalTo(State.SUCCESS)));
assertThat(validationResult.getResultMessages(), is(equalTo(WELL_FORMED_AND_VALID)));
Expand All @@ -108,7 +108,7 @@ public void testThatValidFilesValidateWithDefaultModules() {

@Test
public void testThatValidFilesValidateWithExtendedModules() {
LongTimePreservationValidationInterface validator = new LongTimePreservationValidationModule();
LongTermPreservationValidationInterface validator = new LongTermPreservationValidation();
ValidationResult validationResult = validator.validate(PNG_URI, FileType.PNG);
assertThat(validationResult.getState(), is(equalTo(State.SUCCESS)));
assertThat(validationResult.getResultMessages(), is(equalTo(WELL_FORMED_AND_VALID)));
Expand Down

0 comments on commit e4e4423

Please sign in to comment.