data1 = home.create(cert); assertNotNull("Failed to create", data1); log.debug("created it!"); } catch (javax.ejb.DuplicateKeyException e) { home.remove(pk); log.debug("Removed it!"); data1 = home.create(cert); assertNotNull("Failed to create", data1); log.debug("created it!");
Certificate ce = store.findCertificateByFingerprint(admin,fp); if (ce != null) { log.info("Certificate with fp="+fp+" already exists in db, cannot add."); certAlreadyExists = true; return; } boolean ret = store.storeCertificate(admin, cert, "foo", "1234", CertificateDataBean.CERT_INACTIVE, CertificateDataBean.CERT_TYPE_ENCRYPTION); assertTrue("Failed to store", ret); log.debug("stored it!"); } catch (RemoteException e) { log.error("Error storing certificate: ",e); assertTrue("Error storing certificate.", false);
    public void test01CreateNewCert() throws Exception {        log.debug(">test01CreateNewCert()");        X509Certificate cert = CertTools.getCertfromByteArray(testcert);        CertificateDataPK pk = new CertificateDataPK();        pk.fingerprint = CertTools.getFingerprintAsString(cert);        log.debug("keyed it! =" + pk);        CertificateData data1 = null;        try {            data1 = home.create(cert);            assertNotNull("Failed to create", data1);            log.debug("created it!");        } catch (javax.ejb.DuplicateKeyException e) {            home.remove(pk);            log.debug("Removed it!");            data1 = home.create(cert);            assertNotNull("Failed to create", data1);            log.debug("created it!");            return;        }        log.debug("<test01CreateNewCert()");    }