aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo')
-rw-r--r--pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/PDFATestInfo.java41
-rw-r--r--pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/SignaturePositionTestInfo.java138
-rw-r--r--pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/TestInfo.java76
-rw-r--r--pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/TestVerdict.java10
4 files changed, 265 insertions, 0 deletions
diff --git a/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/PDFATestInfo.java b/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/PDFATestInfo.java
new file mode 100644
index 00000000..a5f7c190
--- /dev/null
+++ b/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/PDFATestInfo.java
@@ -0,0 +1,41 @@
+package at.gv.egiz.param_tests.testinfo;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.pdfbox.preflight.ValidationResult;
+
+/**
+ * Test information class for PDF-A conformance tests.
+ *
+ * @author mtappler
+ *
+ */
+public class PDFATestInfo extends TestInfo {
+
+ /**
+ * the validation result before signing for the input PDF file
+ */
+ private Pair<ValidationResult, Throwable> resultBeforeSign;
+ /**
+ * the validation result after signing for the output PDF file
+ */
+ private Pair<ValidationResult, Throwable> resultAfterSign;
+
+ public Pair<ValidationResult, Throwable> getResultBeforeSign() {
+ return resultBeforeSign;
+ }
+
+ public void setResultBeforeSign(
+ Pair<ValidationResult, Throwable> resultBeforeSign) {
+ this.resultBeforeSign = resultBeforeSign;
+ }
+
+ public Pair<ValidationResult, Throwable> getResultAfterSign() {
+ return resultAfterSign;
+ }
+
+ public void setResultAfterSign(
+ Pair<ValidationResult, Throwable> resultAfterSign) {
+ this.resultAfterSign = resultAfterSign;
+ }
+
+}
diff --git a/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/SignaturePositionTestInfo.java b/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/SignaturePositionTestInfo.java
new file mode 100644
index 00000000..04b75edc
--- /dev/null
+++ b/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/SignaturePositionTestInfo.java
@@ -0,0 +1,138 @@
+package at.gv.egiz.param_tests.testinfo;
+
+import java.awt.Rectangle;
+import java.util.List;
+
+/**
+ * Test information class for signature position test.
+ *
+ * @author mtappler
+ *
+ */
+public class SignaturePositionTestInfo extends TestInfo {
+ /**
+ * Class containing attributes for non-standard parameters of signature
+ * position tests.
+ *
+ * @author mtappler
+ *
+ */
+ public static class SignaturePositionParameters {
+ /**
+ * positioning string which specifies the position of the signature
+ * block
+ */
+ private String positionString;
+ /**
+ * The page number of the page, which shows the signature block.
+ */
+ private int sigPageNumber;
+ /**
+ * A list of rectangular areas, which will be ignored for image
+ * comparison
+ */
+ private List<Rectangle> ignoredAreas;
+ /**
+ * the file name of the reference file for image comparison
+ */
+ private String refImageFileName;
+ /**
+ * if set to true, a reference image is captured during the test, but no
+ * actual comparison will be performed
+ */
+ private boolean captureReferenceImage;
+
+ public String getPositionString() {
+ return positionString;
+ }
+
+ public void setPositionString(String positionString) {
+ this.positionString = positionString;
+ }
+
+ public int getSigPageNumber() {
+ return sigPageNumber;
+ }
+
+ public void setSigPageNumber(int sigPageNumber) {
+ this.sigPageNumber = sigPageNumber;
+ }
+
+ public List<Rectangle> getIgnoredAreas() {
+ return ignoredAreas;
+ }
+
+ public void setIgnoredAreas(List<Rectangle> ignoredAreas) {
+ this.ignoredAreas = ignoredAreas;
+ }
+
+ public String getRefImageFileName() {
+ return refImageFileName;
+ }
+
+ public void setRefImageFileName(String refImageFileName) {
+ this.refImageFileName = refImageFileName;
+ }
+
+ public boolean isCaptureReferenceImage() {
+ return captureReferenceImage;
+ }
+
+ public void setCaptureReferenceImage(boolean captureReferenceImage) {
+ this.captureReferenceImage = captureReferenceImage;
+ }
+ }
+
+ /**
+ * additional/non-standard parameter of signature position tests
+ */
+ private SignaturePositionParameters additionParameters = new SignaturePositionParameters();
+
+ /**
+ * file name of the reference image with ignored areas
+ */
+ private String refImageIgnored;
+
+ /**
+ * file name of the signature page image with ignored areas
+ */
+ private String sigPageImageIgnored;
+
+ /**
+ * file name of difference image
+ */
+ private String diffImage;
+
+ public String getRefImageIgnored() {
+ return refImageIgnored;
+ }
+
+ public String getSigPageImageIgnored() {
+ return sigPageImageIgnored;
+ }
+
+ public String getDiffImage() {
+ return diffImage;
+ }
+
+ public SignaturePositionParameters getAdditionParameters() {
+ return additionParameters;
+ }
+
+ public void setAdditionParameters(
+ SignaturePositionParameters additionParameters) {
+ this.additionParameters = additionParameters;
+ }
+
+ public void setRefImageIgnored(String refImageIgnored) {
+ this.refImageIgnored = refImageIgnored;
+ }
+
+ public void setSigPageImageIgnored(String sigPageImageIgnored) {
+ this.sigPageImageIgnored = sigPageImageIgnored;
+ }
+
+ public void setDiffImage(String diffImage) {
+ this.diffImage = diffImage;
+ }
+}
diff --git a/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/TestInfo.java b/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/TestInfo.java
new file mode 100644
index 00000000..130cece3
--- /dev/null
+++ b/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/TestInfo.java
@@ -0,0 +1,76 @@
+package at.gv.egiz.param_tests.testinfo;
+
+import at.gv.egiz.param_tests.provider.BaseSignatureTestData;
+
+/**
+ * Abstract test information class containing information common to all tests.
+ * It is declared abstract to enforce that a subclass of it must be created for
+ * each test-type, because serializer prototypes are registered for
+ * <code>TestInfo</code>-subclasses.
+ *
+ * @author mtappler
+ *
+ */
+public abstract class TestInfo {
+ /**
+ * signature test parameters common to all tests
+ */
+ private BaseSignatureTestData baseTestData;
+ /**
+ * the verdict of a test
+ */
+ private TestVerdict verdict = TestVerdict.UNKNOWN;
+ /**
+ * the cause for failure, non-null if the verdict is inconclusive or fail
+ */
+ private Throwable failCause;
+ /**
+ * standard output data written during the test
+ */
+ private String stdOut;
+ /**
+ * standard error data written during the test
+ */
+ private String stdErr;
+
+ public void setBaseTestData(BaseSignatureTestData baseTestData) {
+ this.baseTestData = baseTestData;
+ }
+
+ public Throwable getFailCause() {
+ return failCause;
+ }
+
+ public BaseSignatureTestData getBaseTestData() {
+ return this.baseTestData;
+ }
+
+ public TestVerdict getVerdict() {
+ return verdict;
+ }
+
+ public String getStdOut() {
+ return stdOut;
+ }
+
+ public void setVerdict(TestVerdict result) {
+ this.verdict = result;
+ }
+
+ public void setFailCause(Throwable e) {
+ this.failCause = e;
+ }
+
+ public void setStdOut(String stdOutFromTest) {
+ this.stdOut = stdOutFromTest;
+ }
+
+ public void setStdErr(String stdErrFromTest) {
+ this.stdErr = stdErrFromTest;
+ }
+
+ public String getStdErr() {
+ return stdErr;
+ }
+
+}
diff --git a/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/TestVerdict.java b/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/TestVerdict.java
new file mode 100644
index 00000000..0fc31a6a
--- /dev/null
+++ b/pdf-as-tests/src/test/java/at/gv/egiz/param_tests/testinfo/TestVerdict.java
@@ -0,0 +1,10 @@
+package at.gv.egiz.param_tests.testinfo;
+
+/**
+ * Enum defining constants for test verdicts.
+ * @author mtappler
+ *
+ */
+public enum TestVerdict {
+ UNKNOWN, INCONCLUSIVE, FAILED, SUCCEEDED
+}