Fix Result.Code enum values to use UPPER_CAMEL naming

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133324460
This commit is contained in:
mcilwain 2016-09-15 16:38:05 -07:00 committed by Ben McIlwain
parent 823bdc721f
commit c6e9779af1
38 changed files with 126 additions and 125 deletions

View file

@ -105,7 +105,7 @@ public final class EppController {
} catch (Throwable e) {
// Something bad and unexpected happened. Send the client a generic error, and log it.
logger.severe(e, "Unexpected failure");
return getErrorResponse(clock, Result.create(Code.CommandFailed), flowComponent.trid());
return getErrorResponse(clock, Result.create(Code.COMMAND_FAILED), flowComponent.trid());
}
}

View file

@ -63,7 +63,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.AuthenticationError)
@EppResultCode(Code.AUTHENTICATION_ERROR)
public abstract static class AuthenticationErrorException extends EppException {
public AuthenticationErrorException(String message) {
super(message);
@ -71,7 +71,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.AuthenticationErrorClosingConnection)
@EppResultCode(Code.AUTHENTICATION_ERROR_CLOSING_CONNECTION)
public abstract static class AuthenticationErrorClosingConnectionException extends EppException {
public AuthenticationErrorClosingConnectionException(String message) {
super(message);
@ -79,7 +79,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.AuthorizationError)
@EppResultCode(Code.AUTHORIZATION_ERROR)
public abstract static class AuthorizationErrorException extends EppException {
public AuthorizationErrorException(String message) {
super(message);
@ -87,7 +87,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.InvalidAuthorizationInformationError)
@EppResultCode(Code.INVALID_AUTHORIZATION_INFORMATION_ERROR)
public abstract static class InvalidAuthorizationInformationErrorException extends EppException {
public InvalidAuthorizationInformationErrorException(String message) {
super(message);
@ -95,7 +95,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.CommandUseError)
@EppResultCode(Code.COMMAND_USE_ERROR)
public abstract static class CommandUseErrorException extends EppException {
public CommandUseErrorException(String message) {
super(message);
@ -103,7 +103,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.ObjectExists)
@EppResultCode(Code.OBJECT_EXISTS)
public abstract static class ObjectAlreadyExistsException extends EppException {
public ObjectAlreadyExistsException(String message) {
super(message);
@ -111,7 +111,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.ObjectDoesNotExist)
@EppResultCode(Code.OBJECT_DOES_NOT_EXIST)
public abstract static class ObjectDoesNotExistException extends EppException {
public ObjectDoesNotExistException(Class<?> type, String id) {
super(
@ -135,7 +135,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.ObjectPendingTransfer)
@EppResultCode(Code.OBJECT_PENDING_TRANSFER)
public abstract static class ObjectPendingTransferException extends EppException {
public ObjectPendingTransferException(String id) {
super(String.format("Object with given ID (%s) already has a pending transfer.", id));
@ -143,7 +143,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.ObjectNotPendingTransfer)
@EppResultCode(Code.OBJECT_NOT_PENDING_TRANSFER)
public abstract static class ObjectNotPendingTransferException extends EppException {
public ObjectNotPendingTransferException(String id) {
super(String.format("Object with given ID (%s) does not have a pending transfer.", id));
@ -151,7 +151,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.AssociationProhibitsOperation)
@EppResultCode(Code.ASSOCIATION_PROHIBITS_OPERATION)
public abstract static class AssociationProhibitsOperationException extends EppException {
public AssociationProhibitsOperationException(String message) {
super(message);
@ -159,7 +159,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.ParameterValuePolicyError)
@EppResultCode(Code.PARAMETER_VALUE_POLICY_ERROR)
public abstract static class ParameterValuePolicyErrorException extends EppException {
public ParameterValuePolicyErrorException(String message) {
super(message);
@ -167,7 +167,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.ParameterValueRangeError)
@EppResultCode(Code.PARAMETER_VALUE_RANGE_ERROR)
public abstract static class ParameterValueRangeErrorException extends EppException {
public ParameterValueRangeErrorException(String message) {
super(message);
@ -175,7 +175,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.ParameterValueSyntaxError)
@EppResultCode(Code.PARAMETER_VALUE_SYNTAX_ERROR)
public abstract static class ParameterValueSyntaxErrorException extends EppException {
public ParameterValueSyntaxErrorException(String message) {
super(message);
@ -183,7 +183,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.RequiredParameterMissing)
@EppResultCode(Code.REQUIRED_PARAMETER_MISSING)
public abstract static class RequiredParameterMissingException extends EppException {
public RequiredParameterMissingException(String message) {
super(message);
@ -191,7 +191,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.StatusProhibitsOperation)
@EppResultCode(Code.STATUS_PROHIBITS_OPERATION)
public abstract static class StatusProhibitsOperationException extends EppException {
public StatusProhibitsOperationException(String message) {
super(message);
@ -199,7 +199,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.SyntaxError)
@EppResultCode(Code.SYNTAX_ERROR)
public abstract static class SyntaxErrorException extends EppException {
public SyntaxErrorException(String message) {
super(message);
@ -207,7 +207,7 @@ public abstract class EppException extends Exception {
}
/** Specified command is not implemented. */
@EppResultCode(Code.UnimplementedCommand)
@EppResultCode(Code.UNIMPLEMENTED_COMMAND)
public static class UnimplementedCommandException extends EppException {
public UnimplementedCommandException(InnerCommand command) {
super(String.format(
@ -220,7 +220,7 @@ public abstract class EppException extends Exception {
}
/** Abstract exception class. Do not throw this directly or catch in tests. */
@EppResultCode(Code.UnimplementedOption)
@EppResultCode(Code.UNIMPLEMENTED_OPTION)
public abstract static class UnimplementedOptionException extends EppException {
public UnimplementedOptionException(String message) {
super(message);
@ -228,7 +228,7 @@ public abstract class EppException extends Exception {
}
/** Specified extension is not implemented. */
@EppResultCode(Code.UnimplementedExtension)
@EppResultCode(Code.UNIMPLEMENTED_EXTENSION)
public static class UnimplementedExtensionException extends EppException {
public UnimplementedExtensionException() {
super("Specified extension is not implemented");
@ -236,7 +236,7 @@ public abstract class EppException extends Exception {
}
/** Specified object service is not implemented. */
@EppResultCode(Code.UnimplementedObjectService)
@EppResultCode(Code.UNIMPLEMENTED_OBJECT_SERVICE)
public static class UnimplementedObjectServiceException extends EppException {
public UnimplementedObjectServiceException() {
super("Specified object service is not implemented");
@ -244,7 +244,7 @@ public abstract class EppException extends Exception {
}
/** Specified protocol version is not implemented. */
@EppResultCode(Code.UnimplementedProtocolVersion)
@EppResultCode(Code.UNIMPLEMENTED_PROTOCOL_VERSION)
public static class UnimplementedProtocolVersionException extends EppException {
public UnimplementedProtocolVersionException() {
super("Specified protocol version is not implemented");
@ -252,7 +252,7 @@ public abstract class EppException extends Exception {
}
/** Command failed. */
@EppResultCode(Code.CommandFailed)
@EppResultCode(Code.COMMAND_FAILED)
public static class CommandFailedException extends EppException {
public CommandFailedException() {
super("Command failed");

View file

@ -14,7 +14,7 @@
package google.registry.flows;
import static google.registry.model.eppoutput.Result.Code.SuccessWithActionPending;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.googlecode.objectify.Key;
@ -71,7 +71,7 @@ public abstract class ResourceAsyncDeleteFlow
/** Subclasses can override this to return a different success result code. */
@Override
protected Code getDeleteResultCode() {
return SuccessWithActionPending;
return SUCCESS_WITH_ACTION_PENDING;
}
/** Resource to be deleted has active incoming references. */

View file

@ -14,7 +14,7 @@
package google.registry.flows;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import com.google.common.collect.ImmutableList;
import google.registry.config.RegistryEnvironment;
@ -46,7 +46,7 @@ public abstract class ResourceCheckFlow<R extends EppResource, C extends Resourc
@Override
protected final EppOutput runResourceFlow() throws EppException {
return createOutput(
Success,
SUCCESS,
getCheckData(),
getResponseExtensions());
}

View file

@ -14,7 +14,7 @@
package google.registry.flows;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -55,7 +55,7 @@ public abstract class ResourceDeleteFlow<R extends EppResource, C extends Single
/** Subclasses can override this to return a different success result code. */
protected Code getDeleteResultCode() {
return Success;
return SUCCESS;
}
/** Subclasses can override this to return response extensions. */

View file

@ -15,7 +15,7 @@
package google.registry.flows;
import static google.registry.model.EppResourceUtils.cloneResourceWithLinkedStatus;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import com.google.common.collect.ImmutableList;
import google.registry.model.EppResource;
@ -34,7 +34,7 @@ public abstract class ResourceInfoFlow<R extends EppResource, C extends SingleRe
extends ResourceQueryFlow<R, C> {
@Override
public EppOutput runResourceFlow() throws EppException {
return createOutput(Success, getResourceInfo(), getResponseExtensions());
return createOutput(SUCCESS, getResourceInfo(), getResponseExtensions());
}
@SuppressWarnings("unused")

View file

@ -15,7 +15,7 @@
package google.registry.flows;
import static google.registry.flows.ResourceFlowUtils.createTransferResponse;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import google.registry.flows.EppException.ObjectNotPendingTransferException;
@ -92,7 +92,7 @@ public abstract class ResourceMutatePendingTransferFlow
@Override
protected final EppOutput getOutput() throws EppException {
return createOutput(
Success, createTransferResponse(newResource, newResource.getTransferData(), now));
SUCCESS, createTransferResponse(newResource, newResource.getTransferData(), now));
}
/** The resource does not have a pending transfer. */

View file

@ -15,7 +15,7 @@
package google.registry.flows;
import static google.registry.flows.ResourceFlowUtils.createTransferResponse;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import google.registry.flows.EppException.AuthorizationErrorException;
import google.registry.flows.EppException.CommandUseErrorException;
@ -52,7 +52,7 @@ public abstract class ResourceTransferQueryFlow<R extends EppResource,
@Override
public final EppOutput runResourceFlow() throws EppException {
return createOutput(
Success, createTransferResponse(existingResource, existingResource.getTransferData(), now));
SUCCESS, createTransferResponse(existingResource, existingResource.getTransferData(), now));
}
/** Registrar is not authorized to view transfer status. */

View file

@ -17,7 +17,7 @@ package google.registry.flows;
import static google.registry.flows.ResourceFlowUtils.createPendingTransferNotificationResponse;
import static google.registry.flows.ResourceFlowUtils.createTransferResponse;
import static google.registry.flows.ResourceFlowUtils.verifyAuthInfoForResource;
import static google.registry.model.eppoutput.Result.Code.SuccessWithActionPending;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.CollectionUtils.union;
@ -180,7 +180,7 @@ import org.joda.time.Duration;
@Override
protected final EppOutput getOutput() throws EppException {
return createOutput(
SuccessWithActionPending,
SUCCESS_WITH_ACTION_PENDING,
createTransferResponse(newResource, newResource.getTransferData(), now),
getTransferResponseExtensions());
}

View file

@ -14,7 +14,7 @@
package google.registry.flows;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
@ -105,7 +105,7 @@ public abstract class ResourceUpdateFlow
@Override
protected final EppOutput getOutput() {
return createOutput(Success);
return createOutput(SUCCESS);
}
/** The specified status value cannot be set by clients. */

View file

@ -15,7 +15,7 @@
package google.registry.flows.contact;
import static google.registry.model.EppResourceUtils.checkResourcesExist;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import com.google.common.collect.ImmutableList;
import google.registry.config.ConfigModule.Config;
@ -55,6 +55,6 @@ public class ContactCheckFlow extends LoggedInFlow {
boolean unused = !existingIds.contains(id);
checks.add(ContactCheck.create(unused, id, unused ? null : "In use"));
}
return createOutput(Success, ContactCheckData.create(checks.build()));
return createOutput(SUCCESS, ContactCheckData.create(checks.build()));
}
}

View file

@ -18,7 +18,7 @@ import static google.registry.flows.contact.ContactFlowUtils.validateAsciiPostal
import static google.registry.flows.contact.ContactFlowUtils.validateContactAgainstPolicy;
import static google.registry.model.EppResourceUtils.createContactHostRoid;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.googlecode.objectify.Key;
@ -86,6 +86,6 @@ public class ContactCreateFlow extends LoggedInFlow implements TransactionalFlow
historyBuilder.build(),
ForeignKeyIndex.create(newResource, newResource.getDeletionTime()),
EppResourceIndex.create(Key.create(newResource)));
return createOutput(Success, ContactCreateData.create(newResource.getContactId(), now));
return createOutput(SUCCESS, ContactCreateData.create(newResource.getContactId(), now));
}
}

View file

@ -19,7 +19,7 @@ import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.SuccessWithActionPending;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Function;
@ -115,6 +115,6 @@ public class ContactDeleteFlow extends LoggedInFlow implements TransactionalFlow
.setModificationTime(now)
.setParent(Key.create(existingResource));
ofy().save().<Object>entities(newResource, historyBuilder.build());
return createOutput(SuccessWithActionPending);
return createOutput(SUCCESS_WITH_ACTION_PENDING);
}
}

View file

@ -17,7 +17,7 @@ package google.registry.flows.contact;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
import static google.registry.model.EppResourceUtils.cloneResourceWithLinkedStatus;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import com.google.common.base.Optional;
import google.registry.flows.EppException;
@ -47,6 +47,6 @@ public class ContactInfoFlow extends LoggedInFlow {
throw new ResourceToQueryDoesNotExistException(ContactResource.class, targetId);
}
verifyOptionalAuthInfoForResource(authInfo, existingResource);
return createOutput(Success, cloneResourceWithLinkedStatus(existingResource, now));
return createOutput(SUCCESS, cloneResourceWithLinkedStatus(existingResource, now));
}
}

View file

@ -19,7 +19,7 @@ import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
import static google.registry.flows.contact.ContactFlowUtils.createGainingTransferPollMessage;
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Optional;
@ -91,6 +91,6 @@ public class ContactTransferApproveFlow extends LoggedInFlow implements Transact
// Delete the billing event and poll messages that were written in case the transfer would have
// been implicitly server approved.
ofy().delete().keys(existingResource.getTransferData().getServerApproveEntities());
return createOutput(Success, createTransferResponse(targetId, newResource.getTransferData()));
return createOutput(SUCCESS, createTransferResponse(targetId, newResource.getTransferData()));
}
}

View file

@ -18,7 +18,7 @@ import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForR
import static google.registry.flows.contact.ContactFlowUtils.createLosingTransferPollMessage;
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Optional;
@ -92,6 +92,6 @@ public class ContactTransferCancelFlow extends LoggedInFlow implements Transacti
// Delete the billing event and poll messages that were written in case the transfer would have
// been implicitly server approved.
ofy().delete().keys(existingResource.getTransferData().getServerApproveEntities());
return createOutput(Success, createTransferResponse(targetId, newResource.getTransferData()));
return createOutput(SUCCESS, createTransferResponse(targetId, newResource.getTransferData()));
}
}

View file

@ -17,7 +17,7 @@ package google.registry.flows.contact;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import com.google.common.base.Optional;
import google.registry.flows.EppException;
@ -67,6 +67,6 @@ public class ContactTransferQueryFlow extends LoggedInFlow {
throw new NotAuthorizedToViewTransferException();
}
return createOutput(
Success, createTransferResponse(targetId, existingResource.getTransferData()));
SUCCESS, createTransferResponse(targetId, existingResource.getTransferData()));
}
}

View file

@ -19,7 +19,7 @@ import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
import static google.registry.flows.contact.ContactFlowUtils.createGainingTransferPollMessage;
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Optional;
@ -86,6 +86,6 @@ public class ContactTransferRejectFlow extends LoggedInFlow implements Transacti
// Delete the billing event and poll messages that were written in case the transfer would have
// been implicitly server approved.
ofy().delete().keys(existingResource.getTransferData().getServerApproveEntities());
return createOutput(Success, createTransferResponse(targetId, newResource.getTransferData()));
return createOutput(SUCCESS, createTransferResponse(targetId, newResource.getTransferData()));
}
}

View file

@ -20,7 +20,7 @@ import static google.registry.flows.contact.ContactFlowUtils.createGainingTransf
import static google.registry.flows.contact.ContactFlowUtils.createLosingTransferPollMessage;
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.SuccessWithActionPending;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Optional;
@ -140,7 +140,8 @@ public class ContactTransferRequestFlow extends LoggedInFlow implements Transact
serverApproveGainingPollMessage,
serverApproveLosingPollMessage);
return createOutput(
SuccessWithActionPending, createTransferResponse(targetId, newResource.getTransferData()));
SUCCESS_WITH_ACTION_PENDING,
createTransferResponse(targetId, newResource.getTransferData()));
}
}

View file

@ -20,7 +20,7 @@ import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
import static google.registry.flows.contact.ContactFlowUtils.validateAsciiPostalInfo;
import static google.registry.flows.contact.ContactFlowUtils.validateContactAgainstPolicy;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Optional;
@ -127,6 +127,6 @@ public class ContactUpdateFlow extends LoggedInFlow implements TransactionalFlow
validateAsciiPostalInfo(newResource.getInternationalizedPostalInfo());
validateContactAgainstPolicy(newResource);
ofy().save().<Object>entities(newResource, historyBuilder.build());
return createOutput(Success);
return createOutput(SUCCESS);
}
}

View file

@ -16,7 +16,7 @@ package google.registry.flows.domain;
import static google.registry.flows.domain.DomainFlowUtils.DISALLOWED_TLD_STATES_FOR_LAUNCH_FLOWS;
import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.index.ForeignKeyIndex.loadAndGetKey;
@ -218,7 +218,7 @@ public class DomainApplicationCreateFlow extends BaseDomainCreateFlow<DomainAppl
}
return createOutput(
Success,
SUCCESS,
DomainCreateData.create(newResource.getFullyQualifiedDomainName(), now, null),
responseExtensionsBuilder.build());
}

View file

@ -101,7 +101,7 @@ public abstract class DomainCreateOrAllocateFlow
@Override
protected final EppOutput getOutput() {
return createOutput(
Result.Code.Success,
Result.Code.SUCCESS,
DomainCreateData.create(
newResource.getFullyQualifiedDomainName(),
now,

View file

@ -17,8 +17,8 @@ package google.registry.flows.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld;
import static google.registry.flows.domain.DomainFlowUtils.updateAutorenewRecurrenceEndTime;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SuccessWithActionPending;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
import static google.registry.util.CollectionUtils.nullToEmpty;
@ -187,7 +187,7 @@ public class DomainDeleteFlow extends ResourceSyncDeleteFlow<DomainResource, Bui
@Override
protected final Code getDeleteResultCode() {
return newResource.getDeletionTime().isAfter(now)
? SuccessWithActionPending : Success;
? SUCCESS_WITH_ACTION_PENDING : SUCCESS;
}
@Nullable

View file

@ -23,7 +23,7 @@ import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge;
import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears;
import static google.registry.model.domain.DomainResource.MAX_REGISTRATION_YEARS;
import static google.registry.model.domain.fee.Fee.FEE_RENEW_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
import static google.registry.util.DateTimeUtils.leapSafeAddYears;
@ -197,7 +197,7 @@ public class DomainRenewFlow extends OwnedResourceMutateFlow<DomainResource, Ren
@Override
protected final EppOutput getOutput() {
return createOutput(
Success,
SUCCESS,
DomainRenewData.create(
newResource.getFullyQualifiedDomainName(), newResource.getRegistrationExpirationTime()),
(feeRenew == null)

View file

@ -21,7 +21,7 @@ import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge;
import static google.registry.flows.domain.DomainFlowUtils.verifyNotReserved;
import static google.registry.flows.domain.DomainFlowUtils.verifyPremiumNameIsNotBlocked;
import static google.registry.model.domain.fee.Fee.FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
@ -200,7 +200,7 @@ public class DomainRestoreRequestFlow extends OwnedResourceMutateFlow<DomainReso
@Override
protected final EppOutput getOutput() {
return createOutput(
Success,
SUCCESS,
null,
(feeUpdate == null)
? null

View file

@ -15,7 +15,7 @@
package google.registry.flows.host;
import static google.registry.model.EppResourceUtils.checkResourcesExist;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import com.google.common.collect.ImmutableList;
import google.registry.config.ConfigModule.Config;
@ -55,6 +55,6 @@ public class HostCheckFlow extends LoggedInFlow {
boolean unused = !existingIds.contains(id);
checks.add(HostCheck.create(unused, id, unused ? null : "In use"));
}
return createOutput(Success, HostCheckData.create(checks.build()));
return createOutput(SUCCESS, HostCheckData.create(checks.build()));
}
}

View file

@ -19,7 +19,7 @@ import static google.registry.flows.host.HostFlowUtils.validateHostName;
import static google.registry.flows.host.HostFlowUtils.verifyDomainIsSameRegistrar;
import static google.registry.model.EppResourceUtils.createContactHostRoid;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.CollectionUtils.isNullOrEmpty;
import static google.registry.util.CollectionUtils.union;
@ -126,7 +126,7 @@ public class HostCreateFlow extends LoggedInFlow implements TransactionalFlow {
DnsQueue.create().addHostRefreshTask(targetId);
}
ofy().save().entities(entitiesToSave);
return createOutput(Success, HostCreateData.create(targetId, now));
return createOutput(SUCCESS, HostCreateData.create(targetId, now));
}
/** Subordinate hosts must have an ip address. */

View file

@ -19,7 +19,7 @@ import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.SuccessWithActionPending;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Function;
@ -114,6 +114,6 @@ public class HostDeleteFlow extends LoggedInFlow implements TransactionalFlow {
.setModificationTime(now)
.setParent(Key.create(existingResource));
ofy().save().<Object>entities(newResource, historyBuilder.build());
return createOutput(SuccessWithActionPending);
return createOutput(SUCCESS_WITH_ACTION_PENDING);
}
}

View file

@ -17,7 +17,7 @@ package google.registry.flows.host;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
import static google.registry.model.EppResourceUtils.cloneResourceWithLinkedStatus;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import com.google.common.base.Optional;
import google.registry.flows.EppException;
@ -50,6 +50,6 @@ public class HostInfoFlow extends LoggedInFlow {
throw new ResourceToQueryDoesNotExistException(HostResource.class, targetId);
}
verifyOptionalAuthInfoForResource(authInfo, existingResource);
return createOutput(Success, cloneResourceWithLinkedStatus(existingResource, now));
return createOutput(SUCCESS, cloneResourceWithLinkedStatus(existingResource, now));
}
}

View file

@ -22,7 +22,7 @@ import static google.registry.flows.host.HostFlowUtils.lookupSuperordinateDomain
import static google.registry.flows.host.HostFlowUtils.validateHostName;
import static google.registry.flows.host.HostFlowUtils.verifyDomainIsSameRegistrar;
import static google.registry.model.EppResourceUtils.loadByUniqueId;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.index.ForeignKeyIndex.loadAndGetKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.CollectionUtils.isNullOrEmpty;
@ -156,7 +156,7 @@ public class HostUpdateFlow extends LoggedInFlow implements TransactionalFlow {
.setParent(Key.create(existingResource))
.build());
ofy().save().entities(entitiesToSave.build());
return createOutput(Success);
return createOutput(SUCCESS);
}
private void verifyUpdateAllowed(

View file

@ -16,8 +16,8 @@ package google.registry.flows.poll;
import static com.google.common.base.Preconditions.checkState;
import static google.registry.flows.poll.PollFlowUtils.getPollMessagesQuery;
import static google.registry.model.eppoutput.Result.Code.Success;
import static google.registry.model.eppoutput.Result.Code.SuccessWithNoMessages;
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_NO_MESSAGES;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.DateTimeUtils.isBeforeOrAt;
@ -117,9 +117,9 @@ public class PollAckFlow extends LoggedInFlow implements TransactionalFlow {
messageCount--;
}
if (messageCount <= 0) {
return createOutput(SuccessWithNoMessages);
return createOutput(SUCCESS_WITH_NO_MESSAGES);
}
return createOutput(Success, null, null, MessageQueueInfo.create(
return createOutput(SUCCESS, null, null, MessageQueueInfo.create(
null, // eventTime
null, // msg
messageCount,

View file

@ -15,8 +15,8 @@
package google.registry.flows.poll;
import static google.registry.flows.poll.PollFlowUtils.getPollMessagesQuery;
import static google.registry.model.eppoutput.Result.Code.SuccessWithAckMessage;
import static google.registry.model.eppoutput.Result.Code.SuccessWithNoMessages;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACK_MESSAGE;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_NO_MESSAGES;
import static google.registry.util.CollectionUtils.forceEmptyToNull;
import com.googlecode.objectify.Key;
@ -49,10 +49,10 @@ public class PollRequestFlow extends LoggedInFlow {
// Return the oldest message from the queue.
PollMessage pollMessage = getPollMessagesQuery(clientId, now).first().now();
if (pollMessage == null) {
return createOutput(SuccessWithNoMessages);
return createOutput(SUCCESS_WITH_NO_MESSAGES);
}
return createOutput(
SuccessWithAckMessage,
SUCCESS_WITH_ACK_MESSAGE,
forceEmptyToNull(pollMessage.getResponseData()),
forceEmptyToNull(pollMessage.getResponseExtensions()),
MessageQueueInfo.create(

View file

@ -132,7 +132,7 @@ public class LoginFlow extends Flow {
sessionMetadata.resetFailedLoginAttempts();
sessionMetadata.setClientId(login.getClientId());
sessionMetadata.setServiceExtensionUris(serviceExtensionUrisBuilder.build());
return createOutput(Code.Success);
return createOutput(Code.SUCCESS);
}
/** Registrar with this client ID could not be found. */

View file

@ -14,7 +14,7 @@
package google.registry.flows.session;
import static google.registry.model.eppoutput.Result.Code.SuccessAndClose;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_AND_CLOSE;
import google.registry.flows.EppException;
import google.registry.flows.LoggedInFlow;
@ -33,6 +33,6 @@ public class LogoutFlow extends LoggedInFlow {
@Override
public final EppOutput run() throws EppException {
sessionMetadata.invalidate();
return createOutput(SuccessAndClose);
return createOutput(SUCCESS_AND_CLOSE);
}
}

View file

@ -40,88 +40,88 @@ public class Result extends ImmutableObject {
*/
public enum Code {
@XmlEnumValue("1000")
Success("Command completed successfully"),
SUCCESS("Command completed successfully"),
@XmlEnumValue("1001")
SuccessWithActionPending("Command completed successfully; action pending"),
SUCCESS_WITH_ACTION_PENDING("Command completed successfully; action pending"),
@XmlEnumValue("1300")
SuccessWithNoMessages("Command completed successfully; no messages"),
SUCCESS_WITH_NO_MESSAGES("Command completed successfully; no messages"),
@XmlEnumValue("1301")
SuccessWithAckMessage("Command completed successfully; ack to dequeue"),
SUCCESS_WITH_ACK_MESSAGE("Command completed successfully; ack to dequeue"),
@XmlEnumValue("1500")
SuccessAndClose("Command completed successfully; ending session"),
SUCCESS_AND_CLOSE("Command completed successfully; ending session"),
@XmlEnumValue("2000")
UnknownCommand("Unknown command"),
UNKNOWN_COMMAND("Unknown command"),
@XmlEnumValue("2001")
SyntaxError("Command syntax error"),
SYNTAX_ERROR("Command syntax error"),
@XmlEnumValue("2002")
CommandUseError("Command use error"),
COMMAND_USE_ERROR("Command use error"),
@XmlEnumValue("2003")
RequiredParameterMissing("Required parameter missing"),
REQUIRED_PARAMETER_MISSING("Required parameter missing"),
@XmlEnumValue("2004")
ParameterValueRangeError("Parameter value range error"),
PARAMETER_VALUE_RANGE_ERROR("Parameter value range error"),
@XmlEnumValue("2005")
ParameterValueSyntaxError("Parameter value syntax error"),
PARAMETER_VALUE_SYNTAX_ERROR("Parameter value syntax error"),
@XmlEnumValue("2100")
UnimplementedProtocolVersion("Unimplemented protocol version"),
UNIMPLEMENTED_PROTOCOL_VERSION("Unimplemented protocol version"),
@XmlEnumValue("2101")
UnimplementedCommand("Unimplemented command"),
UNIMPLEMENTED_COMMAND("Unimplemented command"),
@XmlEnumValue("2102")
UnimplementedOption("Unimplemented option"),
UNIMPLEMENTED_OPTION("Unimplemented option"),
@XmlEnumValue("2103")
UnimplementedExtension("Unimplemented extension"),
UNIMPLEMENTED_EXTENSION("Unimplemented extension"),
@XmlEnumValue("2200")
AuthenticationError("Authentication error"),
AUTHENTICATION_ERROR("Authentication error"),
@XmlEnumValue("2201")
AuthorizationError("Authorization error"),
AUTHORIZATION_ERROR("Authorization error"),
@XmlEnumValue("2202")
InvalidAuthorizationInformationError("Invalid authorization information"),
INVALID_AUTHORIZATION_INFORMATION_ERROR("Invalid authorization information"),
@XmlEnumValue("2300")
ObjectPendingTransfer("Object pending transfer"),
OBJECT_PENDING_TRANSFER("Object pending transfer"),
@XmlEnumValue("2301")
ObjectNotPendingTransfer("Object not pending transfer"),
OBJECT_NOT_PENDING_TRANSFER("Object not pending transfer"),
@XmlEnumValue("2302")
ObjectExists("Object exists"),
OBJECT_EXISTS("Object exists"),
@XmlEnumValue("2303")
ObjectDoesNotExist("Object does not exist"),
OBJECT_DOES_NOT_EXIST("Object does not exist"),
@XmlEnumValue("2304")
StatusProhibitsOperation("Object status prohibits operation"),
STATUS_PROHIBITS_OPERATION("Object status prohibits operation"),
@XmlEnumValue("2305")
AssociationProhibitsOperation("Object association prohibits operation"),
ASSOCIATION_PROHIBITS_OPERATION("Object association prohibits operation"),
@XmlEnumValue("2306")
ParameterValuePolicyError("Parameter value policy error"),
PARAMETER_VALUE_POLICY_ERROR("Parameter value policy error"),
@XmlEnumValue("2307")
UnimplementedObjectService("Unimplemented object service"),
UNIMPLEMENTED_OBJECT_SERVICE("Unimplemented object service"),
@XmlEnumValue("2400")
CommandFailed("Command failed"),
COMMAND_FAILED("Command failed"),
@XmlEnumValue("2501")
AuthenticationErrorClosingConnection("Authentication error; server closing connection");
AUTHENTICATION_ERROR_CLOSING_CONNECTION("Authentication error; server closing connection");
/** A four-digit (positive) number that describes the success or failure of the command. */
public final int code;

View file

@ -80,7 +80,7 @@ public class EppControllerTest extends ShardableTestCase {
when(eppOutput.isResponse()).thenReturn(true);
when(eppOutput.getResponse()).thenReturn(eppResponse);
when(eppResponse.getResult()).thenReturn(result);
when(result.getCode()).thenReturn(Code.SuccessWithNoMessages);
when(result.getCode()).thenReturn(Code.SUCCESS_WITH_NO_MESSAGES);
eppController = new EppController();
eppController.metricBuilder = EppMetric.builderForRequest("request-id-1", clock);
@ -94,7 +94,7 @@ public class EppControllerTest extends ShardableTestCase {
public void testMarshallingUnknownError() throws Exception {
marshal(
EppController.getErrorResponse(
new SystemClock(), Result.create(Code.CommandFailed), Trid.create(null)),
new SystemClock(), Result.create(Code.COMMAND_FAILED), Trid.create(null)),
ValidationMode.STRICT);
}
@ -116,7 +116,7 @@ public class EppControllerTest extends ShardableTestCase {
assertThat(metric.getEndTimestamp()).isEqualTo(clock.nowUtc());
assertThat(metric.getClientId()).hasValue("some-client");
assertThat(metric.getPrivilegeLevel()).hasValue("NORMAL");
assertThat(metric.getStatus()).hasValue(Code.SyntaxError);
assertThat(metric.getStatus()).hasValue(Code.SYNTAX_ERROR);
}
@Test
@ -140,7 +140,7 @@ public class EppControllerTest extends ShardableTestCase {
assertThat(metric.getEndTimestamp()).isEqualTo(clock.nowUtc());
assertThat(metric.getClientId()).hasValue("some-client");
assertThat(metric.getPrivilegeLevel()).hasValue("SUPERUSER");
assertThat(metric.getStatus()).hasValue(Code.SuccessWithNoMessages);
assertThat(metric.getStatus()).hasValue(Code.SUCCESS_WITH_NO_MESSAGES);
assertThat(metric.getCommandName()).hasValue("Create");
assertThat(metric.getEppTarget()).hasValue("example.tld");
}

View file

@ -431,7 +431,7 @@ public class DomainResourceTest extends EntityTestCase {
int numPreviousReads = RequestCapturingAsyncDatastoreService.getReads().size();
EppXmlTransformer.marshal(
EppOutput.create(new EppResponse.Builder()
.setResult(Result.create(Code.Success))
.setResult(Result.create(Code.SUCCESS))
.setResData(ImmutableList.of(domain))
.setTrid(Trid.create(null, "abc"))
.build()),

View file

@ -44,7 +44,7 @@ public class EppMetricTest {
.setClientId("client")
.setPrivilegeLevel("level")
.setEppTarget("target")
.setStatus(Code.CommandUseError)
.setStatus(Code.COMMAND_USE_ERROR)
.incrementAttempts()
.build();
@ -74,7 +74,7 @@ public class EppMetricTest {
.setClientId("client")
.setPrivilegeLevel("level")
.setEppTarget("target")
.setStatus(Code.CommandUseError)
.setStatus(Code.COMMAND_USE_ERROR)
.incrementAttempts()
.build();
ImmutableSet.Builder<String> schemaFieldNames = new ImmutableSet.Builder<>();