use of com.adaptris.security.certificate.CertificateHandler in project interlok by adaptris.
the class TestCertificateHandler method testGoodCertificateRevocationCache.
@Test
public void testGoodCertificateRevocationCache() throws Exception {
InputStream input = new FileInputStream(config.getProperties().getProperty(Config.CERTHANDLER_GOOD));
CertificateHandler handler = CertificateHandlerFactory.getInstance().generateHandler(input);
input.close();
assertEquals("Revocation", handler.isRevoked(), false);
Calendar lastGoodCheck = handler.getLastRevocationCheck();
assertEquals("Calendar", handler.getLastRevocationCheck(), lastGoodCheck);
}
use of com.adaptris.security.certificate.CertificateHandler in project interlok by adaptris.
the class TestCertificateHandler method testExpiredCertificateExpiry.
@Test
public void testExpiredCertificateExpiry() throws Exception {
InputStream input = new FileInputStream(config.getProperties().getProperty(Config.CERTHANDLER_EXPIRED));
CertificateHandler handler = CertificateHandlerFactory.getInstance().generateHandler(input);
input.close();
assertTrue("Expiry on \n" + handler.getCertificate().toString(), handler.isExpired());
}
use of com.adaptris.security.certificate.CertificateHandler in project interlok by adaptris.
the class TestCertificateHandler method testGoodCertificateExpiry.
@Test
public void testGoodCertificateExpiry() throws Exception {
InputStream input = new FileInputStream(config.getProperties().getProperty(Config.CERTHANDLER_GOOD));
CertificateHandler handler = CertificateHandlerFactory.getInstance().generateHandler(input);
input.close();
assertTrue("Expiry on \n" + handler.getCertificate().toString(), !handler.isExpired());
}
use of com.adaptris.security.certificate.CertificateHandler in project interlok by adaptris.
the class TestCertificateHandler method testExpiredCertificateRevocationCache.
@Test
public void testExpiredCertificateRevocationCache() throws Exception {
try {
InputStream input = new FileInputStream(config.getProperties().getProperty(Config.CERTHANDLER_EXPIRED));
CertificateHandler handler = CertificateHandlerFactory.getInstance().generateHandler(input);
input.close();
assertEquals("Revocation", handler.isRevoked(), false);
Calendar lastExpiredCheck = handler.getLastRevocationCheck();
assertEquals("Calendar", handler.getLastRevocationCheck(), lastExpiredCheck);
} catch (CertException e) {
if (!(e.getCause() != null && e.getCause() instanceof UnknownHostException)) {
throw e;
}
}
}
use of com.adaptris.security.certificate.CertificateHandler in project interlok by adaptris.
the class TestCertificateHandler method testExpiredCertificateRevocation.
@Test
public void testExpiredCertificateRevocation() throws Exception {
try {
InputStream input = new FileInputStream(config.getProperties().getProperty(Config.CERTHANDLER_EXPIRED));
CertificateHandler handler = CertificateHandlerFactory.getInstance().generateHandler(input);
input.close();
assertEquals("Revocation", handler.isRevoked(), false);
assertNotNull(handler.getLastRevocationCheck());
} catch (CertException e) {
if (!(e.getCause() != null && e.getCause() instanceof UnknownHostException)) {
throw e;
}
}
}
Aggregations