mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Add more absent clTrid unit tests
In RFC 5730, clTrid is specified as optional. We ran into an error earlier this year in which a registrar was not passing a client transaction id and we didn't handle it correctly. So, this CL adds some tests of common EPP operations verify that they work correctly when the clTrid is not specified. This also slightly improves some flow logic to make it more obvious at first glance that clTrid is indeed optional. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=202000845
This commit is contained in:
parent
6706b99828
commit
ed910455b0
21 changed files with 252 additions and 33 deletions
|
@ -16,7 +16,6 @@ package google.registry.model.eppcommon;
|
|||
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.googlecode.objectify.annotation.Embed;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import java.util.Optional;
|
||||
|
@ -40,6 +39,7 @@ public class Trid extends ImmutableObject {
|
|||
|
||||
/** The client transaction id, if provided by the client, otherwise null. */
|
||||
@XmlElement(name = "clTRID", namespace = "urn:ietf:params:xml:ns:epp-1.0")
|
||||
@Nullable
|
||||
String clientTransactionId;
|
||||
|
||||
public String getServerTransactionId() {
|
||||
|
@ -50,7 +50,6 @@ public class Trid extends ImmutableObject {
|
|||
return Optional.ofNullable(clientTransactionId);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public static Trid create(@Nullable String clientTransactionId, String serverTransactionId) {
|
||||
checkArgumentNotNull(serverTransactionId, "serverTransactionId cannot be null");
|
||||
Trid instance = new Trid();
|
||||
|
|
|
@ -366,10 +366,15 @@ public class EppInput extends ImmutableObject {
|
|||
@XmlElementWrapper
|
||||
List<CommandExtension> extension;
|
||||
|
||||
String clTRID;
|
||||
@Nullable String clTRID;
|
||||
|
||||
public String getClTrid() {
|
||||
return clTRID;
|
||||
/**
|
||||
* Returns the client transaction ID.
|
||||
*
|
||||
* <p>This is optional (i.e. it may not be specified) per RFC 5730.
|
||||
*/
|
||||
public Optional<String> getClTrid() {
|
||||
return Optional.ofNullable(clTRID);
|
||||
}
|
||||
|
||||
public InnerCommand getCommand() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue