public abstract class EC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
@Test
public void testTemplateBuilderCanUseImageIdWithoutFetchingAllImages() throws Exception {
Template defaultTemplate = view.getComputeService().templateBuilder().build();
String defaultImageId = defaultTemplate.getImage().getId();
String defaultImageProviderId = defaultTemplate.getImage().getProviderId();
ComputeServiceContext context = null;
try {
// Track http commands
final List<HttpCommand> commandsInvoked = Lists.newArrayList();
context = createView(
setupProperties(),
ImmutableSet.<Module> of(new Log4JLoggingModule(),
TrackingJavaUrlHttpCommandExecutorService.newTrackingModule(commandsInvoked)));
Template template = context.getComputeService().templateBuilder().imageId(defaultImageId)
.build();
assertEquals(template.getImage(), defaultTemplate.getImage());
Collection<HttpCommand> filteredCommandsInvoked = Collections2.filter(commandsInvoked, new Predicate<HttpCommand>() {
private final Collection<Method> ignored = ImmutableSet.of(
AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeRegions", DescribeRegionsOptions[].class),
AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeAvailabilityZonesInRegion", String.class, DescribeAvailabilityZonesOptions[].class));