/** * Create an instance of {@link TimeConstraint } * */ public TimeConstraint createTimeConstraint() { return new TimeConstraint(); }
@Test public void failedRevocationDataFreshCheck() throws Exception { TimeConstraint tc = new TimeConstraint(); tc.setUnit(TimeUnit.DAYS); tc.setValue(1); tc.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); Date now = new Date(); long nowMil = now.getTime(); xr.setProductionDate(new Date(nowMil - 172800000)); // 48 hours ago XmlRFC result = new XmlRFC(); RevocationDataFreshCheck rdec = new RevocationDataFreshCheck(result, new RevocationWrapper(xr), now, tc); rdec.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void revocationDataFreshCheck() throws Exception { TimeConstraint tc = new TimeConstraint(); tc.setUnit(TimeUnit.DAYS); tc.setValue(1); tc.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); Date now = new Date(); long nowMil = now.getTime(); xr.setProductionDate(new Date(nowMil - 43200000)); // 12 hours ago XmlRFC result = new XmlRFC(); RevocationDataFreshCheck rdec = new RevocationDataFreshCheck(result, new RevocationWrapper(xr), now, tc); rdec.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }