diff --git a/java/google/registry/billing/ExpandRecurringBillingEventsAction.java b/java/google/registry/billing/ExpandRecurringBillingEventsAction.java index 5b565d417..525b63ac7 100644 --- a/java/google/registry/billing/ExpandRecurringBillingEventsAction.java +++ b/java/google/registry/billing/ExpandRecurringBillingEventsAction.java @@ -203,7 +203,12 @@ public class ExpandRecurringBillingEventsAction implements Runnable { getContext().incrementCounter("error: " + t.getClass().getSimpleName()); getContext().incrementCounter(ERROR_COUNTER); } - getContext().incrementCounter("Saved OneTime billing events", billingEventsSaved); + if (!isDryRun) { + getContext().incrementCounter("Saved OneTime billing events", billingEventsSaved); + } else { + getContext().incrementCounter( + "Generated OneTime billing events (dry run)", billingEventsSaved); + } } /** @@ -236,8 +241,11 @@ public class ExpandRecurringBillingEventsAction implements Runnable { .filter(new Predicate() { @Override public boolean apply(OneTime billingEvent) { - return billingEvent.getCancellationMatchingBillingEvent().equals( - Key.create(recurringEvent)); + Key cancellationMatchingBillingEvent = + billingEvent.getCancellationMatchingBillingEvent(); + return cancellationMatchingBillingEvent != null + && billingEvent.getCancellationMatchingBillingEvent().equals( + Key.create(recurringEvent)); }}) .transform(new Function() { @Override diff --git a/java/google/registry/module/backend/BackendRequestComponent.java b/java/google/registry/module/backend/BackendRequestComponent.java index fd15e3796..6d4d90526 100644 --- a/java/google/registry/module/backend/BackendRequestComponent.java +++ b/java/google/registry/module/backend/BackendRequestComponent.java @@ -21,6 +21,7 @@ import google.registry.backup.CommitLogCheckpointAction; import google.registry.backup.DeleteOldCommitLogsAction; import google.registry.backup.ExportCommitLogDiffAction; import google.registry.backup.RestoreCommitLogsAction; +import google.registry.billing.ExpandRecurringBillingEventsAction; import google.registry.cron.CommitLogFanoutAction; import google.registry.cron.CronModule; import google.registry.cron.TldFanoutAction; @@ -87,6 +88,7 @@ interface BackendRequestComponent { DeleteHostResourceAction deleteHostResourceAction(); DeleteOldCommitLogsAction deleteOldCommitLogsAction(); DnsRefreshForHostRenameAction dnsRefreshForHostRenameAction(); + ExpandRecurringBillingEventsAction expandRecurringBillingEventsAction(); ExportCommitLogDiffAction exportCommitLogDiffAction(); ExportDomainListsAction exportDomainListsAction(); ExportReservedTermsAction exportReservedTermsAction();