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

@ -16,6 +16,9 @@ package google.registry.tools;
import dagger.Component;
import google.registry.config.ConfigModule;
import google.registry.dns.writer.VoidDnsWriterModule;
import google.registry.dns.writer.clouddns.CloudDnsModule;
import google.registry.dns.writer.dnsupdate.DnsUpdateWriterModule;
import google.registry.keyring.api.KeyModule;
import google.registry.keyring.api.VoidKeyringModule;
import google.registry.request.Modules.DatastoreServiceModule;
@ -30,19 +33,24 @@ import google.registry.util.SystemClock.SystemClockModule;
* Otherwise {@link RegistryCli} will not be able to populate those fields after its instantiation.
*/
@Component(
modules = {
ConfigModule.class,
DatastoreServiceModule.class,
Jackson2Module.class,
KeyModule.class,
RegistryToolModule.class,
SystemClockModule.class,
URLFetchServiceModule.class,
VoidKeyringModule.class,
})
modules = {
ConfigModule.class,
DatastoreServiceModule.class,
CloudDnsModule.class,
DnsUpdateWriterModule.class,
Jackson2Module.class,
KeyModule.class,
RegistryToolModule.class,
SystemClockModule.class,
URLFetchServiceModule.class,
VoidDnsWriterModule.class,
VoidKeyringModule.class,
}
)
interface RegistryToolComponent {
void inject(CreateAnchorTenantCommand command);
void inject(CreateContactCommand command);
void inject(CreateTldCommand command);
void inject(EncryptEscrowDepositCommand command);
void inject(GenerateApplicationsReportCommand command);
void inject(GenerateDnsReportCommand command);
@ -53,6 +61,7 @@ interface RegistryToolComponent {
void inject(SendEscrowReportToIcannCommand command);
void inject(SetupOteCommand command);
void inject(UpdateCursorsCommand command);
void inject(UpdateTldCommand command);
void inject(ValidateEscrowDepositCommand command);
void inject(WhoisQueryCommand command);
}