Fix NPE in registry_tool when creating or updating a TLD with a dns writer

I forgot to inject the CreateTldCommand/UpdateTldCommand commands, which now
need to be injected so that the list of available DnsWriter implementations is
instantiated. This CL also adds a new DI Set<String> with just the name of the
writer, so that the instantiated writer map (which may have many DI dependencies)
doesn't need to be pulled in.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130042215
This commit is contained in:
shikhman 2016-08-11 15:54:16 -07:00 committed by Ben McIlwain
parent 0cab13e6d8
commit e55ed209c5
6 changed files with 58 additions and 21 deletions

View file

@ -23,10 +23,12 @@ import com.google.common.base.Function;
import dagger.Module;
import dagger.Provides;
import dagger.multibindings.IntoMap;
import dagger.multibindings.IntoSet;
import dagger.multibindings.StringKey;
import google.registry.config.ConfigModule.Config;
import google.registry.dns.writer.DnsWriter;
import java.util.Set;
import javax.inject.Named;
/** Dagger module for Google Cloud DNS service connection objects. */
@Module
@ -46,7 +48,14 @@ public final class CloudDnsModule {
@Provides
@IntoMap
@StringKey(CloudDnsWriter.NAME)
static DnsWriter provideCloudDnsWriter(CloudDnsWriter writer) {
static DnsWriter provideWriter(CloudDnsWriter writer) {
return writer;
}
@Provides
@IntoSet
@Named("dnsWriterNames")
static String provideWriterName() {
return CloudDnsWriter.NAME;
}
}