use of com.google.gerrit.server.mail.Address in project gerrit by GerritCodeReview.
the class Base64HeaderMessage method expectedMailMessage.
@Override
public MailMessage expectedMailMessage() {
MailMessage.Builder expect = MailMessage.builder();
expect.id("<001a114da7ae26e2eb053fe0c29c@google.com>").from(new Address("Jonathan Nieder (Gerrit)", "noreply-gerritcodereview-CtTy0igsBrnvL7dKoWEIEg@google.com")).addTo(new Address("ekempin", "ekempin@google.com")).textContent(textContent).subject("😛 test").dateReceived(new DateTime(2016, 10, 25, 9, 11, 35, 0, DateTimeZone.UTC));
return expect.build();
}
use of com.google.gerrit.server.mail.Address in project gerrit by GerritCodeReview.
the class NonUTF8Message method expectedMailMessage.
@Override
public MailMessage expectedMailMessage() {
MailMessage.Builder expect = MailMessage.builder();
expect.id("<001a114da7ae26e2eb053fe0c29c@google.com>").from(new Address("Jonathan Nieder (Gerrit)", "noreply-gerritcodereview-CtTy0igsBrnvL7dKoWEIEg@google.com")).addTo(new Address("ekempin", "ekempin@google.com")).textContent(textContent).subject("😛 test").dateReceived(new DateTime(2016, 10, 25, 9, 11, 35, 0, DateTimeZone.UTC));
return expect.build();
}
use of com.google.gerrit.server.mail.Address in project gerrit by GerritCodeReview.
the class SimpleTextMessage method expectedMailMessage.
@Override
public MailMessage expectedMailMessage() {
MailMessage.Builder expect = MailMessage.builder();
expect.id("<001a114da7ae26e2eb053fe0c29c@google.com>").from(new Address("Jonathan Nieder (Gerrit)", "noreply-gerritcodereview-CtTy0igsBrnvL7dKoWEIEg@google.com")).addTo(new Address("ekempin", "ekempin@google.com")).addCc(new Address("Dave Borowitz", "dborowitz@google.com")).addCc(new Address("Jonathan Nieder", "jrn@google.com")).addCc(new Address("Patrick Hiesel", "hiesel@google.com")).textContent(textContent).subject("Change in gerrit[master]: (Re)enable voting buttons for merged changes").dateReceived(new DateTime(2016, 10, 25, 9, 11, 35, 0, DateTimeZone.UTC)).addAdditionalHeader("Authentication-Results: mx.google.com; dkim=pass header.i=@google.com;").addAdditionalHeader("In-Reply-To: <gerrit.1477487889000.Iba501e00bee" + "77be3bd0ced72f88fd04ba0accaed@gerrit-review.googlesource.com>").addAdditionalHeader("References: <gerrit.1477487889000.Iba501e00bee" + "77be3bd0ced72f88fd04ba0accaed@gerrit-review.googlesource.com>");
return expect.build();
}
use of com.google.gerrit.server.mail.Address in project gerrit by GerritCodeReview.
the class AbstractParserTest method newMailMessageBuilder.
/** Returns a MailMessage.Builder with all required fields populated. */
protected static MailMessage.Builder newMailMessageBuilder() {
MailMessage.Builder b = MailMessage.builder();
b.id("id");
b.from(new Address("Foo Bar", "foo@bar.com"));
b.dateReceived(new DateTime());
b.subject("");
return b;
}
use of com.google.gerrit.server.mail.Address in project gerrit by GerritCodeReview.
the class MetadataParserTest method parseMetadataFromHeader.
@Test
public void parseMetadataFromHeader() {
// This tests if the metadata parser is able to parse metadata from the
// email headers of the message.
MailMessage.Builder b = MailMessage.builder();
b.id("");
b.dateReceived(new DateTime());
b.subject("");
b.addAdditionalHeader(toHeaderWithDelimiter(MetadataName.CHANGE_ID) + "cid");
b.addAdditionalHeader(toHeaderWithDelimiter(MetadataName.PATCH_SET) + "1");
b.addAdditionalHeader(toHeaderWithDelimiter(MetadataName.MESSAGE_TYPE) + "comment");
b.addAdditionalHeader(toHeaderWithDelimiter(MetadataName.TIMESTAMP) + "Tue, 25 Oct 2016 02:11:35 -0700");
Address author = new Address("Diffy", "test@gerritcodereview.com");
b.from(author);
MailMetadata meta = MetadataParser.parse(b.build());
assertThat(meta.author).isEqualTo(author.getEmail());
assertThat(meta.changeId).isEqualTo("cid");
assertThat(meta.patchSet).isEqualTo(1);
assertThat(meta.messageType).isEqualTo("comment");
assertThat(meta.timestamp.getTime()).isEqualTo(new DateTime(2016, 10, 25, 9, 11, 35, 0, DateTimeZone.UTC).getMillis());
}
Aggregations