Make async flow logic handle missing client transaction IDs

Per EPP RFC 5730, the <clTRID> element is optional. However, we weren't handling
it not being specified in asynchronous contact/host deletions because we were
adding it directly as a parameter value on a task, which does not allow null and
thus threw a NullPointerException.

This fixes handling for nulls (the parameter isn't set at all) and adds a test.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194123259
This commit is contained in:
mcilwain
2018-05-05 23:21:55 -04:00
committed by jianglai
parent f56355c9e8
commit 33505f4df7
16 changed files with 196 additions and 47 deletions
@@ -15,6 +15,7 @@
package google.registry.rde.imports;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import google.registry.model.eppcommon.Trid;
@@ -34,9 +35,10 @@ public class RdeImportTestUtils {
*/
public static void checkTrid(Trid trid) {
assertThat(trid).isNotNull();
assertThat(trid.getClientTransactionId()).isNotNull();
assertThat(trid.getClientTransactionId().length()).isAtLeast(3);
assertThat(trid.getClientTransactionId().length()).isAtMost(64);
assertThat(trid.getClientTransactionId()).startsWith("Import_");
assertThat(trid.getClientTransactionId()).isPresent();
String clTrid = trid.getClientTransactionId().get();
assertThat(clTrid.length()).isAtLeast(3);
assertThat(clTrid.length()).isAtMost(64);
assertThat(clTrid).startsWith("Import_");
}
}