Search in sources :

Example 1 with BlueTestSummary

use of io.jenkins.blueocean.rest.model.BlueTestSummary in project blueocean-plugin by jenkinsci.

the class AbstractRunImpl method getBlueTestSummary.

@Override
public BlueTestSummary getBlueTestSummary() {
    BlueTestSummary blueTestSummary;
    if (getStateObj() == BlueRunState.FINISHED && run != null) {
        blueTestSummary = TEST_SUMMARY.get(run.getExternalizableId(), s -> {
            // 
            LOGGER.debug(// 
            "load test summary {} thread {}", // 
            run.getExternalizableId(), Thread.currentThread().getName());
            BlueTestSummary summary = BlueTestResultFactory.resolve(run, parent).summary;
            return summary;
        });
    } else {
        blueTestSummary = BlueTestResultFactory.resolve(run, this).summary;
    }
    // .../runs/123/blueTestSummary
    if (blueTestSummary == null) {
        // Just use an empty one while we wait to avoid 404
        return new BlueTestSummary(0, 0, 0, 0, 0, 0, 0, this.getLink());
    }
    Link link = this.getLink().rel("blueTestSummary");
    blueTestSummary.setLink(link);
    return blueTestSummary;
}
Also used : Date(java.util.Date) QueryParameter(org.kohsuke.stapler.QueryParameter) LoggerFactory(org.slf4j.LoggerFactory) Cache(com.github.benmanes.caffeine.cache.Cache) Exported(org.kohsuke.stapler.export.Exported) BlueArtifactContainer(io.jenkins.blueocean.rest.model.BlueArtifactContainer) BooleanUtils(org.apache.commons.lang.BooleanUtils) Links(io.jenkins.blueocean.rest.hal.Links) BlueTestResultFactory(io.jenkins.blueocean.rest.factory.BlueTestResultFactory) Container(io.jenkins.blueocean.rest.model.Container) Action(hudson.model.Action) Caffeine(com.github.benmanes.caffeine.cache.Caffeine) Logger(org.slf4j.Logger) BluePipelineNodeContainer(io.jenkins.blueocean.rest.model.BluePipelineNodeContainer) BlueTestSummary(io.jenkins.blueocean.rest.model.BlueTestSummary) Collection(java.util.Collection) Reachable(io.jenkins.blueocean.rest.Reachable) BlueRun(io.jenkins.blueocean.rest.model.BlueRun) Collectors(java.util.stream.Collectors) ServiceException(io.jenkins.blueocean.commons.ServiceException) ZoneId(java.time.ZoneId) Run(hudson.model.Run) TimeUnit(java.util.concurrent.TimeUnit) BlueChangeSetEntry(io.jenkins.blueocean.rest.model.BlueChangeSetEntry) BlueTestResultContainer(io.jenkins.blueocean.rest.model.BlueTestResultContainer) DateTimeFormatter(java.time.format.DateTimeFormatter) Result(hudson.model.Result) BlueOrganization(io.jenkins.blueocean.rest.model.BlueOrganization) Optional(java.util.Optional) BlueActionProxy(io.jenkins.blueocean.rest.model.BlueActionProxy) BluePipelineStepContainer(io.jenkins.blueocean.rest.model.BluePipelineStepContainer) LinkResolver(io.jenkins.blueocean.rest.hal.LinkResolver) CauseAction(hudson.model.CauseAction) Link(io.jenkins.blueocean.rest.hal.Link) GenericResource(io.jenkins.blueocean.rest.model.GenericResource) BlueTestSummary(io.jenkins.blueocean.rest.model.BlueTestSummary) Link(io.jenkins.blueocean.rest.hal.Link)

Example 2 with BlueTestSummary

use of io.jenkins.blueocean.rest.model.BlueTestSummary in project blueocean-plugin by jenkinsci.

the class BlueTestResultFactory method resolve.

public static Result resolve(Run<?, ?> run, Reachable parent) {
    Iterable<BlueTestResult> results = new ArrayList<>(0);
    BlueTestSummary summary = new // 
    BlueTestSummary(// 
    0, // 
    0, // 
    0, // 
    0, // 
    0, // 
    0, // 
    0, parent == null ? null : parent.getLink());
    for (BlueTestResultFactory factory : allFactories()) {
        Result result = factory.getBlueTestResults(run, parent);
        if (result != null && result.results != null && result.summary != null) {
            results = IterableUtils.chainedIterable(result.results, results);
            summary = summary.tally(result.summary);
        }
    }
    return getResult(results, summary);
}
Also used : ArrayList(java.util.ArrayList) BlueTestResult(io.jenkins.blueocean.rest.model.BlueTestResult) BlueTestSummary(io.jenkins.blueocean.rest.model.BlueTestSummary) BlueTestResult(io.jenkins.blueocean.rest.model.BlueTestResult)

Aggregations

BlueTestSummary (io.jenkins.blueocean.rest.model.BlueTestSummary)2 Cache (com.github.benmanes.caffeine.cache.Cache)1 Caffeine (com.github.benmanes.caffeine.cache.Caffeine)1 Action (hudson.model.Action)1 CauseAction (hudson.model.CauseAction)1 Result (hudson.model.Result)1 Run (hudson.model.Run)1 ServiceException (io.jenkins.blueocean.commons.ServiceException)1 Reachable (io.jenkins.blueocean.rest.Reachable)1 BlueTestResultFactory (io.jenkins.blueocean.rest.factory.BlueTestResultFactory)1 Link (io.jenkins.blueocean.rest.hal.Link)1 LinkResolver (io.jenkins.blueocean.rest.hal.LinkResolver)1 Links (io.jenkins.blueocean.rest.hal.Links)1 BlueActionProxy (io.jenkins.blueocean.rest.model.BlueActionProxy)1 BlueArtifactContainer (io.jenkins.blueocean.rest.model.BlueArtifactContainer)1 BlueChangeSetEntry (io.jenkins.blueocean.rest.model.BlueChangeSetEntry)1 BlueOrganization (io.jenkins.blueocean.rest.model.BlueOrganization)1 BluePipelineNodeContainer (io.jenkins.blueocean.rest.model.BluePipelineNodeContainer)1 BluePipelineStepContainer (io.jenkins.blueocean.rest.model.BluePipelineStepContainer)1 BlueRun (io.jenkins.blueocean.rest.model.BlueRun)1