当前位置: 首页>>代码示例>>Java>>正文


Java StreamBuildListener类代码示例

本文整理汇总了Java中hudson.model.StreamBuildListener的典型用法代码示例。如果您正苦于以下问题:Java StreamBuildListener类的具体用法?Java StreamBuildListener怎么用?Java StreamBuildListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StreamBuildListener类属于hudson.model包,在下文中一共展示了StreamBuildListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testExpandValues

import hudson.model.StreamBuildListener; //导入依赖的package包/类
@Test
public void testExpandValues()
        throws Exception
{
    AddFixVersion addFixVersion = new AddFixVersion("Beta Release $FOO");
    addFixVersion.setJiraClientSvc(jiraClientSvc);
    AbstractBuild mockBuild = mock(AbstractBuild.class);
    EnvVars envVars = new EnvVars();
    envVars.put("FOO", "BAR");
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(envVars);
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101"));
    jiraCommits.add(new JiraCommit("SSD-101"));

    addFixVersion.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    verify(jiraClientSvc, times(1)).addFixVersion(eq("SSD-101"), eq("Beta Release BAR"));

}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:19,代码来源:AddFixVersionTest.java

示例2: testResiliency

import hudson.model.StreamBuildListener; //导入依赖的package包/类
/**
 * An exception updating a ticket should not impact other issues being updated
 */
@Test
public void testResiliency()
        throws Exception
{
    AddFixVersion addFixVersion = new AddFixVersion("Beta Release");
    addFixVersion.setJiraClientSvc(jiraClientSvc);
    AbstractBuild mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars());
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101"));
    jiraCommits.add(new JiraCommit("SSD-102"));

    doThrow(new RuntimeException("Issue is invalid"))
            .when(jiraClientSvc).addFixVersion("SSD-101", "Beta Release");
    addFixVersion.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    // no exception - good!

    verify(jiraClientSvc, times(1)).addFixVersion("SSD-101", "Beta Release");
    verify(jiraClientSvc, times(1)).addFixVersion("SSD-102", "Beta Release");
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:24,代码来源:AddFixVersionTest.java

示例3: testResiliency

import hudson.model.StreamBuildListener; //导入依赖的package包/类
/**
 * An exception adding the first label add should not disrupt the next label
 */
@Test
public void testResiliency()
        throws Exception
{
    Transition transition = new Transition("Resolve");
    transition.setJiraClientSvc(jiraClientSvc);

    AbstractBuild mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars());
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));
    jiraCommits.add(new JiraCommit("SSD-102", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));
    doThrow(new RuntimeException("Issue is invalid"))
            .when(jiraClientSvc).changeWorkflowOfTicket("SSD-101", "Test Comment");
    transition.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    verify(jiraClientSvc, times(1)).changeWorkflowOfTicket(eq("SSD-101"), eq("Resolve"));
    verify(jiraClientSvc, times(1)).changeWorkflowOfTicket(eq("SSD-102"), eq("Resolve"));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:22,代码来源:TransitionTest.java

示例4: testInvokeOperations

import hudson.model.StreamBuildListener; //导入依赖的package包/类
@Test
public void testInvokeOperations()
        throws Exception
{
    IssueStrategyExtension mockStrategy = mock(IssueStrategyExtension.class);
    JiraOperationExtension mockOperation = mock(JiraOperationExtension.class);
    Descriptor mockDescriptor = mock(Descriptor.class);
    when(mockDescriptor.getDisplayName()).thenReturn("Mock descriptor");
    when(mockOperation.getDescriptor()).thenReturn(mockDescriptor);
    JiraExtPublisherStep publisher = new JiraExtPublisherStep(mockStrategy,
            Arrays.asList(mockOperation));
    List<JiraCommit> commits = Arrays.asList(new JiraCommit("JENKINS-101",
            MockChangeLogUtil.mockChangeLogSetEntry("example ticket")));

    when(mockStrategy.getJiraCommits(any(AbstractBuild.class), any(BuildListener.class)))
            .thenReturn(commits);

    assertTrue(publisher.perform(mock(AbstractBuild.class), mock(Launcher.class),
            new StreamBuildListener(System.out, Charset.defaultCharset())));
    verify(mockOperation).perform(eq(commits), any(AbstractBuild.class), any(Launcher.class), any(BuildListener.class));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:22,代码来源:JiraPublisherStepTest.java

示例5: testAddLabel

import hudson.model.StreamBuildListener; //导入依赖的package包/类
@Test
public void testAddLabel()
        throws Exception
{
    AddLabel addLabel = new AddLabel("Test Label");
    addLabel.setJiraClientSvc(jiraClientSvc);

    AbstractBuild mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars());
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));

    addLabel.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    verify(jiraClientSvc, times(1)).addLabelToTicket(eq("SSD-101"), eq("Test Label"));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:17,代码来源:AddLabelTest.java

