mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Use cursor to track updating of registrar sheet
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=138221931
This commit is contained in:
parent
3a75486c72
commit
cef07f6bc5
9 changed files with 58 additions and 42 deletions
|
@ -74,6 +74,8 @@ The following cursor types are defined:
|
||||||
escrow provider's SFTP server for a given TLD.
|
escrow provider's SFTP server for a given TLD.
|
||||||
* **`RECURRING_BILLING`** - Expansion of `Recurring` (renew) billing events
|
* **`RECURRING_BILLING`** - Expansion of `Recurring` (renew) billing events
|
||||||
into `OneTime` events.
|
into `OneTime` events.
|
||||||
|
* **`SYNC_REGISTRAR_SHEET`** - Tracks the last time the registrar spreadsheet
|
||||||
|
was successfully synced.
|
||||||
|
|
||||||
All `Cursor` entities in Datastore contain a `DateTime` that represents the next
|
All `Cursor` entities in Datastore contain a `DateTime` that represents the next
|
||||||
timestamp at which an operation should resume processing and a `CursorType` that
|
timestamp at which an operation should resume processing and a `CursorType` that
|
||||||
|
|
|
@ -618,17 +618,6 @@ public final class ConfigModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Amount of time between synchronizations of the Registrar spreadsheet.
|
|
||||||
*
|
|
||||||
* @see google.registry.export.sheet.SyncRegistrarsSheetAction
|
|
||||||
*/
|
|
||||||
@Provides
|
|
||||||
@Config("sheetRegistrarInterval")
|
|
||||||
public static Duration provideSheetRegistrarInterval() {
|
|
||||||
return Duration.standardHours(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns SSH client connection and read timeout.
|
* Returns SSH client connection and read timeout.
|
||||||
*
|
*
|
||||||
|
|
|
@ -21,6 +21,7 @@ java_library(
|
||||||
"//third_party/java/joda_time",
|
"//third_party/java/joda_time",
|
||||||
"//third_party/java/jsr305_annotations",
|
"//third_party/java/jsr305_annotations",
|
||||||
"//third_party/java/jsr330_inject",
|
"//third_party/java/jsr330_inject",
|
||||||
|
"//third_party/java/objectify:objectify-v4_1",
|
||||||
"//third_party/java/servlet/servlet_api",
|
"//third_party/java/servlet/servlet_api",
|
||||||
"//java/google/registry/config",
|
"//java/google/registry/config",
|
||||||
"//java/google/registry/model",
|
"//java/google/registry/model",
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
package google.registry.export.sheet;
|
package google.registry.export.sheet;
|
||||||
|
|
||||||
import static com.google.common.base.MoreObjects.firstNonNull;
|
import static com.google.common.base.MoreObjects.firstNonNull;
|
||||||
|
import static google.registry.model.common.Cursor.CursorType.SYNC_REGISTRAR_SHEET;
|
||||||
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
import static google.registry.model.registrar.RegistrarContact.Type.ABUSE;
|
import static google.registry.model.registrar.RegistrarContact.Type.ABUSE;
|
||||||
import static google.registry.model.registrar.RegistrarContact.Type.ADMIN;
|
import static google.registry.model.registrar.RegistrarContact.Type.ADMIN;
|
||||||
import static google.registry.model.registrar.RegistrarContact.Type.BILLING;
|
import static google.registry.model.registrar.RegistrarContact.Type.BILLING;
|
||||||
|
@ -22,6 +24,7 @@ import static google.registry.model.registrar.RegistrarContact.Type.LEGAL;
|
||||||
import static google.registry.model.registrar.RegistrarContact.Type.MARKETING;
|
import static google.registry.model.registrar.RegistrarContact.Type.MARKETING;
|
||||||
import static google.registry.model.registrar.RegistrarContact.Type.TECH;
|
import static google.registry.model.registrar.RegistrarContact.Type.TECH;
|
||||||
import static google.registry.model.registrar.RegistrarContact.Type.WHOIS;
|
import static google.registry.model.registrar.RegistrarContact.Type.WHOIS;
|
||||||
|
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
@ -32,6 +35,8 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSortedSet;
|
import com.google.common.collect.ImmutableSortedSet;
|
||||||
import com.google.common.collect.Ordering;
|
import com.google.common.collect.Ordering;
|
||||||
import com.google.gdata.util.ServiceException;
|
import com.google.gdata.util.ServiceException;
|
||||||
|
import com.googlecode.objectify.VoidWork;
|
||||||
|
import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.registrar.RegistrarAddress;
|
import google.registry.model.registrar.RegistrarAddress;
|
||||||
import google.registry.model.registrar.RegistrarContact;
|
import google.registry.model.registrar.RegistrarContact;
|
||||||
|
@ -41,10 +46,9 @@ import java.io.IOException;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.Duration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for synchronizing all {@link Registrar} datastore objects to a Google Spreadsheet.
|
* Class for synchronizing all {@link Registrar} Datastore objects to a Google Spreadsheet.
|
||||||
*
|
*
|
||||||
* @see SyncRegistrarsSheetAction
|
* @see SyncRegistrarsSheetAction
|
||||||
*/
|
*/
|
||||||
|
@ -54,11 +58,15 @@ class SyncRegistrarsSheet {
|
||||||
@Inject SheetSynchronizer sheetSynchronizer;
|
@Inject SheetSynchronizer sheetSynchronizer;
|
||||||
@Inject SyncRegistrarsSheet() {}
|
@Inject SyncRegistrarsSheet() {}
|
||||||
|
|
||||||
/** Returns true if a {@link Registrar} entity was modified in past {@code duration}. */
|
/**
|
||||||
boolean wasRegistrarsModifiedInLast(Duration duration) {
|
* Returns true if any {@link Registrar} entity was modified since the last time this task
|
||||||
DateTime watermark = clock.nowUtc().minus(duration);
|
* successfully completed, as measured by a cursor.
|
||||||
|
*/
|
||||||
|
boolean wereRegistrarsModified() {
|
||||||
|
Cursor cursor = ofy().load().key(Cursor.createGlobalKey(SYNC_REGISTRAR_SHEET)).now();
|
||||||
|
DateTime lastUpdateTime = (cursor == null) ? START_OF_TIME : cursor.getCursorTime();
|
||||||
for (Registrar registrar : Registrar.loadAll()) {
|
for (Registrar registrar : Registrar.loadAll()) {
|
||||||
if (DateTimeUtils.isAtOrAfter(registrar.getLastUpdateTime(), watermark)) {
|
if (DateTimeUtils.isAtOrAfter(registrar.getLastUpdateTime(), lastUpdateTime)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +75,7 @@ class SyncRegistrarsSheet {
|
||||||
|
|
||||||
/** Performs the synchronization operation. */
|
/** Performs the synchronization operation. */
|
||||||
void run(String spreadsheetId) throws IOException, ServiceException {
|
void run(String spreadsheetId) throws IOException, ServiceException {
|
||||||
|
final DateTime executionTime = clock.nowUtc();
|
||||||
sheetSynchronizer.synchronize(
|
sheetSynchronizer.synchronize(
|
||||||
spreadsheetId,
|
spreadsheetId,
|
||||||
FluentIterable
|
FluentIterable
|
||||||
|
@ -167,6 +176,11 @@ class SyncRegistrarsSheet {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.toList());
|
.toList());
|
||||||
|
ofy().transact(new VoidWork() {
|
||||||
|
@Override
|
||||||
|
public void vrun() {
|
||||||
|
ofy().save().entity(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, executionTime));
|
||||||
|
}});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String convertContacts(
|
private static String convertContacts(
|
||||||
|
|
|
@ -111,7 +111,6 @@ public class SyncRegistrarsSheetAction implements Runnable {
|
||||||
@Inject SyncRegistrarsSheet syncRegistrarsSheet;
|
@Inject SyncRegistrarsSheet syncRegistrarsSheet;
|
||||||
@Inject @Config("sheetLockTimeout") Duration timeout;
|
@Inject @Config("sheetLockTimeout") Duration timeout;
|
||||||
@Inject @Config("sheetRegistrarId") Optional<String> idConfig;
|
@Inject @Config("sheetRegistrarId") Optional<String> idConfig;
|
||||||
@Inject @Config("sheetRegistrarInterval") Duration interval;
|
|
||||||
@Inject @Parameter("id") Optional<String> idParam;
|
@Inject @Parameter("id") Optional<String> idParam;
|
||||||
@Inject SyncRegistrarsSheetAction() {}
|
@Inject SyncRegistrarsSheetAction() {}
|
||||||
|
|
||||||
|
@ -123,8 +122,7 @@ public class SyncRegistrarsSheetAction implements Runnable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!idParam.isPresent()) {
|
if (!idParam.isPresent()) {
|
||||||
// TODO(b/19082368): Use a cursor.
|
if (!syncRegistrarsSheet.wereRegistrarsModified()) {
|
||||||
if (!syncRegistrarsSheet.wasRegistrarsModifiedInLast(interval)) {
|
|
||||||
Result.NOTMODIFIED.send(response, null);
|
Result.NOTMODIFIED.send(response, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,14 @@ public class Cursor extends ImmutableObject {
|
||||||
* for which Recurring billing events have been expanded (i.e. the inclusive first billing time
|
* for which Recurring billing events have been expanded (i.e. the inclusive first billing time
|
||||||
* for the next expansion job).
|
* for the next expansion job).
|
||||||
*/
|
*/
|
||||||
RECURRING_BILLING(EntityGroupRoot.class);
|
RECURRING_BILLING(EntityGroupRoot.class),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cursor for {@link google.registry.export.sheet.SyncRegistrarsSheetAction}. The DateTime
|
||||||
|
* stored is the last time that registrar changes were successfully synced to the sheet. If
|
||||||
|
* there were no changes since the last time the action run, the cursor is not updated.
|
||||||
|
*/
|
||||||
|
SYNC_REGISTRAR_SHEET(EntityGroupRoot.class);
|
||||||
|
|
||||||
/** See the definition of scope on {@link #getScopeClass}. */
|
/** See the definition of scope on {@link #getScopeClass}. */
|
||||||
private final Class<? extends ImmutableObject> scope;
|
private final Class<? extends ImmutableObject> scope;
|
||||||
|
|
|
@ -18,6 +18,7 @@ java_library(
|
||||||
"//third_party/java/jsr305_annotations",
|
"//third_party/java/jsr305_annotations",
|
||||||
"//third_party/java/junit",
|
"//third_party/java/junit",
|
||||||
"//third_party/java/mockito",
|
"//third_party/java/mockito",
|
||||||
|
"//third_party/java/objectify:objectify-v4_1",
|
||||||
"//third_party/java/servlet/servlet_api",
|
"//third_party/java/servlet/servlet_api",
|
||||||
"//third_party/java/truth",
|
"//third_party/java/truth",
|
||||||
"//java/google/registry/config",
|
"//java/google/registry/config",
|
||||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.export.sheet;
|
||||||
|
|
||||||
import static com.google.common.net.MediaType.PLAIN_TEXT_UTF_8;
|
import static com.google.common.net.MediaType.PLAIN_TEXT_UTF_8;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static org.mockito.Matchers.any;
|
|
||||||
import static org.mockito.Matchers.eq;
|
import static org.mockito.Matchers.eq;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
@ -55,7 +54,6 @@ public class SyncRegistrarsSheetActionTest {
|
||||||
action.syncRegistrarsSheet = syncRegistrarsSheet;
|
action.syncRegistrarsSheet = syncRegistrarsSheet;
|
||||||
action.idConfig = Optional.fromNullable(idConfig);
|
action.idConfig = Optional.fromNullable(idConfig);
|
||||||
action.idParam = Optional.fromNullable(idParam);
|
action.idParam = Optional.fromNullable(idParam);
|
||||||
action.interval = Duration.standardHours(1);
|
|
||||||
action.timeout = Duration.standardHours(1);
|
action.timeout = Duration.standardHours(1);
|
||||||
action.run();
|
action.run();
|
||||||
}
|
}
|
||||||
|
@ -69,22 +67,22 @@ public class SyncRegistrarsSheetActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPost_withoutParams_runsSyncWithDefaultIdAndChecksIfModified() throws Exception {
|
public void testPost_withoutParams_runsSyncWithDefaultIdAndChecksIfModified() throws Exception {
|
||||||
when(syncRegistrarsSheet.wasRegistrarsModifiedInLast(any(Duration.class))).thenReturn(true);
|
when(syncRegistrarsSheet.wereRegistrarsModified()).thenReturn(true);
|
||||||
runAction("jazz", null);
|
runAction("jazz", null);
|
||||||
assertThat(response.getStatus()).isEqualTo(200);
|
assertThat(response.getStatus()).isEqualTo(200);
|
||||||
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
|
assertThat(response.getContentType()).isEqualTo(PLAIN_TEXT_UTF_8);
|
||||||
assertThat(response.getPayload()).startsWith("OK");
|
assertThat(response.getPayload()).startsWith("OK");
|
||||||
verify(syncRegistrarsSheet).wasRegistrarsModifiedInLast(any(Duration.class));
|
verify(syncRegistrarsSheet).wereRegistrarsModified();
|
||||||
verify(syncRegistrarsSheet).run(eq("jazz"));
|
verify(syncRegistrarsSheet).run(eq("jazz"));
|
||||||
verifyNoMoreInteractions(syncRegistrarsSheet);
|
verifyNoMoreInteractions(syncRegistrarsSheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPost_noModificationsToRegistrarEntities_doesNothing() throws Exception {
|
public void testPost_noModificationsToRegistrarEntities_doesNothing() throws Exception {
|
||||||
when(syncRegistrarsSheet.wasRegistrarsModifiedInLast(any(Duration.class))).thenReturn(false);
|
when(syncRegistrarsSheet.wereRegistrarsModified()).thenReturn(false);
|
||||||
runAction("NewRegistrar", null);
|
runAction("NewRegistrar", null);
|
||||||
assertThat(response.getPayload()).startsWith("NOTMODIFIED");
|
assertThat(response.getPayload()).startsWith("NOTMODIFIED");
|
||||||
verify(syncRegistrarsSheet).wasRegistrarsModifiedInLast(any(Duration.class));
|
verify(syncRegistrarsSheet).wereRegistrarsModified();
|
||||||
verifyNoMoreInteractions(syncRegistrarsSheet);
|
verifyNoMoreInteractions(syncRegistrarsSheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,14 @@ package google.registry.export.sheet;
|
||||||
|
|
||||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
import static google.registry.model.common.Cursor.CursorType.SYNC_REGISTRAR_SHEET;
|
||||||
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
import static google.registry.testing.DatastoreHelper.createTld;
|
import static google.registry.testing.DatastoreHelper.createTld;
|
||||||
import static google.registry.testing.DatastoreHelper.deleteResource;
|
import static google.registry.testing.DatastoreHelper.deleteResource;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
||||||
import static org.joda.time.DateTimeZone.UTC;
|
import static org.joda.time.DateTimeZone.UTC;
|
||||||
import static org.joda.time.Duration.standardHours;
|
import static org.joda.time.Duration.standardMinutes;
|
||||||
import static org.mockito.Matchers.eq;
|
import static org.mockito.Matchers.eq;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
|
@ -29,6 +31,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import google.registry.config.RegistryEnvironment;
|
import google.registry.config.RegistryEnvironment;
|
||||||
|
import google.registry.model.common.Cursor;
|
||||||
import google.registry.model.ofy.Ofy;
|
import google.registry.model.ofy.Ofy;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
import google.registry.model.registrar.RegistrarAddress;
|
import google.registry.model.registrar.RegistrarAddress;
|
||||||
|
@ -37,7 +40,6 @@ import google.registry.testing.AppEngineRule;
|
||||||
import google.registry.testing.FakeClock;
|
import google.registry.testing.FakeClock;
|
||||||
import google.registry.testing.InjectRule;
|
import google.registry.testing.InjectRule;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.Duration;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -87,14 +89,12 @@ public class SyncRegistrarsSheetTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWasRegistrarsModifiedInLast_noRegistrars_returnsFalse() throws Exception {
|
public void test_wereRegistrarsModified_noRegistrars_returnsFalse() throws Exception {
|
||||||
SyncRegistrarsSheet sync = newSyncRegistrarsSheet();
|
assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isFalse();
|
||||||
assertThat(sync.wasRegistrarsModifiedInLast(Duration.standardHours(1))).isFalse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWasRegistrarsModifiedInLastInterval() throws Exception {
|
public void test_wereRegistrarsModified_atDifferentCursorTimes() throws Exception {
|
||||||
Duration interval = standardHours(1);
|
|
||||||
persistResource(new Registrar.Builder()
|
persistResource(new Registrar.Builder()
|
||||||
.setClientId("SomeRegistrar")
|
.setClientId("SomeRegistrar")
|
||||||
.setRegistrarName("Some Registrar Inc.")
|
.setRegistrarName("Some Registrar Inc.")
|
||||||
|
@ -102,14 +102,15 @@ public class SyncRegistrarsSheetTest {
|
||||||
.setIanaIdentifier(8L)
|
.setIanaIdentifier(8L)
|
||||||
.setState(Registrar.State.ACTIVE)
|
.setState(Registrar.State.ACTIVE)
|
||||||
.build());
|
.build());
|
||||||
clock.advanceBy(interval);
|
persistResource(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, clock.nowUtc().minusHours(1)));
|
||||||
assertThat(newSyncRegistrarsSheet().wasRegistrarsModifiedInLast(interval)).isTrue();
|
assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isTrue();
|
||||||
clock.advanceOneMilli();
|
persistResource(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, clock.nowUtc().plusHours(1)));
|
||||||
assertThat(newSyncRegistrarsSheet().wasRegistrarsModifiedInLast(interval)).isFalse();
|
assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun() throws Exception {
|
public void testRun() throws Exception {
|
||||||
|
DateTime beforeExecution = clock.nowUtc();
|
||||||
persistResource(new Registrar.Builder()
|
persistResource(new Registrar.Builder()
|
||||||
.setClientId("anotherregistrar")
|
.setClientId("anotherregistrar")
|
||||||
.setRegistrarName("Another Registrar LLC")
|
.setRegistrarName("Another Registrar LLC")
|
||||||
|
@ -190,6 +191,7 @@ public class SyncRegistrarsSheetTest {
|
||||||
persistSimpleResources(contacts);
|
persistSimpleResources(contacts);
|
||||||
persistResource(registrar);
|
persistResource(registrar);
|
||||||
|
|
||||||
|
clock.advanceBy(standardMinutes(1));
|
||||||
newSyncRegistrarsSheet().run("foobar");
|
newSyncRegistrarsSheet().run("foobar");
|
||||||
|
|
||||||
verify(sheetSynchronizer).synchronize(eq("foobar"), rowsCaptor.capture());
|
verify(sheetSynchronizer).synchronize(eq("foobar"), rowsCaptor.capture());
|
||||||
|
@ -254,8 +256,8 @@ public class SyncRegistrarsSheetTest {
|
||||||
assertThat(row).containsEntry("address.countryCode", "US");
|
assertThat(row).containsEntry("address.countryCode", "US");
|
||||||
assertThat(row).containsEntry("phoneNumber", "+1.2223334444");
|
assertThat(row).containsEntry("phoneNumber", "+1.2223334444");
|
||||||
assertThat(row).containsEntry("faxNumber", "");
|
assertThat(row).containsEntry("faxNumber", "");
|
||||||
assertThat(row.get("creationTime")).isEqualTo(clock.nowUtc().toString());
|
assertThat(row.get("creationTime")).isEqualTo(beforeExecution.toString());
|
||||||
assertThat(row.get("lastUpdateTime")).isEqualTo(clock.nowUtc().toString());
|
assertThat(row.get("lastUpdateTime")).isEqualTo(beforeExecution.toString());
|
||||||
assertThat(row).containsEntry("allowedTlds", "example");
|
assertThat(row).containsEntry("allowedTlds", "example");
|
||||||
assertThat(row).containsEntry("blockPremiumNames", "false");
|
assertThat(row).containsEntry("blockPremiumNames", "false");
|
||||||
assertThat(row).containsEntry("ipAddressWhitelist", "");
|
assertThat(row).containsEntry("ipAddressWhitelist", "");
|
||||||
|
@ -289,8 +291,8 @@ public class SyncRegistrarsSheetTest {
|
||||||
assertThat(row).containsEntry("address.countryCode", "US");
|
assertThat(row).containsEntry("address.countryCode", "US");
|
||||||
assertThat(row).containsEntry("phoneNumber", "+1.2125551212");
|
assertThat(row).containsEntry("phoneNumber", "+1.2125551212");
|
||||||
assertThat(row).containsEntry("faxNumber", "+1.2125551213");
|
assertThat(row).containsEntry("faxNumber", "+1.2125551213");
|
||||||
assertThat(row.get("creationTime")).isEqualTo(clock.nowUtc().toString());
|
assertThat(row.get("creationTime")).isEqualTo(beforeExecution.toString());
|
||||||
assertThat(row.get("lastUpdateTime")).isEqualTo(clock.nowUtc().toString());
|
assertThat(row.get("lastUpdateTime")).isEqualTo(beforeExecution.toString());
|
||||||
assertThat(row).containsEntry("allowedTlds", "");
|
assertThat(row).containsEntry("allowedTlds", "");
|
||||||
assertThat(row).containsEntry("whoisServer", "whois.example.com");
|
assertThat(row).containsEntry("whoisServer", "whois.example.com");
|
||||||
assertThat(row).containsEntry("blockPremiumNames", "false");
|
assertThat(row).containsEntry("blockPremiumNames", "false");
|
||||||
|
@ -299,6 +301,10 @@ public class SyncRegistrarsSheetTest {
|
||||||
assertThat(row).containsEntry("referralUrl",
|
assertThat(row).containsEntry("referralUrl",
|
||||||
ENVIRONMENT.config().getRegistrarDefaultReferralUrl().toString());
|
ENVIRONMENT.config().getRegistrarDefaultReferralUrl().toString());
|
||||||
assertThat(row).containsEntry("icannReferralEmail", "jim@example.net");
|
assertThat(row).containsEntry("icannReferralEmail", "jim@example.net");
|
||||||
|
|
||||||
|
Cursor cursor = ofy().load().key(Cursor.createGlobalKey(SYNC_REGISTRAR_SHEET)).now();
|
||||||
|
assertThat(cursor).isNotNull();
|
||||||
|
assertThat(cursor.getCursorTime()).isGreaterThan(beforeExecution);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue