47 .recipient(first.author())
48 .id(EmailAddress.from(UUID.randomUUID() + "@id.id"))
49 .header("In-Reply-To", first.id().toString())
50 .header("References", references)
51 .build();
52 mailingList.post(email);
53 }
54
55 @Test
56 void simpleArchive(TestInfo testInfo) throws IOException {
57 try (var credentials = new HostCredentials(testInfo);
58 var tempFolder = new TemporaryDirectory();
59 var listServer = new TestMailmanServer()) {
60 var author = credentials.getHostedRepository();
61 var archive = credentials.getHostedRepository();
62 var ignored = credentials.getHostedRepository();
63 var listAddress = EmailAddress.parse(listServer.createList("test"));
64 var censusBuilder = credentials.getCensusBuilder()
65 .addAuthor(author.forge().currentUser().id());
66 var from = EmailAddress.from("test", "test@test.mail");
67 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master",
68 listAddress,
69 Set.of(ignored.forge().currentUser().userName()),
70 Set.of(),
71 listServer.getArchive(), listServer.getSMTP(),
72 archive, "webrev", Path.of("test"),
73 URIBuilder.base("http://www.test.test/").build(),
74 Set.of(), Map.of(),
75 URIBuilder.base("http://issues.test/browse/").build(),
76 Map.of(), Duration.ZERO);
77
78 // The mailing list as well
79 var mailmanServer = MailingListServerFactory.createMailmanServer(listServer.getArchive(), listServer.getSMTP(),
80 Duration.ZERO);
81 var mailmanList = mailmanServer.getList(listAddress.address());
82 var readerBot = new MailingListArchiveReaderBot(from, Set.of(mailmanList), Set.of(archive));
83
84 // Populate the projects repository
85 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType());
86 var masterHash = localRepo.resolve("master").orElseThrow();
87 localRepo.push(masterHash, author.url(), "master", true);
116 var updated = pr.comments();
117 assertEquals(2, updated.size());
118 assertTrue(updated.get(1).body().contains("Mailing list message from"));
119 assertTrue(updated.get(1).body().contains("[Commenter](mailto:c@test.test)"));
120 assertTrue(updated.get(1).body().contains("[test](mailto:test@" + listAddress.domain() + ")"));
121 }
122 }
123
124 @Test
125 void rememberBridged(TestInfo testInfo) throws IOException {
126 try (var credentials = new HostCredentials(testInfo);
127 var tempFolder = new TemporaryDirectory();
128 var listServer = new TestMailmanServer()) {
129 var author = credentials.getHostedRepository();
130 var archive = credentials.getHostedRepository();
131 var ignored = credentials.getHostedRepository();
132 var listAddress = EmailAddress.parse(listServer.createList("test"));
133 var censusBuilder = credentials.getCensusBuilder()
134 .addAuthor(author.forge().currentUser().id());
135 var from = EmailAddress.from("test", "test@test.mail");
136 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master",
137 listAddress,
138 Set.of(ignored.forge().currentUser().userName()),
139 Set.of(),
140 listServer.getArchive(), listServer.getSMTP(),
141 archive, "webrev", Path.of("test"),
142 URIBuilder.base("http://www.test.test/").build(),
143 Set.of(), Map.of(),
144 URIBuilder.base("http://issues.test/browse/").build(),
145 Map.of(), Duration.ZERO);
146
147 // The mailing list as well
148 var mailmanServer = MailingListServerFactory.createMailmanServer(listServer.getArchive(), listServer.getSMTP(),
149 Duration.ZERO);
150 var mailmanList = mailmanServer.getList(listAddress.address());
151 var readerBot = new MailingListArchiveReaderBot(from, Set.of(mailmanList), Set.of(archive));
152
153 // Populate the projects repository
154 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType());
155 var masterHash = localRepo.resolve("master").orElseThrow();
156 localRepo.push(masterHash, author.url(), "master", true);
|
47 .recipient(first.author())
48 .id(EmailAddress.from(UUID.randomUUID() + "@id.id"))
49 .header("In-Reply-To", first.id().toString())
50 .header("References", references)
51 .build();
52 mailingList.post(email);
53 }
54
55 @Test
56 void simpleArchive(TestInfo testInfo) throws IOException {
57 try (var credentials = new HostCredentials(testInfo);
58 var tempFolder = new TemporaryDirectory();
59 var listServer = new TestMailmanServer()) {
60 var author = credentials.getHostedRepository();
61 var archive = credentials.getHostedRepository();
62 var ignored = credentials.getHostedRepository();
63 var listAddress = EmailAddress.parse(listServer.createList("test"));
64 var censusBuilder = credentials.getCensusBuilder()
65 .addAuthor(author.forge().currentUser().id());
66 var from = EmailAddress.from("test", "test@test.mail");
67 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
68 censusBuilder.build(), "master",
69 listAddress,
70 Set.of(ignored.forge().currentUser().userName()),
71 Set.of(),
72 listServer.getArchive(), listServer.getSMTP(),
73 archive, "webrev", Path.of("test"),
74 URIBuilder.base("http://www.test.test/").build(),
75 Set.of(), Map.of(),
76 URIBuilder.base("http://issues.test/browse/").build(),
77 Map.of(), Duration.ZERO);
78
79 // The mailing list as well
80 var mailmanServer = MailingListServerFactory.createMailmanServer(listServer.getArchive(), listServer.getSMTP(),
81 Duration.ZERO);
82 var mailmanList = mailmanServer.getList(listAddress.address());
83 var readerBot = new MailingListArchiveReaderBot(from, Set.of(mailmanList), Set.of(archive));
84
85 // Populate the projects repository
86 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType());
87 var masterHash = localRepo.resolve("master").orElseThrow();
88 localRepo.push(masterHash, author.url(), "master", true);
117 var updated = pr.comments();
118 assertEquals(2, updated.size());
119 assertTrue(updated.get(1).body().contains("Mailing list message from"));
120 assertTrue(updated.get(1).body().contains("[Commenter](mailto:c@test.test)"));
121 assertTrue(updated.get(1).body().contains("[test](mailto:test@" + listAddress.domain() + ")"));
122 }
123 }
124
125 @Test
126 void rememberBridged(TestInfo testInfo) throws IOException {
127 try (var credentials = new HostCredentials(testInfo);
128 var tempFolder = new TemporaryDirectory();
129 var listServer = new TestMailmanServer()) {
130 var author = credentials.getHostedRepository();
131 var archive = credentials.getHostedRepository();
132 var ignored = credentials.getHostedRepository();
133 var listAddress = EmailAddress.parse(listServer.createList("test"));
134 var censusBuilder = credentials.getCensusBuilder()
135 .addAuthor(author.forge().currentUser().id());
136 var from = EmailAddress.from("test", "test@test.mail");
137 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
138 censusBuilder.build(), "master",
139 listAddress,
140 Set.of(ignored.forge().currentUser().userName()),
141 Set.of(),
142 listServer.getArchive(), listServer.getSMTP(),
143 archive, "webrev", Path.of("test"),
144 URIBuilder.base("http://www.test.test/").build(),
145 Set.of(), Map.of(),
146 URIBuilder.base("http://issues.test/browse/").build(),
147 Map.of(), Duration.ZERO);
148
149 // The mailing list as well
150 var mailmanServer = MailingListServerFactory.createMailmanServer(listServer.getArchive(), listServer.getSMTP(),
151 Duration.ZERO);
152 var mailmanList = mailmanServer.getList(listAddress.address());
153 var readerBot = new MailingListArchiveReaderBot(from, Set.of(mailmanList), Set.of(archive));
154
155 // Populate the projects repository
156 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType());
157 var masterHash = localRepo.resolve("master").orElseThrow();
158 localRepo.push(masterHash, author.url(), "master", true);
|