示例6: testExpandValues

import hudson.model.StreamBuildListener; //导入依赖的package包/类
@Test
public void testExpandValues()
        throws Exception
{
    AddLabel addLabel = new AddLabel("Test Label $FOO");
    addLabel.setJiraClientSvc(jiraClientSvc);

    AbstractBuild mockBuild = mock(AbstractBuild.class);
    EnvVars envVars = new EnvVars();
    envVars.put("FOO", "BAR");
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(envVars);
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));

    addLabel.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    verify(jiraClientSvc, times(1)).addLabelToTicket(eq("SSD-101"), eq("Test Label BAR"));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:18,代码来源:AddLabelTest.java

示例7: testResiliency

import hudson.model.StreamBuildListener; //导入依赖的package包/类
/**
 * An exception adding the first label add should not disrupt the next label
 */
@Test
public void testResiliency()
    throws Exception
{
    AddLabel addLabel = new AddLabel("Test Label");
    addLabel.setJiraClientSvc(jiraClientSvc);

    AbstractBuild mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars());
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));
    jiraCommits.add(new JiraCommit("SSD-102", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));
    doThrow(new RuntimeException("Issue is invalid"))
            .when(jiraClientSvc).addLabelToTicket("SSD-101", "Test Label");
    addLabel.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    verify(jiraClientSvc, times(1)).addLabelToTicket(eq("SSD-101"), eq("Test Label"));
    verify(jiraClientSvc, times(1)).addLabelToTicket(eq("SSD-102"), eq("Test Label"));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:22,代码来源:AddLabelTest.java

示例8: testInvokeOperations

import hudson.model.StreamBuildListener; //导入依赖的package包/类
@Test
public void testInvokeOperations()
{
    IssueStrategyExtension mockStrategy = mock(IssueStrategyExtension.class);
    JiraOperationExtension mockOperation = mock(JiraOperationExtension.class);
    Descriptor mockDescriptor = mock(Descriptor.class);
    when(mockDescriptor.getDisplayName()).thenReturn("Mock descriptor");
    when(mockOperation.getDescriptor()).thenReturn(mockDescriptor);
    JiraExtBuildStep builder = new JiraExtBuildStep(mockStrategy,
            Arrays.asList(mockOperation));
    List<JiraCommit> commits = Arrays.asList(new JiraCommit("JENKINS-101",
                    MockChangeLogUtil.mockChangeLogSetEntry("example ticket")));

    when(mockStrategy.getJiraCommits(any(AbstractBuild.class), any(BuildListener.class)))
                .thenReturn(commits);

    assertTrue(builder.perform(mock(AbstractBuild.class), mock(Launcher.class), new StreamBuildListener(System.out)));
    verify(mockOperation).perform(eq(commits), any(AbstractBuild.class), any(Launcher.class), any(BuildListener.class));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:20,代码来源:JiraBuildStepPublisherTest.java

示例9: testFirstWordOfCommit

import hudson.model.StreamBuildListener; //导入依赖的package包/类
@Test
public void testFirstWordOfCommit()
        throws Exception
{
    FirstWordOfCommitStrategy strategy = new FirstWordOfCommitStrategy();

    ChangeLogSet mockChangeSet = MockChangeLogUtil.mockChangeLogSet(
            new MockChangeLogUtil.MockChangeLog("FOO-101 first", "dalvizu"),
            new MockChangeLogUtil.MockChangeLog("BAR-102 again", "jsmith"),
            new MockChangeLogUtil.MockChangeLog("No Valid Ticket", "build robot"));
    AbstractBuild mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getChangeSet()).thenReturn(mockChangeSet);
    List<JiraCommit> commits = strategy.getJiraCommits(mockBuild,
            new StreamBuildListener(System.out, Charset.defaultCharset()));
    assertEquals(commits.size(), 2);

    assertThat(commits, hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("FOO-101"))));
    assertThat(commits, hasItem(Matchers.<JiraCommit>hasProperty("jiraTicket", equalTo("BAR-102"))));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:20,代码来源:FirstWordOfCommitStrategyTest.java

示例10: testExpandValues

