mirror of
https://github.com/google/nomulus
synced 2026-08-03 22:06:13 +00:00
Add and adjust EppInput accessors for more useful properties
This primarily adds accessors to EppInput that will be used for flow reporting logging in FlowReporter. Specifically, it adds: - Optional<String> getResourceType() -> domain/host/contact - Optional<String> getSingleTargetId() -> for SingleResourceCommands And in addition, it adjusts getCommandName() so that it's now named getCommandType() for better parallelism with the new getResourceType() (since getResourceName() would be misleading), and it changes the value returned to be lowercased, again for consistency. This isn't an issue because getCommandName() isn't actually used anywhere right now (it was formerly used for EPP whitebox metrics, but no longer due to recent changes there). ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=153851957
This commit is contained in:
@@ -36,9 +36,11 @@ public class EppInputTest {
|
||||
unmarshal(
|
||||
EppInput.class,
|
||||
readResourceBytes(ContactResourceTest.class, "testdata/contact_info.xml").read());
|
||||
assertThat(input.getTargetIds()).containsExactly("sh8013");
|
||||
assertThat(input.getCommandWrapper().getClTrid()).isEqualTo("ABC-12345");
|
||||
assertThat(input.getCommandName()).isEqualTo("Info");
|
||||
assertThat(input.getCommandType()).isEqualTo("info");
|
||||
assertThat(input.getResourceType()).hasValue("contact");
|
||||
assertThat(input.getSingleTargetId()).hasValue("sh8013");
|
||||
assertThat(input.getTargetIds()).containsExactly("sh8013");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -47,18 +49,22 @@ public class EppInputTest {
|
||||
unmarshal(
|
||||
EppInput.class,
|
||||
readResourceBytes(DomainResourceTest.class, "testdata/domain_check.xml").read());
|
||||
assertThat(input.getTargetIds()).containsExactly("example.com", "example.net", "example.org");
|
||||
assertThat(input.getCommandWrapper().getClTrid()).isEqualTo("ABC-12345");
|
||||
assertThat(input.getCommandName()).isEqualTo("Check");
|
||||
assertThat(input.getCommandType()).isEqualTo("check");
|
||||
assertThat(input.getResourceType()).hasValue("domain");
|
||||
assertThat(input.getSingleTargetId()).isAbsent();
|
||||
assertThat(input.getTargetIds()).containsExactly("example.com", "example.net", "example.org");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnmarshalling_login() throws Exception {
|
||||
EppInput input =
|
||||
unmarshal(EppInput.class, readResourceBytes(getClass(), "testdata/login_valid.xml").read());
|
||||
assertThat(input.getTargetIds()).isEmpty();
|
||||
assertThat(input.getCommandWrapper().getClTrid()).isEqualTo("ABC-12345");
|
||||
assertThat(input.getCommandName()).isEqualTo("Login");
|
||||
assertThat(input.getCommandType()).isEqualTo("login");
|
||||
assertThat(input.getResourceType()).isAbsent();
|
||||
assertThat(input.getSingleTargetId()).isAbsent();
|
||||
assertThat(input.getTargetIds()).isEmpty();
|
||||
InnerCommand command = input.getCommandWrapper().getCommand();
|
||||
assertThat(command).isInstanceOf(Login.class);
|
||||
Login loginCommand = (Login) command;
|
||||
|
||||
Reference in New Issue
Block a user