本文整理匯總了Java中com.amazonaws.services.ec2.model.DescribeInstancesResult.setReservations方法的典型用法代碼示例。如果您正苦於以下問題:Java DescribeInstancesResult.setReservations方法的具體用法?Java DescribeInstancesResult.setReservations怎麽用?Java DescribeInstancesResult.setReservations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.amazonaws.services.ec2.model.DescribeInstancesResult
的用法示例。
在下文中一共展示了DescribeInstancesResult.setReservations方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testTagsAssociated
import com.amazonaws.services.ec2.model.DescribeInstancesResult; //導入方法依賴的package包/類
@Test
public void testTagsAssociated() {
MockAmazonEc2Client client = new MockAmazonEc2Client(null);
Collection<Instance> instances = Arrays.asList(new Instance());
DescribeInstancesResult describeInstancesResult = new DescribeInstancesResult();
Reservation reservation = new Reservation();
describeInstancesResult.setReservations(Arrays.asList(reservation));
reservation.setInstances(instances);
client.setDescribeInstances(describeInstancesResult);
Properties properties = new Properties();
properties.setProperty("tagAccounting","key,value");
properties.setProperty("function_tag","foo2");
properties.setProperty("product_tag","foo3");
AwsTagReporter reporter = new AwsTagReporter("testUuid",client,instances,properties);
reporter.run();
}
示例2: testExceptionCaught
import com.amazonaws.services.ec2.model.DescribeInstancesResult; //導入方法依賴的package包/類
@Test
public void testExceptionCaught() {
MockAmazonEc2Client client = new MockAmazonEc2Client(null);
Collection<Instance> instances = Arrays.asList(new Instance());
DescribeInstancesResult describeInstancesResult = new DescribeInstancesResult();
Reservation reservation = new Reservation();
describeInstancesResult.setReservations(Arrays.asList(reservation));
reservation.setInstances(instances);
client.setDescribeInstances(describeInstancesResult);
Properties properties = new Properties();
properties.setProperty("tagAccounting","key");
properties.setProperty("function_tag","foo2");
properties.setProperty("product_tag","foo3");
AwsTagReporter reporter = new AwsTagReporter("testUuid",client,instances,properties);
reporter.run();
}
示例3: testClientThrowsErrors
import com.amazonaws.services.ec2.model.DescribeInstancesResult; //導入方法依賴的package包/類
@Test
public void testClientThrowsErrors() {
MockAmazonEc2Client client = new MockAmazonEc2Client(null);
client.setDescribeInstancesToThrowError();
Collection<Instance> instances = Arrays.asList(new Instance());
DescribeInstancesResult describeInstancesResult = new DescribeInstancesResult();
Reservation reservation = new Reservation();
describeInstancesResult.setReservations(Arrays.asList(reservation));
reservation.setInstances(instances);
client.setDescribeInstances(describeInstancesResult);
Properties properties = new Properties();
properties.setProperty("accounting_tag","foo");
properties.setProperty("function_tag","foo2");
properties.setProperty("product_tag","foo3");
AwsTagReporter reporter = new AwsTagReporter("testUuid",client,instances,properties) {
@Override
void sleep() throws InterruptedException {
// do nothing
}
};
reporter.run();
}
示例4: testSleepThrowsErrors
import com.amazonaws.services.ec2.model.DescribeInstancesResult; //導入方法依賴的package包/類
@Test
public void testSleepThrowsErrors() {
MockAmazonEc2Client client = new MockAmazonEc2Client(null);
client.setDescribeInstancesToThrowError();
Collection<Instance> instances = Arrays.asList(new Instance());
DescribeInstancesResult describeInstancesResult = new DescribeInstancesResult();
Reservation reservation = new Reservation();
describeInstancesResult.setReservations(Arrays.asList(reservation));
reservation.setInstances(instances);
client.setDescribeInstances(describeInstancesResult);
Properties properties = new Properties();
properties.setProperty("accounting_tag","foo");
properties.setProperty("function_tag","foo2");
properties.setProperty("product_tag","foo3");
AwsTagReporter reporter = new AwsTagReporter("testUuid",client,instances,properties) {
@Override
void sleep() throws InterruptedException {
throw new InterruptedException();
}
};
reporter.run();
}
示例5: testThreadTimesOut
import com.amazonaws.services.ec2.model.DescribeInstancesResult; //導入方法依賴的package包/類
@Test()
public void testThreadTimesOut() {
MockAmazonEc2Client client = new MockAmazonEc2Client(null);
Collection<Instance> instances = Arrays.asList(new Instance());
DescribeInstancesResult describeInstancesResult = new DescribeInstancesResult();
Reservation reservation = new Reservation();
describeInstancesResult.setReservations(Arrays.asList(reservation));
// Make count mismatch
reservation.setInstances(Arrays.asList(new Instance(),new Instance()));
client.setDescribeInstances(describeInstancesResult);
Properties properties = new Properties();
properties.setProperty("accounting_tag","foo");
properties.setProperty("function_tag","foo2");
properties.setProperty("product_tag","foo3");
AwsTagReporter reporter = new AwsTagReporter("testUuid",client,instances,properties);
AwsTagReporter.TIMEOUT_IN_SECONDS = 1;
try{
reporter.run();
} catch(RuntimeException e) {
Assert.assertEquals("Error waiting for instances to exist to add tags",e.getMessage());
return;
}
Assert.fail("Exception should have been thrown since tags were never filed");
}