类hudson.model.Queue.Executable源码实例Demo

下面列出了怎么用hudson.model.Queue.Executable的API类实例代码及写法,或者点击链接到github查看源代码。

@Test
public void testAtomNode() throws IOException {
    ErrorAction error = mock(ErrorAction.class);
    CpsFlowExecution execution = mock(CpsFlowExecution.class);

    StepAtomNode stageNode = new StepAtomNode(execution, null, mock(FlowNode.class));
    stageNode.addAction(error);

    FlowExecutionOwner owner = mock(FlowExecutionOwner.class);
    when(execution.getOwner()).thenReturn(owner);

    Executable exec = mock(Executable.class);
    when(owner.getExecutable()).thenReturn(exec);

    AbstractBuild build = mock(AbstractBuild.class);
    when(owner.getExecutable()).thenReturn(build);
    when(build.getAction(ExecutionModelAction.class)).thenReturn(null); // not declarative

    BuildStatusAction buildStatusAction = mock(BuildStatusAction.class);
    when(build.getAction(BuildStatusAction.class)).thenReturn(buildStatusAction);

    GithubBuildStatusGraphListener instance = new GithubBuildStatusGraphListener();
    instance.onNewHead(stageNode);
    verify(buildStatusAction).sendNonStageError(any());
}
 
源代码2 项目: jenkins-test-harness   文件: HudsonTestCase.java
/**
 * Waits until Jenkins finishes building everything, including those builds in the queue, or fail the test
 * if the specified timeout milliseconds is exceeded.
 */
protected void waitUntilNoActivityUpTo(int timeout) throws Exception {
    long startTime = System.currentTimeMillis();
    int streak = 0;

    while (true) {
        Thread.sleep(100);
        if (isSomethingHappening())
            streak=0;
        else
            streak++;

        if (streak>2)   // the system is quiet for a while
            return;

        if (System.currentTimeMillis()-startTime > timeout) {
            List<Executable> building = new ArrayList<Executable>();
            for (Computer c : jenkins.getComputers()) {
                for (Executor e : c.getExecutors()) {
                    if (e.isBusy())
                        building.add(e.getCurrentExecutable());
                }
            }
            throw new AssertionError(String.format("Jenkins is still doing something after %dms: queue=%s building=%s",
                    timeout, Arrays.asList(jenkins.getQueue().getItems()), building));
        }
    }
}
 
源代码3 项目: DotCi   文件: DbBackedBuild.java
private boolean isCurrent(final Executor executor) {
    final Executable currentExecutable = executor.getCurrentExecutable();
    return currentExecutable != null && currentExecutable instanceof DbBackedBuild && this.equals(currentExecutable);
}
 
 类所在包
 类方法
 同包方法