com.amazonaws.services.devicefarm.model.ScheduleRunResult Java Examples
The following examples show how to use
com.amazonaws.services.devicefarm.model.ScheduleRunResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AWSDeviceFarmRecorder.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 6 votes |
private Map<String, FilePath> getSuites(AWSDeviceFarm adf, ScheduleRunResult run, Map<String, FilePath> jobs) throws IOException, InterruptedException { Map<String, FilePath> suites = new HashMap<String, FilePath>(); String runArn = run.getRun().getArn(); String components[] = runArn.split(":"); // constructing job ARN for each job using the run ARN components[5] = "job"; for (Map.Entry<String, FilePath> jobEntry : jobs.entrySet()) { String jobArn = jobEntry.getKey(); components[6] = jobArn; String fullJobArn = StringUtils.join(components, ":"); ListSuitesResult result = adf.listSuites(fullJobArn); for (Suite suite : result.getSuites()) { String arn = suite.getArn().split(":")[6]; suites.put(arn, new FilePath(jobs.get(jobArn), suite.getName())); suites.get(arn).mkdirs(); } } return suites; }
Example #2
Source File: AWSDeviceFarmRecorder.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 6 votes |
private Map<String, FilePath> getTests(AWSDeviceFarm adf, ScheduleRunResult run, Map<String, FilePath> suites) throws IOException, InterruptedException { Map<String, FilePath> tests = new HashMap<String, FilePath>(); String runArn = run.getRun().getArn(); String components[] = runArn.split(":"); // constructing suite ARN for each job using the run ARN components[5] = "suite"; for (Map.Entry<String, FilePath> suiteEntry : suites.entrySet()) { String suiteArn = suiteEntry.getKey(); components[6] = suiteArn; String fullsuiteArn = StringUtils.join(components, ":"); ListTestsResult result = adf.listTests(fullsuiteArn); for (Test test : result.getTests()) { String arn = test.getArn().split(":")[6]; tests.put(arn, new FilePath(suites.get(suiteArn), test.getName())); tests.get(arn).mkdirs(); } } return tests; }
Example #3
Source File: AWSDeviceFarmRecorder.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 6 votes |
private Map<String, FilePath> getJobs(AWSDeviceFarm adf, ScheduleRunResult run, FilePath resultsDir) throws IOException, InterruptedException { Map<String, FilePath> jobs = new HashMap<String, FilePath>(); ListJobsResult result = adf.listJobs(run.getRun().getArn()); for (Job job : result.getJobs()) { String arn = job.getArn().split(":")[6]; String jobId = arn.substring(arn.lastIndexOf("/") + 1); // Two jobs can have same name. Appending Os version information to job name String osVersion = null; if (job.getDevice() != null) { osVersion = job.getDevice().getOs(); } jobs.put(arn, new FilePath(resultsDir, job.getName() + "-" + (osVersion != null ? osVersion : jobId))); jobs.get(arn).mkdirs(); } return jobs; }
Example #4
Source File: AWSDeviceFarmTestResultAction.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 6 votes |
/** * 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 */ public void waitForRunCompletion(AWSDeviceFarm adf, ScheduleRunResult runResult, TaskListener listener) throws InterruptedException { PrintStream log = listener.getLogger(); while (true) { GetRunResult latestRunResult = adf.describeRun(runResult.getRun().getArn()); Run run = latestRunResult.getRun(); result = new AWSDeviceFarmTestResult(owner, run); writeToLog(log, String.format("Run %s status %s", run.getName(), run.getStatus())); if (result.isCompleted()) { break; } try { Thread.sleep(DefaultUpdateInterval); } catch (InterruptedException ex) { writeToLog(log, String.format("Thread interrupted while waiting for the Run to complete")); throw ex; } } }
Example #5
Source File: AWSDeviceFarm.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 5 votes |
/** * Schedule a test run on Device Farm. * * @param projectArn The ARN of the Device Farm project to run the test on. * @param name The name of the test run. * @param appArn The ARN of the app to test. * @param devicePoolArn The ARN of the device pool to test against. * @param test The run test. * @param configuration The run configuration. * @return The result of the schedle run. */ public ScheduleRunResult scheduleRun(String projectArn, String name, String appArn, String devicePoolArn, ScheduleRunTest test, Integer jobTimeoutMinutes, ScheduleRunConfiguration configuration, Boolean videoCapture, Boolean skipAppResign) { ScheduleRunRequest request = new ScheduleRunRequest() .withProjectArn(projectArn) .withName(name) .withDevicePoolArn(devicePoolArn) .withTest(test); ExecutionConfiguration exeConfiguration = new ExecutionConfiguration(); if (!jobTimeoutMinutes.equals(DEFAULT_JOB_TIMEOUT_MINUTE)) { exeConfiguration.setJobTimeoutMinutes(jobTimeoutMinutes); } exeConfiguration.setVideoCapture(videoCapture); exeConfiguration.setSkipAppResign(skipAppResign); request.withExecutionConfiguration(exeConfiguration); if (configuration != null) { request.withConfiguration(configuration); } if (appArn != null) { request.withAppArn(appArn); } return api.scheduleRun(request); }
Example #6
Source File: DeviceFarmServer.java From aws-device-farm-gradle-plugin with Apache License 2.0 | 4 votes |
/** * Upload and test the newly built apk. * * @param variantName variant of the latest build. Ex: 'debug' * @param testPackage File object to the newly built APK which contains tests * @param testedApk File object to the newly built application APK */ @Override public void uploadApks(final String variantName, final File testPackage, final File testedApk) { final Project project = utils.findProjectByName(extension.getProjectName()); logger.lifecycle(String.format("Using Project \"%s\", \"%s\"", project.getName(), project.getArn())); final DevicePool devicePool = utils.findDevicePoolByName(project, extension.getDevicePool()); logger.lifecycle(String.format("Using Device Pool \"%s\", \"%s\"", devicePool.getName(), devicePool.getArn())); final String appArn = uploader.upload(testedApk == null ? testPackage : testedApk, project, UploadType.ANDROID_APP).getArn(); logger.lifecycle(String.format("Will test app in \"%s\", \"%s\"", testedApk == null ? testPackage.getName() : testedApk.getName(), appArn)); final Collection<Upload> auxApps = uploadAuxApps(project); final String extraDataArn = uploadExtraDataZip(project); // For few frameworks , you can specify a testSpec final Upload testSpec = utils.findTestSpecByName(extension.getTest().getTestSpecName(), project); if (testSpec != null) { logger.lifecycle(String.format("Using TestSpec \"%s\", \"%s\"", testSpec.getName(), testSpec.getArn())); } final ScheduleRunTest runTest = new ScheduleRunTest() .withParameters(extension.getTest().getTestParameters()) .withType(extension.getTest().getTestType()) .withFilter(extension.getTest().getFilter()) .withTestPackageArn(uploadTestPackageIfNeeded(project, testPackage)) .withTestSpecArn(testSpec == null ? null: testSpec.getArn()); runTest.addParametersEntry(RUNPARAM_APP_PERF_MONITORING, Boolean.toString(extension.getPerformanceMonitoring())); final ExecutionConfiguration executionConfiguration = new ExecutionConfiguration() .withJobTimeoutMinutes(extension.getExecutionTimeoutMinutes()) .withVideoCapture(extension.getVideoRecording()); final ScheduleRunConfiguration configuration = new ScheduleRunConfiguration() .withAuxiliaryApps(getAuxAppArns(auxApps)) .withExtraDataPackageArn(extraDataArn) .withLocale(extension.getDeviceState().getLocale().toString()) .withLocation(extension.getDeviceState().getLocation()) .withBillingMethod(extension.isMetered() ? BillingMethod.METERED : BillingMethod.UNMETERED) .withRadios(extension.getDeviceState().getRadios()); final ScheduleRunRequest request = new ScheduleRunRequest() .withAppArn(appArn) .withConfiguration(configuration) .withDevicePoolArn(devicePool.getArn()) .withProjectArn(project.getArn()) .withTest(runTest) .withExecutionConfiguration(executionConfiguration) .withName(String.format("%s (Gradle)", testedApk == null ? testPackage.getName() : testedApk.getName())); final ScheduleRunResult response = api.scheduleRun(request); logger.lifecycle(String.format("View the %s run in the AWS Device Farm Console: %s", runTest.getType(), utils.getRunUrlFromArn(response.getRun().getArn()))); }
Example #7
Source File: AWSDeviceFarmTestResultAction.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 4 votes |
public void waitForRunCompletion(AWSDeviceFarm adf, ScheduleRunResult runResult) throws InterruptedException { waitForRunCompletion(adf, runResult, TaskListener.NULL); }