import hudson.model.StreamBuildListener; //导入依赖的package包/类
@Test
public void testExpandValues()
        throws Exception
{
    UpdateField updateField = new UpdateField("CustomField_123", "Completed $FOO");
    updateField.setJiraClientSvc(jiraClientSvc);
    AbstractBuild mockBuild = mock(AbstractBuild.class);
    EnvVars envVars = new EnvVars();
    envVars.put("FOO", "BAR");
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(envVars);
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));

    updateField.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    verify(jiraClientSvc, times(1)).updateStringField(eq("SSD-101"), eq("CustomField_123"), eq("Completed BAR"));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:17,代码来源:UpdateFieldTest.java

示例11: testResiliency

import hudson.model.StreamBuildListener; //导入依赖的package包/类
/**
 * An exception adding the first label add should not disrupt the next label
 */
@Test
public void testResiliency()
        throws Exception
{
    UpdateField updateField = new UpdateField("CustomField_123", "Completed");
    updateField.setJiraClientSvc(jiraClientSvc);

    AbstractBuild mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars());
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));
    jiraCommits.add(new JiraCommit("SSD-102", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));
    doThrow(new RuntimeException("Issue is invalid"))
            .when(jiraClientSvc).updateStringField(eq("SSD-101"), eq("CustomField_123"), eq("Completed"));
    updateField.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    verify(jiraClientSvc, times(1)).updateStringField(eq("SSD-101"), eq("CustomField_123"), eq("Completed"));
    verify(jiraClientSvc, times(1)).updateStringField(eq("SSD-102"), eq("CustomField_123"), eq("Completed"));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:22,代码来源:UpdateFieldTest.java

示例12: testResiliency

import hudson.model.StreamBuildListener; //导入依赖的package包/类
/**
 * An exception adding the first label add should not disrupt the next label
 */
@Test
public void testResiliency()
        throws Exception
{
    AddComment addComment = new AddComment(false, "Test Comment");
    addComment.setJiraClientSvc(jiraClientSvc);

    AbstractBuild mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars());
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));
    jiraCommits.add(new JiraCommit("SSD-102", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));
    doThrow(new RuntimeException("Issue is invalid"))
            .when(jiraClientSvc).addCommentToTicket("SSD-101", "Test Comment");
    addComment.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    verify(jiraClientSvc, times(1)).addCommentToTicket("SSD-101", "Test Comment");
    verify(jiraClientSvc, times(1)).addCommentToTicket("SSD-102", "Test Comment");
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:22,代码来源:AddCommentTest.java

示例13: testAddFixVersion

import hudson.model.StreamBuildListener; //导入依赖的package包/类
@Test
public void testAddFixVersion()
        throws Exception
{
    AddFixVersion addFixVersion = new AddFixVersion("Beta Release");
    addFixVersion.setJiraClientSvc(jiraClientSvc);
    AbstractBuild mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars());
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101"));
    jiraCommits.add(new JiraCommit("SSD-101"));

    addFixVersion.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    verify(jiraClientSvc, times(1)).addFixVersion(eq("SSD-101"), eq("Beta Release"));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:16,代码来源:AddFixVersionTest.java

示例14: testTransition

import hudson.model.StreamBuildListener; //导入依赖的package包/类
@Test
public void testTransition()
        throws Exception
{
    Transition transition = new Transition("Resolve");
    transition.setJiraClientSvc(jiraClientSvc);
    AbstractBuild mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars());
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));

    transition.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    verify(jiraClientSvc, times(1)).changeWorkflowOfTicket(eq("SSD-101"), eq("Resolve"));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:16,代码来源:TransitionTest.java

示例15: testUpdateField

import hudson.model.StreamBuildListener; //导入依赖的package包/类
@Test
public void testUpdateField()
        throws Exception
{
    UpdateField updateField = new UpdateField("CustomField_123", "Completed");
    updateField.setJiraClientSvc(jiraClientSvc);
    AbstractBuild mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getEnvironment(any(TaskListener.class))).thenReturn(new EnvVars());
    List<JiraCommit> jiraCommits = new ArrayList<>();
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));
    jiraCommits.add(new JiraCommit("SSD-101", MockChangeLogUtil.mockChangeLogSetEntry("Test Comment")));

    updateField.perform(jiraCommits, mockBuild, mock(Launcher.class), new StreamBuildListener(System.out, Charset.defaultCharset()));
    verify(jiraClientSvc, times(1)).updateStringField(eq("SSD-101"), eq("CustomField_123"), eq("Completed"));
}
 
开发者ID:jenkinsci,项目名称:jira-ext-plugin,代码行数:16,代码来源:UpdateFieldTest.java


注:本文中的hudson.model.StreamBuildListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。