mirror of
https://github.com/google/nomulus.git
synced 2025-07-25 12:08:36 +02:00
Don't send email notification when 0 uploads were attempted (#1058)
* Don't send email notification when 0 uploads were attempted
This commit is contained in:
parent
06b0887c51
commit
e31f0cb9ba
2 changed files with 10 additions and 10 deletions
|
@ -278,9 +278,15 @@ public final class IcannReportingUploadAction implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void emailUploadResults(ImmutableMap<String, Boolean> reportSummary) {
|
private void emailUploadResults(ImmutableMap<String, Boolean> reportSummary) {
|
||||||
String subject = String.format(
|
if (reportSummary.size() == 0) {
|
||||||
"ICANN Monthly report upload summary: %d/%d succeeded",
|
logger.atInfo().log("No uploads were attempted today; skipping notification email.");
|
||||||
reportSummary.values().stream().filter((b) -> b).count(), reportSummary.size());
|
return;
|
||||||
|
}
|
||||||
|
String subject =
|
||||||
|
String.format(
|
||||||
|
"ICANN Monthly report upload summary: %d/%d succeeded",
|
||||||
|
// This filter() does in fact do something: It counts only the trues.
|
||||||
|
reportSummary.values().stream().filter((b) -> b).count(), reportSummary.size());
|
||||||
String body =
|
String body =
|
||||||
String.format(
|
String.format(
|
||||||
"Report Filename - Upload status:\n%s",
|
"Report Filename - Upload status:\n%s",
|
||||||
|
|
|
@ -210,13 +210,7 @@ class IcannReportingUploadActionTest {
|
||||||
action.run();
|
action.run();
|
||||||
tm().clearSessionCache();
|
tm().clearSessionCache();
|
||||||
verifyNoMoreInteractions(mockReporter);
|
verifyNoMoreInteractions(mockReporter);
|
||||||
verify(emailService)
|
verifyNoMoreInteractions(emailService);
|
||||||
.sendEmail(
|
|
||||||
EmailMessage.create(
|
|
||||||
"ICANN Monthly report upload summary: 0/0 succeeded",
|
|
||||||
"Report Filename - Upload status:\n",
|
|
||||||
new InternetAddress("recipient@example.com"),
|
|
||||||
new InternetAddress("sender@example.com")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestOfyAndSql
|
@TestOfyAndSql
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue