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


Java RunList类代码示例

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


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

示例1: createJobMetricsDTO

import hudson.util.RunList; //导入依赖的package包/类
public static JobMetricDTO createJobMetricsDTO(Job job) {
    if (job != null) {
        JobMetricDTO answer = new JobMetricDTO(job.getDisplayName(), job.getUrl(), job.getEstimatedDuration(), job.isBuilding());
        RunList<Run> builds = job.getBuilds();
        if (builds != null) {
            for (Run build : builds) {
                if (Runs.includeBuildInMetrics(build)) {
                    BuildMetricsDTO buildDto =  BuildMetricsDTO.createBuildMetricsDTO(build);
                    if (buildDto != null) {
                        answer.addBuild(buildDto);
                    }
                }
            }
        }
        return answer;
    }
    return null;
}
 
开发者ID:fabric8io,项目名称:fabric8-jenkins-workflow-steps,代码行数:19,代码来源:JobMetricDTO.java

示例2: testBuilds

import hudson.util.RunList; //导入依赖的package包/类
@Test
@LocalData
public void testBuilds() {
    FreeStyleProject job = j.jenkins.getItemByFullName("JenkinsSlaveTrigger", FreeStyleProject.class);
    assertNotNull("The job should be loaded", job);

    RunList<FreeStyleBuild> builds = job.getBuilds();
    FreeStyleBuild two = builds.getLastBuild();
    assertNotNull(two);
    FreeStyleBuild one = two.getPreviousBuild();
    assertNotNull(one);

    assertSame("First build should be failure", Result.FAILURE, one.getResult());
    assertSame("Second build should be success", Result.SUCCESS, two.getResult());

    DockerHubWebHookCause cause = two.getCause(DockerHubWebHookCause.class);
    assertNotNull("The cause should be loaded", cause);
    PushNotification notification = cause.getPushNotification();
    assertNotNull("The cause should have a notification", notification);
    assertEquals("csanchez/jenkins-swarm-slave", notification.getRepoName());
    assertEquals("registry.hub.example.com", notification.getRegistryHost());
}
 
开发者ID:jenkinsci,项目名称:dockerhub-notification-plugin,代码行数:23,代码来源:BackCompat102Test.java

示例3: getAllPrBuilds

import hudson.util.RunList; //导入依赖的package包/类
/**
 * Searches for all builds performed in the runs of current job.
 *
 * @return map with keys - numbers of built PRs and values - lists of related builds.
 */
