Add capability to sync DNS using multiple writers if configured

This is written in such a way that it can safely handle task items in the
old format so long as the DNS writer to use for the given TLD is unambiguous
(which it is for now, until we allow multiple DNS writers to be configured).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162293412
This commit is contained in:
mcilwain 2017-07-17 17:05:47 -07:00 committed by Ben McIlwain
parent c88a776741
commit 4a921973ea
6 changed files with 131 additions and 60 deletions

View file

@ -23,6 +23,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import google.registry.dns.DnsMetrics.Status;
@ -79,6 +80,7 @@ public class PublishDnsUpdatesActionTest {
action.tld = tld;
action.hosts = ImmutableSet.<String>of();
action.domains = ImmutableSet.<String>of();
action.dnsWriter = Optional.<String>absent();
action.dnsWriterProxy = new DnsWriterProxy(ImmutableMap.of("mock", dnsWriter));
action.dnsMetrics = dnsMetrics;
return action;
@ -102,6 +104,7 @@ public class PublishDnsUpdatesActionTest {
public void testDomain_published() throws Exception {
action = createAction("xn--q9jyb4c");
action.domains = ImmutableSet.of("example.xn--q9jyb4c");
action.dnsWriter = Optional.of("mock");
action.run();
verify(dnsWriter).publishDomain("example.xn--q9jyb4c");