mirror of
https://github.com/google/nomulus.git
synced 2025-07-25 12:08:36 +02:00
Swap all uses of Lock to LockHandler
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167661348
This commit is contained in:
parent
57bcd6b1eb
commit
c3861f6e95
10 changed files with 50 additions and 21 deletions
|
@ -26,14 +26,13 @@ import static org.mockito.Mockito.verify;
|
|||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.common.Cursor.CursorType;
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.server.Lock;
|
||||
import google.registry.rde.EscrowTaskRunner.EscrowTask;
|
||||
import google.registry.request.HttpException.NoContentException;
|
||||
import google.registry.request.HttpException.ServiceUnavailableException;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
import google.registry.testing.ExceptionRule;
|
||||
import google.registry.testing.FakeClock;
|
||||
import java.util.concurrent.Callable;
|
||||
import google.registry.testing.FakeLockHandler;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.junit.Before;
|
||||
|
@ -68,6 +67,7 @@ public class EscrowTaskRunnerTest {
|
|||
runner = new EscrowTaskRunner();
|
||||
runner.clock = clock;
|
||||
runner.tld = "lol";
|
||||
runner.lockHandler = new FakeLockHandler(true);
|
||||
DateTimeZone.setDefault(DateTimeZone.forID("America/New_York")); // Make sure UTC stuff works.
|
||||
}
|
||||
|
||||
|
@ -112,16 +112,8 @@ public class EscrowTaskRunnerTest {
|
|||
persistResource(
|
||||
Cursor.create(CursorType.RDE_STAGING, DateTime.parse("2006-06-06TZ"), registry));
|
||||
thrown.expect(ServiceUnavailableException.class, "Lock in use: " + lockName);
|
||||
Lock.executeWithLocks(
|
||||
new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
runner.lockRunAndRollForward(
|
||||
task, registry, standardSeconds(30), CursorType.RDE_STAGING, standardDays(1));
|
||||
return null;
|
||||
}},
|
||||
"lol",
|
||||
standardSeconds(30),
|
||||
lockName);
|
||||
runner.lockHandler = new FakeLockHandler(false);
|
||||
runner.lockRunAndRollForward(
|
||||
task, registry, standardSeconds(30), CursorType.RDE_STAGING, standardDays(1));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ import google.registry.request.RequestParameters;
|
|||
import google.registry.testing.ExceptionRule;
|
||||
import google.registry.testing.FakeClock;
|
||||
import google.registry.testing.FakeKeyringModule;
|
||||
import google.registry.testing.FakeLockHandler;
|
||||
import google.registry.testing.FakeResponse;
|
||||
import google.registry.testing.InjectRule;
|
||||
import google.registry.testing.TaskQueueHelper.TaskMatcher;
|
||||
|
@ -137,6 +138,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
|
|||
action.lenient = false;
|
||||
action.reducer = new RdeStagingReducer(
|
||||
new TaskEnqueuer(new Retrier(new SystemSleeper(), 1)), // taskEnqueuer
|
||||
new FakeLockHandler(true),
|
||||
0, // gcsBufferSize
|
||||
"rde-bucket", // bucket
|
||||
31337, // ghostrydeBufferSize
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue