aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-cli/src/test
diff options
context:
space:
mode:
authorAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-04-16 21:31:36 +0200
committerAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-04-16 21:31:36 +0200
commit649b3cd196987eac24a519d987676a0ba09e2432 (patch)
tree2b23429059a42e47ae79918f3742a94d31630f2a /pdf-as-cli/src/test
parent0ee66ba66a9ea84cd6f31589ce0b0192f24a6258 (diff)
downloadpdf-as-4-649b3cd196987eac24a519d987676a0ba09e2432.tar.gz
pdf-as-4-649b3cd196987eac24a519d987676a0ba09e2432.tar.bz2
pdf-as-4-649b3cd196987eac24a519d987676a0ba09e2432.zip
added test & error message
Diffstat (limited to 'pdf-as-cli/src/test')
-rw-r--r--pdf-as-cli/src/test/java/at/gv/egiz/pdfas/cli/test/SignaturBlockParameterTest.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/pdf-as-cli/src/test/java/at/gv/egiz/pdfas/cli/test/SignaturBlockParameterTest.java b/pdf-as-cli/src/test/java/at/gv/egiz/pdfas/cli/test/SignaturBlockParameterTest.java
index 9c53c80e..7b29b535 100644
--- a/pdf-as-cli/src/test/java/at/gv/egiz/pdfas/cli/test/SignaturBlockParameterTest.java
+++ b/pdf-as-cli/src/test/java/at/gv/egiz/pdfas/cli/test/SignaturBlockParameterTest.java
@@ -45,6 +45,7 @@ import org.junit.Test;
import javax.activation.DataSource;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
@@ -67,6 +68,38 @@ public class SignaturBlockParameterTest {
return absolutePath;
}
+ @Test(expected = PdfAsException.class)
+ public void invalid() throws IOException, PdfAsException, PDFASError {
+
+ PdfAs pdfas = PdfAsFactory.createPdfAs(new File(getPath("pdfas-config")));
+ Configuration config = pdfas.getConfiguration();
+
+ byte[] input = IOUtils.toByteArray(new FileInputStream(getPath("simple_rotated_0.pdf")));
+
+ IPlainSigner signer = new PAdESSignerKeystore(getPath("test.p12"), KS_ALIAS, KS_PASS, KS_KEY_PASS, KS_TYPE);
+
+ String profile = "SIGNATURBLOCK_DE_NOTE_DYNAMIC";
+ System.out.println("Testing " + profile);
+
+ DataSource source = new ByteArrayDataSource(input);
+ String outFile = getPath("out") + "/" + profile + ".pdf";
+ FileOutputStream fos = new FileOutputStream(outFile);
+ SignParameter signParameter = PdfAsFactory.createSignParameter(
+ config, source, fos);
+
+ Map<String, String> map = new HashMap<>();
+ map.put("subject", "TEST123");
+ map.put("WAY_TOOOOOOOOOOOOOOOOOOOOO_LONG_KEY", "bar");
+ signParameter.setDynamicSignatureBlockArguments(map);
+// signParameter.setPlainSigner(signer);
+// signParameter.setSignatureProfileId(profile);
+//
+// SignResult result = pdfas.sign(signParameter);
+
+ fos.close();
+
+ }
+
@Test
public void test() throws IOException, PDFASError, PdfAsException {