Example usage for com.amazonaws.services.devicefarm.model GetRunResult getRun

List of usage examples for com.amazonaws.services.devicefarm.model GetRunResult getRun

Introduction

In this page you can find the example usage for com.amazonaws.services.devicefarm.model GetRunResult getRun.

Prototype


public Run getRun() 

Source Link

Document

The run you wish to get results from.

Usage

From source file:org.jenkinsci.plugins.awsdevicefarm.AWSDeviceFarmTestResultAction.java

License:Open Source License

/**
 * Blocking function which periodically polls the given AWS Device Farm run until its completed. During this waiting period,
 * we will grab the latest results reported by Device Farm and updated our internal result "snapshot" which will be used
 * to populate/inform the UI of test results/progress.
 *
 * @param runResult//from ww w  .  j ava  2 s. c  o m
 */
public void waitForRunCompletion(AWSDeviceFarm adf, ScheduleRunResult runResult) throws InterruptedException {
    while (true) {
        GetRunResult latestRunResult = adf.describeRun(runResult.getRun().getArn());
        Run run = latestRunResult.getRun();
        result = new AWSDeviceFarmTestResult(owner, run);
        writeToLog(String.format("Run %s status %s", run.getName(), run.getStatus()));
        if (result.isCompleted()) {
            break;
        }
        try {
            Thread.sleep(DefaultUpdateInterval);
        } catch (InterruptedException ex) {
            writeToLog(String.format("Thread interrupted while waiting for the Run to complete"));
            throw ex;
        }
    }
}