log.trace("<test08TestCRLStore()");
}
public void test09CrlGenerateForAll() throws Exception {
log.trace(">test09CrlGenerateForAll()");
final X509CAInfo cainfo = (X509CAInfo) caAdminSession.getCAInfo(admin, caid);
cainfo.setCRLIssueInterval(1); // Issue very often..
cainfo.setDeltaCRLPeriod(1); // Issue very often..
caAdminSession.editCA(admin, cainfo);
ca = caSession.getCA(admin, caid);
Thread.sleep(1000);
final X509CRL x509crl = CertTools.getCRLfromByteArray(crlSession.getLastCRL(admin, cainfo.getSubjectDN(), false));
crlCreateSession.createCRLs(admin);
final X509CRL x509crlAfter = CertTools.getCRLfromByteArray(crlSession.getLastCRL(admin, cainfo.getSubjectDN(), false));
assertTrue("Did not generate a newer CRL.", x509crlAfter.getThisUpdate().after(x509crl.getThisUpdate()));
final X509CRL x509deltaCrl = CertTools.getCRLfromByteArray(crlSession.getLastCRL(admin, cainfo.getSubjectDN(), true));
crlCreateSession.createDeltaCRLs(admin);
final X509CRL x509deltaCrlAfter = CertTools.getCRLfromByteArray(crlSession.getLastCRL(admin, cainfo.getSubjectDN(), true));
assertTrue("Did not generate a newer Delta CRL.", x509deltaCrlAfter.getThisUpdate().after(x509deltaCrl.getThisUpdate()));
// Try a similar thing when we specify which CA IDs to generate CRLs for
// Compare CRL numbers instead of Dates, since these CRLs might have been generated the same second as the last ones
final Collection<Integer> caids = new ArrayList<Integer>();
caids.add(Integer.valueOf(caid));
crlCreateSession.createCRLs(admin, caids, 2);
final X509CRL x509crlAfter2 = CertTools.getCRLfromByteArray(crlSession.getLastCRL(admin, cainfo.getSubjectDN(), false));
assertTrue("Did not generate a newer CRL.", CrlExtensions.getCrlNumber(x509crlAfter2).intValue() > CrlExtensions.getCrlNumber(x509crlAfter).intValue());
crlCreateSession.createDeltaCRLs(admin, caids, 2);
final X509CRL x509deltaCrlAfter2 = CertTools.getCRLfromByteArray(crlSession.getLastCRL(admin, cainfo.getSubjectDN(), true));
assertTrue("Did not generate a newer Delta CRL.", CrlExtensions.getCrlNumber(x509deltaCrlAfter2).intValue() > CrlExtensions.getCrlNumber(x509deltaCrlAfter).intValue());
log.trace("<test09CrlGenerateForAll()");
}