com.amazonaws.services.devicefarm.model.ScheduleRunConfiguration Java Examples
The following examples show how to use
com.amazonaws.services.devicefarm.model.ScheduleRunConfiguration.
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: TestConfigurationFactoryTest.java From justtestlah with Apache License 2.0 | 6 votes |
@Test public void testScheduleRunConfigurationTestFalse() { Properties props = new Properties(); props.put("aws.runUnmetered", "false"); props.put("aws.bluetooth", "false"); props.put("aws.gps", "false"); props.put("aws.nfc", "false"); props.put("aws.wifi", "false"); ReflectionTestUtils.setField(properties, "props", props); target = new TestConfigurationFactory(properties); ScheduleRunConfiguration scheduleRunConfiguration = target.getScheduleRunConfiguration(); BillingMethod billingMethod = Boolean.parseBoolean(props.getProperty("aws.runUnmetered")) ? BillingMethod.UNMETERED : BillingMethod.METERED; assertThat(scheduleRunConfiguration.getBillingMethod()).isEqualTo(billingMethod.toString()); assertThat(scheduleRunConfiguration.getRadios().getBluetooth()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.bluetooth"))); assertThat(scheduleRunConfiguration.getRadios().getGps()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.gps"))); assertThat(scheduleRunConfiguration.getRadios().getNfc()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.nfc"))); assertThat(scheduleRunConfiguration.getRadios().getWifi()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.wifi"))); }
Example #2
Source File: TestConfigurationFactoryTest.java From justtestlah with Apache License 2.0 | 6 votes |
@Test public void testScheduleRunConfigurationTestDefaults() { Properties props = new Properties(); ReflectionTestUtils.setField(properties, "props", props); target = new TestConfigurationFactory(properties); ScheduleRunConfiguration scheduleRunConfiguration = target.getScheduleRunConfiguration(); assertThat(scheduleRunConfiguration.getBillingMethod()) .isEqualTo(BillingMethod.UNMETERED.toString()); assertThat(scheduleRunConfiguration.getLocation().getLatitude()).isEqualTo(1.3521); assertThat(scheduleRunConfiguration.getLocation().getLongitude()).isEqualTo(103.8198); assertThat(scheduleRunConfiguration.getRadios().getBluetooth()).isEqualTo(false); assertThat(scheduleRunConfiguration.getRadios().getGps()).isEqualTo(true); assertThat(scheduleRunConfiguration.getRadios().getNfc()).isEqualTo(true); assertThat(scheduleRunConfiguration.getRadios().getWifi()).isEqualTo(true); assertThat(scheduleRunConfiguration.getExtraDataPackageArn()).isEqualTo(null); }
Example #3
Source File: AWSDeviceFarmRecorder.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 6 votes |
private ScheduleRunConfiguration getScheduleRunConfiguration(Boolean isRunUnmetered, Boolean deviceLocation, Boolean radioDetails) { ScheduleRunConfiguration configuration = new ScheduleRunConfiguration(); if (isRunUnmetered != null && isRunUnmetered) { configuration.setBillingMethod(BillingMethod.UNMETERED); } else { configuration.setBillingMethod(BillingMethod.METERED); } // set a bunch of other default values as Device Farm expect these configuration.setAuxiliaryApps(new ArrayList<String>()); configuration.setLocale("en_US"); Location location = getScheduleRunConfigurationLocation(deviceLocation); configuration.setLocation(location); Radios radio = getScheduleRunConfigurationRadio(radioDetails); configuration.setRadios(radio); return configuration; }
Example #4
Source File: TestConfigurationFactory.java From justtestlah with Apache License 2.0 | 5 votes |
public ScheduleRunConfiguration getScheduleRunConfiguration() { ScheduleRunConfiguration configuration = new ScheduleRunConfiguration(); if (Boolean.parseBoolean(properties.getProperty("aws.runUnmetered", "true"))) { configuration.setBillingMethod(BillingMethod.UNMETERED); } else { configuration.setBillingMethod(BillingMethod.METERED); } configuration.setAuxiliaryApps(new ArrayList<String>()); configuration.setLocale("en_US"); Location location = new Location(); location.setLatitude( Double.parseDouble(properties.getProperty("aws.deviceLatitude", "1.3521"))); location.setLongitude( Double.parseDouble(properties.getProperty("aws.deviceLongitude", "103.8198"))); configuration.setLocation(location); Radios radios = new Radios(); radios.setBluetooth(Boolean.parseBoolean(properties.getProperty("aws.bluetooth", "false"))); radios.setGps(Boolean.parseBoolean(properties.getProperty("aws.gps", "true"))); radios.setNfc(Boolean.parseBoolean(properties.getProperty("aws.nfc", "true"))); radios.setWifi(Boolean.parseBoolean(properties.getProperty("aws.wifi", "true"))); configuration.setRadios(radios); String extraDataArn = properties.getOptionalProperty("aws.extraDataArn"); if (extraDataArn != null && !extraDataArn.isEmpty()) { configuration.setExtraDataPackageArn(extraDataArn); } return configuration; }
Example #5
Source File: TestConfigurationFactoryTest.java From justtestlah with Apache License 2.0 | 5 votes |
@Test public void testScheduleRunConfigurationTestTrue() { Properties props = new Properties(); props.put("aws.runUnmetered", "true"); props.put("aws.deviceLatitude", "100.0"); props.put("aws.deviceLongitude", "50.0"); props.put("aws.bluetooth", "true"); props.put("aws.gps", "true"); props.put("aws.nfc", "true"); props.put("aws.wifi", "true"); props.put("aws.extraDataArn", "extraPackage"); ReflectionTestUtils.setField(properties, "props", props); target = new TestConfigurationFactory(properties); ScheduleRunConfiguration scheduleRunConfiguration = target.getScheduleRunConfiguration(); BillingMethod billingMethod = Boolean.parseBoolean(props.getProperty("aws.runUnmetered")) ? BillingMethod.UNMETERED : BillingMethod.METERED; assertThat(scheduleRunConfiguration.getBillingMethod()).isEqualTo(billingMethod.toString()); assertThat(scheduleRunConfiguration.getLocation().getLatitude()) .isEqualTo(Double.parseDouble(props.getProperty("aws.deviceLatitude"))); assertThat(scheduleRunConfiguration.getLocation().getLongitude()) .isEqualTo(Double.parseDouble(props.getProperty("aws.deviceLongitude"))); assertThat(scheduleRunConfiguration.getRadios().getBluetooth()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.bluetooth"))); assertThat(scheduleRunConfiguration.getRadios().getGps()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.gps"))); assertThat(scheduleRunConfiguration.getRadios().getNfc()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.nfc"))); assertThat(scheduleRunConfiguration.getRadios().getWifi()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.wifi"))); assertThat(scheduleRunConfiguration.getExtraDataPackageArn()) .isEqualTo(props.getProperty("aws.extraDataArn")); }
Example #6
Source File: TestConfigurationFactoryTest.java From justtestlah with Apache License 2.0 | 5 votes |
@Test public void testScheduleRunConfigurationTestRandom() { Properties props = new Properties(); props.put("aws.runUnmetered", Boolean.toString(RandomUtils.nextBoolean())); props.put("aws.deviceLatitude", Double.toString(RandomUtils.nextDouble(0, 180))); props.put("aws.deviceLongitude", Double.toString(RandomUtils.nextDouble(0, 180))); props.put("aws.bluetooth", Boolean.toString(RandomUtils.nextBoolean())); props.put("aws.gps", Boolean.toString(RandomUtils.nextBoolean())); props.put("aws.nfc", Boolean.toString(RandomUtils.nextBoolean())); props.put("aws.wifi", Boolean.toString(RandomUtils.nextBoolean())); props.put("aws.extraDataArn", RandomStringUtils.randomAlphanumeric(20)); ReflectionTestUtils.setField(properties, "props", props); target = new TestConfigurationFactory(properties); ScheduleRunConfiguration scheduleRunConfiguration = target.getScheduleRunConfiguration(); BillingMethod billingMethod = Boolean.parseBoolean(props.getProperty("aws.runUnmetered")) ? BillingMethod.UNMETERED : BillingMethod.METERED; assertThat(scheduleRunConfiguration.getBillingMethod()).isEqualTo(billingMethod.toString()); assertThat(scheduleRunConfiguration.getLocation().getLatitude()) .isEqualTo(Double.parseDouble(props.getProperty("aws.deviceLatitude"))); assertThat(scheduleRunConfiguration.getLocation().getLongitude()) .isEqualTo(Double.parseDouble(props.getProperty("aws.deviceLongitude"))); assertThat(scheduleRunConfiguration.getRadios().getBluetooth()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.bluetooth"))); assertThat(scheduleRunConfiguration.getRadios().getGps()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.gps"))); assertThat(scheduleRunConfiguration.getRadios().getNfc()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.nfc"))); assertThat(scheduleRunConfiguration.getRadios().getWifi()) .isEqualTo(Boolean.parseBoolean(props.getProperty("aws.wifi"))); assertThat(scheduleRunConfiguration.getExtraDataPackageArn()) .isEqualTo(props.getProperty("aws.extraDataArn")); }
Example #7
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 #8
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()))); }