Feature/repo 3505 probes

This commit is contained in:
Alan Davis
2018-05-23 15:36:56 +01:00
parent a20840c5b8
commit 7de82a3541
18 changed files with 618 additions and 75 deletions

View File

@@ -11,9 +11,6 @@
*/
package org.alfresco.transformer;
import org.alfresco.transformer.base.AbstractTransformerController;
import org.alfresco.transformer.base.LogEntry;
import org.alfresco.transformer.base.TransformException;
import org.alfresco.util.exec.RuntimeExec;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -109,6 +106,21 @@ public class ImageMagickController extends AbstractTransformerController
return runtimeExec;
}
@Override
protected ProbeTestTransform getProbeTestTransform()
{
// See the Javadoc on this method and Probes.md for the choice of these values.
return new ProbeTestTransform(this, "quick.jpg", "quick.png",
35593, 1024, 150, 1024, 60*15+1,60*15+0)
{
@Override
protected void executeTransformCommand(File sourceFile, File targetFile)
{
ImageMagickController.this.executeTransformCommand("", sourceFile, "", targetFile, null);
}
};
}
@PostMapping("/transform")
public ResponseEntity<Resource> transform(HttpServletRequest request,
@RequestParam("file") MultipartFile sourceMultipartFile,
@@ -254,6 +266,13 @@ public class ImageMagickController extends AbstractTransformerController
: "["+startPage+'-'+endPage+']';
String options = args.toString();
executeTransformCommand(options, sourceFile, pageRange, targetFile, timeout);
return createAttachment(targetFilename, targetFile, testDelay);
}
private void executeTransformCommand(String options, File sourceFile, String pageRange, File targetFile, Long timeout)
{
LogEntry.setOptions(pageRange+(pageRange.isEmpty() ? "" : " ")+options);
Map<String, String> properties = new HashMap<String, String>(5);
@@ -262,7 +281,5 @@ public class ImageMagickController extends AbstractTransformerController
properties.put("target", targetFile.getAbsolutePath());
executeTransformCommand(properties, targetFile, timeout);
return createAttachment(targetFilename, targetFile, testDelay);
}
}

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -25,6 +25,7 @@
*/
package org.alfresco.transformer;
import org.alfresco.transformer.AbstractHttpRequestTest;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;