diff options
Diffstat (limited to 'pdf-as-cli')
-rw-r--r-- | pdf-as-cli/src/test/java/at/gv/egiz/pdfas/cli/test/SignaturBlockParameterTest.java | 33 |
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 { |