use of org.fagu.fmv.soft.exec.exception.FMVExecuteException in project fmv by f-agu.
the class GSExceptionKnowAnalyzeTestCase method testMerge.
/**
* @throws IOException
*/
@Test
public // @Ignore
void testMerge() throws IOException {
File folder = new File(System.getProperty("java.io.tmpdir"), "gs-merge-test");
FileUtils.deleteDirectory(folder);
folder.mkdirs();
try {
try {
Soft gsSoft = GS.search();
File viewJpegPSFile = new File(new File(gsSoft.getFile().getParentFile().getParentFile(), "lib"), "viewjpeg.ps");
File srcFile = Resource.extract(folder, "cheese.zip");
File outFile = new File(srcFile.getPath() + ".pdf");
List<String> parameters = new ArrayList<>();
parameters.add("-sDEVICE=pdfwrite");
parameters.add("-dPDFSETTINGS=/prepress");
parameters.add("-o");
parameters.add(outFile.getAbsolutePath());
parameters.add(viewJpegPSFile.getAbsolutePath());
parameters.add("-c");
parameters.add("(" + srcFile.getName() + ") viewJPEG showpage");
gsSoft.withParameters(parameters).workingDirectory(srcFile.getParentFile()).execute();
} catch (FMVExecuteException e) {
if (e.isKnown()) {
assertEquals("ddd", e.getExceptionKnown().toString());
} else {
throw e;
}
}
} finally {
FileUtils.deleteDirectory(folder);
}
}
use of org.fagu.fmv.soft.exec.exception.FMVExecuteException in project fmv by f-agu.
the class FFExceptionKnowAnalyzeTestCase method extractMetadatas.
// ****************************************************************
/**
* @param resource
* @param expectedMessage
* @throws IOException
*/
private void extractMetadatas(String resource, String expectedMessage) throws IOException {
File folder = new File(System.getProperty("java.io.tmpdir"), "ff-extractmetadatas-test");
try {
FileUtils.deleteDirectory(folder);
folder.mkdirs();
File file = resource != null ? ResourceUtils.extract(resource, folder) : folder;
try {
MovieMetadatas extract = MovieMetadatas.with(file).extract();
fail(expectedMessage + ": " + extract.toJSON());
} catch (FMVExecuteException e) {
if (e.isKnown()) {
assertEquals(expectedMessage, e.getExceptionKnown().toString());
} else {
throw e;
}
}
} finally {
FileUtils.deleteDirectory(folder);
}
}
Aggregations