Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
750 additions
and 155 deletions.
- +1 −1 bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/ArchiveWorkItem.java
- +3 −3 bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/MailingListBridgeBot.java
- +3 −3 bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/MailingListBridgeBotBuilder.java
- +1 −1 bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/MailingListBridgeBotFactory.java
- +2 −2 bots/mlbridge/src/test/java/org/openjdk/skara/bots/mlbridge/MailingListBridgeBotTests.java
- +4 −0 bots/notify/src/main/java/org/openjdk/skara/bots/notify/IssueUpdater.java
- +89 −0 bots/notify/src/main/java/org/openjdk/skara/bots/notify/IssueUpdaterBuilder.java
- +4 −0 bots/notify/src/main/java/org/openjdk/skara/bots/notify/MailingListUpdater.java
- +103 −0 bots/notify/src/main/java/org/openjdk/skara/bots/notify/MailingListUpdaterBuilder.java
- +4 −0 bots/notify/src/main/java/org/openjdk/skara/bots/notify/NotifyBot.java
- +98 −0 bots/notify/src/main/java/org/openjdk/skara/bots/notify/NotifyBotBuilder.java
- +46 −40 bots/notify/src/main/java/org/openjdk/skara/bots/notify/NotifyBotFactory.java
- +392 −105 bots/notify/src/test/java/org/openjdk/skara/bots/notify/UpdaterTests.java
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,89 @@ | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package org.openjdk.skara.bots.notify; | ||
|
||
import org.openjdk.skara.issuetracker.IssueProject; | ||
|
||
import java.net.URI; | ||
import java.util.Map; | ||
|
||
public class IssueUpdaterBuilder { | ||
private IssueProject issueProject; | ||
private boolean reviewLink = true; | ||
private URI reviewIcon = null; | ||
private boolean commitLink = true; | ||
private URI commitIcon = null; | ||
private boolean setFixVersion = false; | ||
private Map<String, String> fixVersions = null; | ||
private boolean prOnly = false; | ||
|
||
public IssueUpdaterBuilder issueProject(IssueProject issueProject) { | ||
this.issueProject = issueProject; | ||
return this; | ||
} | ||
|
||
public IssueUpdaterBuilder reviewLink(boolean reviewLink) { | ||
this.reviewLink = reviewLink; | ||
return this; | ||
} | ||
|
||
public IssueUpdaterBuilder reviewIcon(URI reviewIcon) { | ||
this.reviewIcon = reviewIcon; | ||
return this; | ||
} | ||
|
||
public IssueUpdaterBuilder commitLink(boolean commitLink) { | ||
this.commitLink = commitLink; | ||
return this; | ||
} | ||
|
||
public IssueUpdaterBuilder commitIcon(URI commitIcon) { | ||
this.commitIcon = commitIcon; | ||
return this; | ||
} | ||
|
||
public IssueUpdaterBuilder setFixVersion(boolean setFixVersion) { | ||
if (setFixVersion && prOnly) { | ||
throw new IllegalArgumentException("Cannot combine setFixVersion with prOnly"); | ||
} | ||
this.setFixVersion = setFixVersion; | ||
return this; | ||
} | ||
|
||
public IssueUpdaterBuilder fixVersions(Map<String, String> fixVersions) { | ||
this.fixVersions = fixVersions; | ||
return this; | ||
} | ||
|
||
public IssueUpdaterBuilder prOnly(boolean prOnly) { | ||
if (prOnly && setFixVersion) { | ||
throw new IllegalArgumentException("Cannot combine prOnly with setFixVersion"); | ||
} | ||
this.prOnly = prOnly; | ||
return this; | ||
} | ||
|
||
public IssueUpdater build() { | ||
return new IssueUpdater(issueProject, reviewLink, reviewIcon, commitLink, commitIcon, setFixVersion, fixVersions, prOnly); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
package org.openjdk.skara.bots.notify; | ||
|
||
import org.openjdk.skara.email.EmailAddress; | ||
import org.openjdk.skara.mailinglist.MailingList; | ||
|
||
import java.util.Map; | ||
import java.util.regex.Pattern; | ||
|
||
public class MailingListUpdaterBuilder { | ||
private MailingList list; | ||
private EmailAddress recipient; | ||
private EmailAddress sender; | ||
private EmailAddress author = null; | ||
private boolean includeBranch = false; | ||
private boolean reportNewTags = true; | ||
private boolean reportNewBranches = true; | ||
private boolean reportNewBuilds = true; | ||
private MailingListUpdater.Mode mode = MailingListUpdater.Mode.ALL; | ||
private Map<String, String> headers = Map.of(); | ||
private Pattern allowedAuthorDomains = Pattern.compile(".*"); | ||
|
||
public MailingListUpdaterBuilder list(MailingList list) { | ||
this.list = list; | ||
return this; | ||
} | ||
|
||
public MailingListUpdaterBuilder recipient(EmailAddress recipient) { | ||
this.recipient = recipient; | ||
return this; | ||
} | ||
|
||
public MailingListUpdaterBuilder sender(EmailAddress sender) { | ||
this.sender = sender; | ||
return this; | ||
} | ||
|
||
public MailingListUpdaterBuilder author(EmailAddress author) { | ||
this.author = author; | ||
return this; | ||
} | ||
|
||
public MailingListUpdaterBuilder includeBranch(boolean includeBranch) { | ||
this.includeBranch = includeBranch; | ||
return this; | ||
} | ||
|
||
public MailingListUpdaterBuilder reportNewTags(boolean reportNewTags) { | ||
this.reportNewTags = reportNewTags; | ||
return this; | ||
} | ||
|
||
public MailingListUpdaterBuilder reportNewBranches(boolean reportNewBranches) { | ||
this.reportNewBranches = reportNewBranches; | ||
return this; | ||
} | ||
|
||
public MailingListUpdaterBuilder reportNewBuilds(boolean reportNewBuilds) { | ||
this.reportNewBuilds = reportNewBuilds; | ||
return this; | ||
} | ||
|
||
public MailingListUpdaterBuilder mode(MailingListUpdater.Mode mode) { | ||
this.mode = mode; | ||
return this; | ||
} | ||
|
||
public MailingListUpdaterBuilder headers(Map<String, String> headers) { | ||
this.headers = headers; | ||
return this; | ||
} | ||
|
||
public MailingListUpdaterBuilder allowedAuthorDomains(Pattern allowedAuthorDomains) { | ||
this.allowedAuthorDomains = allowedAuthorDomains; | ||
return this; | ||
} | ||
|
||
public MailingListUpdater build() { | ||
return new MailingListUpdater(list, recipient, sender, author, includeBranch, reportNewTags, reportNewBranches, | ||
reportNewBuilds, mode, headers, allowedAuthorDomains); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.