95 private String noreplyAddress(HostedRepository repository) {
96 return "test+" + repository.forge().currentUser().id() + "+" +
97 repository.forge().currentUser().userName() +
98 "@openjdk.java.net";
99 }
100
101 @Test
102 void simpleArchive(TestInfo testInfo) throws IOException {
103 try (var credentials = new HostCredentials(testInfo);
104 var tempFolder = new TemporaryDirectory();
105 var archiveFolder = new TemporaryDirectory();
106 var webrevFolder = new TemporaryDirectory();
107 var listServer = new TestMailmanServer()) {
108 var author = credentials.getHostedRepository();
109 var archive = credentials.getHostedRepository();
110 var ignored = credentials.getHostedRepository();
111 var listAddress = EmailAddress.parse(listServer.createList("test"));
112 var censusBuilder = credentials.getCensusBuilder()
113 .addAuthor(author.forge().currentUser().id());
114 var from = EmailAddress.from("test", "test@test.mail");
115 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master", listAddress,
116 Set.of(ignored.forge().currentUser().userName()),
117 Set.of(),
118 listServer.getArchive(), listServer.getSMTP(),
119 archive, "webrev", Path.of("test"),
120 URIBuilder.base("http://www.test.test/").build(),
121 Set.of("rfr"), Map.of(ignored.forge().currentUser().userName(),
122 Pattern.compile("ready")),
123 URIBuilder.base("http://issues.test/browse/").build(),
124 Map.of("Extra1", "val1", "Extra2", "val2"),
125 Duration.ZERO);
126
127 // Populate the projects repository
128 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType());
129 var masterHash = localRepo.resolve("master").orElseThrow();
130 localRepo.push(masterHash, author.url(), "master", true);
131 localRepo.push(masterHash, archive.url(), "webrev", true);
132
133 // Make a change with a corresponding PR
134 var editHash = CheckableRepository.appendAndCommit(localRepo, "A simple change",
135 "Change msg\n\nWith several lines");
252 assertEquals(noreplyAddress(archive), newMail.author().address());
253 assertEquals(listAddress, newMail.sender());
254 }
255 assertTrue(conversations.get(0).allMessages().get(2).body().contains("This is a comment 😄"));
256 }
257 }
258
259 @Test
260 void reviewComment(TestInfo testInfo) throws IOException {
261 try (var credentials = new HostCredentials(testInfo);
262 var tempFolder = new TemporaryDirectory();
263 var archiveFolder = new TemporaryDirectory();
264 var listServer = new TestMailmanServer()) {
265 var author = credentials.getHostedRepository();
266 var archive = credentials.getHostedRepository();
267 var ignored = credentials.getHostedRepository();
268 var listAddress = EmailAddress.parse(listServer.createList("test"));
269 var censusBuilder = credentials.getCensusBuilder()
270 .addAuthor(author.forge().currentUser().id());
271 var from = EmailAddress.from("test", "test@test.mail");
272 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master", listAddress,
273 Set.of(ignored.forge().currentUser().userName()),
274 Set.of(),
275 listServer.getArchive(), listServer.getSMTP(),
276 archive, "webrev", Path.of("test"),
277 URIBuilder.base("http://www.test.test/").build(),
278 Set.of(), Map.of(),
279 URIBuilder.base("http://issues.test/browse/").build(),
280 Map.of(), Duration.ZERO);
281
282 // Populate the projects repository
283 var reviewFile = Path.of("reviewfile.txt");
284 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
285 var masterHash = localRepo.resolve("master").orElseThrow();
286 localRepo.push(masterHash, author.url(), "master", true);
287 localRepo.push(masterHash, archive.url(), "webrev", true);
288
289 // Make a change with a corresponding PR
290 var editHash = CheckableRepository.appendAndCommit(localRepo);
291 localRepo.push(editHash, author.url(), "edit", true);
292 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
340 assertEquals(3, conversations.get(0).allMessages().size());
341 for (var newMail : conversations.get(0).allMessages()) {
342 assertEquals(noreplyAddress(archive), newMail.author().address());
343 assertEquals(listAddress, newMail.sender());
344 }
345 }
346 }
347
348 @Test
349 void combineComments(TestInfo testInfo) throws IOException {
350 try (var credentials = new HostCredentials(testInfo);
351 var tempFolder = new TemporaryDirectory();
352 var archiveFolder = new TemporaryDirectory();
353 var listServer = new TestMailmanServer()) {
354 var author = credentials.getHostedRepository();
355 var archive = credentials.getHostedRepository();
356 var listAddress = EmailAddress.parse(listServer.createList("test"));
357 var censusBuilder = credentials.getCensusBuilder()
358 .addAuthor(author.forge().currentUser().id());
359 var from = EmailAddress.from("test", "test@test.mail");
360 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master",
361 listAddress, Set.of(), Set.of(),
362 listServer.getArchive(),
363 listServer.getSMTP(),
364 archive, "webrev", Path.of("test"),
365 URIBuilder.base("http://www.test.test/").build(),
366 Set.of(), Map.of(),
367 URIBuilder.base("http://issues.test/browse/").build(),
368 Map.of(), Duration.ZERO);
369
370 // Populate the projects repository
371 var reviewFile = Path.of("reviewfile.txt");
372 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
373 var masterHash = localRepo.resolve("master").orElseThrow();
374 localRepo.push(masterHash, author.url(), "master", true);
375 localRepo.push(masterHash, archive.url(), "webrev", true);
376
377 // Make a change with a corresponding PR
378 var editHash = CheckableRepository.appendAndCommit(localRepo);
379 localRepo.push(editHash, author.url(), "edit", true);
380 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
428
429 // The combined review comments should only appear unquoted once
430 assertEquals(1, archiveContainsCount(archiveFolder.path(), "^Another review comment"));
431 }
432 }
433
434 @Test
435 void commentThreading(TestInfo testInfo) throws IOException {
436 try (var credentials = new HostCredentials(testInfo);
437 var tempFolder = new TemporaryDirectory();
438 var archiveFolder = new TemporaryDirectory();
439 var listServer = new TestMailmanServer()) {
440 var author = credentials.getHostedRepository();
441 var reviewer = credentials.getHostedRepository();
442 var archive = credentials.getHostedRepository();
443 var listAddress = EmailAddress.parse(listServer.createList("test"));
444 var censusBuilder = credentials.getCensusBuilder()
445 .addReviewer(reviewer.forge().currentUser().id())
446 .addAuthor(author.forge().currentUser().id());
447 var from = EmailAddress.from("test", "test@test.mail");
448 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master",
449 listAddress, Set.of(), Set.of(),
450 listServer.getArchive(),
451 listServer.getSMTP(),
452 archive, "webrev", Path.of("test"),
453 URIBuilder.base("http://www.test.test/").build(),
454 Set.of(), Map.of(),
455 URIBuilder.base("http://issues.test/browse/").build(),
456 Map.of(), Duration.ZERO);
457
458 // Populate the projects repository
459 var reviewFile = Path.of("reviewfile.txt");
460 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
461 var masterHash = localRepo.resolve("master").orElseThrow();
462 localRepo.push(masterHash, author.url(), "master", true);
463 localRepo.push(masterHash, archive.url(), "webrev", true);
464
465 // Make a change with a corresponding PR
466 var editHash = CheckableRepository.appendAndCommit(localRepo);
467 localRepo.push(editHash, author.url(), "edit", true);
468 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
549 var thread4 = replies.get(3);
550 assertEquals("Re: [Approved] RFR: This is a pull request", thread4.subject());
551 assertTrue(thread4.body().contains("Looks fine"));
552 assertTrue(thread4.body().contains("The final review comment"));
553 assertTrue(thread4.body().contains("Approved by integrationreviewer1 (Reviewer)"));
554 }
555 }
556
557 @Test
558 void reviewContext(TestInfo testInfo) throws IOException {
559 try (var credentials = new HostCredentials(testInfo);
560 var tempFolder = new TemporaryDirectory();
561 var archiveFolder = new TemporaryDirectory();
562 var listServer = new TestMailmanServer()) {
563 var author = credentials.getHostedRepository();
564 var archive = credentials.getHostedRepository();
565 var listAddress = EmailAddress.parse(listServer.createList("test"));
566 var censusBuilder = credentials.getCensusBuilder()
567 .addAuthor(author.forge().currentUser().id());
568 var from = EmailAddress.from("test", "test@test.mail");
569 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master",
570 listAddress, Set.of(), Set.of(),
571 listServer.getArchive(),
572 listServer.getSMTP(),
573 archive, "webrev", Path.of("test"),
574 URIBuilder.base("http://www.test.test/").build(),
575 Set.of(), Map.of(),
576 URIBuilder.base("http://issues.test/browse/").build(),
577 Map.of(), Duration.ZERO);
578
579 // Populate the projects repository
580 var reviewFile = Path.of("reviewfile.txt");
581 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
582 var masterHash = localRepo.resolve("master").orElseThrow();
583 localRepo.push(masterHash, author.url(), "master", true);
584 localRepo.push(masterHash, archive.url(), "webrev", true);
585
586 // Make a change with a corresponding PR
587 var editHash = CheckableRepository.appendAndCommit(localRepo, "Line 1\nLine 2\nLine 3\nLine 4");
588 localRepo.push(editHash, author.url(), "edit", true);
589 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
600 // The archive should only contain context around line 2
601 Repository.materialize(archiveFolder.path(), archive.url(), "master");
602 assertTrue(archiveContains(archiveFolder.path(), "^> 2: Line 1$"));
603 assertTrue(archiveContains(archiveFolder.path(), "^> 3: Line 2$"));
604 assertFalse(archiveContains(archiveFolder.path(), "^> 4: Line 3$"));
605 }
606 }
607
608 @Test
609 void multipleReviewContexts(TestInfo testInfo) throws IOException {
610 try (var credentials = new HostCredentials(testInfo);
611 var tempFolder = new TemporaryDirectory();
612 var archiveFolder = new TemporaryDirectory();
613 var listServer = new TestMailmanServer()) {
614 var author = credentials.getHostedRepository();
615 var archive = credentials.getHostedRepository();
616 var listAddress = EmailAddress.parse(listServer.createList("test"));
617 var censusBuilder = credentials.getCensusBuilder()
618 .addAuthor(author.forge().currentUser().id());
619 var from = EmailAddress.from("test", "test@test.mail");
620 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master",
621 listAddress, Set.of(), Set.of(),
622 listServer.getArchive(),
623 listServer.getSMTP(),
624 archive, "webrev", Path.of("test"),
625 URIBuilder.base("http://www.test.test/").build(),
626 Set.of(), Map.of(),
627 URIBuilder.base("http://issues.test/browse/").build(),
628 Map.of(), Duration.ZERO);
629
630 // Populate the projects repository
631 var reviewFile = Path.of("reviewfile.txt");
632 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
633 var masterHash = localRepo.resolve("master").orElseThrow();
634 localRepo.push(masterHash, author.url(), "master", true);
635 localRepo.push(masterHash, archive.url(), "webrev", true);
636 var initialHash = CheckableRepository.appendAndCommit(localRepo,
637 "Line 0.1\nLine 0.2\nLine 0.3\nLine 0.4\n" +
638 "Line 1\nLine 2\nLine 3\nLine 4\n" +
639 "Line 5\nLine 6\nLine 7\nLine 8\n" +
640 "Line 8.1\nLine 8.2\nLine 8.3\nLine 8.4\n" +
670
671 assertTrue(archiveContains(archiveFolder.path(), "reviewfile.txt line 24"));
672 assertTrue(archiveContains(archiveFolder.path(), "^> 23: Line 12.5$"));
673 assertTrue(archiveContains(archiveFolder.path(), "^> 24: Line 13 edit$"));
674 assertFalse(archiveContains(archiveFolder.path(), "^Line 15"));
675 }
676 }
677
678 @Test
679 void filterComments(TestInfo testInfo) throws IOException {
680 try (var credentials = new HostCredentials(testInfo);
681 var tempFolder = new TemporaryDirectory();
682 var archiveFolder = new TemporaryDirectory();
683 var listServer = new TestMailmanServer()) {
684 var author = credentials.getHostedRepository();
685 var archive = credentials.getHostedRepository();
686 var listAddress = EmailAddress.parse(listServer.createList("test"));
687 var censusBuilder = credentials.getCensusBuilder()
688 .addAuthor(author.forge().currentUser().id());
689 var from = EmailAddress.from("test", "test@test.mail");
690 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master",
691 listAddress, Set.of(), Set.of(),
692 listServer.getArchive(), listServer.getSMTP(),
693 archive, "webrev", Path.of("test"),
694 URIBuilder.base("http://www.test.test/").build(),
695 Set.of(), Map.of(),
696 URIBuilder.base("http://issues.test/browse/").build(),
697 Map.of(), Duration.ZERO);
698
699 // Populate the projects repository
700 var reviewFile = Path.of("reviewfile.txt");
701 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
702 var masterHash = localRepo.resolve("master").orElseThrow();
703 localRepo.push(masterHash, author.url(), "master", true);
704 localRepo.push(masterHash, archive.url(), "webrev", true);
705
706 // Make a change with a corresponding PR
707 var editHash = CheckableRepository.appendAndCommit(localRepo);
708 localRepo.push(editHash, author.url(), "edit", true);
709 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
710 pr.setBody("This is now ready\n<!-- this is a comment -->\nAnd this is not\n" +
729 assertFalse(archiveContains(archiveFolder.path(), "-->"));
730 assertTrue(archiveContains(archiveFolder.path(), "Plain comment"));
731 assertTrue(archiveContains(archiveFolder.path(), "Review comment"));
732 assertFalse(archiveContains(archiveFolder.path(), "/integrate"));
733 }
734 }
735
736 @Test
737 void incrementalChanges(TestInfo testInfo) throws IOException {
738 try (var credentials = new HostCredentials(testInfo);
739 var tempFolder = new TemporaryDirectory();
740 var archiveFolder = new TemporaryDirectory();
741 var listServer = new TestMailmanServer()) {
742 var author = credentials.getHostedRepository();
743 var archive = credentials.getHostedRepository();
744 var commenter = credentials.getHostedRepository();
745 var listAddress = EmailAddress.parse(listServer.createList("test"));
746 var censusBuilder = credentials.getCensusBuilder()
747 .addAuthor(author.forge().currentUser().id());
748 var from = EmailAddress.from("test", "test@test.mail");
749 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master",
750 listAddress, Set.of(), Set.of(),
751 listServer.getArchive(), listServer.getSMTP(),
752 archive, "webrev", Path.of("test"),
753 URIBuilder.base("http://www.test.test/").build(),
754 Set.of(), Map.of(),
755 URIBuilder.base("http://issues.test/browse/").build(),
756 Map.of(), Duration.ZERO);
757
758 // Populate the projects repository
759 var reviewFile = Path.of("reviewfile.txt");
760 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
761 var masterHash = localRepo.resolve("master").orElseThrow();
762 localRepo.push(masterHash, author.url(), "master", true);
763 localRepo.push(masterHash, archive.url(), "webrev", true);
764
765 // Make a change with a corresponding PR
766 var editHash = CheckableRepository.appendAndCommit(localRepo);
767 localRepo.push(editHash, author.url(), "edit", true);
768 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
769 pr.setBody("This is now ready");
850 var conversation = updatedConversations.get(0);
851 assertEquals(6, conversation.allMessages().size());
852 assertEquals("Re: [Rev 01] RFR: This is a pull request", conversation.allMessages().get(1).subject());
853 assertEquals("Re: [Rev 01] RFR: This is a pull request", conversation.allMessages().get(2).subject(), conversation.allMessages().get(2).toString());
854 assertEquals("Re: [Rev 04] RFR: This is a pull request", conversation.allMessages().get(5).subject());
855 }
856 }
857
858 @Test
859 void rebased(TestInfo testInfo) throws IOException {
860 try (var credentials = new HostCredentials(testInfo);
861 var tempFolder = new TemporaryDirectory();
862 var archiveFolder = new TemporaryDirectory();
863 var listServer = new TestMailmanServer()) {
864 var author = credentials.getHostedRepository();
865 var archive = credentials.getHostedRepository();
866 var listAddress = EmailAddress.parse(listServer.createList("test"));
867 var censusBuilder = credentials.getCensusBuilder()
868 .addAuthor(author.forge().currentUser().id());
869 var sender = EmailAddress.from("test", "test@test.mail");
870 var mlBot = new MailingListBridgeBot(sender, author, archive, censusBuilder.build(), "master",
871 listAddress, Set.of(), Set.of(),
872 listServer.getArchive(), listServer.getSMTP(),
873 archive, "webrev", Path.of("test"),
874 URIBuilder.base("http://www.test.test/").build(),
875 Set.of(), Map.of(),
876 URIBuilder.base("http://issues.test/browse/").build(),
877 Map.of(), Duration.ZERO);
878
879 // Populate the projects repository
880 var reviewFile = Path.of("reviewfile.txt");
881 var localRepo = CheckableRepository.init(tempFolder.path().resolve("first"), author.repositoryType(), reviewFile);
882 var masterHash = localRepo.resolve("master").orElseThrow();
883 localRepo.push(masterHash, author.url(), "master", true);
884 localRepo.push(masterHash, archive.url(), "webrev", true);
885
886 // Make a change with a corresponding PR
887 var editHash = CheckableRepository.appendAndCommit(localRepo, "A line", "Original msg");
888 localRepo.push(editHash, author.url(), "edit", true);
889 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
890 pr.setBody("This is now ready");
941 assertFalse(newMail.hasHeader("PR-Head-Hash"));
942 }
943 assertEquals("Re: [Rev 01] RFR: This is a pull request", conversations.get(0).allMessages().get(1).subject());
944 }
945 }
946
947 @Test
948 void skipAddingExistingWebrev(TestInfo testInfo) throws IOException {
949 try (var credentials = new HostCredentials(testInfo);
950 var tempFolder = new TemporaryDirectory();
951 var archiveFolder = new TemporaryDirectory();
952 var webrevFolder = new TemporaryDirectory();
953 var listServer = new TestMailmanServer()) {
954 var author = credentials.getHostedRepository();
955 var archive = credentials.getHostedRepository();
956 var ignored = credentials.getHostedRepository();
957 var listAddress = EmailAddress.parse(listServer.createList("test"));
958 var censusBuilder = credentials.getCensusBuilder()
959 .addAuthor(author.forge().currentUser().id());
960 var from = EmailAddress.from("test", "test@test.mail");
961 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master",
962 listAddress,
963 Set.of(ignored.forge().currentUser().userName()),
964 Set.of(),
965 listServer.getArchive(), listServer.getSMTP(),
966 archive, "webrev", Path.of("test"),
967 URIBuilder.base("http://www.test.test/").build(),
968 Set.of(), Map.of(),
969 URIBuilder.base("http://issues.test/browse/").build(),
970 Map.of(), Duration.ZERO);
971
972 // Populate the projects repository
973 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType());
974 var masterHash = localRepo.resolve("master").orElseThrow();
975 localRepo.push(masterHash, author.url(), "master", true);
976 localRepo.push(masterHash, archive.url(), "webrev", true);
977
978 // Make a change with a corresponding PR
979 var editHash = CheckableRepository.appendAndCommit(localRepo, "A simple change",
980 "Change msg\n\nWith several lines");
981 localRepo.push(editHash, author.url(), "edit", true);
1016 .collect(Collectors.toList());
1017 assertEquals(1, webrevComments.size());
1018 assertEquals(1, countSubstrings(webrevComments.get(0).body(), "webrev.00"));
1019 }
1020 }
1021
1022 @Test
1023 void notifyReviewVerdicts(TestInfo testInfo) throws IOException {
1024 try (var credentials = new HostCredentials(testInfo);
1025 var tempFolder = new TemporaryDirectory();
1026 var archiveFolder = new TemporaryDirectory();
1027 var listServer = new TestMailmanServer()) {
1028 var author = credentials.getHostedRepository();
1029 var archive = credentials.getHostedRepository();
1030 var reviewer = credentials.getHostedRepository();
1031 var listAddress = EmailAddress.parse(listServer.createList("test"));
1032 var from = EmailAddress.from("test", "test@test.mail");
1033 var censusBuilder = credentials.getCensusBuilder()
1034 .addReviewer(reviewer.forge().currentUser().id())
1035 .addAuthor(author.forge().currentUser().id());
1036 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master",
1037 listAddress, Set.of(), Set.of(),
1038 listServer.getArchive(), listServer.getSMTP(),
1039 archive, "webrev", Path.of("test"),
1040 URIBuilder.base("http://www.test.test/").build(),
1041 Set.of(), Map.of(),
1042 URIBuilder.base("http://issues.test/browse/").build(),
1043 Map.of(), Duration.ZERO);
1044
1045 // Populate the projects repository
1046 var reviewFile = Path.of("reviewfile.txt");
1047 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
1048 var masterHash = localRepo.resolve("master").orElseThrow();
1049 localRepo.push(masterHash, author.url(), "master", true);
1050 localRepo.push(masterHash, archive.url(), "webrev", true);
1051
1052 // Make a change with a corresponding PR
1053 var editHash = CheckableRepository.appendAndCommit(localRepo);
1054 localRepo.push(editHash, author.url(), "edit", true);
1055 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
1056 pr.setBody("This is now ready");
1098 assertEquals(2, archiveContainsCount(archiveFolder.path(), "Changes requested by "));
1099 if (author.forge().supportsReviewBody()) {
1100 assertEquals(1, archiveContainsCount(archiveFolder.path(), "Reason 3"));
1101 }
1102 }
1103 }
1104
1105 @Test
1106 void ignoreComments(TestInfo testInfo) throws IOException {
1107 try (var credentials = new HostCredentials(testInfo);
1108 var tempFolder = new TemporaryDirectory();
1109 var archiveFolder = new TemporaryDirectory();
1110 var listServer = new TestMailmanServer()) {
1111 var author = credentials.getHostedRepository();
1112 var ignored = credentials.getHostedRepository();
1113 var archive = credentials.getHostedRepository();
1114 var listAddress = EmailAddress.parse(listServer.createList("test"));
1115 var censusBuilder = credentials.getCensusBuilder()
1116 .addAuthor(author.forge().currentUser().id());
1117 var from = EmailAddress.from("test", "test@test.mail");
1118 var mlBot = new MailingListBridgeBot(from, author, archive, censusBuilder.build(), "master",
1119 listAddress,
1120 Set.of(ignored.forge().currentUser().userName()),
1121 Set.of(Pattern.compile("ignore this comment", Pattern.MULTILINE | Pattern.DOTALL)),
1122 listServer.getArchive(), listServer.getSMTP(),
1123 archive, "webrev", Path.of("test"),
1124 URIBuilder.base("http://www.test.test/").build(),
1125 Set.of(), Map.of(),
1126 URIBuilder.base("http://issues.test/browse/").build(),
1127 Map.of(), Duration.ZERO);
1128
1129 // Populate the projects repository
1130 var reviewFile = Path.of("reviewfile.txt");
1131 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
1132 var masterHash = localRepo.resolve("master").orElseThrow();
1133 localRepo.push(masterHash, author.url(), "master", true);
1134 localRepo.push(masterHash, archive.url(), "webrev", true);
1135
1136 // Make a change with a corresponding PR
1137 var editHash = CheckableRepository.appendAndCommit(localRepo);
1138 localRepo.push(editHash, author.url(), "edit", true);
|
95 private String noreplyAddress(HostedRepository repository) {
96 return "test+" + repository.forge().currentUser().id() + "+" +
97 repository.forge().currentUser().userName() +
98 "@openjdk.java.net";
99 }
100
101 @Test
102 void simpleArchive(TestInfo testInfo) throws IOException {
103 try (var credentials = new HostCredentials(testInfo);
104 var tempFolder = new TemporaryDirectory();
105 var archiveFolder = new TemporaryDirectory();
106 var webrevFolder = new TemporaryDirectory();
107 var listServer = new TestMailmanServer()) {
108 var author = credentials.getHostedRepository();
109 var archive = credentials.getHostedRepository();
110 var ignored = credentials.getHostedRepository();
111 var listAddress = EmailAddress.parse(listServer.createList("test"));
112 var censusBuilder = credentials.getCensusBuilder()
113 .addAuthor(author.forge().currentUser().id());
114 var from = EmailAddress.from("test", "test@test.mail");
115 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
116 censusBuilder.build(), "master", listAddress,
117 Set.of(ignored.forge().currentUser().userName()),
118 Set.of(),
119 listServer.getArchive(), listServer.getSMTP(),
120 archive, "webrev", Path.of("test"),
121 URIBuilder.base("http://www.test.test/").build(),
122 Set.of("rfr"), Map.of(ignored.forge().currentUser().userName(),
123 Pattern.compile("ready")),
124 URIBuilder.base("http://issues.test/browse/").build(),
125 Map.of("Extra1", "val1", "Extra2", "val2"),
126 Duration.ZERO);
127
128 // Populate the projects repository
129 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType());
130 var masterHash = localRepo.resolve("master").orElseThrow();
131 localRepo.push(masterHash, author.url(), "master", true);
132 localRepo.push(masterHash, archive.url(), "webrev", true);
133
134 // Make a change with a corresponding PR
135 var editHash = CheckableRepository.appendAndCommit(localRepo, "A simple change",
136 "Change msg\n\nWith several lines");
253 assertEquals(noreplyAddress(archive), newMail.author().address());
254 assertEquals(listAddress, newMail.sender());
255 }
256 assertTrue(conversations.get(0).allMessages().get(2).body().contains("This is a comment 😄"));
257 }
258 }
259
260 @Test
261 void reviewComment(TestInfo testInfo) throws IOException {
262 try (var credentials = new HostCredentials(testInfo);
263 var tempFolder = new TemporaryDirectory();
264 var archiveFolder = new TemporaryDirectory();
265 var listServer = new TestMailmanServer()) {
266 var author = credentials.getHostedRepository();
267 var archive = credentials.getHostedRepository();
268 var ignored = credentials.getHostedRepository();
269 var listAddress = EmailAddress.parse(listServer.createList("test"));
270 var censusBuilder = credentials.getCensusBuilder()
271 .addAuthor(author.forge().currentUser().id());
272 var from = EmailAddress.from("test", "test@test.mail");
273 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
274 censusBuilder.build(), "master", listAddress,
275 Set.of(ignored.forge().currentUser().userName()),
276 Set.of(),
277 listServer.getArchive(), listServer.getSMTP(),
278 archive, "webrev", Path.of("test"),
279 URIBuilder.base("http://www.test.test/").build(),
280 Set.of(), Map.of(),
281 URIBuilder.base("http://issues.test/browse/").build(),
282 Map.of(), Duration.ZERO);
283
284 // Populate the projects repository
285 var reviewFile = Path.of("reviewfile.txt");
286 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
287 var masterHash = localRepo.resolve("master").orElseThrow();
288 localRepo.push(masterHash, author.url(), "master", true);
289 localRepo.push(masterHash, archive.url(), "webrev", true);
290
291 // Make a change with a corresponding PR
292 var editHash = CheckableRepository.appendAndCommit(localRepo);
293 localRepo.push(editHash, author.url(), "edit", true);
294 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
342 assertEquals(3, conversations.get(0).allMessages().size());
343 for (var newMail : conversations.get(0).allMessages()) {
344 assertEquals(noreplyAddress(archive), newMail.author().address());
345 assertEquals(listAddress, newMail.sender());
346 }
347 }
348 }
349
350 @Test
351 void combineComments(TestInfo testInfo) throws IOException {
352 try (var credentials = new HostCredentials(testInfo);
353 var tempFolder = new TemporaryDirectory();
354 var archiveFolder = new TemporaryDirectory();
355 var listServer = new TestMailmanServer()) {
356 var author = credentials.getHostedRepository();
357 var archive = credentials.getHostedRepository();
358 var listAddress = EmailAddress.parse(listServer.createList("test"));
359 var censusBuilder = credentials.getCensusBuilder()
360 .addAuthor(author.forge().currentUser().id());
361 var from = EmailAddress.from("test", "test@test.mail");
362 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
363 censusBuilder.build(), "master",
364 listAddress, Set.of(), Set.of(),
365 listServer.getArchive(),
366 listServer.getSMTP(),
367 archive, "webrev", Path.of("test"),
368 URIBuilder.base("http://www.test.test/").build(),
369 Set.of(), Map.of(),
370 URIBuilder.base("http://issues.test/browse/").build(),
371 Map.of(), Duration.ZERO);
372
373 // Populate the projects repository
374 var reviewFile = Path.of("reviewfile.txt");
375 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
376 var masterHash = localRepo.resolve("master").orElseThrow();
377 localRepo.push(masterHash, author.url(), "master", true);
378 localRepo.push(masterHash, archive.url(), "webrev", true);
379
380 // Make a change with a corresponding PR
381 var editHash = CheckableRepository.appendAndCommit(localRepo);
382 localRepo.push(editHash, author.url(), "edit", true);
383 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
431
432 // The combined review comments should only appear unquoted once
433 assertEquals(1, archiveContainsCount(archiveFolder.path(), "^Another review comment"));
434 }
435 }
436
437 @Test
438 void commentThreading(TestInfo testInfo) throws IOException {
439 try (var credentials = new HostCredentials(testInfo);
440 var tempFolder = new TemporaryDirectory();
441 var archiveFolder = new TemporaryDirectory();
442 var listServer = new TestMailmanServer()) {
443 var author = credentials.getHostedRepository();
444 var reviewer = credentials.getHostedRepository();
445 var archive = credentials.getHostedRepository();
446 var listAddress = EmailAddress.parse(listServer.createList("test"));
447 var censusBuilder = credentials.getCensusBuilder()
448 .addReviewer(reviewer.forge().currentUser().id())
449 .addAuthor(author.forge().currentUser().id());
450 var from = EmailAddress.from("test", "test@test.mail");
451 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
452 censusBuilder.build(), "master",
453 listAddress, Set.of(), Set.of(),
454 listServer.getArchive(),
455 listServer.getSMTP(),
456 archive, "webrev", Path.of("test"),
457 URIBuilder.base("http://www.test.test/").build(),
458 Set.of(), Map.of(),
459 URIBuilder.base("http://issues.test/browse/").build(),
460 Map.of(), Duration.ZERO);
461
462 // Populate the projects repository
463 var reviewFile = Path.of("reviewfile.txt");
464 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
465 var masterHash = localRepo.resolve("master").orElseThrow();
466 localRepo.push(masterHash, author.url(), "master", true);
467 localRepo.push(masterHash, archive.url(), "webrev", true);
468
469 // Make a change with a corresponding PR
470 var editHash = CheckableRepository.appendAndCommit(localRepo);
471 localRepo.push(editHash, author.url(), "edit", true);
472 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
553 var thread4 = replies.get(3);
554 assertEquals("Re: [Approved] RFR: This is a pull request", thread4.subject());
555 assertTrue(thread4.body().contains("Looks fine"));
556 assertTrue(thread4.body().contains("The final review comment"));
557 assertTrue(thread4.body().contains("Approved by integrationreviewer1 (Reviewer)"));
558 }
559 }
560
561 @Test
562 void reviewContext(TestInfo testInfo) throws IOException {
563 try (var credentials = new HostCredentials(testInfo);
564 var tempFolder = new TemporaryDirectory();
565 var archiveFolder = new TemporaryDirectory();
566 var listServer = new TestMailmanServer()) {
567 var author = credentials.getHostedRepository();
568 var archive = credentials.getHostedRepository();
569 var listAddress = EmailAddress.parse(listServer.createList("test"));
570 var censusBuilder = credentials.getCensusBuilder()
571 .addAuthor(author.forge().currentUser().id());
572 var from = EmailAddress.from("test", "test@test.mail");
573 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
574 censusBuilder.build(), "master",
575 listAddress, Set.of(), Set.of(),
576 listServer.getArchive(),
577 listServer.getSMTP(),
578 archive, "webrev", Path.of("test"),
579 URIBuilder.base("http://www.test.test/").build(),
580 Set.of(), Map.of(),
581 URIBuilder.base("http://issues.test/browse/").build(),
582 Map.of(), Duration.ZERO);
583
584 // Populate the projects repository
585 var reviewFile = Path.of("reviewfile.txt");
586 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
587 var masterHash = localRepo.resolve("master").orElseThrow();
588 localRepo.push(masterHash, author.url(), "master", true);
589 localRepo.push(masterHash, archive.url(), "webrev", true);
590
591 // Make a change with a corresponding PR
592 var editHash = CheckableRepository.appendAndCommit(localRepo, "Line 1\nLine 2\nLine 3\nLine 4");
593 localRepo.push(editHash, author.url(), "edit", true);
594 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
605 // The archive should only contain context around line 2
606 Repository.materialize(archiveFolder.path(), archive.url(), "master");
607 assertTrue(archiveContains(archiveFolder.path(), "^> 2: Line 1$"));
608 assertTrue(archiveContains(archiveFolder.path(), "^> 3: Line 2$"));
609 assertFalse(archiveContains(archiveFolder.path(), "^> 4: Line 3$"));
610 }
611 }
612
613 @Test
614 void multipleReviewContexts(TestInfo testInfo) throws IOException {
615 try (var credentials = new HostCredentials(testInfo);
616 var tempFolder = new TemporaryDirectory();
617 var archiveFolder = new TemporaryDirectory();
618 var listServer = new TestMailmanServer()) {
619 var author = credentials.getHostedRepository();
620 var archive = credentials.getHostedRepository();
621 var listAddress = EmailAddress.parse(listServer.createList("test"));
622 var censusBuilder = credentials.getCensusBuilder()
623 .addAuthor(author.forge().currentUser().id());
624 var from = EmailAddress.from("test", "test@test.mail");
625 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
626 censusBuilder.build(), "master",
627 listAddress, Set.of(), Set.of(),
628 listServer.getArchive(),
629 listServer.getSMTP(),
630 archive, "webrev", Path.of("test"),
631 URIBuilder.base("http://www.test.test/").build(),
632 Set.of(), Map.of(),
633 URIBuilder.base("http://issues.test/browse/").build(),
634 Map.of(), Duration.ZERO);
635
636 // Populate the projects repository
637 var reviewFile = Path.of("reviewfile.txt");
638 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
639 var masterHash = localRepo.resolve("master").orElseThrow();
640 localRepo.push(masterHash, author.url(), "master", true);
641 localRepo.push(masterHash, archive.url(), "webrev", true);
642 var initialHash = CheckableRepository.appendAndCommit(localRepo,
643 "Line 0.1\nLine 0.2\nLine 0.3\nLine 0.4\n" +
644 "Line 1\nLine 2\nLine 3\nLine 4\n" +
645 "Line 5\nLine 6\nLine 7\nLine 8\n" +
646 "Line 8.1\nLine 8.2\nLine 8.3\nLine 8.4\n" +
676
677 assertTrue(archiveContains(archiveFolder.path(), "reviewfile.txt line 24"));
678 assertTrue(archiveContains(archiveFolder.path(), "^> 23: Line 12.5$"));
679 assertTrue(archiveContains(archiveFolder.path(), "^> 24: Line 13 edit$"));
680 assertFalse(archiveContains(archiveFolder.path(), "^Line 15"));
681 }
682 }
683
684 @Test
685 void filterComments(TestInfo testInfo) throws IOException {
686 try (var credentials = new HostCredentials(testInfo);
687 var tempFolder = new TemporaryDirectory();
688 var archiveFolder = new TemporaryDirectory();
689 var listServer = new TestMailmanServer()) {
690 var author = credentials.getHostedRepository();
691 var archive = credentials.getHostedRepository();
692 var listAddress = EmailAddress.parse(listServer.createList("test"));
693 var censusBuilder = credentials.getCensusBuilder()
694 .addAuthor(author.forge().currentUser().id());
695 var from = EmailAddress.from("test", "test@test.mail");
696 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
697 censusBuilder.build(), "master",
698 listAddress, Set.of(), Set.of(),
699 listServer.getArchive(), listServer.getSMTP(),
700 archive, "webrev", Path.of("test"),
701 URIBuilder.base("http://www.test.test/").build(),
702 Set.of(), Map.of(),
703 URIBuilder.base("http://issues.test/browse/").build(),
704 Map.of(), Duration.ZERO);
705
706 // Populate the projects repository
707 var reviewFile = Path.of("reviewfile.txt");
708 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
709 var masterHash = localRepo.resolve("master").orElseThrow();
710 localRepo.push(masterHash, author.url(), "master", true);
711 localRepo.push(masterHash, archive.url(), "webrev", true);
712
713 // Make a change with a corresponding PR
714 var editHash = CheckableRepository.appendAndCommit(localRepo);
715 localRepo.push(editHash, author.url(), "edit", true);
716 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
717 pr.setBody("This is now ready\n<!-- this is a comment -->\nAnd this is not\n" +
736 assertFalse(archiveContains(archiveFolder.path(), "-->"));
737 assertTrue(archiveContains(archiveFolder.path(), "Plain comment"));
738 assertTrue(archiveContains(archiveFolder.path(), "Review comment"));
739 assertFalse(archiveContains(archiveFolder.path(), "/integrate"));
740 }
741 }
742
743 @Test
744 void incrementalChanges(TestInfo testInfo) throws IOException {
745 try (var credentials = new HostCredentials(testInfo);
746 var tempFolder = new TemporaryDirectory();
747 var archiveFolder = new TemporaryDirectory();
748 var listServer = new TestMailmanServer()) {
749 var author = credentials.getHostedRepository();
750 var archive = credentials.getHostedRepository();
751 var commenter = credentials.getHostedRepository();
752 var listAddress = EmailAddress.parse(listServer.createList("test"));
753 var censusBuilder = credentials.getCensusBuilder()
754 .addAuthor(author.forge().currentUser().id());
755 var from = EmailAddress.from("test", "test@test.mail");
756 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
757 censusBuilder.build(), "master",
758 listAddress, Set.of(), Set.of(),
759 listServer.getArchive(), listServer.getSMTP(),
760 archive, "webrev", Path.of("test"),
761 URIBuilder.base("http://www.test.test/").build(),
762 Set.of(), Map.of(),
763 URIBuilder.base("http://issues.test/browse/").build(),
764 Map.of(), Duration.ZERO);
765
766 // Populate the projects repository
767 var reviewFile = Path.of("reviewfile.txt");
768 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
769 var masterHash = localRepo.resolve("master").orElseThrow();
770 localRepo.push(masterHash, author.url(), "master", true);
771 localRepo.push(masterHash, archive.url(), "webrev", true);
772
773 // Make a change with a corresponding PR
774 var editHash = CheckableRepository.appendAndCommit(localRepo);
775 localRepo.push(editHash, author.url(), "edit", true);
776 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
777 pr.setBody("This is now ready");
858 var conversation = updatedConversations.get(0);
859 assertEquals(6, conversation.allMessages().size());
860 assertEquals("Re: [Rev 01] RFR: This is a pull request", conversation.allMessages().get(1).subject());
861 assertEquals("Re: [Rev 01] RFR: This is a pull request", conversation.allMessages().get(2).subject(), conversation.allMessages().get(2).toString());
862 assertEquals("Re: [Rev 04] RFR: This is a pull request", conversation.allMessages().get(5).subject());
863 }
864 }
865
866 @Test
867 void rebased(TestInfo testInfo) throws IOException {
868 try (var credentials = new HostCredentials(testInfo);
869 var tempFolder = new TemporaryDirectory();
870 var archiveFolder = new TemporaryDirectory();
871 var listServer = new TestMailmanServer()) {
872 var author = credentials.getHostedRepository();
873 var archive = credentials.getHostedRepository();
874 var listAddress = EmailAddress.parse(listServer.createList("test"));
875 var censusBuilder = credentials.getCensusBuilder()
876 .addAuthor(author.forge().currentUser().id());
877 var sender = EmailAddress.from("test", "test@test.mail");
878 var mlBot = new MailingListBridgeBot(sender, author, archive, "master",
879 censusBuilder.build(), "master",
880 listAddress, Set.of(), Set.of(),
881 listServer.getArchive(), listServer.getSMTP(),
882 archive, "webrev", Path.of("test"),
883 URIBuilder.base("http://www.test.test/").build(),
884 Set.of(), Map.of(),
885 URIBuilder.base("http://issues.test/browse/").build(),
886 Map.of(), Duration.ZERO);
887
888 // Populate the projects repository
889 var reviewFile = Path.of("reviewfile.txt");
890 var localRepo = CheckableRepository.init(tempFolder.path().resolve("first"), author.repositoryType(), reviewFile);
891 var masterHash = localRepo.resolve("master").orElseThrow();
892 localRepo.push(masterHash, author.url(), "master", true);
893 localRepo.push(masterHash, archive.url(), "webrev", true);
894
895 // Make a change with a corresponding PR
896 var editHash = CheckableRepository.appendAndCommit(localRepo, "A line", "Original msg");
897 localRepo.push(editHash, author.url(), "edit", true);
898 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
899 pr.setBody("This is now ready");
950 assertFalse(newMail.hasHeader("PR-Head-Hash"));
951 }
952 assertEquals("Re: [Rev 01] RFR: This is a pull request", conversations.get(0).allMessages().get(1).subject());
953 }
954 }
955
956 @Test
957 void skipAddingExistingWebrev(TestInfo testInfo) throws IOException {
958 try (var credentials = new HostCredentials(testInfo);
959 var tempFolder = new TemporaryDirectory();
960 var archiveFolder = new TemporaryDirectory();
961 var webrevFolder = new TemporaryDirectory();
962 var listServer = new TestMailmanServer()) {
963 var author = credentials.getHostedRepository();
964 var archive = credentials.getHostedRepository();
965 var ignored = credentials.getHostedRepository();
966 var listAddress = EmailAddress.parse(listServer.createList("test"));
967 var censusBuilder = credentials.getCensusBuilder()
968 .addAuthor(author.forge().currentUser().id());
969 var from = EmailAddress.from("test", "test@test.mail");
970 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
971 censusBuilder.build(), "master",
972 listAddress,
973 Set.of(ignored.forge().currentUser().userName()),
974 Set.of(),
975 listServer.getArchive(), listServer.getSMTP(),
976 archive, "webrev", Path.of("test"),
977 URIBuilder.base("http://www.test.test/").build(),
978 Set.of(), Map.of(),
979 URIBuilder.base("http://issues.test/browse/").build(),
980 Map.of(), Duration.ZERO);
981
982 // Populate the projects repository
983 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType());
984 var masterHash = localRepo.resolve("master").orElseThrow();
985 localRepo.push(masterHash, author.url(), "master", true);
986 localRepo.push(masterHash, archive.url(), "webrev", true);
987
988 // Make a change with a corresponding PR
989 var editHash = CheckableRepository.appendAndCommit(localRepo, "A simple change",
990 "Change msg\n\nWith several lines");
991 localRepo.push(editHash, author.url(), "edit", true);
1026 .collect(Collectors.toList());
1027 assertEquals(1, webrevComments.size());
1028 assertEquals(1, countSubstrings(webrevComments.get(0).body(), "webrev.00"));
1029 }
1030 }
1031
1032 @Test
1033 void notifyReviewVerdicts(TestInfo testInfo) throws IOException {
1034 try (var credentials = new HostCredentials(testInfo);
1035 var tempFolder = new TemporaryDirectory();
1036 var archiveFolder = new TemporaryDirectory();
1037 var listServer = new TestMailmanServer()) {
1038 var author = credentials.getHostedRepository();
1039 var archive = credentials.getHostedRepository();
1040 var reviewer = credentials.getHostedRepository();
1041 var listAddress = EmailAddress.parse(listServer.createList("test"));
1042 var from = EmailAddress.from("test", "test@test.mail");
1043 var censusBuilder = credentials.getCensusBuilder()
1044 .addReviewer(reviewer.forge().currentUser().id())
1045 .addAuthor(author.forge().currentUser().id());
1046 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
1047 censusBuilder.build(), "master",
1048 listAddress, Set.of(), Set.of(),
1049 listServer.getArchive(), listServer.getSMTP(),
1050 archive, "webrev", Path.of("test"),
1051 URIBuilder.base("http://www.test.test/").build(),
1052 Set.of(), Map.of(),
1053 URIBuilder.base("http://issues.test/browse/").build(),
1054 Map.of(), Duration.ZERO);
1055
1056 // Populate the projects repository
1057 var reviewFile = Path.of("reviewfile.txt");
1058 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
1059 var masterHash = localRepo.resolve("master").orElseThrow();
1060 localRepo.push(masterHash, author.url(), "master", true);
1061 localRepo.push(masterHash, archive.url(), "webrev", true);
1062
1063 // Make a change with a corresponding PR
1064 var editHash = CheckableRepository.appendAndCommit(localRepo);
1065 localRepo.push(editHash, author.url(), "edit", true);
1066 var pr = credentials.createPullRequest(archive, "master", "edit", "This is a pull request");
1067 pr.setBody("This is now ready");
1109 assertEquals(2, archiveContainsCount(archiveFolder.path(), "Changes requested by "));
1110 if (author.forge().supportsReviewBody()) {
1111 assertEquals(1, archiveContainsCount(archiveFolder.path(), "Reason 3"));
1112 }
1113 }
1114 }
1115
1116 @Test
1117 void ignoreComments(TestInfo testInfo) throws IOException {
1118 try (var credentials = new HostCredentials(testInfo);
1119 var tempFolder = new TemporaryDirectory();
1120 var archiveFolder = new TemporaryDirectory();
1121 var listServer = new TestMailmanServer()) {
1122 var author = credentials.getHostedRepository();
1123 var ignored = credentials.getHostedRepository();
1124 var archive = credentials.getHostedRepository();
1125 var listAddress = EmailAddress.parse(listServer.createList("test"));
1126 var censusBuilder = credentials.getCensusBuilder()
1127 .addAuthor(author.forge().currentUser().id());
1128 var from = EmailAddress.from("test", "test@test.mail");
1129 var mlBot = new MailingListBridgeBot(from, author, archive, "master",
1130 censusBuilder.build(), "master",
1131 listAddress,
1132 Set.of(ignored.forge().currentUser().userName()),
1133 Set.of(Pattern.compile("ignore this comment", Pattern.MULTILINE | Pattern.DOTALL)),
1134 listServer.getArchive(), listServer.getSMTP(),
1135 archive, "webrev", Path.of("test"),
1136 URIBuilder.base("http://www.test.test/").build(),
1137 Set.of(), Map.of(),
1138 URIBuilder.base("http://issues.test/browse/").build(),
1139 Map.of(), Duration.ZERO);
1140
1141 // Populate the projects repository
1142 var reviewFile = Path.of("reviewfile.txt");
1143 var localRepo = CheckableRepository.init(tempFolder.path(), author.repositoryType(), reviewFile);
1144 var masterHash = localRepo.resolve("master").orElseThrow();
1145 localRepo.push(masterHash, author.url(), "master", true);
1146 localRepo.push(masterHash, archive.url(), "webrev", true);
1147
1148 // Make a change with a corresponding PR
1149 var editHash = CheckableRepository.appendAndCommit(localRepo);
1150 localRepo.push(editHash, author.url(), "edit", true);
|