@Nonnull
public Map<Integer, List<Run<?, ?>>> getAllPrBuilds() {

    Map<Integer, List<Run<?, ?>>> map = new HashMap<>();
    final RunList<?> runs = job.getBuilds();
    LOG.debug("Got builds for job {}", job.getFullName());

    for (Run<?, ?> run : runs) {
        GitHubPRCause cause = ghPRCauseFromRun(run);
        if (cause != null) {
            int number = cause.getNumber();
            List<Run<?, ?>> buildsByNumber = map.get(number);
            if (isNull(buildsByNumber)) {
                buildsByNumber = new ArrayList<>();
                map.put(number, buildsByNumber);
            }
            buildsByNumber.add(run);
        }
    }

    return map;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:28,代码来源:GitHubPRRepository.java

示例4: getAllBranchBuilds

import hudson.util.RunList; //导入依赖的package包/类
/**
 * Searches for all builds performed in the runs of current job.
 *
 * @return map with key - string branch names; value - lists of related builds.
 */
public Map<String, List<Run<?, ?>>> getAllBranchBuilds() {

    Map<String, List<Run<?, ?>>> map = new HashMap<>();
    final RunList<?> runs = job.getBuilds();
    LOG.debug("Got builds for job {}", job.getFullName());

    for (Run<?, ?> run : runs) {
        GitHubBranchCause cause = ghBranchCauseFromRun(run);
        if (cause != null) {
            String branchName = cause.getBranchName();
            List<Run<?, ?>> buildsByBranchName = map.get(branchName);
            if (isNull(buildsByBranchName)) {
                buildsByBranchName = new ArrayList<>();
                map.put(branchName, buildsByBranchName);
            }
            buildsByBranchName.add(run);
        }
    }

    return map;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:27,代码来源:GitHubBranchRepository.java

示例5: createProject

import hudson.util.RunList; //导入依赖的package包/类
private AbstractProject<?,?> createProject(String... shas) {
  AbstractBuild build = mock(AbstractBuild.class);
  List<BuildData> buildDatas = new ArrayList<BuildData>();
  for(String sha : shas) {
    BuildData buildData = createBuildData(sha);
    buildDatas.add(buildData);
  }

  when(build.getAction(BuildData.class)).thenReturn(buildDatas.get(0));
  when(build.getActions(BuildData.class)).thenReturn(buildDatas);

  AbstractProject<?, ?> project = mock(AbstractProject.class);
  when(build.getProject()).thenReturn(project);

  RunList list = mock(RunList.class);
  when(list.iterator()).thenReturn(Arrays.asList(build).iterator());
  when(project.getBuilds()).thenReturn(list);

  return project;
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:21,代码来源:BuildUtilTest.java

示例6: build

import hudson.util.RunList; //导入依赖的package包/类
public static JobResults build(final Job job) {
    JobResults jobResults = new JobResults();

    final RunList<?> jobs = job.getBuilds();
    int jobCount = 0;
    for (Run<?,?> jobRun : jobs) {
        if (jobCount > 9) break;
        if (jobRun.isBuilding()) continue;
        TestResultAction testResults = jobRun.getAction(TestResultAction.class);
        if (testResults == null) continue;
        jobCount++;
        final Collection<PackageResult> packageResults = testResults.getResult().getChildren();
        for (PackageResult packageResult : packageResults) {
            final Collection<ClassResult> classResults = packageResult.getChildren();
            for (ClassResult classResult : classResults) {
                    jobResults.addResult(jobRun, classResult);
            }
        }
    }
    return jobResults;
}
 
开发者ID:daveneedstoknow,项目名称:RadTest,代码行数:22,代码来源:JobResultsBuilder.java

示例7: twoFeatureBranchesBothValid_2BuildsAreTriggeredBothBranchesGetIntegratedBuildMarkedAsSUCCESS

import hudson.util.RunList; //导入依赖的package包/类
@Test
public void twoFeatureBranchesBothValid_2BuildsAreTriggeredBothBranchesGetIntegratedBuildMarkedAsSUCCESS() throws Exception {
    Repository repository = TestUtilsFactory.createValidRepositoryWith2FeatureBranches("test-repo");
    repositories.add(repository);
    final int COMMIT_COUNT_BEFORE_EXECUTION = TestUtilsFactory.countCommits(repository);

    FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, STRATEGY_TYPE.SQUASH, repository);
    TestUtilsFactory.triggerProject(project);

    jenkinsRule.waitUntilNoActivityUpTo(60000);

    RunList<FreeStyleBuild> builds = project.getBuilds();

    assertEquals(2, project.getNextBuildNumber() - 1);

    for (FreeStyleBuild build : builds) {
        Result result = build.getResult();
        assertTrue(result.isBetterOrEqualTo(Result.SUCCESS));
    }

    final int COMMIT_COUNT_AFTER_EXECUTION = TestUtilsFactory.countCommits(repository);

    TestCase.assertEquals("Commit count missmatch.", COMMIT_COUNT_AFTER_EXECUTION, COMMIT_COUNT_BEFORE_EXECUTION + 2);
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:25,代码来源:SquashCommitStrategyIT.java

示例8: getJobStats

import hudson.util.RunList; //导入依赖的package包/类
/**
 * Return information about the latest builds run on each environment/workflow combination
 * Called from jelly view
 */
public List<Stat> getJobStats() {
    RunList<B> builds = getBuilds();
    List<Stat> stats = StatsHelper.getLastStats(builds);
    Collections.sort(stats, new Comparator<Stat>() {
        @Override
        public int compare(Stat o1, Stat o2) {
            int result = o1.env.compareTo(o2.env);
            if (result == 0) {
                result = o2.timestamp.compareTo(o1.timestamp);
            }
            return result;
        }
    });
    return stats;
}
 
开发者ID:epicforce,项目名称:leroy_jenkins,代码行数:20,代码来源:NewProject.java

示例9: getAllStats

import hudson.util.RunList; //导入依赖的package包/类
public static List<Stat> getAllStats(RunList builds) {
    Iterator it = builds.iterator();
    List<Stat> stats = new ArrayList<Stat>();
    while (it.hasNext()) {
        AbstractBuild b = (AbstractBuild) it.next();
        if (!b.isBuilding() && !b.hasntStartedYet() && b.getResult().isCompleteBuild()) {
            Stat stat = new Stat();
            stat.buildNumber = String.valueOf(b.getNumber());
            stat.artifactsLink = stat.buildNumber + "/artifact/";
            stat.deployer = getDeployer(b);
            stat.env = getEnv(b);
            stat.workflow = getWorkflow(b);
            stat.timestampString = b.getTimestampString2();
            stat.timestamp = b.getTimestamp();
            stat.resultIcon = getStatusImage(b);
            stat.console = stat.buildNumber + "/console";
            if (!StringUtils.isEmpty(stat.env) && !StringUtils.isEmpty(stat.workflow)) {
                stats.add(stat);
            }
        }
    }
    return stats;
}
 
开发者ID:epicforce,项目名称:leroy_jenkins,代码行数:24,代码来源:NewProject.java

示例10: getLastStats

import hudson.util.RunList; //导入依赖的package包/类
/**
 * This method selects the latest build for each env/workflow combination,
 * and return the list of statistics for these builds.
 * @param builds
 * @return
 */
public static List<Stat> getLastStats(RunList builds) {
    List<Stat> allStats = getAllStats(builds);
    Map<String, Stat> latestStatMap = new HashMap<String, Stat>();
    for (Stat s : allStats) {
        String key = s.env + "%delim%" + s.workflow;
        Stat latest = latestStatMap.get(key);
        if (latest == null) {
            latestStatMap.put(key, s);
        } else {
            if (latest.timestamp.before(s.timestamp)) {
                latestStatMap.put(key, s);
            }
        }
    }
    return new ArrayList<Stat>(latestStatMap.values());
}
 
开发者ID:epicforce,项目名称:leroy_jenkins,代码行数:23,代码来源:NewProject.java

示例11: getFirstUpstreamBuild

import hudson.util.RunList; //导入依赖的package包/类
@CheckForNull
private AbstractBuild getFirstUpstreamBuild(AbstractProject<?, ?> project, AbstractProject<?, ?> first,
                                            Result minResult) {
    RunList<? extends AbstractBuild> builds = project.getBuilds();
    for (AbstractBuild build : builds) {
        if (minResult != null && (build.isBuilding() || build.getResult().isWorseThan(minResult))) {
            continue;
        }

        AbstractBuild upstream = BuildUtil.getFirstUpstreamBuild(build, first);
        if (upstream != null && upstream.getProject().equals(first)) {
            return upstream;
        }
    }
    return null;
}
 
开发者ID:Diabol,项目名称:delivery-pipeline-plugin,代码行数:17,代码来源:Stage.java

示例12: triggerManual

import hudson.util.RunList; //导入依赖的package包/类
@Override
public void triggerManual(String projectName, String upstreamName, String buildId)
        throws TriggerException, AuthenticationException {
    LOG.fine("Manual/Input step called for project: " + projectName + " and build id: " + buildId);

    WorkflowJob workflowJob;
    try {
        workflowJob = ProjectUtil.getWorkflowJob(projectName, getOwnerItemGroup());
        RunList<WorkflowRun> builds = workflowJob.getBuilds();
        for (WorkflowRun run : builds) {
            if (Integer.toString(run.getNumber()).equals(buildId)) {
                InputAction inputAction = run.getAction(InputAction.class);
                if (inputAction != null && !inputAction.getExecutions().isEmpty()) {
                    inputAction.getExecutions().get(0).doProceedEmpty();
                }
            }
        }
        throw new PipelineException("Failed to resolve manual/input step for build with id: "
                + buildId + " for project: " + projectName);
    } catch (IOException | PipelineException e) {
        LOG.warning("Failed to resolve project to trigger manual/input step for: " + e);
    }
}
 
开发者ID:Diabol,项目名称:delivery-pipeline-plugin,代码行数:24,代码来源:WorkflowPipelineView.java

示例13: preCheckout

import hudson.util.RunList; //导入依赖的package包/类
/**
 * Abort running builds when new build referencing same revision is scheduled to run
 */
@Override
public void preCheckout(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException,
        InterruptedException {
    String abortOnRevisionId = getAbortOnRevisionId(build);
    // If ABORT_ON_REVISION_ID is available
    if (!CommonUtils.isBlank(abortOnRevisionId)) {
        // Create a cause of interruption
        PhabricatorCauseOfInterruption causeOfInterruption =
                new PhabricatorCauseOfInterruption(build.getUrl());
        Run upstreamRun = getUpstreamRun(build);

        // Get the running builds that were scheduled before the current one
        RunList<AbstractBuild> runningBuilds = (RunList<AbstractBuild>) build.getProject().getBuilds();
        for (AbstractBuild runningBuild : runningBuilds) {
            Executor executor = runningBuild.getExecutor();
            Run runningBuildUpstreamRun = getUpstreamRun(runningBuild);

            // Ignore builds that were triggered by the same upstream build
            // Find builds triggered with the same ABORT_ON_REVISION_ID_FIELD
            if (runningBuild.isBuilding()
                    && runningBuild.number < build.number
                    && abortOnRevisionId.equals(getAbortOnRevisionId(runningBuild))
                    && (upstreamRun == null
                    || runningBuildUpstreamRun == null
                    || !upstreamRun.equals(runningBuildUpstreamRun))
                    && executor != null) {
                // Abort the builds
                executor.interrupt(Result.ABORTED, causeOfInterruption);
            }
        }
    }
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:36,代码来源:PhabricatorBuildWrapper.java

示例14: getBuildsByEnvironment

import hudson.util.RunList; //导入依赖的package包/类
@JavaScriptMethod
public List<Stat> getBuildsByEnvironment(String env) {
    RunList<B> builds = getBuilds();
    if (env == null) {
        env = "null";
    }
    List<Stat> stats = StatsHelper.getBuildsByEnvironment(builds, env);
    Collections.sort(stats, new Comparator<Stat>() {
        @Override
        public int compare(Stat o1, Stat o2) {
            return o2.timestamp.compareTo(o1.timestamp);
        }
    });
    return stats;
}
 
开发者ID:epicforce,项目名称:leroy_jenkins,代码行数:16,代码来源:NewProject.java

示例15: getBuildsByWorkflow

import hudson.util.RunList; //导入依赖的package包/类
@JavaScriptMethod
public List<Stat> getBuildsByWorkflow(String workflow) {
    RunList<B> builds = getBuilds();
    if (workflow == null) {
        workflow = "null";
    }
    List<Stat> stats = StatsHelper.getBuildByWorkflow(builds, workflow);
    Collections.sort(stats, new Comparator<Stat>() {
        @Override
        public int compare(Stat o1, Stat o2) {
            return o2.timestamp.compareTo(o1.timestamp);
        }
    });
    return stats;
}
 
开发者ID:epicforce,项目名称:leroy_jenkins,代码行数:16,代码来源:NewProject.java


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