@Test public void failedCertificateRevokedCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); xr.setStatus(false); xr.setRevocationDate(CAL1.getTime()); xr.setReason("certificate"); XmlCertificate xc = new XmlCertificate(); xc.getRevocations().add(xr); XmlSubXCV result = new XmlSubXCV(); CertificateRevokedCheck cec = new CertificateRevokedCheck(result, new CertificateWrapper(xc), CAL2.getTime(), constraint, SubContext.CA_CERTIFICATE); cec.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
@Test public void failedCertificateOnHoldCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); xr.setStatus(false); xr.setRevocationDate(CAL1.getTime()); xr.setReason("certificateHold"); XmlCertificate xc = new XmlCertificate(); xc.getRevocations().add(xr); XmlSubXCV result = new XmlSubXCV(); CertificateOnHoldCheck cohc = new CertificateOnHoldCheck(result, new CertificateWrapper(xc), CAL2.getTime(), constraint); cohc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); } }
@Test public void certificateRevokedCheck() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlRevocation xr = new XmlRevocation(); xr.setStatus(false); xr.setReason("certificateHold"); XmlCertificate xc = new XmlCertificate(); xc.getRevocations().add(xr); XmlSubXCV result = new XmlSubXCV(); CertificateRevokedCheck cec = new CertificateRevokedCheck(result, new CertificateWrapper(xc), CAL2.getTime(), constraint, SubContext.CA_CERTIFICATE); cec.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }