本文整理汇总了Java中com.amazonaws.services.ec2.model.CreateTagsRequest.getTags方法的典型用法代码示例。如果您正苦于以下问题:Java CreateTagsRequest.getTags方法的具体用法?Java CreateTagsRequest.getTags怎么用?Java CreateTagsRequest.getTags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.ec2.model.CreateTagsRequest
的用法示例。
在下文中一共展示了CreateTagsRequest.getTags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreateInstance
import com.amazonaws.services.ec2.model.CreateTagsRequest; //导入方法依赖的package包/类
@Test
public void testCreateInstance() throws Exception {
ec2mock.createRunInstancesResult("instance1");
ec2mock.createDescribeImagesResult("image1");
ec2mock.createDescribeSubnetsResult("subnet-a77430d0");
ec2mock.createDescribeSecurityGroupResult("subnet-a77430d0",
"security_group1,security_group2");
ec2mock.createDescribeInstancesResult("instance1", "ok", "1.2.3.4");
Image image = ec2comm.resolveAMI("image1");
ec2comm.createInstance(image);
String result = ph.getAWSInstanceId();
assertEquals("instance1", result);
ArgumentCaptor<RunInstancesRequest> arg1 = ArgumentCaptor
.forClass(RunInstancesRequest.class);
verify(ec2).runInstances(arg1.capture());
RunInstancesRequest rir = arg1.getValue();
assertEquals("image1", rir.getImageId());
assertEquals("type1", rir.getInstanceType());
assertEquals("key_pair", rir.getKeyName());
assertEquals(1, rir.getMinCount().intValue());
assertEquals(1, rir.getMaxCount().intValue());
ArgumentCaptor<CreateTagsRequest> arg2 = ArgumentCaptor
.forClass(CreateTagsRequest.class);
verify(ec2).createTags(arg2.capture());
CreateTagsRequest ctr = arg2.getValue();
for (Tag t : ctr.getTags()) {
if (t.getKey().equalsIgnoreCase("Name")) {
assertEquals("name1", t.getValue());
} else if (t.getKey().equalsIgnoreCase("SubscriptionId")) {
assertEquals("subId", t.getValue());
} else if (t.getKey().equalsIgnoreCase("OrganizationId")) {
assertEquals("orgId", t.getValue());
}
}
parameters.put("USERDATA_URL", new Setting("USERDATA_URL", "userdata"));
}