upd: wait for test-manager certs
authorFelix Dörre <felix@dogcraft.de>
Thu, 4 Jun 2015 20:13:35 +0000 (22:13 +0200)
committerFelix Dörre <felix@dogcraft.de>
Thu, 4 Jun 2015 20:13:35 +0000 (22:13 +0200)
util-testing/org/cacert/gigi/pages/Manager.java

index cccb0ac9b25ae3da8c0418b4de8aa59099305b1e..4028e0692ce174f9f723e287381f66a8a5cbb280 100644 (file)
@@ -25,6 +25,8 @@ import org.cacert.gigi.GigiApiException;
 import org.cacert.gigi.crypto.SPKAC;
 import org.cacert.gigi.database.DatabaseConnection;
 import org.cacert.gigi.database.GigiPreparedStatement;
+import org.cacert.gigi.dbObjects.Certificate;
+import org.cacert.gigi.dbObjects.Certificate.CertificateStatus;
 import org.cacert.gigi.dbObjects.Digest;
 import org.cacert.gigi.dbObjects.EmailAddress;
 import org.cacert.gigi.dbObjects.Group;
@@ -240,13 +242,21 @@ public class Manager extends Page {
 
                 CertificateRequest cr = new CertificateRequest(u, Base64.getEncoder().encodeToString(res), "challange");
                 cr.update(CertificateRequest.DEFAULT_CN, Digest.SHA512.toString(), "client", null, "", "email:" + u.getEmail(), resp.getWriter(), req);
-                cr.draft().issue(null, "2y");
-                resp.getWriter().println("added certificate");
+                Certificate draft = cr.draft();
+                draft.issue(null, "2y").waitFor(10000);
+                if (draft.getStatus() == CertificateStatus.ISSUED) {
+                    resp.getWriter().println("added certificate");
+                } else {
+                    resp.getWriter().println("signer failed");
+                }
             } catch (GeneralSecurityException e1) {
                 e1.printStackTrace();
                 resp.getWriter().println("error");
             } catch (GigiApiException e) {
                 e.format(resp.getWriter(), Language.getInstance(Locale.ENGLISH));
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+                resp.getWriter().println("interrupted");
             }
 
         }