mirror of https://github.com/shred/acme4j
Wait for the order to become valid
parent
827e1277ef
commit
6cfd898895
|
@ -157,7 +157,7 @@ public class OrderIT extends PebbleITBase {
|
||||||
.pollInterval(1, SECONDS)
|
.pollInterval(1, SECONDS)
|
||||||
.timeout(30, SECONDS)
|
.timeout(30, SECONDS)
|
||||||
.conditionEvaluationListener(cond -> updateAuth(auth))
|
.conditionEvaluationListener(cond -> updateAuth(auth))
|
||||||
.until(auth::getStatus, not(Status.PENDING));
|
.until(auth::getStatus, not(isOneOf(Status.PENDING, Status.PROCESSING)));
|
||||||
|
|
||||||
if (auth.getStatus() != Status.VALID) {
|
if (auth.getStatus() != Status.VALID) {
|
||||||
fail("Authorization failed");
|
fail("Authorization failed");
|
||||||
|
@ -171,6 +171,13 @@ public class OrderIT extends PebbleITBase {
|
||||||
|
|
||||||
order.execute(encodedCsr);
|
order.execute(encodedCsr);
|
||||||
|
|
||||||
|
await()
|
||||||
|
.pollInterval(1, SECONDS)
|
||||||
|
.timeout(30, SECONDS)
|
||||||
|
.conditionEvaluationListener(cond -> updateOrder(order))
|
||||||
|
.until(order::getStatus, not(isOneOf(Status.PENDING, Status.PROCESSING)));
|
||||||
|
|
||||||
|
|
||||||
Certificate certificate = order.getCertificate();
|
Certificate certificate = order.getCertificate();
|
||||||
X509Certificate cert = certificate.getCertificate();
|
X509Certificate cert = certificate.getCertificate();
|
||||||
assertThat(cert, not(nullValue()));
|
assertThat(cert, not(nullValue()));
|
||||||
|
@ -193,6 +200,20 @@ public class OrderIT extends PebbleITBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Safely updates the order, catching checked exceptions.
|
||||||
|
*
|
||||||
|
* @param order
|
||||||
|
* {@link Order} to update
|
||||||
|
*/
|
||||||
|
private void updateOrder(Order order) {
|
||||||
|
try {
|
||||||
|
order.update();
|
||||||
|
} catch (AcmeException ex) {
|
||||||
|
throw new AcmeLazyLoadingException(order, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
private static interface Validator {
|
private static interface Validator {
|
||||||
Challenge prepare(Authorization auth) throws Exception;
|
Challenge prepare(Authorization auth) throws Exception;
|
||||||
|
|
Loading…
Reference in New Issue