cat.debug(">test06FindByExpireTime()");
log.debug(">test06FindByExpireTime()");
    public void test06FindByExpireTime() throws Exception {        cat.debug(">test06FindByExpireTime()");        CertificateDataPK pk = new CertificateDataPK();        pk.fingerprint = CertTools.getFingerprintAsString(cert);        CertificateData data = home.findByPrimaryKey(pk);        assertNotNull("Failed to find cert", data);        cat.debug("expiredate="+data.getExpireDate());        // Seconds in a year        long yearmillis = 365*24*60*60*1000;        long findDateSecs = data.getExpireDate() - (yearmillis*100);        Date findDate = new Date(findDateSecs);        ICertificateStoreSessionRemote store = storehome.create();        cat.debug("1. Looking for cert with expireDate="+findDate);        Collection certs = store.findCertificatesByExpireTime(new Admin(Admin.TYPE_INTERNALUSER), findDate);        cat.debug("findCertificatesByExpireTime returned "+ certs.size()+" certs.");        assertTrue("No certs should have expired before this date", certs.size() == 0);        findDateSecs = data.getExpireDate() + 10000;        findDate = new Date(findDateSecs);        cat.debug("2. Looking for cert with expireDate="+findDate);        certs = store.findCertificatesByExpireTime(new Admin(Admin.TYPE_INTERNALUSER), findDate);        cat.debug("findCertificatesByExpireTime returned "+ certs.size()+" certs.");        assertTrue("Some certs should have expired before this date", certs.size() != 0);        Iterator iter = certs.iterator();        while (iter.hasNext()) {            X509Certificate cert = (X509Certificate)iter.next();            Date retDate = cert.getNotAfter();            cat.debug(retDate);            assertTrue("This cert is not expired by the specified Date.", retDate.getTime() < findDate.getTime());        }        cat.debug("<test06FindByExpireTime()");    }