mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
Record a version of EPP metrics with TLD for domain commands
Also fixes the issue that dry run EPP commands were incorrectly being reported on. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171062984
This commit is contained in:
parent
7e68ffa16a
commit
302a27f0db
13 changed files with 283 additions and 61 deletions
|
@ -100,6 +100,8 @@ public class FlowReporterTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void testRecordToLogs_metadata_basic() throws Exception {
|
||||
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(true);
|
||||
when(flowReporter.eppInput.getResourceType()).thenReturn(Optional.of("domain"));
|
||||
flowReporter.recordToLogs();
|
||||
assertThat(parseJsonMap(findFirstLogMessageByPrefix(handler, "FLOW-LOG-SIGNATURE-METADATA: ")))
|
||||
.containsExactly(
|
||||
|
@ -136,6 +138,7 @@ public class FlowReporterTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void testRecordToLogs_metadata_notResourceFlow_noResourceTypeOrTld() throws Exception {
|
||||
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(false);
|
||||
when(flowReporter.eppInput.getResourceType()).thenReturn(Optional.<String>absent());
|
||||
flowReporter.recordToLogs();
|
||||
Map<String, Object> json =
|
||||
|
@ -148,6 +151,7 @@ public class FlowReporterTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void testRecordToLogs_metadata_notDomainFlow_noTld() throws Exception {
|
||||
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(false);
|
||||
when(flowReporter.eppInput.getResourceType()).thenReturn(Optional.of("contact"));
|
||||
flowReporter.recordToLogs();
|
||||
Map<String, Object> json =
|
||||
|
@ -159,6 +163,8 @@ public class FlowReporterTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void testRecordToLogs_metadata_multipartDomainName_multipartTld() throws Exception {
|
||||
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(true);
|
||||
when(flowReporter.eppInput.getResourceType()).thenReturn(Optional.of("domain"));
|
||||
when(flowReporter.eppInput.getSingleTargetId()).thenReturn(Optional.of("target.co.uk"));
|
||||
when(flowReporter.eppInput.getTargetIds()).thenReturn(ImmutableList.of("target.co.uk"));
|
||||
flowReporter.recordToLogs();
|
||||
|
@ -172,6 +178,7 @@ public class FlowReporterTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void testRecordToLogs_metadata_multipleTargetIds_uniqueTldSet() throws Exception {
|
||||
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(true);
|
||||
when(flowReporter.eppInput.getSingleTargetId()).thenReturn(Optional.<String>absent());
|
||||
when(flowReporter.eppInput.getTargetIds())
|
||||
.thenReturn(ImmutableList.of("target.co.uk", "foo.uk", "bar.uk", "baz.com"));
|
||||
|
@ -187,6 +194,7 @@ public class FlowReporterTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void testRecordToLogs_metadata_uppercaseDomainName_lowercaseTld() throws Exception {
|
||||
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(true);
|
||||
when(flowReporter.eppInput.getSingleTargetId()).thenReturn(Optional.of("TARGET.FOO"));
|
||||
when(flowReporter.eppInput.getTargetIds()).thenReturn(ImmutableList.of("TARGET.FOO"));
|
||||
flowReporter.recordToLogs();
|
||||
|
@ -200,6 +208,7 @@ public class FlowReporterTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void testRecordToLogs_metadata_invalidDomainName_stillGuessesTld() throws Exception {
|
||||
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(true);
|
||||
when(flowReporter.eppInput.getSingleTargetId()).thenReturn(Optional.of("<foo@bar.com>"));
|
||||
when(flowReporter.eppInput.getTargetIds()).thenReturn(ImmutableList.of("<foo@bar.com>"));
|
||||
flowReporter.recordToLogs();
|
||||
|
@ -213,6 +222,7 @@ public class FlowReporterTest extends ShardableTestCase {
|
|||
|
||||
@Test
|
||||
public void testRecordToLogs_metadata_domainWithoutPeriod_noTld() throws Exception {
|
||||
when(flowReporter.eppInput.isDomainResourceType()).thenReturn(true);
|
||||
when(flowReporter.eppInput.getSingleTargetId()).thenReturn(Optional.of("target,foo"));
|
||||
when(flowReporter.eppInput.getTargetIds()).thenReturn(ImmutableList.of("target,foo"));
|
||||
flowReporter.recordToLogs();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue