Rename Runnable classes from Tasks to Actions

This is cleanup relating to a naming decision that we made awhile ago
but never got around to.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117244827
This commit is contained in:
mcilwain 2016-03-15 09:14:24 -07:00 committed by Justine Tunney
parent 5f7bf57cf9
commit 57fa57968d
48 changed files with 320 additions and 318 deletions

View file

@ -132,7 +132,7 @@ public final class ConfigModule {
return projectId + "-icann-brda";
}
/** @see com.google.domain.registry.rde.BrdaCopyTask */
/** @see com.google.domain.registry.rde.BrdaCopyAction */
@Provides
@Config("brdaDayOfWeek")
public static int provideBrdaDayOfWeek() {
@ -238,8 +238,8 @@ public final class ConfigModule {
/**
* Returns the publicly accessible domain name for the running Google Apps instance.
*
* @see com.google.domain.registry.export.SyncGroupMembersTask
* @see com.google.domain.registry.tools.server.CreateGroupsTask
* @see com.google.domain.registry.export.SyncGroupMembersAction
* @see com.google.domain.registry.tools.server.CreateGroupsAction
*/
@Provides
@Config("publicDomainName")
@ -264,7 +264,7 @@ public final class ConfigModule {
* <p>This file needs to be downloaded at least once a day and verified to make sure it was
* signed by {@code icann-tmch.crt}.
*
* @see com.google.domain.registry.tmch.TmchCrlTask
* @see com.google.domain.registry.tmch.TmchCrlAction
* @see "http://tools.ietf.org/html/draft-lozano-tmch-func-spec-08#section-5.2.3.2"
*/
@Provides
@ -325,7 +325,7 @@ public final class ConfigModule {
*
* <p>You must append {@code "/TLD/ID"} to this URL.
*
* @see com.google.domain.registry.rde.RdeReportTask
* @see com.google.domain.registry.rde.RdeReportAction
*/
@Provides
@Config("rdeReportUrlPrefix")
@ -382,7 +382,7 @@ public final class ConfigModule {
* which cloud storage files are uploaded. The password should not be included, as it's better to
* use public key authentication.
*
* @see com.google.domain.registry.rde.RdeUploadTask
* @see com.google.domain.registry.rde.RdeUploadAction
*/
@Provides
@Config("rdeUploadUrl")
@ -407,7 +407,7 @@ public final class ConfigModule {
*
* <p>This ID, as you'd expect, comes from the URL of the spreadsheet.
*
* @see com.google.domain.registry.export.sheet.SyncRegistrarsSheetTask
* @see com.google.domain.registry.export.sheet.SyncRegistrarsSheetAction
*/
@Provides
@Config("sheetRegistrarId")
@ -437,7 +437,7 @@ public final class ConfigModule {
/**
* Returns SSH client connection and read timeout.
*
* @see com.google.domain.registry.rde.RdeUploadTask
* @see com.google.domain.registry.rde.RdeUploadAction
*/
@Provides
@Config("sshTimeout")

View file

@ -28,15 +28,15 @@ import com.google.domain.registry.util.Clock;
import javax.inject.Inject;
/** Endpoint for manually triggering refresh of DNS information. */
/** Action that manually triggers refresh of DNS information. */
@Action(path = "/_dr/dnsRefresh", automaticallyPrintOk = true)
public final class RefreshDns implements Runnable {
public final class RefreshDnsAction implements Runnable {
@Inject Clock clock;
@Inject DnsQueue dnsQueue;
@Inject @Parameter("name") String domainOrHostName;
@Inject @Parameter("type") TargetType type;
@Inject RefreshDns() {}
@Inject RefreshDnsAction() {}
@Override
public void run() {

View file

@ -49,9 +49,9 @@ import java.util.concurrent.Callable;
import javax.inject.Inject;
import javax.inject.Provider;
/** Task that consumes pull-queue for zone updates to write to the DNS server. */
/** Action that consumes pull-queue for zone updates to write to the DNS server. */
@Action(path = "/_dr/task/writeDns", method = POST, automaticallyPrintOk = true)
public final class WriteDnsTask implements Runnable, Callable<Void> {
public final class WriteDnsAction implements Runnable, Callable<Void> {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
@ -59,7 +59,7 @@ public final class WriteDnsTask implements Runnable, Callable<Void> {
@Inject Provider<DnsWriter> writerProvider;
@Inject @Config("dnsWriteLockTimeout") Duration timeout;
@Inject @Parameter(RequestParameters.PARAM_TLD) String tld;
@Inject WriteDnsTask() {}
@Inject WriteDnsAction() {}
/** Runs the task. */
@Override

View file

@ -34,9 +34,9 @@ import com.google.domain.registry.util.FormattingLogger;
import javax.inject.Inject;
/** Exports the publicly viewable reserved terms list for a TLD to Google Drive. */
/** Action that exports the publicly viewable reserved terms list for a TLD to Google Drive. */
@Action(path = "/_dr/task/exportReservedTerms", method = POST)
public class ExportReservedTermsTask implements Runnable {
public class ExportReservedTermsAction implements Runnable {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
static final MediaType EXPORT_MIME_TYPE = MediaType.PLAIN_TEXT_UTF_8;
@ -45,7 +45,7 @@ public class ExportReservedTermsTask implements Runnable {
@Inject DriveConnection driveConnection;
@Inject @Parameter(RequestParameters.PARAM_TLD) String tld;
@Inject Response response;
@Inject ExportReservedTermsTask() {}
@Inject ExportReservedTermsAction() {}
/**
* Exports the reserved terms for the TLD specified via the "tld" param to a newline-delimited

View file

@ -48,10 +48,12 @@ import javax.annotation.Nullable;
import javax.inject.Inject;
/**
* Syncs changes to {@link RegistrarContact} entities with Google Groups using the Directory API.
* Action that syncs changes to {@link RegistrarContact} entities with Google Groups.
*
* <p>This uses the <a href="https://developers.google.com/admin-sdk/directory/">Directory API</a>.
*/
@Action(path = "/_dr/task/syncGroupMembers", method = POST)
public final class SyncGroupMembersTask implements Runnable {
public final class SyncGroupMembersAction implements Runnable {
/**
* The number of threads to run simultaneously (one per registrar) while processing group syncs.
@ -90,7 +92,7 @@ public final class SyncGroupMembersTask implements Runnable {
@Inject GroupsConnection groupsConnection;
@Inject Response response;
@Inject @Config("publicDomainName") String publicDomainName;
@Inject SyncGroupMembersTask() {}
@Inject SyncGroupMembersAction() {}
private void sendResponse(Result result, @Nullable List<Throwable> causes) {
for (Throwable cause : nullToEmpty(causes)) {

View file

@ -49,7 +49,7 @@ import javax.inject.Inject;
/**
* Class for synchronizing all {@link Registrar} datastore objects to a Google Spreadsheet.
*
* @see SyncRegistrarsSheetTask
* @see SyncRegistrarsSheetAction
*/
class SyncRegistrarsSheet {

View file

@ -46,14 +46,14 @@ import javax.annotation.Nullable;
import javax.inject.Inject;
/**
* Task for synchronizing the registrars spreadsheet.
* Action for synchronizing the registrars spreadsheet.
*
* <p>You can specify the spreadsheet ID by passing the "id" parameter. If this parameter is not
* specified, then the spreadsheet ID will be obtained from the registry configuration.
*
* <p>Cron will run this task hourly. So in order to minimize Google Spreadsheets I/O, this task
* <p>Cron will run this action hourly. So in order to minimize Google Spreadsheets I/O, this action
* will iterate through all registrars and check if any entries were modified in the past hour. If
* no modifications were made, the task will exit without performing any syncing.
* no modifications were made, the action will exit without performing any syncing.
*
* <p><b>Note:</b> Setting the "id" parameter will disable the registrar update check.
*
@ -63,8 +63,8 @@ import javax.inject.Inject;
*
* @see SyncRegistrarsSheet
*/
@Action(path = SyncRegistrarsSheetTask.PATH, method = POST)
public class SyncRegistrarsSheetTask implements Runnable {
@Action(path = SyncRegistrarsSheetAction.PATH, method = POST)
public class SyncRegistrarsSheetAction implements Runnable {
private enum Result {
OK(SC_OK, "Sheet successfully updated."),
@ -116,7 +116,7 @@ public class SyncRegistrarsSheetTask implements Runnable {
@Inject @Config("sheetRegistrarId") Optional<String> idConfig;
@Inject @Config("sheetRegistrarInterval") Duration interval;
@Inject @Parameter("id") Optional<String> idParam;
@Inject SyncRegistrarsSheetTask() {}
@Inject SyncRegistrarsSheetAction() {}
@Override
public void run() {

View file

@ -38,7 +38,7 @@ public interface Keyring extends AutoCloseable {
* <p>This keypair should only be known to the domain registry shared
* registry system.
*
* @see com.google.domain.registry.rde.RdeUploadTask
* @see com.google.domain.registry.rde.RdeUploadAction
*/
PGPKeyPair getRdeSigningKey();
@ -65,28 +65,28 @@ public interface Keyring extends AutoCloseable {
* invocation of the RDE upload thing.
*
* @see #getRdeStagingEncryptionKey()
* @see com.google.domain.registry.rde.RdeUploadTask
* @see com.google.domain.registry.rde.RdeUploadAction
*/
PGPPrivateKey getRdeStagingDecryptionKey();
/**
* Returns public key of escrow agent for encrypting deposits as they're uploaded.
*
* @see com.google.domain.registry.rde.RdeUploadTask
* @see com.google.domain.registry.rde.RdeUploadAction
*/
PGPPublicKey getRdeReceiverKey();
/**
* Returns the PGP key we use to sign Bulk Registration Data Access (BRDA) deposits.
*
* @see com.google.domain.registry.rde.BrdaCopyTask
* @see com.google.domain.registry.rde.BrdaCopyAction
*/
PGPKeyPair getBrdaSigningKey();
/**
* Returns public key of receiver of Bulk Registration Data Access (BRDA) deposits.
*
* @see com.google.domain.registry.rde.BrdaCopyTask
* @see com.google.domain.registry.rde.BrdaCopyAction
*/
PGPPublicKey getBrdaReceiverKey();
@ -97,7 +97,7 @@ public interface Keyring extends AutoCloseable {
* {@code ~/.ssh/id_rsa.pub} file. It's usually a single line with the name of
* the algorithm, the base64 key, and the email address of the owner.
*
* @see com.google.domain.registry.rde.RdeUploadTask
* @see com.google.domain.registry.rde.RdeUploadAction
*/
String getRdeSshClientPublicKey();
@ -112,21 +112,21 @@ public interface Keyring extends AutoCloseable {
* admin console. The request should originate from a backend task queue servlet
* invocation of the RDE upload thing.
*
* @see com.google.domain.registry.rde.RdeUploadTask
* @see com.google.domain.registry.rde.RdeUploadAction
*/
String getRdeSshClientPrivateKey();
/**
* Returns password to be used when uploading reports to ICANN.
*
* @see com.google.domain.registry.rde.RdeReportTask
* @see com.google.domain.registry.rde.RdeReportAction
*/
String getIcannReportingPassword();
/**
* Returns {@code user:password} login for TMCH MarksDB HTTP server DNL interface.
*
* @see com.google.domain.registry.tmch.TmchDnlTask
* @see com.google.domain.registry.tmch.TmchDnlAction
*/
String getMarksdbDnlLogin();
@ -140,7 +140,7 @@ public interface Keyring extends AutoCloseable {
/**
* Returns {@code user:password} login for TMCH MarksDB HTTP server SMDRL interface.
*
* @see com.google.domain.registry.tmch.TmchSmdrlTask
* @see com.google.domain.registry.tmch.TmchSmdrlAction
*/
String getMarksdbSmdrlLogin();

View file

@ -32,7 +32,7 @@ import javax.servlet.http.HttpServletRequest;
@Module
public final class LoadTestModule {
// There's already an @Parameter("clientId") for CreateGroupsTask that's only optional, and we
// There's already an @Parameter("clientId") for CreateGroupsAction that's only optional, and we
// want this one to be required, so give it a different name.
@Provides
@Parameter("loadtestClientId")

View file

@ -52,10 +52,10 @@ public class RegistryCursor extends ImmutableObject {
* of each other will be merged into a single deposit. This is problematic in situations where
* the cursor might be a few days behind and is trying to catch up.
*
* <p>The way we solve this problem is by having {@code RdeUploadTask} check this cursor before
* performing an upload for a given TLD. If the cursor is less than two hours old, the task will
* fail with a status code above 300 and App Engine will keep retrying the task until it's
* ready.
* <p>The way we solve this problem is by having {@code RdeUploadAction} check this cursor
* before performing an upload for a given TLD. If the cursor is less than two hours old, the
* action will fail with a status code above 300 and App Engine will keep retrying the action
* until it's ready.
*/
RDE_UPLOAD_SFTP;
}

View file

@ -25,34 +25,34 @@ import com.google.domain.registry.cron.TldFanoutAction;
import com.google.domain.registry.dns.DnsModule;
import com.google.domain.registry.dns.PublishDnsUpdatesAction;
import com.google.domain.registry.dns.ReadDnsQueueAction;
import com.google.domain.registry.dns.RefreshDns;
import com.google.domain.registry.dns.WriteDnsTask;
import com.google.domain.registry.dns.RefreshDnsAction;
import com.google.domain.registry.dns.WriteDnsAction;
import com.google.domain.registry.export.BigqueryPollJobAction;
import com.google.domain.registry.export.ExportDomainListsAction;
import com.google.domain.registry.export.ExportRequestModule;
import com.google.domain.registry.export.ExportReservedTermsTask;
import com.google.domain.registry.export.SyncGroupMembersTask;
import com.google.domain.registry.export.ExportReservedTermsAction;
import com.google.domain.registry.export.SyncGroupMembersAction;
import com.google.domain.registry.export.sheet.SheetModule;
import com.google.domain.registry.export.sheet.SyncRegistrarsSheetTask;
import com.google.domain.registry.export.sheet.SyncRegistrarsSheetAction;
import com.google.domain.registry.flows.async.AsyncFlowsModule;
import com.google.domain.registry.flows.async.DeleteContactResourceAction;
import com.google.domain.registry.flows.async.DeleteHostResourceAction;
import com.google.domain.registry.flows.async.DnsRefreshForHostRenameAction;
import com.google.domain.registry.mapreduce.MapreduceModule;
import com.google.domain.registry.rde.BrdaCopyTask;
import com.google.domain.registry.rde.BrdaCopyAction;
import com.google.domain.registry.rde.RdeModule;
import com.google.domain.registry.rde.RdeReportTask;
import com.google.domain.registry.rde.RdeReportAction;
import com.google.domain.registry.rde.RdeReporter;
import com.google.domain.registry.rde.RdeStagingAction;
import com.google.domain.registry.rde.RdeUploadTask;
import com.google.domain.registry.rde.RdeUploadAction;
import com.google.domain.registry.request.RequestModule;
import com.google.domain.registry.request.RequestScope;
import com.google.domain.registry.tmch.NordnUploadAction;
import com.google.domain.registry.tmch.NordnVerifyAction;
import com.google.domain.registry.tmch.TmchCrlTask;
import com.google.domain.registry.tmch.TmchDnlTask;
import com.google.domain.registry.tmch.TmchCrlAction;
import com.google.domain.registry.tmch.TmchDnlAction;
import com.google.domain.registry.tmch.TmchModule;
import com.google.domain.registry.tmch.TmchSmdrlTask;
import com.google.domain.registry.tmch.TmchSmdrlAction;
import dagger.Subcomponent;
@ -74,7 +74,7 @@ import dagger.Subcomponent;
})
interface BackendRequestComponent {
BigqueryPollJobAction bigqueryPollJobAction();
BrdaCopyTask brdaCopyTask();
BrdaCopyAction brdaCopyAction();
CommitLogCheckpointAction commitLogCheckpointAction();
CommitLogFanoutAction commitLogFanoutAction();
DeleteContactResourceAction deleteContactResourceAction();
@ -83,22 +83,22 @@ interface BackendRequestComponent {
DnsRefreshForHostRenameAction dnsRefreshForHostRenameAction();
ExportCommitLogDiffAction exportCommitLogDiffAction();
ExportDomainListsAction exportDomainListsAction();
ExportReservedTermsTask exportReservedTermsTask();
ExportReservedTermsAction exportReservedTermsAction();
NordnUploadAction nordnUploadAction();
NordnVerifyAction nordnVerifyAction();
PublishDnsUpdatesAction publishDnsUpdatesAction();
ReadDnsQueueAction readDnsQueueAction();
RdeReportTask rdeReportTask();
RdeReportAction rdeReportAction();
RdeStagingAction rdeStagingAction();
RdeUploadTask rdeUploadTask();
RdeUploadAction rdeUploadAction();
RdeReporter rdeReporter();
RefreshDns refreshDns();
RefreshDnsAction refreshDnsAction();
RestoreCommitLogsAction restoreCommitLogsAction();
SyncGroupMembersTask syncGroupMembersTask();
SyncRegistrarsSheetTask syncRegistrarsSheetTask();
SyncGroupMembersAction syncGroupMembersAction();
SyncRegistrarsSheetAction syncRegistrarsSheetAction();
TldFanoutAction tldFanoutAction();
TmchCrlTask tmchCrlTask();
TmchDnlTask tmchDnlTask();
TmchSmdrlTask tmchSmdrlTask();
WriteDnsTask writeDnsTask();
TmchCrlAction tmchCrlAction();
TmchDnlAction tmchDnlAction();
TmchSmdrlAction tmchSmdrlAction();
WriteDnsAction writeDnsAction();
}

View file

@ -22,7 +22,7 @@ import com.google.domain.registry.request.RequestModule;
import com.google.domain.registry.request.RequestScope;
import com.google.domain.registry.tools.mapreduce.DeleteProberDataAction;
import com.google.domain.registry.tools.mapreduce.ResaveAllEppResourcesAction;
import com.google.domain.registry.tools.server.CreateGroupsTask;
import com.google.domain.registry.tools.server.CreateGroupsAction;
import com.google.domain.registry.tools.server.CreatePremiumListAction;
import com.google.domain.registry.tools.server.DeleteEntityAction;
import com.google.domain.registry.tools.server.GenerateZoneFilesAction;
@ -52,7 +52,7 @@ import dagger.Subcomponent;
})
interface ToolsRequestComponent {
AnnihilateNonDefaultNamespacesAction annihilateNonDefaultNamespacesAction();
CreateGroupsTask createGroupsTask();
CreateGroupsAction createGroupsAction();
CreatePremiumListAction createPremiumListAction();
DeleteEntityAction deleteEntityAction();
DeleteProberDataAction deleteProberDataAction();

View file

@ -43,11 +43,11 @@ import java.io.OutputStream;
import javax.inject.Inject;
/**
* Task that re-encrypts a BRDA escrow deposit and puts it into the upload bucket.
* Action that re-encrypts a BRDA escrow deposit and puts it into the upload bucket.
*
* <p>This task is run by the mapreduce for each BRDA staging file it generates. The staging file is
* encrypted with our internal {@link Ghostryde} encryption. We then re-encrypt it as a RyDE file,
* which is what the third-party escrow provider understands.
* <p>This action is run by the mapreduce for each BRDA staging file it generates. The staging file
* is encrypted with our internal {@link Ghostryde} encryption. We then re-encrypt it as a RyDE
* file, which is what the third-party escrow provider understands.
*
* <p>Then we put the RyDE file (along with our digital signature) into the configured BRDA bucket.
* This bucket is special because a separate script will rsync it to the third party escrow provider
@ -55,8 +55,8 @@ import javax.inject.Inject;
*
* @see "http://newgtlds.icann.org/en/applicants/agb/agreement-approved-09jan14-en.htm"
*/
@Action(path = BrdaCopyTask.PATH, method = POST, automaticallyPrintOk = true)
public final class BrdaCopyTask implements Runnable {
@Action(path = BrdaCopyAction.PATH, method = POST, automaticallyPrintOk = true)
public final class BrdaCopyAction implements Runnable {
static final String PATH = "/_dr/task/brdaCopy";
@ -76,7 +76,7 @@ public final class BrdaCopyTask implements Runnable {
@Inject @Key("brdaReceiverKey") PGPPublicKey receiverKey;
@Inject @Key("brdaSigningKey") PGPKeyPair signingKey;
@Inject @Key("rdeStagingDecryptionKey") PGPPrivateKey stagingDecryptionKey;
@Inject BrdaCopyTask() {}
@Inject BrdaCopyAction() {}
@Override
public void run() {

View file

@ -40,7 +40,7 @@ import javax.inject.Inject;
* as-needed basis.
*
* @see JSchSftpChannel
* @see RdeUploadTask
* @see RdeUploadAction
* @see com.jcraft.jsch.Session
*/
final class JSchSshSession implements Closeable {

View file

@ -48,10 +48,10 @@ import java.io.InputStream;
import javax.inject.Inject;
/**
* Uploads a small XML RDE report to ICANN after {@link RdeUploadTask} has finished.
* Action that uploads a small XML RDE report to ICANN after {@link RdeUploadAction} has finished.
*/
@Action(path = RdeReportTask.PATH, method = POST)
public final class RdeReportTask implements Runnable, EscrowTask {
@Action(path = RdeReportAction.PATH, method = POST)
public final class RdeReportAction implements Runnable, EscrowTask {
static final String PATH = "/_dr/task/rdeReport";
@ -67,7 +67,7 @@ public final class RdeReportTask implements Runnable, EscrowTask {
@Inject @Config("rdeInterval") Duration interval;
@Inject @Config("rdeReportLockTimeout") Duration timeout;
@Inject @Key("rdeStagingDecryptionKey") PGPPrivateKey stagingDecryptionKey;
@Inject RdeReportTask() {}
@Inject RdeReportAction() {}
@Override
public void run() {
@ -80,7 +80,7 @@ public final class RdeReportTask implements Runnable, EscrowTask {
RegistryCursor.load(Registry.get(tld), CursorType.RDE_UPLOAD).or(START_OF_TIME);
if (!stagingCursor.isAfter(watermark)) {
logger.infofmt("tld=%s reportCursor=%s uploadCursor=%s", tld, watermark, stagingCursor);
throw new NoContentException("Waiting for RdeUploadTask to complete");
throw new NoContentException("Waiting for RdeUploadAction to complete");
}
String prefix = RdeNamingUtils.makeRydeFilename(tld, watermark, FULL, 1, 0);
GcsFilename reportFilename = new GcsFilename(bucket, prefix + "-report.xml.ghostryde");

View file

@ -51,7 +51,7 @@ import javax.inject.Inject;
/**
* Class that uploads a decrypted XML deposit report to ICANN's webserver.
*
* @see RdeReportTask
* @see RdeReportAction
*/
public class RdeReporter {

View file

@ -67,7 +67,7 @@ import javax.inject.Inject;
* <p>The XML deposit files generated by this job are humongous. A tiny XML report file is generated
* for each deposit, telling us how much of what it contains.
*
* <p>Once a deposit is successfully generated, an {@link RdeUploadTask} is enqueued which will
* <p>Once a deposit is successfully generated, an {@link RdeUploadAction} is enqueued which will
* upload it via SFTP to the third-party escrow provider.
*
* <p>To generate escrow deposits manually and locally, use the {@code registry_tool} command
@ -128,7 +128,7 @@ import javax.inject.Inject;
* Duplicate jobs may exist {@code <=cursor}. So a transaction will not bother changing the cursor
* if it's already been rolled forward.
*
* <p>Enqueueing {@code RdeUploadTask} is also part of the cursor transaction. This is necessary
* <p>Enqueueing {@code RdeUploadAction} is also part of the cursor transaction. This is necessary
* because the first thing the upload task does is check the staging cursor to verify it's been
* completed, so we can't enqueue before we roll. We also can't enqueue after the roll, because then
* if enqueueing fails, the upload might never be enqueued.

View file

@ -169,7 +169,7 @@ public final class RdeStagingReducer extends Reducer<PendingDeposit, DepositFrag
// Write a file to GCS containing the byte length (ASCII) of the raw unencrypted XML.
//
// This is necessary because RdeUploadTask creates a tar file which requires that the length
// This is necessary because RdeUploadAction creates a tar file which requires that the length
// be outputted. We don't want to have to decrypt the entire ghostryde file to determine the
// length, so we just save it separately.
logger.infofmt("Writing %s", xmlLengthFilename);
@ -195,7 +195,7 @@ public final class RdeStagingReducer extends Reducer<PendingDeposit, DepositFrag
}
}
// Now that we're done, kick off RdeUploadTask and roll forward the cursor transactionally.
// Now that we're done, kick off RdeUploadAction and roll forward the cursor transactionally.
ofy().transact(new VoidWork() {
@Override
public void vrun() {
@ -213,11 +213,11 @@ public final class RdeStagingReducer extends Reducer<PendingDeposit, DepositFrag
RdeRevision.saveRevision(tld, watermark, mode, revision);
if (mode == RdeMode.FULL) {
taskEnqueuer.enqueue(getQueue("rde-upload"),
withUrl(RdeUploadTask.PATH)
withUrl(RdeUploadAction.PATH)
.param(RequestParameters.PARAM_TLD, tld));
} else {
taskEnqueuer.enqueue(getQueue("brda"),
withUrl(BrdaCopyTask.PATH)
withUrl(BrdaCopyAction.PATH)
.param(RequestParameters.PARAM_TLD, tld)
.param(RdeModule.PARAM_WATERMARK, watermark.toString()));
}

View file

@ -67,17 +67,17 @@ import javax.inject.Inject;
import javax.inject.Named;
/**
* Task that securely uploads an RDE XML file from Cloud Storage to a trusted third party (such as
* Action that securely uploads an RDE XML file from Cloud Storage to a trusted third party (such as
* Iron Mountain) via SFTP.
*
* <p>This task is invoked by {@link RdeStagingAction} once it's created the files we need. The date
* is calculated from {@link CursorType#RDE_UPLOAD}.
* <p>This action is invoked by {@link RdeStagingAction} once it's created the files we need. The
* date is calculated from {@link CursorType#RDE_UPLOAD}.
*
* <p>Once this task completes, it rolls the cursor forward a day and triggers
* {@link RdeReportTask}.
* <p>Once this action completes, it rolls the cursor forward a day and triggers
* {@link RdeReportAction}.
*/
@Action(path = RdeUploadTask.PATH, method = POST)
public final class RdeUploadTask implements Runnable, EscrowTask {
@Action(path = RdeUploadAction.PATH, method = POST)
public final class RdeUploadAction implements Runnable, EscrowTask {
static final String PATH = "/_dr/task/rdeUpload";
@ -106,14 +106,14 @@ public final class RdeUploadTask implements Runnable, EscrowTask {
@Inject @Key("rdeSigningKey") PGPKeyPair signingKey;
@Inject @Key("rdeStagingDecryptionKey") PGPPrivateKey stagingDecryptionKey;
@Inject @Named("rde-report") Queue reportQueue;
@Inject RdeUploadTask() {}
@Inject RdeUploadAction() {}
@Override
public void run() {
runner.lockRunAndRollForward(this, Registry.get(tld), timeout, CursorType.RDE_UPLOAD, interval);
taskEnqueuer.enqueue(
reportQueue,
withUrl(RdeReportTask.PATH).param(RequestParameters.PARAM_TLD, tld));
withUrl(RdeReportAction.PATH).param(RequestParameters.PARAM_TLD, tld));
}
@Override
@ -122,7 +122,7 @@ public final class RdeUploadTask implements Runnable, EscrowTask {
RegistryCursor.load(Registry.get(tld), CursorType.RDE_STAGING).or(START_OF_TIME);
if (!stagingCursor.isAfter(watermark)) {
logger.infofmt("tld=%s uploadCursor=%s stagingCursor=%s", tld, watermark, stagingCursor);
throw new ServiceUnavailableException("Waiting for RdeStagingTask to complete");
throw new ServiceUnavailableException("Waiting for RdeStagingAction to complete");
}
DateTime sftpCursor =
RegistryCursor.load(Registry.get(tld), CursorType.RDE_UPLOAD_SFTP).or(START_OF_TIME);

View file

@ -37,7 +37,7 @@ import javax.annotation.concurrent.Immutable;
* preferable to using a plain {@link URI}.
*
* @see java.net.URI
* @see RdeUploadTask
* @see RdeUploadAction
*/
@Immutable
final class RdeUploadUrl implements Comparable<RdeUploadUrl> {

View file

@ -27,13 +27,13 @@ import java.security.GeneralSecurityException;
import javax.inject.Inject;
/** Task to download the latest ICANN TMCH CRL from MarksDB. */
/** Action to download the latest ICANN TMCH CRL from MarksDB. */
@Action(path = "/_dr/task/tmchCrl", method = POST, automaticallyPrintOk = true)
public final class TmchCrlTask implements Runnable {
public final class TmchCrlAction implements Runnable {
@Inject Marksdb marksdb;
@Inject @Config("tmchCrlUrl") URL tmchCrlUrl;
@Inject TmchCrlTask() {}
@Inject TmchCrlAction() {}
/** Synchronously fetches latest ICANN TMCH CRL and saves it to datastore. */
@Override

View file

@ -30,9 +30,9 @@ import java.util.List;
import javax.inject.Inject;
/** Task to download the latest domain name list (aka claims list) from MarksDB. */
/** Action to download the latest domain name list (aka claims list) from MarksDB. */
@Action(path = "/_dr/task/tmchDnl", method = POST, automaticallyPrintOk = true)
public final class TmchDnlTask implements Runnable {
public final class TmchDnlAction implements Runnable {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final String DNL_CSV_PATH = "/dnl/dnl-latest.csv";
@ -40,7 +40,7 @@ public final class TmchDnlTask implements Runnable {
@Inject Marksdb marksdb;
@Inject @Key("marksdbDnlLogin") Optional<String> marksdbDnlLogin;
@Inject TmchDnlTask() {}
@Inject TmchDnlAction() {}
/** Synchronously fetches latest domain name list and saves it to datastore. */
@Override

View file

@ -30,9 +30,9 @@ import java.util.List;
import javax.inject.Inject;
/** Task to download the latest signed mark revocation list from MarksDB. */
/** Action to download the latest signed mark revocation list from MarksDB. */
@Action(path = "/_dr/task/tmchSmdrl", method = POST, automaticallyPrintOk = true)
public final class TmchSmdrlTask implements Runnable {
public final class TmchSmdrlAction implements Runnable {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final String SMDRL_CSV_PATH = "/smdrl/smdrl-latest.csv";
@ -40,7 +40,7 @@ public final class TmchSmdrlTask implements Runnable {
@Inject Marksdb marksdb;
@Inject @Key("marksdbSmdrlLogin") Optional<String> marksdbSmdrlLogin;
@Inject TmchSmdrlTask() {}
@Inject TmchSmdrlAction() {}
/** Synchronously fetches latest signed mark revocation list and saves it to datastore. */
@Override

View file

@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.net.MediaType;
import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.tools.Command.GtechCommand;
import com.google.domain.registry.tools.server.CreateGroupsTask;
import com.google.domain.registry.tools.server.CreateGroupsAction;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
@ -77,8 +77,8 @@ public class CreateRegistrarGroupsCommand extends ConfirmingCommand
protected String execute() throws IOException {
for (Registrar registrar : registrars) {
connection.send(
CreateGroupsTask.PATH,
ImmutableMap.of(CreateGroupsTask.CLIENT_ID_PARAM, registrar.getClientIdentifier()),
CreateGroupsAction.PATH,
ImmutableMap.of(CreateGroupsAction.CLIENT_ID_PARAM, registrar.getClientIdentifier()),
MediaType.PLAIN_TEXT_UTF_8,
new byte[0]);
}

View file

@ -14,7 +14,7 @@
package com.google.domain.registry.tools.server;
import static com.google.domain.registry.export.SyncGroupMembersTask.getGroupEmailAddressForContactType;
import static com.google.domain.registry.export.SyncGroupMembersAction.getGroupEmailAddressForContactType;
import static com.google.domain.registry.request.Action.Method.POST;
import static java.util.Arrays.asList;
import static javax.servlet.http.HttpServletResponse.SC_OK;
@ -42,9 +42,9 @@ import java.util.List;
import javax.annotation.Nullable;
import javax.inject.Inject;
/** A task that creates Google Groups for a registrar's mailing lists. */
@Action(path = CreateGroupsTask.PATH, method = POST)
public class CreateGroupsTask implements Runnable {
/** Action that creates Google Groups for a registrar's mailing lists. */
@Action(path = CreateGroupsAction.PATH, method = POST)
public class CreateGroupsAction implements Runnable {
public static final String PATH = "/_dr/admin/createGroups";
public static final String CLIENT_ID_PARAM = "clientId";
@ -55,7 +55,7 @@ public class CreateGroupsTask implements Runnable {
@Inject Response response;
@Inject @Config("publicDomainName") String publicDomainName;
@Inject @Parameter("clientId") Optional<String> clientId;
@Inject CreateGroupsTask() {}
@Inject CreateGroupsAction() {}
@Override
public void run() {

View file

@ -36,7 +36,7 @@ public class ToolsServerModule {
@Provides
@Parameter("clientId")
static Optional<String> provideClientId(HttpServletRequest req) {
return Optional.fromNullable(emptyToNull(req.getParameter(CreateGroupsTask.CLIENT_ID_PARAM)));
return Optional.fromNullable(emptyToNull(req.getParameter(CreateGroupsAction.CLIENT_ID_PARAM)));
}
@Provides

View file

@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.domain.registry.config.RegistryConfig;
import com.google.domain.registry.config.RegistryEnvironment;
import com.google.domain.registry.export.sheet.SyncRegistrarsSheetTask;
import com.google.domain.registry.export.sheet.SyncRegistrarsSheetAction;
import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.model.registrar.RegistrarContact;
import com.google.domain.registry.security.JsonResponseHelper;
@ -148,7 +148,7 @@ public class RegistrarServlet extends ResourceServlet {
if (CollectionUtils.difference(changedKeys, "lastUpdateTime").isEmpty()) {
return;
}
SyncRegistrarsSheetTask.enqueueBackendTask();
SyncRegistrarsSheetAction.enqueueBackendTask();
ImmutableList<String> toEmailAddress = CONFIG.getRegistrarChangesNotificationEmailAddresses();
if (!toEmailAddress.isEmpty()) {
SendEmailUtils.sendEmail(

View file

@ -78,12 +78,12 @@ public final class DnsInjectionTest {
}
@Test
public void testWriteDnsTask_injectsAndWorks() throws Exception {
public void testWriteDnsAction_injectsAndWorks() throws Exception {
persistActiveSubordinateHost("ns1.example.lol", persistActiveDomain("example.lol"));
clock.advanceOneMilli();
dnsQueue.addDomainRefreshTask("example.lol");
when(req.getParameter("tld")).thenReturn("lol");
component.writeDnsTask().run();
component.writeDnsAction().run();
assertNoDnsTasksEnqueued();
}

View file

@ -32,6 +32,6 @@ import dagger.Component;
})
interface DnsTestComponent {
DnsQueue dnsQueue();
RefreshDns refreshDns();
WriteDnsTask writeDnsTask();
RefreshDnsAction refreshDns();
WriteDnsAction writeDnsAction();
}

View file

@ -40,7 +40,7 @@ import org.mockito.runners.MockitoJUnitRunner;
import javax.inject.Provider;
/** Unit tests for {@link WriteDnsTask}. */
/** Unit tests for {@link WriteDnsAction}. */
@RunWith(MockitoJUnitRunner.class)
public class PublishDnsUpdatesActionTest {

View file

@ -36,9 +36,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Unit tests for {@link RefreshDns}. */
/** Unit tests for {@link RefreshDnsAction}. */
@RunWith(JUnit4.class)
public class RefreshDnsTest {
public class RefreshDnsActionTest {
@Rule
public final AppEngineRule appEngine = AppEngineRule.builder()
@ -53,12 +53,12 @@ public class RefreshDnsTest {
private final FakeClock clock = new FakeClock();
private void run(TargetType type, String name) {
RefreshDns refreshDns = new RefreshDns();
refreshDns.clock = clock;
refreshDns.domainOrHostName = name;
refreshDns.type = type;
refreshDns.dnsQueue = dnsQueue;
refreshDns.run();
RefreshDnsAction action = new RefreshDnsAction();
action.clock = clock;
action.domainOrHostName = name;
action.type = type;
action.dnsQueue = dnsQueue;
action.run();
}
@Before

View file

@ -46,9 +46,9 @@ import org.mockito.runners.MockitoJUnitRunner;
import javax.inject.Provider;
/** Unit tests for {@link WriteDnsTask}. */
/** Unit tests for {@link WriteDnsAction}. */
@RunWith(MockitoJUnitRunner.class)
public class WriteDnsTaskTest {
public class WriteDnsActionTest {
@Rule
public final AppEngineRule appEngine = AppEngineRule.builder()
@ -77,16 +77,16 @@ public class WriteDnsTaskTest {
}
private void run(String tld) {
WriteDnsTask task = new WriteDnsTask();
task.dnsQueue = dnsQueue;
task.timeout = Duration.standardSeconds(10);
task.tld = tld;
task.writerProvider = new Provider<DnsWriter>() {
WriteDnsAction action = new WriteDnsAction();
action.dnsQueue = dnsQueue;
action.timeout = Duration.standardSeconds(10);
action.tld = tld;
action.writerProvider = new Provider<DnsWriter>() {
@Override
public DnsWriter get() {
return dnsWriter;
}};
task.run();
action.run();
}
@After

View file

@ -14,8 +14,8 @@
package com.google.domain.registry.export;
import static com.google.domain.registry.export.ExportReservedTermsTask.EXPORT_MIME_TYPE;
import static com.google.domain.registry.export.ExportReservedTermsTask.RESERVED_TERMS_FILENAME;
import static com.google.domain.registry.export.ExportReservedTermsAction.EXPORT_MIME_TYPE;
import static com.google.domain.registry.export.ExportReservedTermsAction.RESERVED_TERMS_FILENAME;
import static com.google.domain.registry.testing.DatastoreHelper.createTld;
import static com.google.domain.registry.testing.DatastoreHelper.persistReservedList;
import static com.google.domain.registry.testing.DatastoreHelper.persistResource;
@ -47,9 +47,9 @@ import org.mockito.runners.MockitoJUnitRunner;
import java.io.IOException;
/** Unit tests for {@link ExportReservedTermsTask}. */
/** Unit tests for {@link ExportReservedTermsAction}. */
@RunWith(MockitoJUnitRunner.class)
public class ExportReservedTermsTaskTest {
public class ExportReservedTermsActionTest {
@Rule
public final AppEngineRule appEngine = AppEngineRule.builder()
@ -68,12 +68,12 @@ public class ExportReservedTermsTaskTest {
@Mock
private Response response;
private void runTask(String tld) {
ExportReservedTermsTask task = new ExportReservedTermsTask();
task.response = response;
task.driveConnection = driveConnection;
task.tld = tld;
task.run();
private void runAction(String tld) {
ExportReservedTermsAction action = new ExportReservedTermsAction();
action.response = response;
action.driveConnection = driveConnection;
action.tld = tld;
action.run();
}
@Before
@ -96,7 +96,7 @@ public class ExportReservedTermsTaskTest {
@Test
public void test_uploadFileToDrive_succeeds() throws Exception {
runTask("tld");
runAction("tld");
byte[] expected =
("This is a disclaimer.\ncat\nlol\n")
.getBytes(UTF_8);
@ -112,7 +112,7 @@ public class ExportReservedTermsTaskTest {
.setReservedLists(ImmutableSet.<ReservedList>of())
.setDriveFolderId(null)
.build());
runTask("tld");
runAction("tld");
verify(response).setStatus(SC_OK);
verify(response).setPayload("No reserved lists configured");
}
@ -121,7 +121,7 @@ public class ExportReservedTermsTaskTest {
public void test_uploadFileToDrive_failsWhenDriveFolderIdIsNull() throws Exception {
thrown.expectRootCause(NullPointerException.class, "No drive folder associated with this TLD");
persistResource(Registry.get("tld").asBuilder().setDriveFolderId(null).build());
runTask("tld");
runAction("tld");
verify(response).setStatus(SC_INTERNAL_SERVER_ERROR);
}
@ -133,7 +133,7 @@ public class ExportReservedTermsTaskTest {
any(MediaType.class),
anyString(),
any(byte[].class))).thenThrow(new IOException("errorMessage"));
runTask("tld");
runAction("tld");
verify(response).setStatus(SC_INTERNAL_SERVER_ERROR);
}
@ -141,7 +141,7 @@ public class ExportReservedTermsTaskTest {
public void test_uploadFileToDrive_failsWhenTldDoesntExist() throws Exception {
thrown.expectRootCause(
RegistryNotFoundException.class, "No registry object found for fakeTld");
runTask("fakeTld");
runAction("fakeTld");
verify(response).setStatus(SC_INTERNAL_SERVER_ERROR);
}
}

View file

@ -15,7 +15,7 @@
package com.google.domain.registry.export;
import static com.google.common.truth.Truth.assertThat;
import static com.google.domain.registry.export.SyncGroupMembersTask.getGroupEmailAddressForContactType;
import static com.google.domain.registry.export.SyncGroupMembersAction.getGroupEmailAddressForContactType;
import static com.google.domain.registry.model.ofy.ObjectifyService.ofy;
import static com.google.domain.registry.model.registrar.RegistrarContact.Type.ADMIN;
import static com.google.domain.registry.model.registrar.RegistrarContact.Type.MARKETING;
@ -47,13 +47,13 @@ import org.mockito.runners.MockitoJUnitRunner;
import java.io.IOException;
/**
* Unit tests for {@link SyncGroupMembersTask}.
* Unit tests for {@link SyncGroupMembersAction}.
*
* <p>Note that this relies on the registrars NewRegistrar and TheRegistrar created by default in
* {@link AppEngineRule}.
*/
@RunWith(MockitoJUnitRunner.class)
public class SyncGroupMembersTaskTest {
public class SyncGroupMembersActionTest {
@Rule
public final AppEngineRule appEngine = AppEngineRule.builder()
@ -72,12 +72,12 @@ public class SyncGroupMembersTaskTest {
@Mock
private Response response;
private void runTask() {
SyncGroupMembersTask task = new SyncGroupMembersTask();
task.groupsConnection = connection;
task.response = response;
task.publicDomainName = "domain-registry.example";
task.run();
private void runAction() {
SyncGroupMembersAction action = new SyncGroupMembersAction();
action.groupsConnection = connection;
action.response = response;
action.publicDomainName = "domain-registry.example";
action.run();
}
@Test
@ -108,7 +108,7 @@ public class SyncGroupMembersTaskTest {
.asBuilder()
.setContactsRequireSyncing(false)
.build());
runTask();
runAction();
verify(response).setStatus(SC_OK);
verify(response).setPayload("NOT_MODIFIED No registrar contacts have been updated "
+ "since the last time servlet ran.\n");
@ -117,7 +117,7 @@ public class SyncGroupMembersTaskTest {
@Test
public void test_doPost_syncsNewContact() throws Exception {
runTask();
runAction();
verify(connection).addMemberToGroup(
"newregistrar-primary-contacts@domain-registry.example",
"janedoe@theregistrar.com",
@ -131,7 +131,7 @@ public class SyncGroupMembersTaskTest {
public void test_doPost_removesOldContact() throws Exception {
when(connection.getMembersOfGroup("newregistrar-primary-contacts@domain-registry.example"))
.thenReturn(ImmutableSet.of("defunct@example.com", "janedoe@theregistrar.com"));
runTask();
runAction();
verify(connection).removeMemberFromGroup(
"newregistrar-primary-contacts@domain-registry.example", "defunct@example.com");
verify(response).setStatus(SC_OK);
@ -145,7 +145,7 @@ public class SyncGroupMembersTaskTest {
ofy().deleteWithoutBackup()
.entities(Registrar.loadByClientId("NewRegistrar").getContacts())
.now();
runTask();
runAction();
verify(connection).removeMemberFromGroup(
"newregistrar-primary-contacts@domain-registry.example", "defunct@example.com");
verify(connection).removeMemberFromGroup(
@ -178,7 +178,7 @@ public class SyncGroupMembersTaskTest {
.setEmailAddress("hexadecimal@snow.fall")
.setTypes(ImmutableSet.of(TECH))
.build());
runTask();
runAction();
verify(connection).removeMemberFromGroup(
"newregistrar-primary-contacts@domain-registry.example", "defunct@example.com");
verify(connection).addMemberToGroup(
@ -211,7 +211,7 @@ public class SyncGroupMembersTaskTest {
.thenReturn(ImmutableSet.<String> of());
when(connection.getMembersOfGroup("theregistrar-primary-contacts@domain-registry.example"))
.thenThrow(new IOException("Internet was deleted"));
runTask();
runAction();
verify(connection).addMemberToGroup(
"newregistrar-primary-contacts@domain-registry.example",
"janedoe@theregistrar.com",

View file

@ -39,9 +39,9 @@ import java.util.concurrent.Callable;
import javax.annotation.Nullable;
/** Unit tests for {@link SyncRegistrarsSheetTask}. */
/** Unit tests for {@link SyncRegistrarsSheetAction}. */
@RunWith(JUnit4.class)
public class SyncRegistrarsSheetTaskTest {
public class SyncRegistrarsSheetActionTest {
@Rule
public final AppEngineRule appEngine = AppEngineRule.builder()
@ -52,20 +52,20 @@ public class SyncRegistrarsSheetTaskTest {
private final FakeResponse response = new FakeResponse();
private final SyncRegistrarsSheet syncRegistrarsSheet = mock(SyncRegistrarsSheet.class);
private void runTask(@Nullable String idConfig, @Nullable String idParam) {
SyncRegistrarsSheetTask task = new SyncRegistrarsSheetTask();
task.response = response;
task.syncRegistrarsSheet = syncRegistrarsSheet;
task.idConfig = Optional.fromNullable(idConfig);
task.idParam = Optional.fromNullable(idParam);
task.interval = Duration.standardHours(1);
task.timeout = Duration.standardHours(1);
task.run();
private void runAction(@Nullable String idConfig, @Nullable String idParam) {
SyncRegistrarsSheetAction action = new SyncRegistrarsSheetAction();
action.response = response;
action.syncRegistrarsSheet = syncRegistrarsSheet;
action.idConfig = Optional.fromNullable(idConfig);
action.idParam = Optional.fromNullable(idParam);
action.interval = Duration.standardHours(1);
action.timeout = Duration.standardHours(1);
action.run();
}
@Test
public void testPost_withoutParamsOrSystemProperty_dropsTask() throws Exception {
runTask(null, null);
runAction(null, null);
assertThat(response.getPayload()).startsWith("MISSINGNO");
verifyZeroInteractions(syncRegistrarsSheet);
}
@ -73,7 +73,7 @@ public class SyncRegistrarsSheetTaskTest {
@Test
public void testPost_withoutParams_runsSyncWithDefaultIdAndChecksIfModified() throws Exception {
when(syncRegistrarsSheet.wasRegistrarsModifiedInLast(any(Duration.class))).thenReturn(true);
runTask("jazz", null);
runAction("jazz", null);
assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
assertThat(response.getPayload()).startsWith("OK");
@ -85,7 +85,7 @@ public class SyncRegistrarsSheetTaskTest {
@Test
public void testPost_noModificationsToRegistrarEntities_doesNothing() throws Exception {
when(syncRegistrarsSheet.wasRegistrarsModifiedInLast(any(Duration.class))).thenReturn(false);
runTask("NewRegistrar", null);
runAction("NewRegistrar", null);
assertThat(response.getPayload()).startsWith("NOTMODIFIED");
verify(syncRegistrarsSheet).wasRegistrarsModifiedInLast(any(Duration.class));
verifyNoMoreInteractions(syncRegistrarsSheet);
@ -93,7 +93,7 @@ public class SyncRegistrarsSheetTaskTest {
@Test
public void testPost_overrideId_runsSyncWithCustomIdAndDoesNotCheckModified() throws Exception {
runTask(null, "foobar");
runAction(null, "foobar");
assertThat(response.getPayload()).startsWith("OK");
verify(syncRegistrarsSheet).run(eq("foobar"));
verifyNoMoreInteractions(syncRegistrarsSheet);
@ -105,10 +105,10 @@ public class SyncRegistrarsSheetTaskTest {
Lock.executeWithLocks(new Callable<Void>() {
@Override
public Void call() throws Exception {
runTask(null, "foobar");
runAction(null, "foobar");
return null;
}
}, SyncRegistrarsSheetTask.class, "", Duration.standardHours(1), lockName);
}, SyncRegistrarsSheetAction.class, "", Duration.standardHours(1), lockName);
assertThat(response.getPayload()).startsWith("LOCKED");
verifyZeroInteractions(syncRegistrarsSheet);
}

View file

@ -53,9 +53,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/** Unit tests for {@link BrdaCopyTask}. */
/** Unit tests for {@link BrdaCopyAction}. */
@RunWith(JUnit4.class)
public class BrdaCopyTaskTest {
public class BrdaCopyActionTest {
private static final ByteSource DEPOSIT_XML = RdeTestData.get("deposit_full.xml"); // 2010-10-17
@ -98,24 +98,24 @@ public class BrdaCopyTaskTest {
private final GcsService gcsService = GcsServiceFactory.createGcsService();
private final GcsUtils gcsUtils = new GcsUtils(gcsService, 1024);
private final BrdaCopyTask task = new BrdaCopyTask();
private final BrdaCopyAction action = new BrdaCopyAction();
@Before
public void before() throws Exception {
task.gcsUtils = gcsUtils;
task.ghostryde = new Ghostryde(23);
task.pgpCompressionFactory = new RydePgpCompressionOutputStreamFactory(Providers.of(1024));
task.pgpEncryptionFactory = new RydePgpEncryptionOutputStreamFactory(Providers.of(1024));
task.pgpFileFactory = new RydePgpFileOutputStreamFactory(Providers.of(1024));
task.pgpSigningFactory = new RydePgpSigningOutputStreamFactory();
task.tarFactory = new RydeTarOutputStreamFactory();
task.tld = "lol";
task.watermark = DateTime.parse("2010-10-17TZ");
task.brdaBucket = "tub";
task.stagingBucket = "keg";
task.receiverKey = receiverKey;
task.signingKey = signingKey;
task.stagingDecryptionKey = decryptKey;
action.gcsUtils = gcsUtils;
action.ghostryde = new Ghostryde(23);
action.pgpCompressionFactory = new RydePgpCompressionOutputStreamFactory(Providers.of(1024));
action.pgpEncryptionFactory = new RydePgpEncryptionOutputStreamFactory(Providers.of(1024));
action.pgpFileFactory = new RydePgpFileOutputStreamFactory(Providers.of(1024));
action.pgpSigningFactory = new RydePgpSigningOutputStreamFactory();
action.tarFactory = new RydeTarOutputStreamFactory();
action.tld = "lol";
action.watermark = DateTime.parse("2010-10-17TZ");
action.brdaBucket = "tub";
action.stagingBucket = "keg";
action.receiverKey = receiverKey;
action.signingKey = signingKey;
action.stagingDecryptionKey = decryptKey;
byte[] xml = DEPOSIT_XML.read();
GcsTestingUtils.writeGcsFile(gcsService, STAGE_FILE,
@ -126,7 +126,7 @@ public class BrdaCopyTaskTest {
@Test
public void testRun() throws Exception {
task.run();
action.run();
assertThat(gcsUtils.existsAndNotEmpty(STAGE_FILE)).isTrue();
assertThat(gcsUtils.existsAndNotEmpty(RYDE_FILE)).isTrue();
assertThat(gcsUtils.existsAndNotEmpty(SIG_FILE)).isTrue();
@ -135,7 +135,7 @@ public class BrdaCopyTaskTest {
@Test
public void testRun_rydeFormat() throws Exception {
assumeTrue(hasCommand("gpg --version"));
task.run();
action.run();
File rydeTmp = new File(gpg.getCwd(), "ryde");
Files.write(readGcsFile(gcsService, RYDE_FILE), rydeTmp);
@ -174,7 +174,7 @@ public class BrdaCopyTaskTest {
@Test
public void testRun_rydeSignature() throws Exception {
assumeTrue(hasCommand("gpg --version"));
task.run();
action.run();
File rydeTmp = new File(gpg.getCwd(), "ryde");
File sigTmp = new File(gpg.getCwd(), "ryde.sig");

View file

@ -66,9 +66,9 @@ import org.mockito.ArgumentCaptor;
import java.io.ByteArrayInputStream;
import java.util.Map;
/** Unit tests for {@link RdeReportTask}. */
/** Unit tests for {@link RdeReportAction}. */
@RunWith(JUnit4.class)
public class RdeReportTaskTest {
public class RdeReportActionTest {
private static final ByteSource REPORT_XML = RdeTestData.get("report.xml");
private static final ByteSource IIRDEA_BAD_XML = RdeTestData.get("iirdea_bad.xml");
@ -96,24 +96,24 @@ public class RdeReportTaskTest {
private final GcsFilename reportFile =
new GcsFilename("tub", "test_2006-06-06_full_S1_R0-report.xml.ghostryde");
private RdeReportTask createTask() {
private RdeReportAction createAction() {
RdeReporter reporter = new RdeReporter();
reporter.config = config;
reporter.reportUrlPrefix = "https://rde-report.example";
reporter.urlFetchService = urlFetchService;
reporter.password = "foo";
RdeReportTask task = new RdeReportTask();
task.gcsUtils = new GcsUtils(gcsService, 1024);
task.ghostryde = new Ghostryde(1024);
task.response = response;
task.bucket = "tub";
task.tld = "test";
task.interval = standardDays(1);
task.reporter = reporter;
task.timeout = standardSeconds(30);
task.stagingDecryptionKey = new RdeKeyringModule().get().getRdeStagingDecryptionKey();
task.runner = runner;
return task;
RdeReportAction action = new RdeReportAction();
action.gcsUtils = new GcsUtils(gcsService, 1024);
action.ghostryde = new Ghostryde(1024);
action.response = response;
action.bucket = "tub";
action.tld = "test";
action.interval = standardDays(1);
action.reporter = reporter;
action.timeout = standardSeconds(30);
action.stagingDecryptionKey = new RdeKeyringModule().get().getRdeStagingDecryptionKey();
action.runner = runner;
return action;
}
@Before
@ -131,11 +131,11 @@ public class RdeReportTaskTest {
@Test
public void testRun() throws Exception {
createTld("lol");
RdeReportTask task = createTask();
task.tld = "lol";
task.run();
RdeReportAction action = createAction();
action.tld = "lol";
action.run();
verify(runner).lockRunAndRollForward(
task, Registry.get("lol"), standardSeconds(30), CursorType.RDE_REPORT, standardDays(1));
action, Registry.get("lol"), standardSeconds(30), CursorType.RDE_REPORT, standardDays(1));
verifyNoMoreInteractions(runner);
}
@ -144,7 +144,7 @@ public class RdeReportTaskTest {
when(httpResponse.getResponseCode()).thenReturn(SC_OK);
when(httpResponse.getContent()).thenReturn(IIRDEA_GOOD_XML.read());
when(urlFetchService.fetch(request.capture())).thenReturn(httpResponse);
createTask().runWithLock(loadRdeReportCursor());
createAction().runWithLock(loadRdeReportCursor());
assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
assertThat(response.getPayload()).isEqualTo("OK test 2006-06-06T00:00:00.000Z\n");
@ -171,7 +171,7 @@ public class RdeReportTaskTest {
when(httpResponse.getContent()).thenReturn(IIRDEA_BAD_XML.read());
when(urlFetchService.fetch(request.capture())).thenReturn(httpResponse);
thrown.expect(InternalServerErrorException.class, "The structure of the report is invalid.");
createTask().runWithLock(loadRdeReportCursor());
createAction().runWithLock(loadRdeReportCursor());
}
@Test
@ -179,7 +179,7 @@ public class RdeReportTaskTest {
class ExpectedException extends RuntimeException {}
when(urlFetchService.fetch(any(HTTPRequest.class))).thenThrow(new ExpectedException());
thrown.expect(ExpectedException.class);
createTask().runWithLock(loadRdeReportCursor());
createAction().runWithLock(loadRdeReportCursor());
}
private DateTime loadRdeReportCursor() {

View file

@ -325,11 +325,11 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
executeTasksUntilEmpty("mapreduce", clock);
assertTasksEnqueued("rde-upload",
new TaskMatcher()
.url(RdeUploadTask.PATH)
.url(RdeUploadAction.PATH)
.param(RequestParameters.PARAM_TLD, "lol"));
assertTasksEnqueued("brda",
new TaskMatcher()
.url(BrdaCopyTask.PATH)
.url(BrdaCopyAction.PATH)
.param(RequestParameters.PARAM_TLD, "lol")
.param(RdeModule.PARAM_WATERMARK, "2000-01-04T00:00:00.000Z"));
}

View file

@ -26,8 +26,8 @@ import org.junit.runners.Suite.SuiteClasses;
GhostrydeTest.class,
HostResourceToXjcConverterTest.class,
RdeStagingActionTest.class,
RdeUploadTaskTest.class,
RdeReportTaskTest.class,
RdeUploadActionTest.class,
RdeReportActionTest.class,
RegistrarToXjcConverterTest.class,
RydeGpgIntegrationTest.class,
})

View file

@ -85,9 +85,9 @@ import java.io.OutputStream;
import java.net.Socket;
import java.net.URI;
/** Unit tests for {@link RdeUploadTask}. */
/** Unit tests for {@link RdeUploadAction}. */
@RunWith(MockitoJUnitRunner.class)
public class RdeUploadTaskTest {
public class RdeUploadActionTest {
private static final int BUFFER_SIZE = 64 * 1024;
private static final ByteSource REPORT_XML = RdeTestData.get("report.xml");
@ -176,35 +176,35 @@ public class RdeUploadTaskTest {
return ioSpy.register(super.create(os, signingKey));
}};
private RdeUploadTask createTask(URI uploadUrl) {
private RdeUploadAction createAction(URI uploadUrl) {
try (Keyring keyring = new RdeKeyringModule().get()) {
RdeUploadTask task = new RdeUploadTask();
task.clock = clock;
task.gcsUtils = new GcsUtils(gcsService, BUFFER_SIZE);
task.ghostryde = new Ghostryde(BUFFER_SIZE);
task.jsch =
RdeUploadAction action = new RdeUploadAction();
action.clock = clock;
action.gcsUtils = new GcsUtils(gcsService, BUFFER_SIZE);
action.ghostryde = new Ghostryde(BUFFER_SIZE);
action.jsch =
JSchModule.provideJSch(
keyring.getRdeSshClientPrivateKey(), keyring.getRdeSshClientPublicKey());
task.jschSshSessionFactory = new JSchSshSessionFactory(standardSeconds(3));
task.response = response;
task.pgpCompressionFactory = compressFactory;
task.pgpEncryptionFactory = encryptFactory;
task.pgpFileFactory = literalFactory;
task.pgpSigningFactory = signFactory;
task.tarFactory = tarFactory;
task.bucket = "bucket";
task.interval = standardDays(1);
task.timeout = standardSeconds(23);
task.tld = "tld";
task.sftpCooldown = standardSeconds(7);
task.uploadUrl = uploadUrl;
task.receiverKey = keyring.getRdeReceiverKey();
task.signingKey = keyring.getRdeSigningKey();
task.stagingDecryptionKey = keyring.getRdeStagingDecryptionKey();
task.reportQueue = QueueFactory.getQueue("rde-report");
task.runner = runner;
task.taskEnqueuer = new TaskEnqueuer(new Retrier(null, 1));
return task;
action.jschSshSessionFactory = new JSchSshSessionFactory(standardSeconds(3));
action.response = response;
action.pgpCompressionFactory = compressFactory;
action.pgpEncryptionFactory = encryptFactory;
action.pgpFileFactory = literalFactory;
action.pgpSigningFactory = signFactory;
action.tarFactory = tarFactory;
action.bucket = "bucket";
action.interval = standardDays(1);
action.timeout = standardSeconds(23);
action.tld = "tld";
action.sftpCooldown = standardSeconds(7);
action.uploadUrl = uploadUrl;
action.receiverKey = keyring.getRdeReceiverKey();
action.signingKey = keyring.getRdeSigningKey();
action.stagingDecryptionKey = keyring.getRdeStagingDecryptionKey();
action.reportQueue = QueueFactory.getQueue("rde-report");
action.runner = runner;
action.taskEnqueuer = new TaskEnqueuer(new Retrier(null, 1));
return action;
}
}
@ -243,13 +243,13 @@ public class RdeUploadTaskTest {
@Test
public void testRun() throws Exception {
createTld("lol");
RdeUploadTask task = createTask(null);
task.tld = "lol";
task.run();
RdeUploadAction action = createAction(null);
action.tld = "lol";
action.run();
verify(runner).lockRunAndRollForward(
task, Registry.get("lol"), standardSeconds(23), CursorType.RDE_UPLOAD, standardDays(1));
action, Registry.get("lol"), standardSeconds(23), CursorType.RDE_UPLOAD, standardDays(1));
assertTasksEnqueued("rde-report", new TaskMatcher()
.url(RdeReportTask.PATH)
.url(RdeReportAction.PATH)
.param(RequestParameters.PARAM_TLD, "lol"));
verifyNoMoreInteractions(runner);
}
@ -264,7 +264,7 @@ public class RdeUploadTaskTest {
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
persistResource(
RegistryCursor.create(Registry.get("tld"), CursorType.RDE_STAGING, stagingCursor));
createTask(uploadUrl).runWithLock(uploadCursor);
createAction(uploadUrl).runWithLock(uploadCursor);
assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
assertThat(response.getPayload()).isEqualTo("OK tld 2010-10-17T00:00:00.000Z\n");
@ -283,7 +283,7 @@ public class RdeUploadTaskTest {
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
persistResource(
RegistryCursor.create(Registry.get("tld"), CursorType.RDE_STAGING, stagingCursor));
createTask(uploadUrl).runWithLock(uploadCursor);
createAction(uploadUrl).runWithLock(uploadCursor);
assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
assertThat(response.getPayload()).isEqualTo("OK tld 2010-10-17T00:00:00.000Z\n");
@ -311,7 +311,7 @@ public class RdeUploadTaskTest {
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
persistSimpleResource(
RegistryCursor.create(Registry.get("tld"), CursorType.RDE_STAGING, stagingCursor));
createTask(uploadUrl).runWithLock(uploadCursor);
createAction(uploadUrl).runWithLock(uploadCursor);
assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
assertThat(response.getPayload()).isEqualTo("OK tld 2010-10-17T00:00:00.000Z\n");
@ -331,7 +331,7 @@ public class RdeUploadTaskTest {
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
persistResource(
RegistryCursor.create(Registry.get("tld"), CursorType.RDE_STAGING, stagingCursor));
createTask(uploadUrl).runWithLock(uploadCursor);
createAction(uploadUrl).runWithLock(uploadCursor);
// Only verify signature for SFTP versions, since we check elsewhere that the GCS files are
// identical to the ones sent over SFTP.
Process pid = gpg.exec("gpg", "--verify",
@ -349,8 +349,8 @@ public class RdeUploadTaskTest {
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
persistResource(
RegistryCursor.create(Registry.get("tld"), CursorType.RDE_STAGING, stagingCursor));
thrown.expect(ServiceUnavailableException.class, "Waiting for RdeStagingTask to complete");
createTask(null).runWithLock(uploadCursor);
thrown.expect(ServiceUnavailableException.class, "Waiting for RdeStagingAction to complete");
createAction(null).runWithLock(uploadCursor);
}
private String slurp(InputStream is) throws FileNotFoundException, IOException {

View file

@ -38,7 +38,7 @@ import org.mockito.runners.MockitoJUnitRunner;
/** Common code for unit tests of classes that extend {@link Marksdb}. */
@RunWith(MockitoJUnitRunner.class)
public class TmchTaskTestCase {
public class TmchActionTestCase {
static final String MARKSDB_LOGIN = "lolcat:attack";
static final String MARKSDB_LOGIN_BASE64 = "bG9sY2F0OmF0dGFjaw==";

View file

@ -28,14 +28,14 @@ import java.security.SignatureException;
import java.security.cert.CRLException;
import java.security.cert.CertificateNotYetValidException;
/** Unit tests for {@link TmchCrlTask}. */
public class TmchCrlTaskTest extends TmchTaskTestCase {
/** Unit tests for {@link TmchCrlAction}. */
public class TmchCrlActionTest extends TmchActionTestCase {
private TmchCrlTask newTmchCrlTask() throws MalformedURLException {
TmchCrlTask result = new TmchCrlTask();
result.marksdb = marksdb;
result.tmchCrlUrl = new URL("http://sloth.lol/tmch.crl");
return result;
private TmchCrlAction newTmchCrlAction() throws MalformedURLException {
TmchCrlAction action = new TmchCrlAction();
action.marksdb = marksdb;
action.tmchCrlUrl = new URL("http://sloth.lol/tmch.crl");
return action;
}
@Test
@ -44,7 +44,7 @@ public class TmchCrlTaskTest extends TmchTaskTestCase {
configRule.useTmchProdCert();
when(httpResponse.getContent()).thenReturn(
readResourceBytes(TmchCertificateAuthority.class, "icann-tmch.crl").read());
newTmchCrlTask().run();
newTmchCrlAction().run();
verify(httpResponse).getContent();
verify(fetchService).fetch(httpRequest.capture());
assertThat(httpRequest.getValue().getURL().toString()).isEqualTo("http://sloth.lol/tmch.crl");
@ -57,7 +57,7 @@ public class TmchCrlTaskTest extends TmchTaskTestCase {
when(httpResponse.getContent()).thenReturn(
readResourceBytes(TmchCertificateAuthority.class, "icann-tmch-test.crl").read());
thrown.expectRootCause(CRLException.class, "New CRL is more out of date than our current CRL.");
newTmchCrlTask().run();
newTmchCrlAction().run();
}
@Test
@ -66,7 +66,7 @@ public class TmchCrlTaskTest extends TmchTaskTestCase {
when(httpResponse.getContent()).thenReturn(
readResourceBytes(TmchCertificateAuthority.class, "icann-tmch.crl").read());
thrown.expectRootCause(SignatureException.class, "Signature does not match.");
newTmchCrlTask().run();
newTmchCrlAction().run();
}
@Test
@ -75,6 +75,6 @@ public class TmchCrlTaskTest extends TmchTaskTestCase {
when(httpResponse.getContent()).thenReturn(
readResourceBytes(TmchCertificateAuthority.class, "icann-tmch-test.crl").read());
thrown.expectRootCause(CertificateNotYetValidException.class);
newTmchCrlTask().run();
newTmchCrlAction().run();
}
}

View file

@ -25,14 +25,14 @@ import com.google.domain.registry.model.tmch.ClaimsListShard;
import org.joda.time.DateTime;
import org.junit.Test;
/** Unit tests for {@link TmchDnlTask}. */
public class TmchDnlTaskTest extends TmchTaskTestCase {
/** Unit tests for {@link TmchDnlAction}. */
public class TmchDnlActionTest extends TmchActionTestCase {
private TmchDnlTask newTmchDnlTask() {
TmchDnlTask result = new TmchDnlTask();
result.marksdb = marksdb;
result.marksdbDnlLogin = Optional.of(MARKSDB_LOGIN);
return result;
private TmchDnlAction newTmchDnlAction() {
TmchDnlAction action = new TmchDnlAction();
action.marksdb = marksdb;
action.marksdbDnlLogin = Optional.of(MARKSDB_LOGIN);
return action;
}
@Test
@ -41,7 +41,7 @@ public class TmchDnlTaskTest extends TmchTaskTestCase {
when(httpResponse.getContent())
.thenReturn(TmchTestData.loadBytes("dnl-latest.csv").read())
.thenReturn(TmchTestData.loadBytes("dnl-latest.sig").read());
newTmchDnlTask().run();
newTmchDnlAction().run();
verify(fetchService, times(2)).fetch(httpRequest.capture());
assertThat(httpRequest.getAllValues().get(0).getURL().toString())
.isEqualTo(MARKSDB_URL + "/dnl/dnl-latest.csv");

View file

@ -26,16 +26,16 @@ import com.google.domain.registry.model.smd.SignedMarkRevocationList;
import org.joda.time.DateTime;
import org.junit.Test;
/** Unit tests for {@link TmchSmdrlTask}. */
public class TmchSmdrlTaskTest extends TmchTaskTestCase {
/** Unit tests for {@link TmchSmdrlAction}. */
public class TmchSmdrlActionTest extends TmchActionTestCase {
private static final DateTime now = DateTime.parse("2014-01-01T00:00:00Z");
private TmchSmdrlTask newTmchSmdrlTask() {
TmchSmdrlTask result = new TmchSmdrlTask();
result.marksdb = marksdb;
result.marksdbSmdrlLogin = Optional.absent();
return result;
private TmchSmdrlAction newTmchSmdrlAction() {
TmchSmdrlAction action = new TmchSmdrlAction();
action.marksdb = marksdb;
action.marksdbSmdrlLogin = Optional.absent();
return action;
}
@Test
@ -46,7 +46,7 @@ public class TmchSmdrlTaskTest extends TmchTaskTestCase {
when(httpResponse.getContent())
.thenReturn(loadBytes("smdrl-latest.csv").read())
.thenReturn(loadBytes("smdrl-latest.sig").read());
newTmchSmdrlTask().run();
newTmchSmdrlAction().run();
verify(fetchService, times(2)).fetch(httpRequest.capture());
assertThat(httpRequest.getAllValues().get(0).getURL().toString())
.isEqualTo(MARKSDB_URL + "/smdrl/smdrl-latest.csv");

View file

@ -26,9 +26,9 @@ import org.junit.runners.Suite.SuiteClasses;
NordnVerifyAction.class,
SmdrlCsvParserTest.class,
TmchCertificateAuthorityTest.class,
TmchCrlTaskTest.class,
TmchDnlTaskTest.class,
TmchSmdrlTaskTest.class,
TmchCrlActionTest.class,
TmchDnlActionTest.class,
TmchSmdrlActionTest.class,
TmchXmlSignatureTest.class,
})
class TmchTestSuite {}

View file

@ -38,10 +38,10 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
/**
* Unit tests for {@link CreateGroupsTask}.
* Unit tests for {@link CreateGroupsAction}.
*/
@RunWith(MockitoJUnitRunner.class)
public class CreateGroupsTaskTest {
public class CreateGroupsActionTest {
@Rule
public final AppEngineRule appEngine = AppEngineRule.builder()
@ -60,32 +60,32 @@ public class CreateGroupsTaskTest {
@Mock
private Response response;
private void runTask(String clientId) {
CreateGroupsTask task = new CreateGroupsTask();
task.response = response;
task.groupsConnection = connection;
task.publicDomainName = "domain-registry.example";
task.clientId = Optional.fromNullable(clientId);
task.run();
private void runAction(String clientId) {
CreateGroupsAction action = new CreateGroupsAction();
action.response = response;
action.groupsConnection = connection;
action.publicDomainName = "domain-registry.example";
action.clientId = Optional.fromNullable(clientId);
action.run();
}
@Test
public void test_invalidRequest_missingClientId() throws Exception {
thrown.expect(BadRequestException.class,
"Error creating Google Groups, missing parameter: clientId");
runTask(null);
runAction(null);
}
@Test
public void test_invalidRequest_invalidClientId() throws Exception {
thrown.expect(BadRequestException.class,
"Error creating Google Groups; could not find registrar with id completelyMadeUpClientId");
runTask("completelyMadeUpClientId");
runAction("completelyMadeUpClientId");
}
@Test
public void test_createsAllGroupsSuccessfully() throws Exception {
runTask("NewRegistrar");
runAction("NewRegistrar");
verify(response).setStatus(SC_OK);
verify(response).setPayload("Success!");
verifyGroupCreationCallsForNewRegistrar();
@ -103,7 +103,7 @@ public class CreateGroupsTaskTest {
"newregistrar-technical-contacts@domain-registry.example",
Role.MEMBER);
try {
runTask("NewRegistrar");
runAction("NewRegistrar");
} catch (InternalServerErrorException e) {
String responseString = e.toString();
assertThat(responseString).contains("abuse => Success");

View file

@ -26,7 +26,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableMap;
import com.google.domain.registry.export.sheet.SyncRegistrarsSheetTask;
import com.google.domain.registry.export.sheet.SyncRegistrarsSheetAction;
import com.google.domain.registry.model.registrar.Registrar;
import com.google.domain.registry.testing.TaskQueueHelper.TaskMatcher;
@ -54,7 +54,7 @@ public class RegistrarServletTest extends RegistrarServletTestCase {
new InternetAddress("notification2@test.example"));
assertThat(message.getContent()).isEqualTo(expectedEmailBody);
assertTasksEnqueued("sheet", new TaskMatcher()
.url(SyncRegistrarsSheetTask.PATH)
.url(SyncRegistrarsSheetAction.PATH)
.method("GET")
.header("Host", "backend.hostname"));
}

View file

@ -23,7 +23,7 @@ import static org.mockito.Mockito.when;
import com.google.appengine.api.modules.ModulesService;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableMap;
import com.google.domain.registry.export.sheet.SyncRegistrarsSheetTask;
import com.google.domain.registry.export.sheet.SyncRegistrarsSheetAction;
import com.google.domain.registry.model.ofy.Ofy;
import com.google.domain.registry.testing.AppEngineRule;
import com.google.domain.registry.testing.ExceptionRule;
@ -95,7 +95,7 @@ public class RegistrarServletTestCase {
inject.setStaticField(Ofy.class, "clock", clock);
inject.setStaticField(ResourceServlet.class, "sessionUtils", sessionUtils);
inject.setStaticField(SendEmailUtils.class, "emailService", emailService);
inject.setStaticField(SyncRegistrarsSheetTask.class, "modulesService", modulesService);
inject.setStaticField(SyncRegistrarsSheetAction.class, "modulesService", modulesService);
message = new MimeMessage(Session.getDefaultInstance(new Properties(), null));
when(emailService.createMessage()).thenReturn(message);
when(req.getMethod()).thenReturn("POST");