Rename updateAccount to modifyAccount

Reserve the term "update" for updating DTOs to the current server state
pull/17/merge
Richard Körber 2015-12-20 23:24:45 +01:00
parent 7d9d851046
commit 8b0f266455
6 changed files with 13 additions and 13 deletions

View File

@ -39,7 +39,7 @@ public interface AcmeClient {
void newRegistration(Account account, Registration registration) throws AcmeException;
/**
* Updates an existing account.
* Modifies an existing account.
*
* @param account
* {@link Account} that is registered
@ -47,7 +47,7 @@ public interface AcmeClient {
* {@link Registration} containing updated registration data. Set the
* account location via {@link Registration#setLocation(URI)}!
*/
void updateRegistration(Account account, Registration registration) throws AcmeException;
void modifyRegistration(Account account, Registration registration) throws AcmeException;
/**
* Creates a new {@link Authorization} for a domain.
@ -79,7 +79,7 @@ public interface AcmeClient {
void updateChallenge(Challenge challenge) throws AcmeException;
/**
* Restore a {@link Challenge} instance if only the challenge URI is known. It
* Restores a {@link Challenge} instance if only the challenge URI is known. It
* contains the current state.
*
* @param challengeUri
@ -90,7 +90,7 @@ public interface AcmeClient {
<T extends Challenge> T restoreChallenge(URI challengeUri) throws AcmeException;
/**
* Request a certificate.
* Requests a certificate.
*
* @param account
* {@link Account} to be used for conversation

View File

@ -125,7 +125,7 @@ public abstract class AbstractAcmeClient implements AcmeClient {
}
@Override
public void updateRegistration(Account account, Registration registration) throws AcmeException {
public void modifyRegistration(Account account, Registration registration) throws AcmeException {
if (account == null) {
throw new NullPointerException("account must not be null");
}
@ -136,7 +136,7 @@ public abstract class AbstractAcmeClient implements AcmeClient {
throw new IllegalArgumentException("registration location must not be null. Use newRegistration() if not known.");
}
LOG.debug("updateRegistration");
LOG.debug("modifyRegistration");
try (Connection conn = createConnection()) {
ClaimBuilder claims = new ClaimBuilder();
claims.putResource("reg");

View File

@ -105,10 +105,10 @@ public class AbstractAcmeClientTest {
}
/**
* Test that a {@link Registration} can be updated.
* Test that a {@link Registration} can be modified.
*/
@Test
public void testUpdateRegistration() throws AcmeException {
public void testModifyRegistration() throws AcmeException {
Registration registration = new Registration();
registration.setAgreement(agreementUri);
registration.addContact("mailto:foo2@example.com");
@ -118,7 +118,7 @@ public class AbstractAcmeClientTest {
@Override
public int sendSignedRequest(URI uri, ClaimBuilder claims, Session session, Account account) throws AcmeException {
assertThat(uri, is(locationUri));
assertThat(claims.toString(), sameJSONAs(getJson("updateRegistration")));
assertThat(claims.toString(), sameJSONAs(getJson("modifyRegistration")));
assertThat(session, is(notNullValue()));
assertThat(account, is(sameInstance(testAccount)));
return HttpURLConnection.HTTP_ACCEPTED;
@ -140,7 +140,7 @@ public class AbstractAcmeClientTest {
TestableAbstractAcmeClient client = new TestableAbstractAcmeClient(connection);
client.updateRegistration(testAccount, registration);
client.modifyRegistration(testAccount, registration);
assertThat(registration.getLocation(), is(locationUri));
assertThat(registration.getAgreement(), is(agreementUri));

View File

@ -16,7 +16,7 @@ newRegistration = \
{"resource":"new-reg",\
"contact":["mailto:foo@example.com"]}
updateRegistration = \
modifyRegistration = \
{"resource":"reg",\
"agreement":"http://example.com/agreement.pdf",\
"contact":["mailto:foo2@example.com"]}

View File

@ -234,7 +234,7 @@ public class ClientTest {
return false;
}
client.updateRegistration(account, reg);
client.modifyRegistration(account, reg);
LOG.info("Updated user's T&C");
return true;

View File

@ -35,5 +35,5 @@ Registration reg = new Registration();
reg.setLocation(accountLocationUri);
reg.setAgreement(agreementUri);
client.updateRegistration(account, reg);
client.modifyRegistration(account, reg);
```