Record metrics for WHOIS commands

Note that this does not write out metrics for invocations of the
nomulus tool.

This requires a slight refactoring of the existing WhoisResponse
interface so as to also support returning the number of results found
by the WHOIS query.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149461208
This commit is contained in:
mcilwain 2017-03-07 13:48:07 -08:00 committed by Ben McIlwain
parent 4eef02f17f
commit 3fcb564251
15 changed files with 247 additions and 62 deletions

View file

@ -26,6 +26,7 @@ import google.registry.model.registrar.RegistrarAddress;
import google.registry.model.registrar.RegistrarContact;
import google.registry.testing.AppEngineRule;
import google.registry.testing.FakeClock;
import google.registry.whois.WhoisResponse.WhoisResponseResults;
import org.joda.time.DateTime;
import org.junit.Rule;
import org.junit.Test;
@ -113,8 +114,8 @@ public class RegistrarWhoisResponseTest {
RegistrarWhoisResponse registrarWhoisResponse =
new RegistrarWhoisResponse(registrar, clock.nowUtc());
assertThat(registrarWhoisResponse.getPlainTextOutput(false, "Doodle Disclaimer"))
.isEqualTo(loadWhoisTestFile("whois_registrar.txt"));
assertThat(registrarWhoisResponse.getResponse(false, "Doodle Disclaimer"))
.isEqualTo(WhoisResponseResults.create(loadWhoisTestFile("whois_registrar.txt"), 1));
}
@Test
@ -129,6 +130,6 @@ public class RegistrarWhoisResponseTest {
RegistrarWhoisResponse registrarWhoisResponse =
new RegistrarWhoisResponse(registrar, clock.nowUtc());
// Just make sure this doesn't NPE.
registrarWhoisResponse.getPlainTextOutput(false, "Doodle Disclaimer");
registrarWhoisResponse.getResponse(false, "Doodle Disclaimer");
}
}