Search in sources :

Example 11 with CommentLinkInfo

use of com.google.gerrit.extensions.api.projects.CommentLinkInfo in project gerrit by GerritCodeReview.

the class ProjectIT method projectConfigUsesLocallySetCommentlinks.

@Test
public void projectConfigUsesLocallySetCommentlinks() throws Exception {
    ConfigInput input = new ConfigInput();
    addCommentLink(input, BUGZILLA, BUGZILLA_MATCH, BUGZILLA_LINK);
    addCommentLink(input, JIRA, JIRA_MATCH, JIRA_LINK);
    ConfigInfo info = setConfig(project, input);
    Map<String, CommentLinkInfo> expected = new HashMap<>();
    expected.put(BUGZILLA, commentLinkInfo(BUGZILLA, BUGZILLA_MATCH, BUGZILLA_LINK));
    expected.put(JIRA, commentLinkInfo(JIRA, JIRA_MATCH, JIRA_LINK));
    assertCommentLinks(info, expected);
    assertCommentLinks(getConfig(), expected);
}
Also used : ConfigInput(com.google.gerrit.extensions.api.projects.ConfigInput) CommentLinkInfo(com.google.gerrit.extensions.api.projects.CommentLinkInfo) HashMap(java.util.HashMap) ConfigInfo(com.google.gerrit.extensions.api.projects.ConfigInfo) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 12 with CommentLinkInfo

use of com.google.gerrit.extensions.api.projects.CommentLinkInfo in project gerrit by GerritCodeReview.

the class ProjectIT method removeCommentLink.

@Test
public void removeCommentLink() throws Exception {
    ConfigInput input = new ConfigInput();
    addCommentLink(input, BUGZILLA, BUGZILLA_MATCH, BUGZILLA_LINK);
    addCommentLink(input, JIRA, JIRA_MATCH, JIRA_LINK);
    ConfigInfo info = setConfig(project, input);
    Map<String, CommentLinkInfo> expected = new HashMap<>();
    expected.put(BUGZILLA, commentLinkInfo(BUGZILLA, BUGZILLA_MATCH, BUGZILLA_LINK));
    expected.put(JIRA, commentLinkInfo(JIRA, JIRA_MATCH, JIRA_LINK));
    assertCommentLinks(info, expected);
    input = new ConfigInput();
    addCommentLink(input, BUGZILLA, null);
    setConfig(project, input);
    expected = new HashMap<>();
    expected.put(JIRA, commentLinkInfo(JIRA, JIRA_MATCH, JIRA_LINK));
    assertCommentLinks(getConfig(project), expected);
}
Also used : ConfigInput(com.google.gerrit.extensions.api.projects.ConfigInput) CommentLinkInfo(com.google.gerrit.extensions.api.projects.CommentLinkInfo) HashMap(java.util.HashMap) ConfigInfo(com.google.gerrit.extensions.api.projects.ConfigInfo) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 13 with CommentLinkInfo

use of com.google.gerrit.extensions.api.projects.CommentLinkInfo in project gerrit by GerritCodeReview.

the class ProjectIT method commentLinkInfo.

private CommentLinkInfo commentLinkInfo(String name, String match, String link) {
    CommentLinkInfo info = new CommentLinkInfo();
    info.name = name;
    info.match = match;
    info.link = link;
    return info;
}
Also used : CommentLinkInfo(com.google.gerrit.extensions.api.projects.CommentLinkInfo)

Example 14 with CommentLinkInfo

use of com.google.gerrit.extensions.api.projects.CommentLinkInfo in project gerrit by GerritCodeReview.

the class ProjectIT method projectConfigUsesCommentLinksFromGlobalAndLocal.

@Test
@GerritConfig(name = "commentlink.bugzilla.match", value = BUGZILLA_MATCH)
@GerritConfig(name = "commentlink.bugzilla.link", value = BUGZILLA_LINK)
public void projectConfigUsesCommentLinksFromGlobalAndLocal() throws Exception {
    Map<String, CommentLinkInfo> expected = new HashMap<>();
    expected.put(BUGZILLA, commentLinkInfo(BUGZILLA, BUGZILLA_MATCH, BUGZILLA_LINK));
    assertCommentLinks(getConfig(), expected);
    ConfigInput input = new ConfigInput();
    addCommentLink(input, JIRA, JIRA_MATCH, JIRA_LINK);
    ConfigInfo info = setConfig(project, input);
    expected.put(JIRA, commentLinkInfo(JIRA, JIRA_MATCH, JIRA_LINK));
    assertCommentLinks(info, expected);
    assertCommentLinks(getConfig(), expected);
}
Also used : CommentLinkInfo(com.google.gerrit.extensions.api.projects.CommentLinkInfo) ConfigInput(com.google.gerrit.extensions.api.projects.ConfigInput) HashMap(java.util.HashMap) ConfigInfo(com.google.gerrit.extensions.api.projects.ConfigInfo) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

CommentLinkInfo (com.google.gerrit.extensions.api.projects.CommentLinkInfo)14 ConfigInfo (com.google.gerrit.extensions.api.projects.ConfigInfo)8 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)7 ConfigInput (com.google.gerrit.extensions.api.projects.ConfigInput)7 HashMap (java.util.HashMap)7 Test (org.junit.Test)7 Project (com.google.gerrit.entities.Project)3 GerritConfig (com.google.gerrit.acceptance.config.GerritConfig)2 StoredCommentLinkInfo (com.google.gerrit.entities.StoredCommentLinkInfo)2 ProjectState (com.google.gerrit.server.project.ProjectState)2 Cache (com.google.common.cache.Cache)1 ImmutableList (com.google.common.collect.ImmutableList)1 BooleanProjectConfig (com.google.gerrit.entities.BooleanProjectConfig)1 InheritedBooleanInfo (com.google.gerrit.extensions.api.projects.ConfigInfo.InheritedBooleanInfo)1 SubmitTypeInfo (com.google.gerrit.extensions.api.projects.ConfigInfo.SubmitTypeInfo)1 AccountDefaultDisplayName (com.google.gerrit.extensions.common.AccountDefaultDisplayName)1 ActionInfo (com.google.gerrit.extensions.common.ActionInfo)1 GitReferenceUpdatedListener (com.google.gerrit.extensions.events.GitReferenceUpdatedListener)1 PluginEventListener (com.google.gerrit.extensions.events.PluginEventListener)1 UiAction (com.google.gerrit.extensions.webui.UiAction)1