diff --git a/greenfield-apps/src/test/java/org/verapdf/apps/test/MultithreadingTest.java b/greenfield-apps/src/test/java/org/verapdf/apps/test/MultithreadingTest.java index 28e5a2ec..f53dd3e7 100644 --- a/greenfield-apps/src/test/java/org/verapdf/apps/test/MultithreadingTest.java +++ b/greenfield-apps/src/test/java/org/verapdf/apps/test/MultithreadingTest.java @@ -9,6 +9,7 @@ import java.io.File; import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; @@ -29,7 +30,7 @@ public void shouldCreateXmlReportsInGivenDirectory() throws Exception { int numberOfThreads = 4; - List> futureResult = startValidation(fileToValidate, numberOfThreads); + List>> futureResult = startValidation(fileToValidate, numberOfThreads); List validationResults = getValidationResult(futureResult); boolean isExpectedResults = compareResultsFromDifferentThreads(validationResults); @@ -52,21 +53,21 @@ private boolean compareResultsFromDifferentThreads(List valida return isExpectedResults; } - private List getValidationResult(List> results) throws InterruptedException, java.util.concurrent.ExecutionException { + private List getValidationResult(List>> results) throws InterruptedException, java.util.concurrent.ExecutionException { List validationResults = new ArrayList<>(); - for (Future result : results) { - ValidationResult validationResult = result.get(); - validationResults.add(validationResult); + for (Future> result : results) { + List validationResult = result.get(); + validationResults.addAll(validationResult); } return validationResults; } - private List> startValidation(File fileToValidate, int numberOfThreads) { - List> futureResult = new ArrayList<>(); + private List>> startValidation(File fileToValidate, int numberOfThreads) { + List>> futureResult = new ArrayList<>(); ExecutorService executor = Executors.newFixedThreadPool(numberOfThreads); for (int i = 0; i < numberOfThreads; i++) { CallableValidatorForTest validator = new CallableValidatorForTest(fileToValidate); - Future submit = executor.submit(validator); + Future> submit = executor.submit(validator); futureResult.add(submit); } return futureResult; diff --git a/greenfield-apps/src/test/java/org/verapdf/pdfa/validation/validators/test/CallableValidatorForTest.java b/greenfield-apps/src/test/java/org/verapdf/pdfa/validation/validators/test/CallableValidatorForTest.java index c2e91dad..d07078ae 100644 --- a/greenfield-apps/src/test/java/org/verapdf/pdfa/validation/validators/test/CallableValidatorForTest.java +++ b/greenfield-apps/src/test/java/org/verapdf/pdfa/validation/validators/test/CallableValidatorForTest.java @@ -7,9 +7,10 @@ import java.io.File; import java.io.FileInputStream; +import java.util.List; import java.util.concurrent.Callable; -public class CallableValidatorForTest implements Callable { +public class CallableValidatorForTest implements Callable> { private final File fileToValidate; public CallableValidatorForTest(File fileToValidate) { @@ -17,12 +18,12 @@ public CallableValidatorForTest(File fileToValidate) { } @Override - public ValidationResult call() throws Exception { - ValidationResult result; + public List call() throws Exception { + List result; try (FileInputStream fis = new FileInputStream(this.fileToValidate); PDFAParser parser = Foundries.defaultInstance().createParser(fis); PDFAValidator validator = Foundries.defaultInstance().createValidator(parser.getFlavour(), false)) { - result = validator.validate(parser); + result = validator.validateAll(parser); } return result; } diff --git a/gui/src/main/java/org/verapdf/cli/VeraPdfCliProcessor.java b/gui/src/main/java/org/verapdf/cli/VeraPdfCliProcessor.java index 57cb6f37..27902a66 100644 --- a/gui/src/main/java/org/verapdf/cli/VeraPdfCliProcessor.java +++ b/gui/src/main/java/org/verapdf/cli/VeraPdfCliProcessor.java @@ -21,6 +21,7 @@ import org.verapdf.cli.CliConstants.ExitCodes; import org.verapdf.cli.commands.VeraCliArgParser; import org.verapdf.core.VeraPDFException; +import org.verapdf.pdfa.results.ValidationResult; import org.verapdf.policy.PolicyChecker; import org.verapdf.processor.*; import org.verapdf.processor.app.ConfigManager; @@ -183,8 +184,11 @@ private ExitCodes processStream(final ItemDetails item, final InputStream toProc if (result.isPdf() && !result.isEncryptedPdf()) { ProcessorFactory.writeSingleResultReport(result, handler, processorConfig); - if (!result.getValidationResult().isCompliant()) { - retVal = ExitCodes.INVALID; + for (ValidationResult validationResult : result.getValidationResults()) { + if (!validationResult.isCompliant()) { + retVal = ExitCodes.INVALID; + break; + } } } else { String message = String.format(