Add support for draft-aaron-acme-profiles

master
Jared Crawford 2025-01-09 19:32:19 -05:00 committed by Richard Körber
parent 19371229b8
commit c85f4a627b
3 changed files with 20 additions and 1 deletions

View File

@ -437,6 +437,16 @@ public class Order extends AcmeJsonResource implements PollableResource {
}
}
/**
* Returns the selected profile.
*
* @since 2.3
* @throws AcmeNotSupportedException if profile is not supported
*/
public String getProfile() {
return getJSON().getFeature("profile").toString();
}
@Override
protected void invalidate() {
super.invalidate();

View File

@ -116,6 +116,8 @@ public class OrderBuilderTest {
.isThrownBy(order::getAutoRenewalLifetimeAdjust);
softly.assertThatExceptionOfType(AcmeNotSupportedException.class)
.isThrownBy(order::isAutoRenewalGetEnabled);
softly.assertThatExceptionOfType(AcmeNotSupportedException.class)
.isThrownBy(order::getProfile);
softly.assertThat(order.getLocation()).isEqualTo(locationUrl);
softly.assertThat(order.getAuthorizations()).isNotNull();
softly.assertThat(order.getAuthorizations()).hasSize(2);
@ -369,11 +371,16 @@ public class OrderBuilderTest {
provider.putTestResource(Resource.NEW_ORDER, resourceUrl);
var account = new Account(login);
account.newOrder()
var order = account.newOrder()
.domain("example.org")
.profile("classic")
.create();
try (var softly = new AutoCloseableSoftAssertions()) {
softly.assertThat(order.getProfile()).isEqualTo("classic");
}
provider.close();
provider.close();
}

View File

@ -90,6 +90,8 @@ public class OrderTest {
.isThrownBy(order::getAutoRenewalLifetimeAdjust);
softly.assertThatExceptionOfType(AcmeNotSupportedException.class)
.isThrownBy(order::isAutoRenewalGetEnabled);
softly.assertThatExceptionOfType(AcmeNotSupportedException.class)
.isThrownBy(order::getProfile);
softly.assertThat(order.getError()).isNotEmpty();
softly.assertThat(order.getError().orElseThrow().getType())