mirror of
https://github.com/shred/acme4j.git
synced 2025-12-13 11:14:02 +08:00
Add support for draft-aaron-acme-profiles
This commit is contained in:
committed by
Richard Körber
parent
19371229b8
commit
c85f4a627b
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user