AWSRunInstancesOptions extends RunInstancesOptions { @Override public AWSRunInstancesOptions withUserData(byte[] unencodedData) { launchSpecificationBuilder.userData(unencodedData); return AWSRunInstancesOptions.class.cast(super.withUserData(unencodedData)); }  AWSRunInstancesOptions inPlacementGroup(String placementGroup); AWSRunInstancesOptions enableMonitoring(); AWSRunInstancesOptions withSubnetId(String subnetId); AWSRunInstancesOptions withSecurityGroupId(String securityGroup); AWSRunInstancesOptions withSecurityGroupIds(Iterable<String> securityGroupIds); AWSRunInstancesOptions withSecurityGroupIds(String... securityGroupIds); @SinceApiVersion("2012-06-01") AWSRunInstancesOptions withIAMInstanceProfileArn(String arn); @SinceApiVersion("2012-06-01") AWSRunInstancesOptions withIAMInstanceProfileName(String name); @Override AWSRunInstancesOptions withBlockDeviceMappings(Set<? extends BlockDeviceMapping> mappings); @Override AWSRunInstancesOptions withKernelId(String kernelId); @Override AWSRunInstancesOptions withKeyName(String keyName); @Override AWSRunInstancesOptions withRamdisk(String ramDiskId); @Override AWSRunInstancesOptions withSecurityGroup(String securityGroup); @Override AWSRunInstancesOptions withSecurityGroups(Iterable<String> securityGroups); @Override AWSRunInstancesOptions withSecurityGroups(String... securityGroups); @Override AWSRunInstancesOptions withUserData(byte[] unencodedData); @Override AWSRunInstancesOptions asType(String type); synchronized LaunchSpecification.Builder getLaunchSpecificationBuilder(); static final AWSRunInstancesOptions NONE; }
@Test public void testWithUserData() { AWSRunInstancesOptions options = new AWSRunInstancesOptions(); options.withUserData("test".getBytes()); assertEquals(options.buildFormParameters().get("UserData"), ImmutableList.of("dGVzdA==")); }
@Test public void testWithUserDataStatic() { AWSRunInstancesOptions options = withUserData("test".getBytes()); assertEquals(options.buildFormParameters().get("UserData"), ImmutableList.of("dGVzdA==")); }
@Test(expectedExceptions = NullPointerException.class) public void testWithUserDataNPE() { withUserData(null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testWithUserDataEmpty() { withUserData("".getBytes()); }