Predicate<VirtualMachine> virtualMachineRunning) {
String serviceOfferingId = DEFAULT_SIZE_ORDERING.min(client.getOfferingClient().listServiceOfferings()).getId();
System.out.printf("serviceOfferingId %s, templateId %s, zoneId %s, options %s%n", serviceOfferingId, templateId,
zoneId, options);
AsyncCreateResponse job = client.getVirtualMachineClient().deployVirtualMachineInZone(zoneId, serviceOfferingId,
templateId, options);
assertTrue(jobComplete.apply(job.getJobId()));
AsyncJob<VirtualMachine> jobWithResult = client.getAsyncJobClient().<VirtualMachine> getAsyncJob(job.getJobId());
if (jobWithResult.getError() != null)
Throwables.propagate(new ExecutionException(String.format("job %s failed with exception %s", job.getId(),
jobWithResult.getError().toString())) {
});
VirtualMachine vm = jobWithResult.getResult();
if (vm.isPasswordEnabled()) {
assert vm.getPassword() != null : vm;