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) { } catch (Throwable e) {
// Something bad and unexpected happened. Send the client a generic error, and log it. // Something bad and unexpected happened. Send the client a generic error, and log it.
logger.severe(e, "Unexpected failure"); 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. */ /** 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 abstract static class AuthenticationErrorException extends EppException {
public AuthenticationErrorException(String message) { public AuthenticationErrorException(String message) {
super(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. */ /** 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 abstract static class AuthenticationErrorClosingConnectionException extends EppException {
public AuthenticationErrorClosingConnectionException(String message) { public AuthenticationErrorClosingConnectionException(String message) {
super(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. */ /** 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 abstract static class AuthorizationErrorException extends EppException {
public AuthorizationErrorException(String message) { public AuthorizationErrorException(String message) {
super(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. */ /** 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 abstract static class InvalidAuthorizationInformationErrorException extends EppException {
public InvalidAuthorizationInformationErrorException(String message) { public InvalidAuthorizationInformationErrorException(String message) {
super(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. */ /** 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 abstract static class CommandUseErrorException extends EppException {
public CommandUseErrorException(String message) { public CommandUseErrorException(String message) {
super(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. */ /** 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 abstract static class ObjectAlreadyExistsException extends EppException {
public ObjectAlreadyExistsException(String message) { public ObjectAlreadyExistsException(String message) {
super(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. */ /** 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 abstract static class ObjectDoesNotExistException extends EppException {
public ObjectDoesNotExistException(Class<?> type, String id) { public ObjectDoesNotExistException(Class<?> type, String id) {
super( super(
@ -135,7 +135,7 @@ public abstract class EppException extends Exception {
} }
/** Abstract exception class. Do not throw this directly or catch in tests. */ /** 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 abstract static class ObjectPendingTransferException extends EppException {
public ObjectPendingTransferException(String id) { public ObjectPendingTransferException(String id) {
super(String.format("Object with given ID (%s) already has a pending transfer.", 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. */ /** 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 abstract static class ObjectNotPendingTransferException extends EppException {
public ObjectNotPendingTransferException(String id) { public ObjectNotPendingTransferException(String id) {
super(String.format("Object with given ID (%s) does not have a pending transfer.", 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. */ /** 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 abstract static class AssociationProhibitsOperationException extends EppException {
public AssociationProhibitsOperationException(String message) { public AssociationProhibitsOperationException(String message) {
super(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. */ /** 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 abstract static class ParameterValuePolicyErrorException extends EppException {
public ParameterValuePolicyErrorException(String message) { public ParameterValuePolicyErrorException(String message) {
super(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. */ /** 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 abstract static class ParameterValueRangeErrorException extends EppException {
public ParameterValueRangeErrorException(String message) { public ParameterValueRangeErrorException(String message) {
super(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. */ /** 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 abstract static class ParameterValueSyntaxErrorException extends EppException {
public ParameterValueSyntaxErrorException(String message) { public ParameterValueSyntaxErrorException(String message) {
super(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. */ /** 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 abstract static class RequiredParameterMissingException extends EppException {
public RequiredParameterMissingException(String message) { public RequiredParameterMissingException(String message) {
super(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. */ /** 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 abstract static class StatusProhibitsOperationException extends EppException {
public StatusProhibitsOperationException(String message) { public StatusProhibitsOperationException(String message) {
super(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. */ /** 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 abstract static class SyntaxErrorException extends EppException {
public SyntaxErrorException(String message) { public SyntaxErrorException(String message) {
super(message); super(message);
@ -207,7 +207,7 @@ public abstract class EppException extends Exception {
} }
/** Specified command is not implemented. */ /** Specified command is not implemented. */
@EppResultCode(Code.UnimplementedCommand) @EppResultCode(Code.UNIMPLEMENTED_COMMAND)
public static class UnimplementedCommandException extends EppException { public static class UnimplementedCommandException extends EppException {
public UnimplementedCommandException(InnerCommand command) { public UnimplementedCommandException(InnerCommand command) {
super(String.format( 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. */ /** 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 abstract static class UnimplementedOptionException extends EppException {
public UnimplementedOptionException(String message) { public UnimplementedOptionException(String message) {
super(message); super(message);
@ -228,7 +228,7 @@ public abstract class EppException extends Exception {
} }
/** Specified extension is not implemented. */ /** Specified extension is not implemented. */
@EppResultCode(Code.UnimplementedExtension) @EppResultCode(Code.UNIMPLEMENTED_EXTENSION)
public static class UnimplementedExtensionException extends EppException { public static class UnimplementedExtensionException extends EppException {
public UnimplementedExtensionException() { public UnimplementedExtensionException() {
super("Specified extension is not implemented"); super("Specified extension is not implemented");
@ -236,7 +236,7 @@ public abstract class EppException extends Exception {
} }
/** Specified object service is not implemented. */ /** Specified object service is not implemented. */
@EppResultCode(Code.UnimplementedObjectService) @EppResultCode(Code.UNIMPLEMENTED_OBJECT_SERVICE)
public static class UnimplementedObjectServiceException extends EppException { public static class UnimplementedObjectServiceException extends EppException {
public UnimplementedObjectServiceException() { public UnimplementedObjectServiceException() {
super("Specified object service is not implemented"); super("Specified object service is not implemented");
@ -244,7 +244,7 @@ public abstract class EppException extends Exception {
} }
/** Specified protocol version is not implemented. */ /** Specified protocol version is not implemented. */
@EppResultCode(Code.UnimplementedProtocolVersion) @EppResultCode(Code.UNIMPLEMENTED_PROTOCOL_VERSION)
public static class UnimplementedProtocolVersionException extends EppException { public static class UnimplementedProtocolVersionException extends EppException {
public UnimplementedProtocolVersionException() { public UnimplementedProtocolVersionException() {
super("Specified protocol version is not implemented"); super("Specified protocol version is not implemented");
@ -252,7 +252,7 @@ public abstract class EppException extends Exception {
} }
/** Command failed. */ /** Command failed. */
@EppResultCode(Code.CommandFailed) @EppResultCode(Code.COMMAND_FAILED)
public static class CommandFailedException extends EppException { public static class CommandFailedException extends EppException {
public CommandFailedException() { public CommandFailedException() {
super("Command failed"); super("Command failed");

View file

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

View file

@ -14,7 +14,7 @@
package google.registry.flows; 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.ImmutableList;
import google.registry.config.RegistryEnvironment; import google.registry.config.RegistryEnvironment;
@ -46,7 +46,7 @@ public abstract class ResourceCheckFlow<R extends EppResource, C extends Resourc
@Override @Override
protected final EppOutput runResourceFlow() throws EppException { protected final EppOutput runResourceFlow() throws EppException {
return createOutput( return createOutput(
Success, SUCCESS,
getCheckData(), getCheckData(),
getResponseExtensions()); getResponseExtensions());
} }

View file

@ -14,7 +14,7 @@
package google.registry.flows; 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.ImmutableList;
import com.google.common.collect.ImmutableSet; 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. */ /** Subclasses can override this to return a different success result code. */
protected Code getDeleteResultCode() { protected Code getDeleteResultCode() {
return Success; return SUCCESS;
} }
/** Subclasses can override this to return response extensions. */ /** Subclasses can override this to return response extensions. */

View file

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

View file

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

View file

@ -15,7 +15,7 @@
package google.registry.flows; package google.registry.flows;
import static google.registry.flows.ResourceFlowUtils.createTransferResponse; 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.AuthorizationErrorException;
import google.registry.flows.EppException.CommandUseErrorException; import google.registry.flows.EppException.CommandUseErrorException;
@ -52,7 +52,7 @@ public abstract class ResourceTransferQueryFlow<R extends EppResource,
@Override @Override
public final EppOutput runResourceFlow() throws EppException { public final EppOutput runResourceFlow() throws EppException {
return createOutput( return createOutput(
Success, createTransferResponse(existingResource, existingResource.getTransferData(), now)); SUCCESS, createTransferResponse(existingResource, existingResource.getTransferData(), now));
} }
/** Registrar is not authorized to view transfer status. */ /** 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.createPendingTransferNotificationResponse;
import static google.registry.flows.ResourceFlowUtils.createTransferResponse; import static google.registry.flows.ResourceFlowUtils.createTransferResponse;
import static google.registry.flows.ResourceFlowUtils.verifyAuthInfoForResource; 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.model.ofy.ObjectifyService.ofy;
import static google.registry.util.CollectionUtils.union; import static google.registry.util.CollectionUtils.union;
@ -180,7 +180,7 @@ import org.joda.time.Duration;
@Override @Override
protected final EppOutput getOutput() throws EppException { protected final EppOutput getOutput() throws EppException {
return createOutput( return createOutput(
SuccessWithActionPending, SUCCESS_WITH_ACTION_PENDING,
createTransferResponse(newResource, newResource.getTransferData(), now), createTransferResponse(newResource, newResource.getTransferData(), now),
getTransferResponseExtensions()); getTransferResponseExtensions());
} }

View file

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

View file

@ -15,7 +15,7 @@
package google.registry.flows.contact; package google.registry.flows.contact;
import static google.registry.model.EppResourceUtils.checkResourcesExist; 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 com.google.common.collect.ImmutableList;
import google.registry.config.ConfigModule.Config; import google.registry.config.ConfigModule.Config;
@ -55,6 +55,6 @@ public class ContactCheckFlow extends LoggedInFlow {
boolean unused = !existingIds.contains(id); boolean unused = !existingIds.contains(id);
checks.add(ContactCheck.create(unused, id, unused ? null : "In use")); 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.flows.contact.ContactFlowUtils.validateContactAgainstPolicy;
import static google.registry.model.EppResourceUtils.createContactHostRoid; import static google.registry.model.EppResourceUtils.createContactHostRoid;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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.model.ofy.ObjectifyService.ofy;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
@ -86,6 +86,6 @@ public class ContactCreateFlow extends LoggedInFlow implements TransactionalFlow
historyBuilder.build(), historyBuilder.build(),
ForeignKeyIndex.create(newResource, newResource.getDeletionTime()), ForeignKeyIndex.create(newResource, newResource.getDeletionTime()),
EppResourceIndex.create(Key.create(newResource))); 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.verifyOptionalAuthInfoForResource;
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership; import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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 static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -115,6 +115,6 @@ public class ContactDeleteFlow extends LoggedInFlow implements TransactionalFlow
.setModificationTime(now) .setModificationTime(now)
.setParent(Key.create(existingResource)); .setParent(Key.create(existingResource));
ofy().save().<Object>entities(newResource, historyBuilder.build()); 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.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
import static google.registry.model.EppResourceUtils.cloneResourceWithLinkedStatus; import static google.registry.model.EppResourceUtils.cloneResourceWithLinkedStatus;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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 com.google.common.base.Optional;
import google.registry.flows.EppException; import google.registry.flows.EppException;
@ -47,6 +47,6 @@ public class ContactInfoFlow extends LoggedInFlow {
throw new ResourceToQueryDoesNotExistException(ContactResource.class, targetId); throw new ResourceToQueryDoesNotExistException(ContactResource.class, targetId);
} }
verifyOptionalAuthInfoForResource(authInfo, existingResource); 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.createGainingTransferPollMessage;
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse; import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Optional; 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 // Delete the billing event and poll messages that were written in case the transfer would have
// been implicitly server approved. // been implicitly server approved.
ofy().delete().keys(existingResource.getTransferData().getServerApproveEntities()); 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.createLosingTransferPollMessage;
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse; import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Optional; 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 // Delete the billing event and poll messages that were written in case the transfer would have
// been implicitly server approved. // been implicitly server approved.
ofy().delete().keys(existingResource.getTransferData().getServerApproveEntities()); 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.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse; import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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 com.google.common.base.Optional;
import google.registry.flows.EppException; import google.registry.flows.EppException;
@ -67,6 +67,6 @@ public class ContactTransferQueryFlow extends LoggedInFlow {
throw new NotAuthorizedToViewTransferException(); throw new NotAuthorizedToViewTransferException();
} }
return createOutput( 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.createGainingTransferPollMessage;
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse; import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Optional; 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 // Delete the billing event and poll messages that were written in case the transfer would have
// been implicitly server approved. // been implicitly server approved.
ofy().delete().keys(existingResource.getTransferData().getServerApproveEntities()); 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.createLosingTransferPollMessage;
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse; import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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 static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Optional; import com.google.common.base.Optional;
@ -140,7 +140,8 @@ public class ContactTransferRequestFlow extends LoggedInFlow implements Transact
serverApproveGainingPollMessage, serverApproveGainingPollMessage,
serverApproveLosingPollMessage); serverApproveLosingPollMessage);
return createOutput( 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.validateAsciiPostalInfo;
import static google.registry.flows.contact.ContactFlowUtils.validateContactAgainstPolicy; import static google.registry.flows.contact.ContactFlowUtils.validateContactAgainstPolicy;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Optional; import com.google.common.base.Optional;
@ -127,6 +127,6 @@ public class ContactUpdateFlow extends LoggedInFlow implements TransactionalFlow
validateAsciiPostalInfo(newResource.getInternationalizedPostalInfo()); validateAsciiPostalInfo(newResource.getInternationalizedPostalInfo());
validateContactAgainstPolicy(newResource); validateContactAgainstPolicy(newResource);
ofy().save().<Object>entities(newResource, historyBuilder.build()); 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.DISALLOWED_TLD_STATES_FOR_LAUNCH_FLOWS;
import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge; 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.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.index.ForeignKeyIndex.loadAndGetKey; import static google.registry.model.index.ForeignKeyIndex.loadAndGetKey;
@ -218,7 +218,7 @@ public class DomainApplicationCreateFlow extends BaseDomainCreateFlow<DomainAppl
} }
return createOutput( return createOutput(
Success, SUCCESS,
DomainCreateData.create(newResource.getFullyQualifiedDomainName(), now, null), DomainCreateData.create(newResource.getFullyQualifiedDomainName(), now, null),
responseExtensionsBuilder.build()); responseExtensionsBuilder.build());
} }

View file

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

View file

@ -17,8 +17,8 @@ package google.registry.flows.domain;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld; import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld;
import static google.registry.flows.domain.DomainFlowUtils.updateAutorenewRecurrenceEndTime; 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.SUCCESS;
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.model.ofy.ObjectifyService.ofy;
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost; import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
import static google.registry.util.CollectionUtils.nullToEmpty; import static google.registry.util.CollectionUtils.nullToEmpty;
@ -187,7 +187,7 @@ public class DomainDeleteFlow extends ResourceSyncDeleteFlow<DomainResource, Bui
@Override @Override
protected final Code getDeleteResultCode() { protected final Code getDeleteResultCode() {
return newResource.getDeletionTime().isAfter(now) return newResource.getDeletionTime().isAfter(now)
? SuccessWithActionPending : Success; ? SUCCESS_WITH_ACTION_PENDING : SUCCESS;
} }
@Nullable @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.flows.domain.DomainFlowUtils.verifyUnitIsYears;
import static google.registry.model.domain.DomainResource.MAX_REGISTRATION_YEARS; 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.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.model.ofy.ObjectifyService.ofy;
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost; import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
import static google.registry.util.DateTimeUtils.leapSafeAddYears; import static google.registry.util.DateTimeUtils.leapSafeAddYears;
@ -197,7 +197,7 @@ public class DomainRenewFlow extends OwnedResourceMutateFlow<DomainResource, Ren
@Override @Override
protected final EppOutput getOutput() { protected final EppOutput getOutput() {
return createOutput( return createOutput(
Success, SUCCESS,
DomainRenewData.create( DomainRenewData.create(
newResource.getFullyQualifiedDomainName(), newResource.getRegistrationExpirationTime()), newResource.getFullyQualifiedDomainName(), newResource.getRegistrationExpirationTime()),
(feeRenew == null) (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.verifyNotReserved;
import static google.registry.flows.domain.DomainFlowUtils.verifyPremiumNameIsNotBlocked; 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.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.model.ofy.ObjectifyService.ofy;
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost; import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
@ -200,7 +200,7 @@ public class DomainRestoreRequestFlow extends OwnedResourceMutateFlow<DomainReso
@Override @Override
protected final EppOutput getOutput() { protected final EppOutput getOutput() {
return createOutput( return createOutput(
Success, SUCCESS,
null, null,
(feeUpdate == null) (feeUpdate == null)
? null ? null

View file

@ -15,7 +15,7 @@
package google.registry.flows.host; package google.registry.flows.host;
import static google.registry.model.EppResourceUtils.checkResourcesExist; 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 com.google.common.collect.ImmutableList;
import google.registry.config.ConfigModule.Config; import google.registry.config.ConfigModule.Config;
@ -55,6 +55,6 @@ public class HostCheckFlow extends LoggedInFlow {
boolean unused = !existingIds.contains(id); boolean unused = !existingIds.contains(id);
checks.add(HostCheck.create(unused, id, unused ? null : "In use")); 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.flows.host.HostFlowUtils.verifyDomainIsSameRegistrar;
import static google.registry.model.EppResourceUtils.createContactHostRoid; import static google.registry.model.EppResourceUtils.createContactHostRoid;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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.model.ofy.ObjectifyService.ofy;
import static google.registry.util.CollectionUtils.isNullOrEmpty; import static google.registry.util.CollectionUtils.isNullOrEmpty;
import static google.registry.util.CollectionUtils.union; import static google.registry.util.CollectionUtils.union;
@ -126,7 +126,7 @@ public class HostCreateFlow extends LoggedInFlow implements TransactionalFlow {
DnsQueue.create().addHostRefreshTask(targetId); DnsQueue.create().addHostRefreshTask(targetId);
} }
ofy().save().entities(entitiesToSave); 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. */ /** 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.verifyOptionalAuthInfoForResource;
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership; import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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 static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -114,6 +114,6 @@ public class HostDeleteFlow extends LoggedInFlow implements TransactionalFlow {
.setModificationTime(now) .setModificationTime(now)
.setParent(Key.create(existingResource)); .setParent(Key.create(existingResource));
ofy().save().<Object>entities(newResource, historyBuilder.build()); 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.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
import static google.registry.model.EppResourceUtils.cloneResourceWithLinkedStatus; import static google.registry.model.EppResourceUtils.cloneResourceWithLinkedStatus;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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 com.google.common.base.Optional;
import google.registry.flows.EppException; import google.registry.flows.EppException;
@ -50,6 +50,6 @@ public class HostInfoFlow extends LoggedInFlow {
throw new ResourceToQueryDoesNotExistException(HostResource.class, targetId); throw new ResourceToQueryDoesNotExistException(HostResource.class, targetId);
} }
verifyOptionalAuthInfoForResource(authInfo, existingResource); 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.validateHostName;
import static google.registry.flows.host.HostFlowUtils.verifyDomainIsSameRegistrar; import static google.registry.flows.host.HostFlowUtils.verifyDomainIsSameRegistrar;
import static google.registry.model.EppResourceUtils.loadByUniqueId; 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.index.ForeignKeyIndex.loadAndGetKey;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.CollectionUtils.isNullOrEmpty; import static google.registry.util.CollectionUtils.isNullOrEmpty;
@ -156,7 +156,7 @@ public class HostUpdateFlow extends LoggedInFlow implements TransactionalFlow {
.setParent(Key.create(existingResource)) .setParent(Key.create(existingResource))
.build()); .build());
ofy().save().entities(entitiesToSave.build()); ofy().save().entities(entitiesToSave.build());
return createOutput(Success); return createOutput(SUCCESS);
} }
private void verifyUpdateAllowed( private void verifyUpdateAllowed(

View file

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

View file

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

View file

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

View file

@ -14,7 +14,7 @@
package google.registry.flows.session; 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.EppException;
import google.registry.flows.LoggedInFlow; import google.registry.flows.LoggedInFlow;
@ -33,6 +33,6 @@ public class LogoutFlow extends LoggedInFlow {
@Override @Override
public final EppOutput run() throws EppException { public final EppOutput run() throws EppException {
sessionMetadata.invalidate(); sessionMetadata.invalidate();
return createOutput(SuccessAndClose); return createOutput(SUCCESS_AND_CLOSE);
} }
} }

View file

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

View file

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

View file

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

View file

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