use of org.apereo.cas.adaptors.x509.util.MockX509CRL in project cas by apereo.
the class ThresholdExpiredCRLRevocationPolicyTests method getTestParameters.
/**
* Gets the unit test parameters.
*
* @return Test parameter data.
* @throws Exception if there is an exception getting the test parameters.
*/
@Parameters
public static Collection<Object[]> getTestParameters() throws Exception {
final Collection<Object[]> params = new ArrayList<>();
final ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC);
final ZonedDateTime twoHoursAgo = now.minusHours(2);
final ZonedDateTime oneHourAgo = now.minusHours(1);
final ZonedDateTime halfHourAgo = now.minusMinutes(30);
final X500Principal issuer = new X500Principal("CN=CAS");
// Test case #1
// Expect expired for zero leniency on CRL expiring 1ms ago
final ThresholdExpiredCRLRevocationPolicy zeroThreshold = new ThresholdExpiredCRLRevocationPolicy(0);
params.add(new Object[] { zeroThreshold, new MockX509CRL(issuer, DateTimeUtils.dateOf(oneHourAgo), DateTimeUtils.dateOf(now.minusSeconds(1))), new ExpiredCRLException("CN=CAS", ZonedDateTime.now(ZoneOffset.UTC)) });
// Test case #2
// Expect expired for 1h leniency on CRL expired 1 hour 1ms ago
final ThresholdExpiredCRLRevocationPolicy oneHourThreshold = new ThresholdExpiredCRLRevocationPolicy(3600);
params.add(new Object[] { oneHourThreshold, new MockX509CRL(issuer, DateTimeUtils.dateOf(twoHoursAgo), DateTimeUtils.dateOf(oneHourAgo.minusSeconds(1))), new ExpiredCRLException("CN=CAS", ZonedDateTime.now(ZoneOffset.UTC)) });
// Test case #3
// Expect valid for 1h leniency on CRL expired 30m ago
params.add(new Object[] { oneHourThreshold, new MockX509CRL(issuer, DateTimeUtils.dateOf(twoHoursAgo), DateTimeUtils.dateOf(halfHourAgo)), null });
return params;
}
Aggregations