Remove unnecessary "throws" declarations

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201058582
This commit is contained in:
mcilwain 2018-06-18 14:25:42 -07:00 committed by Ben McIlwain
parent a7256f5edd
commit 5d80f124ca
377 changed files with 2297 additions and 2373 deletions

View file

@ -396,7 +396,7 @@ public class BigqueryConnection implements AutoCloseable {
public ListenableFuture<DestinationTable> load( public ListenableFuture<DestinationTable> load(
DestinationTable dest, DestinationTable dest,
SourceFormat sourceFormat, SourceFormat sourceFormat,
Iterable<String> sourceUris) throws Exception { Iterable<String> sourceUris) {
Job job = new Job() Job job = new Job()
.setConfiguration(new JobConfiguration() .setConfiguration(new JobConfiguration()
.setLoad(new JobConfigurationLoad() .setLoad(new JobConfigurationLoad()
@ -441,7 +441,7 @@ public class BigqueryConnection implements AutoCloseable {
* <p>Returns a ListenableFuture that holds the ImmutableTable on success. * <p>Returns a ListenableFuture that holds the ImmutableTable on success.
*/ */
public ListenableFuture<ImmutableTable<Integer, TableFieldSchema, Object>> public ListenableFuture<ImmutableTable<Integer, TableFieldSchema, Object>>
queryToLocalTable(String querySql) throws Exception { queryToLocalTable(String querySql) {
Job job = new Job() Job job = new Job()
.setConfiguration(new JobConfiguration() .setConfiguration(new JobConfiguration()
.setQuery(new JobConfigurationQuery() .setQuery(new JobConfigurationQuery()
@ -459,8 +459,7 @@ public class BigqueryConnection implements AutoCloseable {
* *
* <p>Returns the results of the query in an ImmutableTable on success. * <p>Returns the results of the query in an ImmutableTable on success.
*/ */
public ImmutableTable<Integer, TableFieldSchema, Object> queryToLocalTableSync(String querySql) public ImmutableTable<Integer, TableFieldSchema, Object> queryToLocalTableSync(String querySql) {
throws Exception {
Job job = new Job() Job job = new Job()
.setConfiguration(new JobConfiguration() .setConfiguration(new JobConfiguration()
.setQuery(new JobConfigurationQuery() .setQuery(new JobConfigurationQuery()

View file

@ -193,7 +193,7 @@ class ChildEntityReader<R extends EppResource, I extends ImmutableObject> extend
} }
@Override @Override
public void beginShard() throws IOException { public void beginShard() {
eppResourceEntityReader.beginShard(); eppResourceEntityReader.beginShard();
} }

View file

@ -434,7 +434,7 @@ public class EppInput extends ImmutableObject {
} }
@Override @Override
public String marshal(String ignored) throws Exception { public String marshal(String ignored) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
} }

View file

@ -32,7 +32,7 @@ public class OfyFilter implements Filter {
} }
@Override @Override
public void init(FilterConfig config) throws ServletException { public void init(FilterConfig config) {
// Make sure that we've registered all types before we do anything else with Objectify. // Make sure that we've registered all types before we do anything else with Objectify.
ObjectifyService.initOfy(); ObjectifyService.initOfy();
} }

View file

@ -43,12 +43,12 @@ public class EnumToAttributeAdapter<E extends Enum<E> & EnumToAttributeAdapter.E
// Enums that can be unmarshalled from input can override this. // Enums that can be unmarshalled from input can override this.
@Override @Override
public E unmarshal(EnumShim shim) throws Exception { public E unmarshal(EnumShim shim) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override @Override
public final EnumShim marshal(E enumeration) throws Exception { public final EnumShim marshal(E enumeration) {
EnumShim shim = new EnumShim(); EnumShim shim = new EnumShim();
shim.s = enumeration.getXmlName(); shim.s = enumeration.getXmlName();
return shim; return shim;

View file

@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.ChannelSftp;
import java.io.Closeable; import java.io.Closeable;
import java.io.IOException;
/** /**
* {@link ChannelSftp} wrapper that implements {@link Closeable}. * {@link ChannelSftp} wrapper that implements {@link Closeable}.
@ -41,7 +40,7 @@ final class JSchSftpChannel implements Closeable {
} }
@Override @Override
public void close() throws IOException { public void close() {
channel.disconnect(); channel.disconnect();
} }
} }

View file

@ -23,7 +23,6 @@ import com.jcraft.jsch.Session;
import com.jcraft.jsch.SftpException; import com.jcraft.jsch.SftpException;
import google.registry.config.RegistryConfig.Config; import google.registry.config.RegistryConfig.Config;
import java.io.Closeable; import java.io.Closeable;
import java.io.IOException;
import java.net.URI; import java.net.URI;
import javax.inject.Inject; import javax.inject.Inject;
import org.joda.time.Duration; import org.joda.time.Duration;
@ -118,7 +117,7 @@ final class JSchSshSession implements Closeable {
/** @see com.jcraft.jsch.Session#disconnect() */ /** @see com.jcraft.jsch.Session#disconnect() */
@Override @Override
public void close() throws IOException { public void close() {
session.disconnect(); session.disconnect();
} }
} }

View file

@ -31,7 +31,6 @@ import google.registry.model.contact.ContactResource;
import google.registry.rde.imports.RdeParser.RdeHeader; import google.registry.rde.imports.RdeParser.RdeHeader;
import google.registry.xjc.JaxbFragment; import google.registry.xjc.JaxbFragment;
import google.registry.xjc.rdecontact.XjcRdeContactElement; import google.registry.xjc.rdecontact.XjcRdeContactElement;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -74,8 +73,7 @@ public class RdeContactInput extends Input<JaxbFragment<XjcRdeContactElement>> {
} }
@Override @Override
public List<? extends InputReader<JaxbFragment<XjcRdeContactElement>>> createReaders() public List<? extends InputReader<JaxbFragment<XjcRdeContactElement>>> createReaders() {
throws IOException {
int numReaders = this.numReaders; int numReaders = this.numReaders;
RdeHeader header = newParser().getHeader(); RdeHeader header = newParser().getHeader();
int numberOfContacts = header.getContactCount().intValue(); int numberOfContacts = header.getContactCount().intValue();

View file

@ -82,7 +82,7 @@ public class RdeContactReader extends InputReader<JaxbFragment<XjcRdeContactElem
} }
@Override @Override
public JaxbFragment<XjcRdeContactElement> next() throws IOException { public JaxbFragment<XjcRdeContactElement> next() {
if (count < maxResults) { if (count < maxResults) {
if (parser == null) { if (parser == null) {
parser = newParser(); parser = newParser();

View file

@ -31,7 +31,6 @@ import google.registry.model.domain.DomainResource;
import google.registry.rde.imports.RdeParser.RdeHeader; import google.registry.rde.imports.RdeParser.RdeHeader;
import google.registry.xjc.JaxbFragment; import google.registry.xjc.JaxbFragment;
import google.registry.xjc.rdedomain.XjcRdeDomainElement; import google.registry.xjc.rdedomain.XjcRdeDomainElement;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -74,8 +73,7 @@ public class RdeDomainInput extends Input<JaxbFragment<XjcRdeDomainElement>> {
} }
@Override @Override
public List<? extends InputReader<JaxbFragment<XjcRdeDomainElement>>> createReaders() public List<? extends InputReader<JaxbFragment<XjcRdeDomainElement>>> createReaders() {
throws IOException {
int numReaders = this.numReaders; int numReaders = this.numReaders;
RdeHeader header = newParser().getHeader(); RdeHeader header = newParser().getHeader();
int numberOfDomains = header.getDomainCount().intValue(); int numberOfDomains = header.getDomainCount().intValue();

View file

@ -79,7 +79,7 @@ public class RdeDomainReader extends InputReader<JaxbFragment<XjcRdeDomainElemen
} }
@Override @Override
public JaxbFragment<XjcRdeDomainElement> next() throws IOException { public JaxbFragment<XjcRdeDomainElement> next() {
if (count < maxResults) { if (count < maxResults) {
if (parser == null) { if (parser == null) {
parser = newParser(); parser = newParser();

View file

@ -29,7 +29,6 @@ import google.registry.model.host.HostResource;
import google.registry.rde.imports.RdeParser.RdeHeader; import google.registry.rde.imports.RdeParser.RdeHeader;
import google.registry.xjc.JaxbFragment; import google.registry.xjc.JaxbFragment;
import google.registry.xjc.rdehost.XjcRdeHostElement; import google.registry.xjc.rdehost.XjcRdeHostElement;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -74,8 +73,7 @@ public class RdeHostInput extends Input<JaxbFragment<XjcRdeHostElement>> {
} }
@Override @Override
public List<? extends InputReader<JaxbFragment<XjcRdeHostElement>>> createReaders() public List<? extends InputReader<JaxbFragment<XjcRdeHostElement>>> createReaders() {
throws IOException {
int numReaders = this.numReaders; int numReaders = this.numReaders;
RdeHeader header = createParser().getHeader(); RdeHeader header = createParser().getHeader();
int numberOfHosts = header.getHostCount().intValue(); int numberOfHosts = header.getHostCount().intValue();

View file

@ -82,7 +82,7 @@ public class RdeHostReader extends InputReader<JaxbFragment<XjcRdeHostElement>>
} }
@Override @Override
public JaxbFragment<XjcRdeHostElement> next() throws IOException { public JaxbFragment<XjcRdeHostElement> next() {
if (count < maxResults) { if (count < maxResults) {
if (parser == null) { if (parser == null) {
parser = newParser(); parser = newParser();

View file

@ -22,7 +22,6 @@ import com.google.common.io.Resources;
import google.registry.config.RegistryConfig.Config; import google.registry.config.RegistryConfig.Config;
import google.registry.util.ResourceUtils; import google.registry.util.ResourceUtils;
import google.registry.util.SqlTemplate; import google.registry.util.SqlTemplate;
import java.io.IOException;
import java.net.URL; import java.net.URL;
import javax.inject.Inject; import javax.inject.Inject;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
@ -51,7 +50,7 @@ public final class ActivityReportingQueryBuilder implements QueryBuilder {
/** Returns the aggregate query which generates the activity report from the saved view. */ /** Returns the aggregate query which generates the activity report from the saved view. */
@Override @Override
public String getReportQuery() throws IOException { public String getReportQuery() {
return String.format( return String.format(
"#standardSQL\nSELECT * FROM `%s.%s.%s`", "#standardSQL\nSELECT * FROM `%s.%s.%s`",
projectId, projectId,
@ -61,7 +60,7 @@ public final class ActivityReportingQueryBuilder implements QueryBuilder {
/** Sets the month we're doing activity reporting for, and returns the view query map. */ /** Sets the month we're doing activity reporting for, and returns the view query map. */
@Override @Override
public ImmutableMap<String, String> getViewQueryMap() throws IOException { public ImmutableMap<String, String> getViewQueryMap() {
LocalDate firstDayOfMonth = yearMonth.toLocalDate(1); LocalDate firstDayOfMonth = yearMonth.toLocalDate(1);
// The pattern-matching is inclusive, so we subtract 1 day to only report that month's data. // The pattern-matching is inclusive, so we subtract 1 day to only report that month's data.
LocalDate lastDayOfMonth = yearMonth.toLocalDate(1).plusMonths(1).minusDays(1); LocalDate lastDayOfMonth = yearMonth.toLocalDate(1).plusMonths(1).minusDays(1);
@ -70,7 +69,7 @@ public final class ActivityReportingQueryBuilder implements QueryBuilder {
/** Returns a map from view name to its associated SQL query. */ /** Returns a map from view name to its associated SQL query. */
private ImmutableMap<String, String> createQueryMap( private ImmutableMap<String, String> createQueryMap(
LocalDate firstDayOfMonth, LocalDate lastDayOfMonth) throws IOException { LocalDate firstDayOfMonth, LocalDate lastDayOfMonth) {
ImmutableMap.Builder<String, String> queriesBuilder = ImmutableMap.builder(); ImmutableMap.Builder<String, String> queriesBuilder = ImmutableMap.builder();
String operationalRegistrarsQuery = String operationalRegistrarsQuery =
@ -141,7 +140,7 @@ public final class ActivityReportingQueryBuilder implements QueryBuilder {
} }
/** Returns {@link String} for file in {@code reporting/sql/} directory. */ /** Returns {@link String} for file in {@code reporting/sql/} directory. */
private static String getQueryFromFile(String filename) throws IOException { private static String getQueryFromFile(String filename) {
return ResourceUtils.readResourceUtf8(getUrl(filename)); return ResourceUtils.readResourceUtf8(getUrl(filename));
} }

View file

@ -113,7 +113,7 @@ public class IcannHttpReporter {
return success; return success;
} }
private XjcIirdeaResult parseResult(byte[] content) throws XmlException, IOException { private XjcIirdeaResult parseResult(byte[] content) throws XmlException {
XjcIirdeaResponseElement response = XjcIirdeaResponseElement response =
XjcXmlTransformer.unmarshal( XjcXmlTransformer.unmarshal(
XjcIirdeaResponseElement.class, new ByteArrayInputStream(content)); XjcIirdeaResponseElement.class, new ByteArrayInputStream(content));

View file

@ -15,14 +15,13 @@
package google.registry.reporting.icann; package google.registry.reporting.icann;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import java.io.IOException;
/** Interface defining the necessary methods to construct ICANN reporting SQL queries. */ /** Interface defining the necessary methods to construct ICANN reporting SQL queries. */
public interface QueryBuilder { public interface QueryBuilder {
/** Returns a map from an intermediary view's table name to the query that generates it. */ /** Returns a map from an intermediary view's table name to the query that generates it. */
ImmutableMap<String, String> getViewQueryMap() throws IOException; ImmutableMap<String, String> getViewQueryMap();
/** Returns a query that retrieves the overall report from the previously generated view. */ /** Returns a query that retrieves the overall report from the previously generated view. */
String getReportQuery() throws IOException; String getReportQuery();
} }

View file

@ -22,7 +22,6 @@ import com.google.common.io.Resources;
import google.registry.config.RegistryConfig.Config; import google.registry.config.RegistryConfig.Config;
import google.registry.util.ResourceUtils; import google.registry.util.ResourceUtils;
import google.registry.util.SqlTemplate; import google.registry.util.SqlTemplate;
import java.io.IOException;
import java.net.URL; import java.net.URL;
import javax.inject.Inject; import javax.inject.Inject;
import org.joda.time.DateTime; import org.joda.time.DateTime;
@ -52,7 +51,7 @@ public final class TransactionsReportingQueryBuilder implements QueryBuilder {
/** Returns the aggregate query which generates the transactions report from the saved view. */ /** Returns the aggregate query which generates the transactions report from the saved view. */
@Override @Override
public String getReportQuery() throws IOException { public String getReportQuery() {
return String.format( return String.format(
"#standardSQL\nSELECT * FROM `%s.%s.%s`", "#standardSQL\nSELECT * FROM `%s.%s.%s`",
projectId, projectId,
@ -62,7 +61,7 @@ public final class TransactionsReportingQueryBuilder implements QueryBuilder {
/** Sets the month we're doing transactions reporting for, and returns the view query map. */ /** Sets the month we're doing transactions reporting for, and returns the view query map. */
@Override @Override
public ImmutableMap<String, String> getViewQueryMap() throws IOException { public ImmutableMap<String, String> getViewQueryMap() {
// Set the earliest date to to yearMonth on day 1 at 00:00:00 // Set the earliest date to to yearMonth on day 1 at 00:00:00
DateTime earliestReportTime = yearMonth.toLocalDate(1).toDateTime(new LocalTime(0, 0, 0)); DateTime earliestReportTime = yearMonth.toLocalDate(1).toDateTime(new LocalTime(0, 0, 0));
// Set the latest date to yearMonth on the last day at 23:59:59.999 // Set the latest date to yearMonth on the last day at 23:59:59.999
@ -72,7 +71,7 @@ public final class TransactionsReportingQueryBuilder implements QueryBuilder {
/** Returns a map from view name to its associated SQL query. */ /** Returns a map from view name to its associated SQL query. */
private ImmutableMap<String, String> createQueryMap( private ImmutableMap<String, String> createQueryMap(
DateTime earliestReportTime, DateTime latestReportTime) throws IOException { DateTime earliestReportTime, DateTime latestReportTime) {
ImmutableMap.Builder<String, String> queriesBuilder = ImmutableMap.builder(); ImmutableMap.Builder<String, String> queriesBuilder = ImmutableMap.builder();
String registrarIanaIdQuery = String registrarIanaIdQuery =
@ -179,7 +178,7 @@ public final class TransactionsReportingQueryBuilder implements QueryBuilder {
} }
/** Returns {@link String} for file in {@code reporting/sql/} directory. */ /** Returns {@link String} for file in {@code reporting/sql/} directory. */
private static String getQueryFromFile(String filename) throws IOException { private static String getQueryFromFile(String filename) {
return ResourceUtils.readResourceUtf8(getUrl(filename)); return ResourceUtils.readResourceUtf8(getUrl(filename));
} }

View file

@ -63,7 +63,7 @@ final class AllocateDomainCommand extends MutatingEppToolCommand {
private final List<Key<DomainApplication>> applicationKeys = new ArrayList<>(); private final List<Key<DomainApplication>> applicationKeys = new ArrayList<>();
@Override @Override
protected String postExecute() throws Exception { protected String postExecute() {
return ofy() return ofy()
.transactNewReadOnly( .transactNewReadOnly(
() -> { () -> {

View file

@ -65,7 +65,7 @@ class AppEngineConnection implements Connection {
memoize(() -> xsrfTokenManager.generateToken(getUserId())); memoize(() -> xsrfTokenManager.generateToken(getUserId()));
@Override @Override
public void prefetchXsrfToken() throws IOException { public void prefetchXsrfToken() {
// Cause XSRF token to be fetched, and then stay resident in cache (since it's memoized). // Cause XSRF token to be fetched, and then stay resident in cache (since it's memoized).
xsrfToken.get(); xsrfToken.get();
} }

View file

@ -34,7 +34,7 @@ public class CheckSnapshotCommand implements RemoteApiCommand {
private String snapshotName; private String snapshotName;
@Override @Override
public void run() throws Exception { public void run() {
Iterable<DatastoreBackupInfo> backups = Iterable<DatastoreBackupInfo> backups =
DatastoreBackupService.get().findAllByNamePrefix(snapshotName); DatastoreBackupService.get().findAllByNamePrefix(snapshotName);
if (Iterables.isEmpty(backups)) { if (Iterables.isEmpty(backups)) {

View file

@ -22,7 +22,7 @@ import java.io.File;
/** Compare two database backups. */ /** Compare two database backups. */
class CompareDbBackups { class CompareDbBackups {
public static void main(String[] args) throws Exception { public static void main(String[] args) {
if (args.length != 2) { if (args.length != 2) {
System.err.println("Usage: compare_db_backups <directory1> <directory2>"); System.err.println("Usage: compare_db_backups <directory1> <directory2>");
return; return;

View file

@ -71,7 +71,7 @@ public abstract class ConfirmingCommand implements Command {
* Perform any post-execution steps (e.g. verifying the result), and return a description String * Perform any post-execution steps (e.g. verifying the result), and return a description String
* to be printed if non-empty. * to be printed if non-empty.
*/ */
protected String postExecute() throws Exception { protected String postExecute() {
return ""; return "";
} }

View file

@ -21,7 +21,6 @@ import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters; import com.beust.jcommander.Parameters;
import com.google.common.base.Ascii; import com.google.common.base.Ascii;
import google.registry.util.Idn; import google.registry.util.Idn;
import java.io.IOException;
import java.util.List; import java.util.List;
/** Command to convert IDN labels to/from punycode. */ /** Command to convert IDN labels to/from punycode. */
@ -34,7 +33,7 @@ final class ConvertIdnCommand implements Command {
private List<String> mainParameters; private List<String> mainParameters;
@Override @Override
public void run() throws IOException { public void run() {
for (String label : mainParameters) { for (String label : mainParameters) {
if (label.startsWith(ACE_PREFIX)) { if (label.startsWith(ACE_PREFIX)) {
System.out.println(Idn.toUnicode(Ascii.toLowerCase(label))); System.out.println(Idn.toUnicode(Ascii.toLowerCase(label)));

View file

@ -62,7 +62,7 @@ class CreateCdnsTld extends ConfirmingCommand {
private ManagedZone managedZone; private ManagedZone managedZone;
@Override @Override
protected void init() throws IOException, GeneralSecurityException { protected void init() {
managedZone = managedZone =
new ManagedZone() new ManagedZone()
.setDescription(description) .setDescription(description)

View file

@ -56,7 +56,7 @@ final class CreateCreditBalanceCommand extends MutatingCommand {
private DateTime effectiveTime; private DateTime effectiveTime;
@Override @Override
public void init() throws Exception { public void init() {
Registrar registrar = Registrar registrar =
checkArgumentPresent( checkArgumentPresent(
Registrar.loadByClientId(clientId), "Registrar %s not found", clientId); Registrar.loadByClientId(clientId), "Registrar %s not found", clientId);

View file

@ -68,7 +68,7 @@ final class CreateCreditCommand extends MutatingCommand {
private DateTime effectiveTime; private DateTime effectiveTime;
@Override @Override
protected void init() throws Exception { protected void init() {
DateTime now = DateTime.now(UTC); DateTime now = DateTime.now(UTC);
Registrar registrar = Registrar registrar =
checkArgumentPresent( checkArgumentPresent(

View file

@ -81,7 +81,7 @@ abstract class CreateOrUpdatePremiumListCommand extends ConfirmingCommand
} }
@Override @Override
protected String prompt() throws Exception { protected String prompt() {
return String.format( return String.format(
"You are about to save the premium list %s with %d items: ", name, inputLineCount); "You are about to save the premium list %s with %d items: ", name, inputLineCount);
} }

View file

@ -272,7 +272,7 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
@Nullable @Nullable
abstract Registrar getOldRegistrar(String clientId); abstract Registrar getOldRegistrar(String clientId);
protected void initRegistrarCommand() throws Exception {} protected void initRegistrarCommand() {}
@Override @Override
protected final void init() throws Exception { protected final void init() throws Exception {

View file

@ -269,7 +269,7 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
/** Subclasses can override this to assert that the command can be run in this environment. */ /** Subclasses can override this to assert that the command can be run in this environment. */
void assertAllowedEnvironment() {} void assertAllowedEnvironment() {}
protected abstract void initTldCommand() throws Exception; protected abstract void initTldCommand();
@Override @Override
protected final void init() throws Exception { protected final void init() throws Exception {

View file

@ -58,7 +58,7 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand
} }
@Override @Override
protected void initRegistrarCommand() throws Exception { protected void initRegistrarCommand() {
checkArgument(mainParameters.size() == 1, "Must specify exactly one client identifier."); checkArgument(mainParameters.size() == 1, "Must specify exactly one client identifier.");
checkArgumentNotNull(emptyToNull(password), "--password is a required field"); checkArgumentNotNull(emptyToNull(password), "--password is a required field");
checkArgumentNotNull(registrarName, "--name is a required field"); checkArgumentNotNull(registrarName, "--name is a required field");
@ -95,7 +95,7 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand
} }
@Override @Override
protected String postExecute() throws Exception { protected String postExecute() {
if (!createGoogleGroups) { if (!createGoogleGroups) {
return ""; return "";
} }

View file

@ -49,7 +49,7 @@ public class CreateRegistrarGroupsCommand extends ConfirmingCommand
} }
@Override @Override
protected void init() throws IOException { protected void init() {
for (String clientId : clientIds) { for (String clientId : clientIds) {
Registrar registrar = Registrar registrar =
checkArgumentPresent( checkArgumentPresent(

View file

@ -53,7 +53,7 @@ class CreateTldCommand extends CreateOrUpdateTldCommand {
private Money initialRenewBillingCost; private Money initialRenewBillingCost;
@Override @Override
protected void initTldCommand() throws Exception { protected void initTldCommand() {
checkArgument(initialTldState == null || tldStateTransitions.isEmpty(), checkArgument(initialTldState == null || tldStateTransitions.isEmpty(),
"Don't pass both --initial_tld_state and --tld_state_transitions"); "Don't pass both --initial_tld_state and --tld_state_transitions");
checkArgument(initialRenewBillingCost == null || renewBillingCostTransitions.isEmpty(), checkArgument(initialRenewBillingCost == null || renewBillingCostTransitions.isEmpty(),

View file

@ -41,7 +41,7 @@ final class DeleteCreditCommand extends MutatingCommand {
private long creditId; private long creditId;
@Override @Override
protected void init() throws Exception { protected void init() {
Registrar registrar = Registrar registrar =
checkArgumentPresent( checkArgumentPresent(
Registrar.loadByClientId(clientId), "Registrar %s not found", clientId); Registrar.loadByClientId(clientId), "Registrar %s not found", clientId);

View file

@ -43,7 +43,7 @@ final class DeletePremiumListCommand extends ConfirmingCommand implements Remote
private String name; private String name;
@Override @Override
protected void init() throws Exception { protected void init() {
checkArgument( checkArgument(
doesPremiumListExist(name), doesPremiumListExist(name),
"Cannot delete the premium list %s because it doesn't exist.", "Cannot delete the premium list %s because it doesn't exist.",
@ -62,7 +62,7 @@ final class DeletePremiumListCommand extends ConfirmingCommand implements Remote
} }
@Override @Override
protected String execute() throws Exception { protected String execute() {
deletePremiumList(premiumList); deletePremiumList(premiumList);
return String.format("Deleted premium list '%s'.\n", premiumList.getName()); return String.format("Deleted premium list '%s'.\n", premiumList.getName());
} }

View file

@ -36,7 +36,7 @@ final class DeleteReservedListCommand extends MutatingCommand {
private String name; private String name;
@Override @Override
protected void init() throws Exception { protected void init() {
checkArgument( checkArgument(
ReservedList.get(name).isPresent(), ReservedList.get(name).isPresent(),
"Cannot delete the reserved list %s because it doesn't exist.", "Cannot delete the reserved list %s because it doesn't exist.",

View file

@ -52,7 +52,7 @@ final class DeleteTldCommand extends ConfirmingCommand implements RemoteApiComma
* accidental deletion of established TLDs with domains on them. * accidental deletion of established TLDs with domains on them.
*/ */
@Override @Override
protected void init() throws Exception { protected void init() {
registry = Registry.get(tld); registry = Registry.get(tld);
checkState(registry.getTldType().equals(TldType.TEST), "Cannot delete a real TLD"); checkState(registry.getTldType().equals(TldType.TEST), "Cannot delete a real TLD");
@ -77,7 +77,7 @@ final class DeleteTldCommand extends ConfirmingCommand implements RemoteApiComma
} }
@Override @Override
protected String execute() throws Exception { protected String execute() {
ofy().transactNew(new VoidWork() { ofy().transactNew(new VoidWork() {
@Override @Override
public void vrun() { public void vrun() {

View file

@ -25,7 +25,7 @@ public class DeployInvoicingPipelineCommand implements Command {
@Inject InvoicingPipeline invoicingPipeline; @Inject InvoicingPipeline invoicingPipeline;
@Override @Override
public void run() throws Exception { public void run() {
invoicingPipeline.deploy(); invoicingPipeline.deploy();
} }
} }

View file

@ -72,7 +72,7 @@ public class GenerateAllocationTokensCommand implements RemoteApiCommand {
private static final int BATCH_SIZE = 20; private static final int BATCH_SIZE = 20;
@Override @Override
public void run() throws Exception { public void run() {
int tokensSaved = 0; int tokensSaved = 0;
do { do {
ImmutableSet<AllocationToken> tokens = ImmutableSet<AllocationToken> tokens =

View file

@ -79,7 +79,7 @@ final class GenerateEscrowDepositCommand implements RemoteApiCommand {
@Inject @Named("rde-report") Queue queue; @Inject @Named("rde-report") Queue queue;
@Override @Override
public void run() throws Exception { public void run() {
if (tlds.isEmpty()) { if (tlds.isEmpty()) {
throw new ParameterException("At least one TLD must be specified"); throw new ParameterException("At least one TLD must be specified");

View file

@ -47,7 +47,7 @@ public final class GetLrpTokenCommand implements RemoteApiCommand {
private boolean includeHistory = false; private boolean includeHistory = false;
@Override @Override
public void run() throws Exception { public void run() {
checkArgument( checkArgument(
(tokenString == null) == (assignee != null), (tokenString == null) == (assignee != null),
"Exactly one of either token or assignee must be specified."); "Exactly one of either token or assignee must be specified.");

View file

@ -21,7 +21,7 @@ import google.registry.model.SchemaVersion;
@Parameters(commandDescription = "Generate a model schema file") @Parameters(commandDescription = "Generate a model schema file")
final class GetSchemaCommand implements Command { final class GetSchemaCommand implements Command {
@Override @Override
public void run() throws Exception { public void run() {
System.out.println(SchemaVersion.getSchema()); System.out.println(SchemaVersion.getSchema());
} }
} }

View file

@ -51,7 +51,7 @@ final class GetSchemaTreeCommand implements Command {
private Multimap<Class<?>, Class<?>> superclassToSubclasses; private Multimap<Class<?>, Class<?>> superclassToSubclasses;
@Override @Override
public void run() throws Exception { public void run() {
// Get the @Parent type for each class. // Get the @Parent type for each class.
Map<Class<?>, Class<?>> entityToParentType = new HashMap<>(); Map<Class<?>, Class<?>> entityToParentType = new HashMap<>();
for (Class<?> clazz : ALL_CLASSES) { for (Class<?> clazz : ALL_CLASSES) {

View file

@ -36,7 +36,7 @@ final class HelpCommand implements Command {
private List<String> mainParameters = new ArrayList<>(); private List<String> mainParameters = new ArrayList<>();
@Override @Override
public void run() throws Exception { public void run() {
String target = getOnlyElement(mainParameters, null); String target = getOnlyElement(mainParameters, null);
if (target == null) { if (target == null) {
jcommander.usage(); jcommander.usage();

View file

@ -49,7 +49,7 @@ final class ListCursorsCommand implements RemoteApiCommand {
private boolean filterEscrowEnabled; private boolean filterEscrowEnabled;
@Override @Override
public void run() throws Exception { public void run() {
List<String> lines = new ArrayList<>(); List<String> lines = new ArrayList<>();
for (String tld : Registries.getTlds()) { for (String tld : Registries.getTlds()) {
Registry registry = Registry.get(tld); Registry registry = Registry.get(tld);

View file

@ -84,7 +84,7 @@ class LoadTestCommand extends ConfirmingCommand implements ServerSideCommand {
} }
@Override @Override
protected boolean checkExecutionState() throws Exception { protected boolean checkExecutionState() {
if (RegistryToolEnvironment.get() == RegistryToolEnvironment.PRODUCTION) { if (RegistryToolEnvironment.get() == RegistryToolEnvironment.PRODUCTION) {
System.err.println("You may not run a load test against production."); System.err.println("You may not run a load test against production.");
return false; return false;

View file

@ -41,7 +41,7 @@ public class LockDomainCommand extends LockOrUnlockDomainCommand {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Override @Override
protected void initMutatingEppToolCommand() throws Exception { protected void initMutatingEppToolCommand() {
// Project all domains as of the same time so that argument order doesn't affect behavior. // Project all domains as of the same time so that argument order doesn't affect behavior.
DateTime now = DateTime.now(UTC); DateTime now = DateTime.now(UTC);
for (String domain : getDomains()) { for (String domain : getDomains()) {

View file

@ -30,7 +30,7 @@ public abstract class MutatingEppToolCommand extends EppToolCommand {
boolean dryRun; boolean dryRun;
@Override @Override
protected boolean checkExecutionState() throws Exception { protected boolean checkExecutionState() {
checkArgument(!(force && isDryRun()), "--force and --dry_run are incompatible"); checkArgument(!(force && isDryRun()), "--force and --dry_run are incompatible");
return true; return true;
} }

View file

@ -43,7 +43,7 @@ final class PendingEscrowCommand implements RemoteApiCommand {
PendingDepositChecker checker; PendingDepositChecker checker;
@Override @Override
public void run() throws Exception { public void run() {
System.out.println( System.out.println(
SORTER SORTER
.sortedCopy(checker.getTldsAndWatermarksPendingDepositForRdeAndBrda().values()) .sortedCopy(checker.getTldsAndWatermarksPendingDepositForRdeAndBrda().values())

View file

@ -41,7 +41,7 @@ public final class ResaveEntitiesCommand extends MutatingCommand {
List<String> mainParameters; List<String> mainParameters;
@Override @Override
protected void init() throws Exception { protected void init() {
for (List<String> batch : partition(mainParameters, BATCH_SIZE)) { for (List<String> batch : partition(mainParameters, BATCH_SIZE)) {
for (String websafeKey : batch) { for (String websafeKey : batch) {
ImmutableObject entity = ofy().load().key(Key.<ImmutableObject>create(websafeKey)).now(); ImmutableObject entity = ofy().load().key(Key.<ImmutableObject>create(websafeKey)).now();

View file

@ -37,7 +37,7 @@ final class ResaveEnvironmentEntitiesCommand implements RemoteApiCommand {
private static final int BATCH_SIZE = 10; private static final int BATCH_SIZE = 10;
@Override @Override
public void run() throws Exception { public void run() {
batchSave(Registry.class); batchSave(Registry.class);
batchSave(Registrar.class); batchSave(Registrar.class);
batchSave(RegistrarContact.class); batchSave(RegistrarContact.class);

View file

@ -47,7 +47,7 @@ public final class ResaveEppResourceCommand extends MutatingCommand {
protected String uniqueId; protected String uniqueId;
@Override @Override
protected void init() throws Exception { protected void init() {
Key<? extends EppResource> resourceKey = checkArgumentNotNull( Key<? extends EppResource> resourceKey = checkArgumentNotNull(
type.getKey(uniqueId, DateTime.now(UTC)), type.getKey(uniqueId, DateTime.now(UTC)),
"Could not find active resource of type %s: %s", type, uniqueId); "Could not find active resource of type %s: %s", type, uniqueId);

View file

@ -25,7 +25,7 @@ interface ServerSideCommand extends RemoteApiCommand {
/** An http connection to AppEngine. */ /** An http connection to AppEngine. */
interface Connection { interface Connection {
void prefetchXsrfToken() throws IOException; void prefetchXsrfToken();
String send(String endpoint, Map<String, ?> params, MediaType contentType, byte[] payload) String send(String endpoint, Map<String, ?> params, MediaType contentType, byte[] payload)
throws IOException; throws IOException;

View file

@ -221,7 +221,7 @@ final class SetupOteCommand extends ConfirmingCommand implements RemoteApiComman
} }
@Override @Override
protected String prompt() throws Exception { protected String prompt() {
// Each underlying command will confirm its own operation as well, so just provide // Each underlying command will confirm its own operation as well, so just provide
// a summary of the steps in this command. // a summary of the steps in this command.
if (eapOnly) { if (eapOnly) {

View file

@ -248,7 +248,7 @@ public class ShellCommand implements Command {
* *
* <p>Dumps the last line of output prior to doing this. * <p>Dumps the last line of output prior to doing this.
*/ */
private void emitSuccess() throws IOException { private void emitSuccess() {
System.out.println(SUCCESS); System.out.println(SUCCESS);
System.out.flush(); System.out.flush();
} }
@ -258,7 +258,7 @@ public class ShellCommand implements Command {
* *
* <p>Dumps the last line of output prior to doing this. * <p>Dumps the last line of output prior to doing this.
*/ */
private void emitFailure(Throwable e) throws IOException { private void emitFailure(Throwable e) {
System.out.println( System.out.println(
FAILURE FAILURE
+ e.getClass().getName() + e.getClass().getName()

View file

@ -100,7 +100,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand {
ImmutableSortedSet<String> existingDsData; ImmutableSortedSet<String> existingDsData;
@Override @Override
protected void initMutatingEppToolCommand() throws ParseException { protected void initMutatingEppToolCommand() {
superuser = true; superuser = true;
DateTime now = DateTime.now(UTC); DateTime now = DateTime.now(UTC);
ImmutableSet<String> newHostsSet = ImmutableSet.copyOf(newHosts); ImmutableSet<String> newHostsSet = ImmutableSet.copyOf(newHosts);
@ -176,7 +176,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand {
} }
@Override @Override
protected String postExecute() throws Exception { protected String postExecute() {
if (undo) { if (undo) {
return ""; return "";
} }

View file

@ -41,7 +41,7 @@ public class UnlockDomainCommand extends LockOrUnlockDomainCommand {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Override @Override
protected void initMutatingEppToolCommand() throws Exception { protected void initMutatingEppToolCommand() {
// Project all domains as of the same time so that argument order doesn't affect behavior. // Project all domains as of the same time so that argument order doesn't affect behavior.
DateTime now = DateTime.now(UTC); DateTime now = DateTime.now(UTC);
for (String domain : getDomains()) { for (String domain : getDomains()) {

View file

@ -65,7 +65,7 @@ final class UpdateApplicationStatusCommand extends MutatingCommand {
private String clientId = "CharlestonRoad"; private String clientId = "CharlestonRoad";
@Override @Override
protected void init() throws Exception { protected void init() {
checkArgumentPresent( checkArgumentPresent(
Registrar.loadByClientId(clientId), "Registrar with client ID %s not found", clientId); Registrar.loadByClientId(clientId), "Registrar with client ID %s not found", clientId);
for (final String applicationId : ids) { for (final String applicationId : ids) {

View file

@ -62,7 +62,7 @@ final class UpdateClaimsNoticeCommand implements RemoteApiCommand {
private String acceptedTime; private String acceptedTime;
@Override @Override
public void run() throws Exception { public void run() {
final LaunchNotice launchNotice = LaunchNotice.create( final LaunchNotice launchNotice = LaunchNotice.create(
tcnId, validatorId, DateTime.parse(expirationTime), DateTime.parse(acceptedTime)); tcnId, validatorId, DateTime.parse(expirationTime), DateTime.parse(acceptedTime));

View file

@ -47,7 +47,7 @@ final class UpdateCursorsCommand extends MutatingCommand {
private DateTime newTimestamp; private DateTime newTimestamp;
@Override @Override
protected void init() throws Exception { protected void init() {
if (isNullOrEmpty(tlds)) { if (isNullOrEmpty(tlds)) {
Cursor cursor = ofy().load().key(Cursor.createGlobalKey(cursorType)).now(); Cursor cursor = ofy().load().key(Cursor.createGlobalKey(cursorType)).now();
stageEntityChange(cursor, Cursor.createGlobal(cursorType, newTimestamp)); stageEntityChange(cursor, Cursor.createGlobal(cursorType, newTimestamp));

View file

@ -127,7 +127,7 @@ class UpdateTldCommand extends CreateOrUpdateTldCommand {
} }
@Override @Override
protected void initTldCommand() throws Exception { protected void initTldCommand() {
// Due to per-instance caching on Registry, different instances can end up in different TLD // Due to per-instance caching on Registry, different instances can end up in different TLD
// states at the same time, so --set_current_tld_state should never be used in production. // states at the same time, so --set_current_tld_state should never be used in production.
checkArgument( checkArgument(

View file

@ -51,12 +51,12 @@ final class UploadClaimsListCommand extends ConfirmingCommand implements RemoteA
} }
@Override @Override
protected String prompt() throws Exception { protected String prompt() {
return String.format("\nNew claims list:\n%s", claimsList); return String.format("\nNew claims list:\n%s", claimsList);
} }
@Override @Override
public String execute() throws IOException { public String execute() {
claimsList.save(); claimsList.save();
return String.format("Successfully uploaded claims list %s", claimsListFilename); return String.format("Successfully uploaded claims list %s", claimsListFilename);
} }

View file

@ -38,7 +38,7 @@ import java.util.Objects;
public class PopulateNullRegistrarFieldsCommand extends MutatingCommand { public class PopulateNullRegistrarFieldsCommand extends MutatingCommand {
@Override @Override
protected void init() throws Exception { protected void init() {
for (Registrar registrar : ofy().load().type(Registrar.class).ancestor(getCrossTldKey())) { for (Registrar registrar : ofy().load().type(Registrar.class).ancestor(getCrossTldKey())) {
Builder changeBuilder = registrar.asBuilder(); Builder changeBuilder = registrar.asBuilder();
changeBuilder.setRegistrarName( changeBuilder.setRegistrarName(

View file

@ -57,7 +57,7 @@ public class CommitLogCheckpointActionTest {
CommitLogCheckpointAction task = new CommitLogCheckpointAction(); CommitLogCheckpointAction task = new CommitLogCheckpointAction();
@Before @Before
public void before() throws Exception { public void before() {
task.clock = new FakeClock(now); task.clock = new FakeClock(now);
task.strategy = strategy; task.strategy = strategy;
task.taskQueueUtils = new TaskQueueUtils(new Retrier(null, 1)); task.taskQueueUtils = new TaskQueueUtils(new Retrier(null, 1));

View file

@ -83,7 +83,7 @@ public class CommitLogCheckpointStrategyTest {
} }
@Before @Before
public void before() throws Exception { public void before() {
strategy.clock = clock; strategy.clock = clock;
strategy.ofy = ofy; strategy.ofy = ofy;
@ -100,13 +100,13 @@ public class CommitLogCheckpointStrategyTest {
} }
@Test @Test
public void test_readBucketTimestamps_noCommitLogs() throws Exception { public void test_readBucketTimestamps_noCommitLogs() {
assertThat(strategy.readBucketTimestamps()) assertThat(strategy.readBucketTimestamps())
.containsExactly(1, START_OF_TIME, 2, START_OF_TIME, 3, START_OF_TIME); .containsExactly(1, START_OF_TIME, 2, START_OF_TIME, 3, START_OF_TIME);
} }
@Test @Test
public void test_readBucketTimestamps_withSomeCommitLogs() throws Exception { public void test_readBucketTimestamps_withSomeCommitLogs() {
DateTime startTime = clock.nowUtc(); DateTime startTime = clock.nowUtc();
writeCommitLogToBucket(1); writeCommitLogToBucket(1);
clock.advanceOneMilli(); clock.advanceOneMilli();
@ -116,7 +116,7 @@ public class CommitLogCheckpointStrategyTest {
} }
@Test @Test
public void test_readBucketTimestamps_againAfterUpdate_reflectsUpdate() throws Exception { public void test_readBucketTimestamps_againAfterUpdate_reflectsUpdate() {
DateTime firstTime = clock.nowUtc(); DateTime firstTime = clock.nowUtc();
writeCommitLogToBucket(1); writeCommitLogToBucket(1);
writeCommitLogToBucket(2); writeCommitLogToBucket(2);

View file

@ -48,7 +48,7 @@ public class DeleteOldCommitLogsActionTest
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();
@Before @Before
public void setup() throws Exception { public void setup() {
inject.setStaticField(Ofy.class, "clock", clock); inject.setStaticField(Ofy.class, "clock", clock);
action = new DeleteOldCommitLogsAction(); action = new DeleteOldCommitLogsAction();
action.mrRunner = makeDefaultRunner(); action.mrRunner = makeDefaultRunner();

View file

@ -119,7 +119,7 @@ public class GcsDiffFileListerTest {
} }
@Test @Test
public void testList_patchesHoles() throws Exception { public void testList_patchesHoles() {
// Fake out the GCS list() method to return only the first and last file. // Fake out the GCS list() method to return only the first and last file.
// We can't use Mockito.spy() because GcsService's impl is final. // We can't use Mockito.spy() because GcsService's impl is final.
diffLister.gcsService = (GcsService) newProxyInstance( diffLister.gcsService = (GcsService) newProxyInstance(
@ -135,7 +135,7 @@ public class GcsDiffFileListerTest {
boolean called = false; boolean called = false;
@Override @Override
public Iterator<ListItem> call() throws Exception { public Iterator<ListItem> call() {
try { try {
return called ? null : Iterators.forArray( return called ? null : Iterators.forArray(
new ListItem.Builder() new ListItem.Builder()
@ -181,7 +181,7 @@ public class GcsDiffFileListerTest {
} }
@Test @Test
public void testList_boundaries() throws Exception { public void testList_boundaries() {
assertThat(listDiffFiles(now.minusMinutes(4), now)) assertThat(listDiffFiles(now.minusMinutes(4), now))
.containsExactly( .containsExactly(
now.minusMinutes(4), now.minusMinutes(4),

View file

@ -133,7 +133,7 @@ public class DeleteContactsAndHostsActionTest
} }
@Before @Before
public void setup() throws Exception { public void setup() {
enqueuer = enqueuer =
new AsyncFlowEnqueuer( new AsyncFlowEnqueuer(
getQueue(QUEUE_ASYNC_DELETE), getQueue(QUEUE_ASYNC_DELETE),

View file

@ -129,7 +129,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
} }
@Test @Test
public void testFail_givenNonTestTld() throws Exception { public void testFail_givenNonTestTld() {
action.tlds = ImmutableSet.of("not-test.test"); action.tlds = ImmutableSet.of("not-test.test");
IllegalArgumentException thrown = IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, this::runMapreduce); assertThrows(IllegalArgumentException.class, this::runMapreduce);
@ -139,7 +139,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
} }
@Test @Test
public void testFail_givenNonExistentTld() throws Exception { public void testFail_givenNonExistentTld() {
action.tlds = ImmutableSet.of("non-existent.test"); action.tlds = ImmutableSet.of("non-existent.test");
IllegalArgumentException thrown = IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, this::runMapreduce); assertThrows(IllegalArgumentException.class, this::runMapreduce);
@ -149,7 +149,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
} }
@Test @Test
public void testFail_givenNonDotTestTldOnProd() throws Exception { public void testFail_givenNonDotTestTldOnProd() {
action.tlds = ImmutableSet.of("example"); action.tlds = ImmutableSet.of("example");
action.registryEnvironment = RegistryEnvironment.PRODUCTION; action.registryEnvironment = RegistryEnvironment.PRODUCTION;
IllegalArgumentException thrown = IllegalArgumentException thrown =
@ -256,7 +256,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
} }
@Test @Test
public void testFailure_registryAdminClientId_isRequiredForSoftDeletion() throws Exception { public void testFailure_registryAdminClientId_isRequiredForSoftDeletion() {
persistResource( persistResource(
newDomainResource("blah.ib-any.test") newDomainResource("blah.ib-any.test")
.asBuilder() .asBuilder()

View file

@ -100,7 +100,7 @@ public class ExpandRecurringBillingEventsActionTest
.build(); .build();
} }
void saveCursor(final DateTime cursorTime) throws Exception { void saveCursor(final DateTime cursorTime) {
ofy().transact(() -> ofy().save().entity(Cursor.createGlobal(RECURRING_BILLING, cursorTime))); ofy().transact(() -> ofy().save().entity(Cursor.createGlobal(RECURRING_BILLING, cursorTime)));
} }
@ -111,7 +111,7 @@ public class ExpandRecurringBillingEventsActionTest
ofy().clearSessionCache(); ofy().clearSessionCache();
} }
void assertCursorAt(DateTime expectedCursorTime) throws Exception { void assertCursorAt(DateTime expectedCursorTime) {
Cursor cursor = ofy().load().key(Cursor.createGlobalKey(RECURRING_BILLING)).now(); Cursor cursor = ofy().load().key(Cursor.createGlobalKey(RECURRING_BILLING)).now();
assertThat(cursor).isNotNull(); assertThat(cursor).isNotNull();
assertThat(cursor.getCursorTime()).isEqualTo(expectedCursorTime); assertThat(cursor.getCursorTime()).isEqualTo(expectedCursorTime);
@ -643,7 +643,7 @@ public class ExpandRecurringBillingEventsActionTest
} }
@Test @Test
public void testFailure_cursorAfterExecutionTime() throws Exception { public void testFailure_cursorAfterExecutionTime() {
action.cursorTimeParam = Optional.of(clock.nowUtc().plusYears(1)); action.cursorTimeParam = Optional.of(clock.nowUtc().plusYears(1));
IllegalArgumentException thrown = IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, this::runMapreduce); assertThrows(IllegalArgumentException.class, this::runMapreduce);
@ -653,7 +653,7 @@ public class ExpandRecurringBillingEventsActionTest
} }
@Test @Test
public void testFailure_cursorAtExecutionTime() throws Exception { public void testFailure_cursorAtExecutionTime() {
// The clock advances one milli on runMapreduce. // The clock advances one milli on runMapreduce.
action.cursorTimeParam = Optional.of(clock.nowUtc().plusMillis(1)); action.cursorTimeParam = Optional.of(clock.nowUtc().plusMillis(1));
IllegalArgumentException thrown = IllegalArgumentException thrown =

View file

@ -98,7 +98,7 @@ public class MapreduceEntityCleanupActionTest
} }
} }
private static String createMapreduce(String jobName) throws Exception { private static String createMapreduce(String jobName) {
MapReduceJob<String, String, String, String, List<List<String>>> mapReduceJob = MapReduceJob<String, String, String, String, List<List<String>>> mapReduceJob =
new MapReduceJob<>( new MapReduceJob<>(
new MapReduceSpecification.Builder<String, String, String, String, List<List<String>>>() new MapReduceSpecification.Builder<String, String, String, String, List<List<String>>>()
@ -215,7 +215,7 @@ public class MapreduceEntityCleanupActionTest
} }
@Test @Test
public void testNonexistentJobName_fails() throws Exception { public void testNonexistentJobName_fails() {
setJobName("nonexistent"); setJobName("nonexistent");
action.run(); action.run();
@ -491,7 +491,7 @@ public class MapreduceEntityCleanupActionTest
} }
@Test @Test
public void testJobIdAndJobName_fails() throws Exception { public void testJobIdAndJobName_fails() {
setJobIdJobNameAndDaysOld( setJobIdJobNameAndDaysOld(
Optional.of("jobid"), Optional.of("jobname"), Optional.empty()); Optional.of("jobid"), Optional.of("jobname"), Optional.empty());
@ -504,7 +504,7 @@ public class MapreduceEntityCleanupActionTest
} }
@Test @Test
public void testJobIdAndDaysOld_fails() throws Exception { public void testJobIdAndDaysOld_fails() {
setJobIdJobNameAndDaysOld(Optional.of("jobid"), Optional.empty(), Optional.of(0)); setJobIdJobNameAndDaysOld(Optional.of("jobid"), Optional.empty(), Optional.of(0));
action.run(); action.run();
@ -517,7 +517,7 @@ public class MapreduceEntityCleanupActionTest
} }
@Test @Test
public void testJobIdAndNumJobs_fails() throws Exception { public void testJobIdAndNumJobs_fails() {
action = new MapreduceEntityCleanupAction( action = new MapreduceEntityCleanupAction(
Optional.of("jobid"), Optional.of("jobid"),
Optional.empty(), // jobName Optional.empty(), // jobName
@ -539,7 +539,7 @@ public class MapreduceEntityCleanupActionTest
} }
@Test @Test
public void testDeleteZeroJobs_throwsUsageError() throws Exception { public void testDeleteZeroJobs_throwsUsageError() {
new MapreduceEntityCleanupAction( new MapreduceEntityCleanupAction(
Optional.empty(), // jobId Optional.empty(), // jobId
Optional.empty(), // jobName Optional.empty(), // jobName

View file

@ -75,7 +75,7 @@ public class RefreshDnsOnHostRenameActionTest
private final FakeClock clock = new FakeClock(DateTime.parse("2015-01-15T11:22:33Z")); private final FakeClock clock = new FakeClock(DateTime.parse("2015-01-15T11:22:33Z"));
@Before @Before
public void setup() throws Exception { public void setup() {
createTld("tld"); createTld("tld");
enqueuer = enqueuer =
new AsyncFlowEnqueuer( new AsyncFlowEnqueuer(

View file

@ -61,7 +61,7 @@ public class BigqueryTemplatePipelineTest {
} }
@Test @Test
public void testEndToEndPipeline() throws Exception { public void testEndToEndPipeline() {
ImmutableList<TableRow> inputRows = ImmutableList<TableRow> inputRows =
ImmutableList.of( ImmutableList.of(
new TableRow(), new TableRow(),

View file

@ -23,7 +23,7 @@ import org.junit.runners.JUnit4;
public class BigqueryConnectionTest { public class BigqueryConnectionTest {
@Test @Test
public void testNothing() throws Exception { public void testNothing() {
// Placeholder test class for now. // Placeholder test class for now.
// TODO(b/16569089): figure out a good way for testing our Bigquery usage overall - maybe unit // TODO(b/16569089): figure out a good way for testing our Bigquery usage overall - maybe unit
// tests here, maybe end-to-end testing. // tests here, maybe end-to-end testing.

View file

@ -40,7 +40,7 @@ public class BigqueryUtilsTest {
private static final DateTime DATE_3 = DateTime.parse("2014-07-17T20:35:42.123Z"); private static final DateTime DATE_3 = DateTime.parse("2014-07-17T20:35:42.123Z");
@Test @Test
public void test_toBigqueryTimestampString() throws Exception { public void test_toBigqueryTimestampString() {
assertThat(toBigqueryTimestampString(START_OF_TIME)).isEqualTo("1970-01-01 00:00:00.000"); assertThat(toBigqueryTimestampString(START_OF_TIME)).isEqualTo("1970-01-01 00:00:00.000");
assertThat(toBigqueryTimestampString(DATE_0)).isEqualTo("2014-07-17 20:35:42.000"); assertThat(toBigqueryTimestampString(DATE_0)).isEqualTo("2014-07-17 20:35:42.000");
assertThat(toBigqueryTimestampString(DATE_1)).isEqualTo("2014-07-17 20:35:42.100"); assertThat(toBigqueryTimestampString(DATE_1)).isEqualTo("2014-07-17 20:35:42.100");
@ -50,7 +50,7 @@ public class BigqueryUtilsTest {
} }
@Test @Test
public void test_toBigqueryTimestampString_convertsToUtc() throws Exception { public void test_toBigqueryTimestampString_convertsToUtc() {
assertThat(toBigqueryTimestampString(START_OF_TIME.withZone(DateTimeZone.forOffsetHours(5)))) assertThat(toBigqueryTimestampString(START_OF_TIME.withZone(DateTimeZone.forOffsetHours(5))))
.isEqualTo("1970-01-01 00:00:00.000"); .isEqualTo("1970-01-01 00:00:00.000");
assertThat(toBigqueryTimestampString(DateTime.parse("1970-01-01T00:00:00-0500"))) assertThat(toBigqueryTimestampString(DateTime.parse("1970-01-01T00:00:00-0500")))
@ -58,13 +58,13 @@ public class BigqueryUtilsTest {
} }
@Test @Test
public void test_fromBigqueryTimestampString_startAndEndOfTime() throws Exception { public void test_fromBigqueryTimestampString_startAndEndOfTime() {
assertThat(fromBigqueryTimestampString("1970-01-01 00:00:00 UTC")).isEqualTo(START_OF_TIME); assertThat(fromBigqueryTimestampString("1970-01-01 00:00:00 UTC")).isEqualTo(START_OF_TIME);
assertThat(fromBigqueryTimestampString("294247-01-10 04:00:54.775 UTC")).isEqualTo(END_OF_TIME); assertThat(fromBigqueryTimestampString("294247-01-10 04:00:54.775 UTC")).isEqualTo(END_OF_TIME);
} }
@Test @Test
public void test_fromBigqueryTimestampString_trailingZerosOkay() throws Exception { public void test_fromBigqueryTimestampString_trailingZerosOkay() {
assertThat(fromBigqueryTimestampString("2014-07-17 20:35:42 UTC")).isEqualTo(DATE_0); assertThat(fromBigqueryTimestampString("2014-07-17 20:35:42 UTC")).isEqualTo(DATE_0);
assertThat(fromBigqueryTimestampString("2014-07-17 20:35:42.0 UTC")).isEqualTo(DATE_0); assertThat(fromBigqueryTimestampString("2014-07-17 20:35:42.0 UTC")).isEqualTo(DATE_0);
assertThat(fromBigqueryTimestampString("2014-07-17 20:35:42.00 UTC")).isEqualTo(DATE_0); assertThat(fromBigqueryTimestampString("2014-07-17 20:35:42.00 UTC")).isEqualTo(DATE_0);
@ -78,27 +78,27 @@ public class BigqueryUtilsTest {
} }
@Test @Test
public void testFailure_fromBigqueryTimestampString_nonUtcTimeZone() throws Exception { public void testFailure_fromBigqueryTimestampString_nonUtcTimeZone() {
assertThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> fromBigqueryTimestampString("2014-01-01 01:01:01 +05:00")); () -> fromBigqueryTimestampString("2014-01-01 01:01:01 +05:00"));
} }
@Test @Test
public void testFailure_fromBigqueryTimestampString_noTimeZone() throws Exception { public void testFailure_fromBigqueryTimestampString_noTimeZone() {
assertThrows( assertThrows(
IllegalArgumentException.class, () -> fromBigqueryTimestampString("2014-01-01 01:01:01")); IllegalArgumentException.class, () -> fromBigqueryTimestampString("2014-01-01 01:01:01"));
} }
@Test @Test
public void testFailure_fromBigqueryTimestampString_tooManyMillisecondDigits() throws Exception { public void testFailure_fromBigqueryTimestampString_tooManyMillisecondDigits() {
assertThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> fromBigqueryTimestampString("2014-01-01 01:01:01.1234 UTC")); () -> fromBigqueryTimestampString("2014-01-01 01:01:01.1234 UTC"));
} }
@Test @Test
public void test_toBigqueryTimestamp_timeunitConversion() throws Exception { public void test_toBigqueryTimestamp_timeunitConversion() {
assertThat(toBigqueryTimestamp(1234567890L, TimeUnit.SECONDS)) assertThat(toBigqueryTimestamp(1234567890L, TimeUnit.SECONDS))
.isEqualTo("1234567890.000000"); .isEqualTo("1234567890.000000");
assertThat(toBigqueryTimestamp(1234567890123L, TimeUnit.MILLISECONDS)) assertThat(toBigqueryTimestamp(1234567890123L, TimeUnit.MILLISECONDS))
@ -110,14 +110,14 @@ public class BigqueryUtilsTest {
} }
@Test @Test
public void test_toBigqueryTimestamp_timeunitConversionForZero() throws Exception { public void test_toBigqueryTimestamp_timeunitConversionForZero() {
assertThat(toBigqueryTimestamp(0L, TimeUnit.SECONDS)).isEqualTo("0.000000"); assertThat(toBigqueryTimestamp(0L, TimeUnit.SECONDS)).isEqualTo("0.000000");
assertThat(toBigqueryTimestamp(0L, TimeUnit.MILLISECONDS)).isEqualTo("0.000000"); assertThat(toBigqueryTimestamp(0L, TimeUnit.MILLISECONDS)).isEqualTo("0.000000");
assertThat(toBigqueryTimestamp(0L, TimeUnit.MICROSECONDS)).isEqualTo("0.000000"); assertThat(toBigqueryTimestamp(0L, TimeUnit.MICROSECONDS)).isEqualTo("0.000000");
} }
@Test @Test
public void test_toBigqueryTimestamp_datetimeConversion() throws Exception { public void test_toBigqueryTimestamp_datetimeConversion() {
assertThat(toBigqueryTimestamp(START_OF_TIME)).isEqualTo("0.000000"); assertThat(toBigqueryTimestamp(START_OF_TIME)).isEqualTo("0.000000");
assertThat(toBigqueryTimestamp(DATE_0)).isEqualTo("1405629342.000000"); assertThat(toBigqueryTimestamp(DATE_0)).isEqualTo("1405629342.000000");
assertThat(toBigqueryTimestamp(DATE_1)).isEqualTo("1405629342.100000"); assertThat(toBigqueryTimestamp(DATE_1)).isEqualTo("1405629342.100000");
@ -127,18 +127,18 @@ public class BigqueryUtilsTest {
} }
@Test @Test
public void test_toJobReferenceString_normalSucceeds() throws Exception { public void test_toJobReferenceString_normalSucceeds() {
assertThat(toJobReferenceString(new JobReference().setProjectId("foo").setJobId("bar"))) assertThat(toJobReferenceString(new JobReference().setProjectId("foo").setJobId("bar")))
.isEqualTo("foo:bar"); .isEqualTo("foo:bar");
} }
@Test @Test
public void test_toJobReferenceString_emptyReferenceSucceeds() throws Exception { public void test_toJobReferenceString_emptyReferenceSucceeds() {
assertThat(toJobReferenceString(new JobReference())).isEqualTo("null:null"); assertThat(toJobReferenceString(new JobReference())).isEqualTo("null:null");
} }
@Test @Test
public void test_toJobReferenceString_nullThrowsNpe() throws Exception { public void test_toJobReferenceString_nullThrowsNpe() {
assertThrows(NullPointerException.class, () -> toJobReferenceString(null)); assertThrows(NullPointerException.class, () -> toJobReferenceString(null));
} }
} }

View file

@ -23,7 +23,7 @@ import org.junit.runners.JUnit4;
public class RegistryEnvironmentTest { public class RegistryEnvironmentTest {
@Test @Test
public void testGet() throws Exception { public void testGet() {
RegistryEnvironment.get(); RegistryEnvironment.get();
} }
} }

View file

@ -76,7 +76,7 @@ public class TldFanoutActionTest {
return params.build(); return params.build();
} }
private void run(ImmutableListMultimap<String, String> params) throws Exception { private void run(ImmutableListMultimap<String, String> params) {
TldFanoutAction action = new TldFanoutAction(); TldFanoutAction action = new TldFanoutAction();
action.params = params; action.params = params;
action.endpoint = getLast(params.get("endpoint")); action.endpoint = getLast(params.get("endpoint"));
@ -94,7 +94,7 @@ public class TldFanoutActionTest {
} }
@Before @Before
public void before() throws Exception { public void before() {
createTlds("com", "net", "org", "example"); createTlds("com", "net", "org", "example");
persistResource(Registry.get("example").asBuilder().setTldType(TldType.TEST).build()); persistResource(Registry.get("example").asBuilder().setTldType(TldType.TEST).build());
} }
@ -126,7 +126,7 @@ public class TldFanoutActionTest {
} }
@Test @Test
public void testFailure_noTlds() throws Exception { public void testFailure_noTlds() {
assertThrows(IllegalArgumentException.class, () -> run(getParamsMap())); assertThrows(IllegalArgumentException.class, () -> run(getParamsMap()));
} }
@ -188,7 +188,7 @@ public class TldFanoutActionTest {
} }
@Test @Test
public void testFailure_runInEmptyAndTest() throws Exception { public void testFailure_runInEmptyAndTest() {
assertThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
@ -199,7 +199,7 @@ public class TldFanoutActionTest {
} }
@Test @Test
public void testFailure_runInEmptyAndReal() throws Exception { public void testFailure_runInEmptyAndReal() {
assertThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
@ -210,7 +210,7 @@ public class TldFanoutActionTest {
} }
@Test @Test
public void testFailure_runInEmptyAndExclude() throws Exception { public void testFailure_runInEmptyAndExclude() {
assertThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->

View file

@ -92,7 +92,7 @@ public final class DnsInjectionTest {
} }
@Test @Test
public void testRefreshDns_missingDomain_throwsNotFound() throws Exception { public void testRefreshDns_missingDomain_throwsNotFound() {
when(req.getParameter("type")).thenReturn("domain"); when(req.getParameter("type")).thenReturn("domain");
when(req.getParameter("name")).thenReturn("example.lol"); when(req.getParameter("name")).thenReturn("example.lol");
NotFoundException thrown = NotFoundException thrown =
@ -110,7 +110,7 @@ public final class DnsInjectionTest {
} }
@Test @Test
public void testRefreshDns_missingHost_throwsNotFound() throws Exception { public void testRefreshDns_missingHost_throwsNotFound() {
when(req.getParameter("type")).thenReturn("host"); when(req.getParameter("type")).thenReturn("host");
when(req.getParameter("name")).thenReturn("ns1.example.lol"); when(req.getParameter("name")).thenReturn("ns1.example.lol");
NotFoundException thrown = NotFoundException thrown =

View file

@ -62,7 +62,7 @@ public class DnsQueueTest {
} }
@Test @Test
public void test_addHostRefreshTask_failsOnUnknownTld() throws Exception { public void test_addHostRefreshTask_failsOnUnknownTld() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
assertThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
@ -92,7 +92,7 @@ public class DnsQueueTest {
} }
@Test @Test
public void test_addDomainRefreshTask_failsOnUnknownTld() throws Exception { public void test_addDomainRefreshTask_failsOnUnknownTld() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
assertThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,

View file

@ -70,7 +70,7 @@ public class PublishDnsUpdatesActionTest {
private PublishDnsUpdatesAction action; private PublishDnsUpdatesAction action;
@Before @Before
public void setUp() throws Exception { public void setUp() {
inject.setStaticField(Ofy.class, "clock", clock); inject.setStaticField(Ofy.class, "clock", clock);
createTld("xn--q9jyb4c"); createTld("xn--q9jyb4c");
persistResource( persistResource(
@ -86,7 +86,7 @@ public class PublishDnsUpdatesActionTest {
clock.advanceOneMilli(); clock.advanceOneMilli();
} }
private PublishDnsUpdatesAction createAction(String tld) throws Exception { private PublishDnsUpdatesAction createAction(String tld) {
PublishDnsUpdatesAction action = new PublishDnsUpdatesAction(); PublishDnsUpdatesAction action = new PublishDnsUpdatesAction();
action.timeout = Duration.standardSeconds(10); action.timeout = Duration.standardSeconds(10);
action.tld = tld; action.tld = tld;

View file

@ -91,7 +91,7 @@ public class ReadDnsQueueActionTest {
.build(); .build();
@Before @Before
public void before() throws Exception { public void before() {
// Because of b/73372999 - the FakeClock can't be in the past, or the TaskQueues stop working. // Because of b/73372999 - the FakeClock can't be in the past, or the TaskQueues stop working.
// To make sure it's never in the past, we set the date far-far into the future // To make sure it's never in the past, we set the date far-far into the future
clock.setTo(DateTime.parse("3000-01-01TZ")); clock.setTo(DateTime.parse("3000-01-01TZ"));
@ -115,7 +115,7 @@ public class ReadDnsQueueActionTest {
dnsQueue = DnsQueue.createForTesting(clock); dnsQueue = DnsQueue.createForTesting(clock);
} }
private void run() throws Exception { private void run() {
ReadDnsQueueAction action = new ReadDnsQueueAction(); ReadDnsQueueAction action = new ReadDnsQueueAction();
action.tldUpdateBatchSize = TEST_TLD_UPDATE_BATCH_SIZE; action.tldUpdateBatchSize = TEST_TLD_UPDATE_BATCH_SIZE;
action.requestedMaximumDuration = Duration.standardSeconds(10); action.requestedMaximumDuration = Duration.standardSeconds(10);

View file

@ -63,7 +63,7 @@ public class RefreshDnsActionTest {
} }
@Test @Test
public void testSuccess_host() throws Exception { public void testSuccess_host() {
DomainResource domain = persistActiveDomain("example.xn--q9jyb4c"); DomainResource domain = persistActiveDomain("example.xn--q9jyb4c");
persistActiveSubordinateHost("ns1.example.xn--q9jyb4c", domain); persistActiveSubordinateHost("ns1.example.xn--q9jyb4c", domain);
run(TargetType.HOST, "ns1.example.xn--q9jyb4c"); run(TargetType.HOST, "ns1.example.xn--q9jyb4c");
@ -72,7 +72,7 @@ public class RefreshDnsActionTest {
} }
@Test @Test
public void testSuccess_externalHostNotEnqueued() throws Exception { public void testSuccess_externalHostNotEnqueued() {
persistActiveDomain("example.xn--q9jyb4c"); persistActiveDomain("example.xn--q9jyb4c");
persistActiveHost("ns1.example.xn--q9jyb4c"); persistActiveHost("ns1.example.xn--q9jyb4c");
BadRequestException thrown = BadRequestException thrown =
@ -91,7 +91,7 @@ public class RefreshDnsActionTest {
} }
@Test @Test
public void testSuccess_domain() throws Exception { public void testSuccess_domain() {
persistActiveDomain("example.xn--q9jyb4c"); persistActiveDomain("example.xn--q9jyb4c");
run(TargetType.DOMAIN, "example.xn--q9jyb4c"); run(TargetType.DOMAIN, "example.xn--q9jyb4c");
verify(dnsQueue).addDomainRefreshTask("example.xn--q9jyb4c"); verify(dnsQueue).addDomainRefreshTask("example.xn--q9jyb4c");
@ -99,17 +99,17 @@ public class RefreshDnsActionTest {
} }
@Test @Test
public void testFailure_unqualifiedName() throws Exception { public void testFailure_unqualifiedName() {
assertThrows(BadRequestException.class, () -> run(TargetType.DOMAIN, "example")); assertThrows(BadRequestException.class, () -> run(TargetType.DOMAIN, "example"));
} }
@Test @Test
public void testFailure_hostDoesNotExist() throws Exception { public void testFailure_hostDoesNotExist() {
assertThrows(NotFoundException.class, () -> run(TargetType.HOST, "ns1.example.xn--q9jyb4c")); assertThrows(NotFoundException.class, () -> run(TargetType.HOST, "ns1.example.xn--q9jyb4c"));
} }
@Test @Test
public void testFailure_domainDoesNotExist() throws Exception { public void testFailure_domainDoesNotExist() {
assertThrows(NotFoundException.class, () -> run(TargetType.DOMAIN, "example.xn--q9jyb4c")); assertThrows(NotFoundException.class, () -> run(TargetType.DOMAIN, "example.xn--q9jyb4c"));
} }
} }

View file

@ -159,7 +159,7 @@ public class CloudDnsWriterTest {
}); });
} }
private void verifyZone(ImmutableSet<ResourceRecordSet> expectedRecords) throws Exception { private void verifyZone(ImmutableSet<ResourceRecordSet> expectedRecords) {
// Trigger zone changes // Trigger zone changes
writer.commit(); writer.commit();
@ -425,7 +425,7 @@ public class CloudDnsWriterTest {
@Test @Test
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void retryMutateZoneOnError() throws Exception { public void retryMutateZoneOnError() {
CloudDnsWriter spyWriter = spy(writer); CloudDnsWriter spyWriter = spy(writer);
// First call - throw. Second call - do nothing. // First call - throw. Second call - do nothing.
doThrow(ZoneStateException.class).doNothing().when(spyWriter).mutateZone(Matchers.any()); doThrow(ZoneStateException.class).doNothing().when(spyWriter).mutateZone(Matchers.any());

View file

@ -121,7 +121,7 @@ public class DnsUpdateWriterTest {
} }
@Test @Test
public void testPublishAtomic_noCommit() throws Exception { public void testPublishAtomic_noCommit() {
HostResource host1 = persistActiveHost("ns.example1.tld"); HostResource host1 = persistActiveHost("ns.example1.tld");
DomainResource domain1 = DomainResource domain1 =
persistActiveDomain("example1.tld") persistActiveDomain("example1.tld")

View file

@ -93,7 +93,7 @@ public class BigqueryPollJobActionTest {
LoggerConfig.getConfig(BigqueryPollJobAction.class).addHandler(logHandler); LoggerConfig.getConfig(BigqueryPollJobAction.class).addHandler(logHandler);
} }
private static TaskMatcher newPollJobTaskMatcher(String method) throws Exception { private static TaskMatcher newPollJobTaskMatcher(String method) {
return new TaskMatcher() return new TaskMatcher()
.method(method) .method(method)
.url(BigqueryPollJobAction.PATH) .url(BigqueryPollJobAction.PATH)

View file

@ -62,7 +62,7 @@ public class CheckSnapshotActionTest {
private final CheckSnapshotAction action = new CheckSnapshotAction(); private final CheckSnapshotAction action = new CheckSnapshotAction();
@Before @Before
public void before() throws Exception { public void before() {
inject.setStaticField(DatastoreBackupInfo.class, "clock", clock); inject.setStaticField(DatastoreBackupInfo.class, "clock", clock);
action.requestMethod = Method.POST; action.requestMethod = Method.POST;
action.snapshotName = "some_backup"; action.snapshotName = "some_backup";
@ -119,7 +119,7 @@ public class CheckSnapshotActionTest {
} }
@Test @Test
public void testPost_forPendingBackup_returnsNotModified() throws Exception { public void testPost_forPendingBackup_returnsNotModified() {
setPendingBackup(); setPendingBackup();
NotModifiedException thrown = assertThrows(NotModifiedException.class, action::run); NotModifiedException thrown = assertThrows(NotModifiedException.class, action::run);
@ -127,7 +127,7 @@ public class CheckSnapshotActionTest {
} }
@Test @Test
public void testPost_forStalePendingBackupBackup_returnsNoContent() throws Exception { public void testPost_forStalePendingBackupBackup_returnsNoContent() {
setPendingBackup(); setPendingBackup();
when(backupService.findByName("some_backup")).thenReturn(backupInfo); when(backupService.findByName("some_backup")).thenReturn(backupInfo);
@ -182,7 +182,7 @@ public class CheckSnapshotActionTest {
} }
@Test @Test
public void testPost_forBadBackup_returnsBadRequest() throws Exception { public void testPost_forBadBackup_returnsBadRequest() {
when(backupService.findByName("some_backup")) when(backupService.findByName("some_backup"))
.thenThrow(new IllegalArgumentException("No backup found")); .thenThrow(new IllegalArgumentException("No backup found"));
@ -191,7 +191,7 @@ public class CheckSnapshotActionTest {
} }
@Test @Test
public void testGet_returnsInformation() throws Exception { public void testGet_returnsInformation() {
action.requestMethod = Method.GET; action.requestMethod = Method.GET;
action.run(); action.run();
@ -211,7 +211,7 @@ public class CheckSnapshotActionTest {
} }
@Test @Test
public void testGet_forBadBackup_returnsError() throws Exception { public void testGet_forBadBackup_returnsError() {
action.requestMethod = Method.GET; action.requestMethod = Method.GET;
when(backupService.findByName("some_backup")) when(backupService.findByName("some_backup"))
.thenThrow(new IllegalArgumentException("No backup found")); .thenThrow(new IllegalArgumentException("No backup found"));

View file

@ -54,7 +54,7 @@ public class DatastoreBackupInfoTest {
private Entity backupEntity; // Can't initialize until AppEngineRule has set up Datastore. private Entity backupEntity; // Can't initialize until AppEngineRule has set up Datastore.
@Before @Before
public void before() throws Exception { public void before() {
inject.setStaticField(DatastoreBackupInfo.class, "clock", clock); inject.setStaticField(DatastoreBackupInfo.class, "clock", clock);
backupEntity = new Entity("_unused_"); backupEntity = new Entity("_unused_");
backupEntity.setProperty("name", "backup1"); backupEntity.setProperty("name", "backup1");
@ -101,28 +101,28 @@ public class DatastoreBackupInfoTest {
} }
@Test @Test
public void testFailure_missingName() throws Exception { public void testFailure_missingName() {
backupEntity.removeProperty("name"); backupEntity.removeProperty("name");
assertThrows( assertThrows(
NullPointerException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity))); NullPointerException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity)));
} }
@Test @Test
public void testFailure_missingKinds() throws Exception { public void testFailure_missingKinds() {
backupEntity.removeProperty("kinds"); backupEntity.removeProperty("kinds");
assertThrows( assertThrows(
NullPointerException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity))); NullPointerException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity)));
} }
@Test @Test
public void testFailure_missingStartTime() throws Exception { public void testFailure_missingStartTime() {
backupEntity.removeProperty("start_time"); backupEntity.removeProperty("start_time");
assertThrows( assertThrows(
NullPointerException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity))); NullPointerException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity)));
} }
@Test @Test
public void testFailure_badGcsFilenameFormat() throws Exception { public void testFailure_badGcsFilenameFormat() {
backupEntity.setProperty("gs_handle", new Text("foo")); backupEntity.setProperty("gs_handle", new Text("foo"));
assertThrows( assertThrows(
IllegalArgumentException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity))); IllegalArgumentException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity)));

View file

@ -57,7 +57,7 @@ public class DatastoreBackupServiceTest {
private final DatastoreBackupService backupService = DatastoreBackupService.get(); private final DatastoreBackupService backupService = DatastoreBackupService.get();
@Before @Before
public void before() throws Exception { public void before() {
inject.setStaticField(DatastoreBackupService.class, "modulesService", modulesService); inject.setStaticField(DatastoreBackupService.class, "modulesService", modulesService);
when(modulesService.getVersionHostname("default", "ah-builtin-python-bundle")) when(modulesService.getVersionHostname("default", "ah-builtin-python-bundle"))
.thenReturn("ah-builtin-python-bundle.default.localhost"); .thenReturn("ah-builtin-python-bundle.default.localhost");
@ -95,7 +95,7 @@ public class DatastoreBackupServiceTest {
} }
@Test @Test
public void testSuccess_findAllByNamePrefix() throws Exception { public void testSuccess_findAllByNamePrefix() {
assertThat( assertThat(
transform(backupService.findAllByNamePrefix("backupA"), DatastoreBackupInfo::getName)) transform(backupService.findAllByNamePrefix("backupA"), DatastoreBackupInfo::getName))
.containsExactly("backupA1", "backupA2", "backupA3"); .containsExactly("backupA1", "backupA2", "backupA3");
@ -109,18 +109,18 @@ public class DatastoreBackupServiceTest {
} }
@Test @Test
public void testSuccess_findByName() throws Exception { public void testSuccess_findByName() {
assertThat(backupService.findByName("backupA1").getName()).isEqualTo("backupA1"); assertThat(backupService.findByName("backupA1").getName()).isEqualTo("backupA1");
assertThat(backupService.findByName("backupB4").getName()).isEqualTo("backupB42"); assertThat(backupService.findByName("backupB4").getName()).isEqualTo("backupB42");
} }
@Test @Test
public void testFailure_findByName_multipleMatchingBackups() throws Exception { public void testFailure_findByName_multipleMatchingBackups() {
assertThrows(IllegalArgumentException.class, () -> backupService.findByName("backupA")); assertThrows(IllegalArgumentException.class, () -> backupService.findByName("backupA"));
} }
@Test @Test
public void testFailure_findByName_noMatchingBackups() throws Exception { public void testFailure_findByName_noMatchingBackups() {
assertThrows(IllegalArgumentException.class, () -> backupService.findByName("backupX")); assertThrows(IllegalArgumentException.class, () -> backupService.findByName("backupX"));
} }
} }

View file

@ -53,17 +53,17 @@ public class ExportConstantsTest {
""); "");
@Test @Test
public void testBackupKinds_matchGoldenBackupKindsFile() throws Exception { public void testBackupKinds_matchGoldenBackupKindsFile() {
checkKindsMatchGoldenFile("backed-up", GOLDEN_BACKUP_KINDS_FILENAME, getBackupKinds()); checkKindsMatchGoldenFile("backed-up", GOLDEN_BACKUP_KINDS_FILENAME, getBackupKinds());
} }
@Test @Test
public void testReportingKinds_matchGoldenReportingKindsFile() throws Exception { public void testReportingKinds_matchGoldenReportingKindsFile() {
checkKindsMatchGoldenFile("reporting", GOLDEN_REPORTING_KINDS_FILENAME, getReportingKinds()); checkKindsMatchGoldenFile("reporting", GOLDEN_REPORTING_KINDS_FILENAME, getReportingKinds());
} }
@Test @Test
public void testReportingKinds_areSubsetOfBackupKinds() throws Exception { public void testReportingKinds_areSubsetOfBackupKinds() {
assertThat(getBackupKinds()).containsAllIn(getReportingKinds()); assertThat(getBackupKinds()).containsAllIn(getReportingKinds());
} }

View file

@ -95,7 +95,7 @@ public class ExportReservedTermsActionTest {
} }
@Test @Test
public void test_uploadFileToDrive_doesNothingIfReservedListsNotConfigured() throws Exception { public void test_uploadFileToDrive_doesNothingIfReservedListsNotConfigured() {
persistResource( persistResource(
Registry.get("tld") Registry.get("tld")
.asBuilder() .asBuilder()
@ -108,7 +108,7 @@ public class ExportReservedTermsActionTest {
} }
@Test @Test
public void test_uploadFileToDrive_doesNothingWhenDriveFolderIdIsNull() throws Exception { public void test_uploadFileToDrive_doesNothingWhenDriveFolderIdIsNull() {
persistResource(Registry.get("tld").asBuilder().setDriveFolderId(null).build()); persistResource(Registry.get("tld").asBuilder().setDriveFolderId(null).build());
runAction("tld"); runAction("tld");
verify(response).setStatus(SC_OK); verify(response).setStatus(SC_OK);
@ -129,7 +129,7 @@ public class ExportReservedTermsActionTest {
} }
@Test @Test
public void test_uploadFileToDrive_failsWhenTldDoesntExist() throws Exception { public void test_uploadFileToDrive_failsWhenTldDoesntExist() {
RuntimeException thrown = assertThrows(RuntimeException.class, () -> runAction("fakeTld")); RuntimeException thrown = assertThrows(RuntimeException.class, () -> runAction("fakeTld"));
verify(response).setStatus(SC_INTERNAL_SERVER_ERROR); verify(response).setStatus(SC_INTERNAL_SERVER_ERROR);
assertThat(thrown) assertThat(thrown)

View file

@ -46,7 +46,7 @@ public class ExportSnapshotActionTest {
private final ExportSnapshotAction action = new ExportSnapshotAction(); private final ExportSnapshotAction action = new ExportSnapshotAction();
@Before @Before
public void before() throws Exception { public void before() {
action.clock = clock; action.clock = clock;
action.backupService = backupService; action.backupService = backupService;
action.response = response; action.response = response;

View file

@ -180,7 +180,7 @@ public class LoadSnapshotActionTest {
} }
@Test @Test
public void testFailure_doPost_badGcsFilename() throws Exception { public void testFailure_doPost_badGcsFilename() {
action.snapshotFile = "gs://bucket/snapshot"; action.snapshotFile = "gs://bucket/snapshot";
BadRequestException thrown = assertThrows(BadRequestException.class, action::run); BadRequestException thrown = assertThrows(BadRequestException.class, action::run);
assertThat(thrown) assertThat(thrown)

View file

@ -98,7 +98,7 @@ public class SyncGroupMembersActionTest {
} }
@Test @Test
public void test_doPost_noneModified() throws Exception { public void test_doPost_noneModified() {
persistResource( persistResource(
loadRegistrar("NewRegistrar").asBuilder().setContactsRequireSyncing(false).build()); loadRegistrar("NewRegistrar").asBuilder().setContactsRequireSyncing(false).build());
persistResource( persistResource(

View file

@ -66,7 +66,7 @@ public class SyncRegistrarsSheetActionTest {
} }
@Test @Test
public void testPost_withoutParamsOrSystemProperty_dropsTask() throws Exception { public void testPost_withoutParamsOrSystemProperty_dropsTask() {
runAction(null, null); runAction(null, null);
assertThat(response.getPayload()).startsWith("MISSINGNO"); assertThat(response.getPayload()).startsWith("MISSINGNO");
verifyZeroInteractions(syncRegistrarsSheet); verifyZeroInteractions(syncRegistrarsSheet);
@ -85,7 +85,7 @@ public class SyncRegistrarsSheetActionTest {
} }
@Test @Test
public void testPost_noModificationsToRegistrarEntities_doesNothing() throws Exception { public void testPost_noModificationsToRegistrarEntities_doesNothing() {
when(syncRegistrarsSheet.wereRegistrarsModified()).thenReturn(false); when(syncRegistrarsSheet.wereRegistrarsModified()).thenReturn(false);
runAction("NewRegistrar", null); runAction("NewRegistrar", null);
assertThat(response.getPayload()).startsWith("NOTMODIFIED"); assertThat(response.getPayload()).startsWith("NOTMODIFIED");
@ -102,7 +102,7 @@ public class SyncRegistrarsSheetActionTest {
} }
@Test @Test
public void testPost_failToAquireLock_servletDoesNothingAndReturns() throws Exception { public void testPost_failToAquireLock_servletDoesNothingAndReturns() {
action.lockHandler = new FakeLockHandler(false); action.lockHandler = new FakeLockHandler(false);
runAction(null, "foobar"); runAction(null, "foobar");
assertThat(response.getPayload()).startsWith("LOCKED"); assertThat(response.getPayload()).startsWith("LOCKED");

View file

@ -74,7 +74,7 @@ public class SyncRegistrarsSheetTest {
} }
@Before @Before
public void before() throws Exception { public void before() {
inject.setStaticField(Ofy.class, "clock", clock); inject.setStaticField(Ofy.class, "clock", clock);
createTld("example"); createTld("example");
// Remove Registrar entities created by AppEngineRule. // Remove Registrar entities created by AppEngineRule.
@ -82,12 +82,12 @@ public class SyncRegistrarsSheetTest {
} }
@Test @Test
public void test_wereRegistrarsModified_noRegistrars_returnsFalse() throws Exception { public void test_wereRegistrarsModified_noRegistrars_returnsFalse() {
assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isFalse(); assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isFalse();
} }
@Test @Test
public void test_wereRegistrarsModified_atDifferentCursorTimes() throws Exception { public void test_wereRegistrarsModified_atDifferentCursorTimes() {
persistNewRegistrar("SomeRegistrar", "Some Registrar Inc.", Registrar.Type.REAL, 8L); persistNewRegistrar("SomeRegistrar", "Some Registrar Inc.", Registrar.Type.REAL, 8L);
persistResource(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, clock.nowUtc().minusHours(1))); persistResource(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, clock.nowUtc().minusHours(1)));
assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isTrue(); assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isTrue();

View file

@ -64,7 +64,7 @@ public class CheckApi2ActionTest {
private DateTime endTime; private DateTime endTime;
@Before @Before
public void init() throws Exception { public void init() {
createTld("example"); createTld("example");
persistResource( persistResource(
Registry.get("example") Registry.get("example")

View file

@ -46,7 +46,7 @@ public class CheckApiActionTest {
final CheckApiAction action = new CheckApiAction(); final CheckApiAction action = new CheckApiAction();
@Before @Before
public void init() throws Exception { public void init() {
createTld("example"); createTld("example");
persistResource( persistResource(
Registry.get("example") Registry.get("example")
@ -70,42 +70,42 @@ public class CheckApiActionTest {
} }
@Test @Test
public void testFailure_nullDomain() throws Exception { public void testFailure_nullDomain() {
assertThat(getCheckResponse(null)).containsExactly( assertThat(getCheckResponse(null)).containsExactly(
"status", "error", "status", "error",
"reason", "Must supply a valid domain name on an authoritative TLD"); "reason", "Must supply a valid domain name on an authoritative TLD");
} }
@Test @Test
public void testFailure_emptyDomain() throws Exception { public void testFailure_emptyDomain() {
assertThat(getCheckResponse("")).containsExactly( assertThat(getCheckResponse("")).containsExactly(
"status", "error", "status", "error",
"reason", "Must supply a valid domain name on an authoritative TLD"); "reason", "Must supply a valid domain name on an authoritative TLD");
} }
@Test @Test
public void testFailure_invalidDomain() throws Exception { public void testFailure_invalidDomain() {
assertThat(getCheckResponse("@#$%^")).containsExactly( assertThat(getCheckResponse("@#$%^")).containsExactly(
"status", "error", "status", "error",
"reason", "Must supply a valid domain name on an authoritative TLD"); "reason", "Must supply a valid domain name on an authoritative TLD");
} }
@Test @Test
public void testFailure_singlePartDomain() throws Exception { public void testFailure_singlePartDomain() {
assertThat(getCheckResponse("foo")).containsExactly( assertThat(getCheckResponse("foo")).containsExactly(
"status", "error", "status", "error",
"reason", "Must supply a valid domain name on an authoritative TLD"); "reason", "Must supply a valid domain name on an authoritative TLD");
} }
@Test @Test
public void testFailure_nonExistentTld() throws Exception { public void testFailure_nonExistentTld() {
assertThat(getCheckResponse("foo.bar")).containsExactly( assertThat(getCheckResponse("foo.bar")).containsExactly(
"status", "error", "status", "error",
"reason", "Must supply a valid domain name on an authoritative TLD"); "reason", "Must supply a valid domain name on an authoritative TLD");
} }
@Test @Test
public void testFailure_unauthorizedTld() throws Exception { public void testFailure_unauthorizedTld() {
createTld("foo"); createTld("foo");
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of("foo")).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of("foo")).build());
@ -115,7 +115,7 @@ public class CheckApiActionTest {
} }
@Test @Test
public void testSuccess_availableStandard() throws Exception { public void testSuccess_availableStandard() {
assertThat(getCheckResponse("somedomain.example")).containsExactly( assertThat(getCheckResponse("somedomain.example")).containsExactly(
"status", "success", "status", "success",
"available", true, "available", true,
@ -123,7 +123,7 @@ public class CheckApiActionTest {
} }
@Test @Test
public void testSuccess_availableCapital() throws Exception { public void testSuccess_availableCapital() {
assertThat(getCheckResponse("SOMEDOMAIN.EXAMPLE")).containsExactly( assertThat(getCheckResponse("SOMEDOMAIN.EXAMPLE")).containsExactly(
"status", "success", "status", "success",
"available", true, "available", true,
@ -131,7 +131,7 @@ public class CheckApiActionTest {
} }
@Test @Test
public void testSuccess_availableUnicode() throws Exception { public void testSuccess_availableUnicode() {
assertThat(getCheckResponse("ééé.example")).containsExactly( assertThat(getCheckResponse("ééé.example")).containsExactly(
"status", "success", "status", "success",
"available", true, "available", true,
@ -139,7 +139,7 @@ public class CheckApiActionTest {
} }
@Test @Test
public void testSuccess_availablePunycode() throws Exception { public void testSuccess_availablePunycode() {
assertThat(getCheckResponse("xn--9caaa.example")).containsExactly( assertThat(getCheckResponse("xn--9caaa.example")).containsExactly(
"status", "success", "status", "success",
"available", true, "available", true,
@ -147,7 +147,7 @@ public class CheckApiActionTest {
} }
@Test @Test
public void testSuccess_availablePremium() throws Exception { public void testSuccess_availablePremium() {
assertThat(getCheckResponse("rich.example")).containsExactly( assertThat(getCheckResponse("rich.example")).containsExactly(
"status", "success", "status", "success",
"available", true, "available", true,
@ -155,7 +155,7 @@ public class CheckApiActionTest {
} }
@Test @Test
public void testSuccess_alreadyRegistered() throws Exception { public void testSuccess_alreadyRegistered() {
persistActiveDomain("somedomain.example"); persistActiveDomain("somedomain.example");
assertThat(getCheckResponse("somedomain.example")).containsExactly( assertThat(getCheckResponse("somedomain.example")).containsExactly(
"status", "success", "status", "success",
@ -164,7 +164,7 @@ public class CheckApiActionTest {
} }
@Test @Test
public void testSuccess_reserved() throws Exception { public void testSuccess_reserved() {
assertThat(getCheckResponse("foo.example")).containsExactly( assertThat(getCheckResponse("foo.example")).containsExactly(
"status", "success", "status", "success",
"available", false, "available", false,

View file

@ -60,7 +60,7 @@ public class EppCommitLogsTest extends ShardableTestCase {
private EppLoader eppLoader; private EppLoader eppLoader;
@Before @Before
public void init() throws Exception { public void init() {
createTld("tld"); createTld("tld");
inject.setStaticField(Ofy.class, "clock", clock); inject.setStaticField(Ofy.class, "clock", clock);
} }

View file

@ -133,7 +133,7 @@ public class EppControllerTest extends ShardableTestCase {
} }
@Test @Test
public void testHandleEppCommand_unmarshallableData_exportsMetric() throws Exception { public void testHandleEppCommand_unmarshallableData_exportsMetric() {
eppController.handleEppCommand( eppController.handleEppCommand(
sessionMetadata, sessionMetadata,
transportCredentials, transportCredentials,
@ -154,7 +154,7 @@ public class EppControllerTest extends ShardableTestCase {
} }
@Test @Test
public void testHandleEppCommand_regularEppCommand_exportsBigQueryMetric() throws Exception { public void testHandleEppCommand_regularEppCommand_exportsBigQueryMetric() {
eppController.handleEppCommand( eppController.handleEppCommand(
sessionMetadata, sessionMetadata,
transportCredentials, transportCredentials,
@ -176,7 +176,7 @@ public class EppControllerTest extends ShardableTestCase {
} }
@Test @Test
public void testHandleEppCommand_regularEppCommand_exportsEppMetrics() throws Exception { public void testHandleEppCommand_regularEppCommand_exportsEppMetrics() {
createTld("tld"); createTld("tld");
// Note that some of the EPP metric fields, like # of attempts and command name, are set in // Note that some of the EPP metric fields, like # of attempts and command name, are set in
// FlowRunner, not EppController, and since FlowRunner is mocked out for these tests they won't // FlowRunner, not EppController, and since FlowRunner is mocked out for these tests they won't
@ -202,7 +202,7 @@ public class EppControllerTest extends ShardableTestCase {
} }
@Test @Test
public void testHandleEppCommand_dryRunEppCommand_doesNotExportMetric() throws Exception { public void testHandleEppCommand_dryRunEppCommand_doesNotExportMetric() {
eppController.handleEppCommand( eppController.handleEppCommand(
sessionMetadata, sessionMetadata,
transportCredentials, transportCredentials,

View file

@ -45,7 +45,7 @@ public class EppLoginTlsTest extends EppTestCase {
} }
@Before @Before
public void initTest() throws Exception { public void initTest() {
persistResource( persistResource(
loadRegistrar("NewRegistrar") loadRegistrar("NewRegistrar")
.asBuilder() .asBuilder()

View file

@ -41,7 +41,7 @@ public class EppLoginUserTest extends EppTestCase {
.build(); .build();
@Before @Before
public void initTest() throws Exception { public void initTest() {
User user = getUserService().getCurrentUser(); User user = getUserService().getCurrentUser();
persistResource( persistResource(
new RegistrarContact.Builder() new RegistrarContact.Builder()

Some files were not shown because too many files have changed in this diff Show more