diff --git a/java/google/registry/export/ExportReservedTermsAction.java b/java/google/registry/export/ExportReservedTermsAction.java index 1fb2baa2d..7a9f7a75f 100644 --- a/java/google/registry/export/ExportReservedTermsAction.java +++ b/java/google/registry/export/ExportReservedTermsAction.java @@ -14,7 +14,6 @@ package google.registry.export; -import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Strings.isNullOrEmpty; import static com.google.common.net.MediaType.PLAIN_TEXT_UTF_8; import static google.registry.export.ExportUtils.exportReservedTerms; @@ -62,8 +61,11 @@ public class ExportReservedTermsAction implements Runnable { if (registry.getReservedLists().isEmpty() && isNullOrEmpty(registry.getDriveFolderId())) { resultMsg = "No reserved lists configured"; logger.infofmt("No reserved terms to export for TLD %s", tld); + } else if (registry.getDriveFolderId() == null) { + resultMsg = "Skipping export because no Drive folder is associated with this TLD"; + logger.infofmt( + "Skipping reserved terms export for TLD %s because Drive folder isn't specified", tld); } else { - checkNotNull(registry.getDriveFolderId(), "No drive folder associated with this TLD"); resultMsg = driveConnection.createOrUpdateFile( RESERVED_TERMS_FILENAME, EXPORT_MIME_TYPE, diff --git a/java/google/registry/model/registry/Registry.java b/java/google/registry/model/registry/Registry.java index ba1de3e83..88f17bcfa 100644 --- a/java/google/registry/model/registry/Registry.java +++ b/java/google/registry/model/registry/Registry.java @@ -270,7 +270,11 @@ public class Registry extends ImmutableObject implements Buildable { */ String tldUnicode; - /** Id of the folder in drive used to publish information for this TLD. */ + /** + * Id of the folder in drive used to public (export) information for this TLD. + * + *

This is optional; if not configured, then information won't be exported for this TLD. + */ String driveFolderId; /** The type of the TLD, whether it's real or for testing. */ diff --git a/javatests/google/registry/export/ExportReservedTermsActionTest.java b/javatests/google/registry/export/ExportReservedTermsActionTest.java index e8682b0fc..ce250d467 100644 --- a/javatests/google/registry/export/ExportReservedTermsActionTest.java +++ b/javatests/google/registry/export/ExportReservedTermsActionTest.java @@ -110,15 +110,12 @@ public class ExportReservedTermsActionTest { } @Test - public void test_uploadFileToDrive_failsWhenDriveFolderIdIsNull() throws Exception { + public void test_uploadFileToDrive_doesNothingWhenDriveFolderIdIsNull() throws Exception { persistResource(Registry.get("tld").asBuilder().setDriveFolderId(null).build()); - try { - runAction("tld"); - assertWithMessage("Expected RuntimeException to be thrown").fail(); - } catch (RuntimeException e) { - verify(response).setStatus(SC_INTERNAL_SERVER_ERROR); - assertThat(getRootCause(e)).hasMessage("No drive folder associated with this TLD"); - } + runAction("tld"); + verify(response).setStatus(SC_OK); + verify(response) + .setPayload("Skipping export because no Drive folder is associated with this TLD"); } @Test