1 package org.intix.signer.test; 2 3 4 import java.util.Date; 5 import java.util.Random; 6 7 import org.intix.signer.SignPdf; 8 9 public class SignPerformance { 10 11 public static void main(String args[]) throws Exception { 12 13 String KEYSTORE_PATH = "keystore.ks"; 14 String KEYSTORE_PASS = "in2pass"; 15 String PRIVATEKEY_PASS = "in2pass"; 16 String PDF_ORGINAL = "./test/original.pdf"; 17 String CERT_ALIAS = "juancarlos"; 18 boolean visible = true; 19 20 long MAX = 100; 21 22 Random aRandom = new Random(); 23 24 long start = new Date().getTime(); 25 26 for( int i=0; i < MAX ; i++) { 27 String aFileName = "./test/" + String.valueOf(aRandom.nextLong()) + ".pdf"; 28 SignPdf aSigner = new SignPdf(KEYSTORE_PATH, KEYSTORE_PASS); 29 aSigner.sign(PDF_ORGINAL, aFileName, CERT_ALIAS, PRIVATEKEY_PASS, visible); 30 } 31 32 long end = new Date().getTime(); 33 34 System.out.println("Número de firmas realizadas " + MAX); 35 System.out.println("Tiempo invertido .. " + (end - start) + " milisegundos"); 36 System.out.println("Tiempo medio invertido en firma un pdf .. " + (end-start)/MAX + " milisegundos"); 37 38 } 39 }