jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zack Shoylev <notificati...@github.com>
Subject Re: [jclouds-labs-openstack] Adds service predicates and more tests (#186)
Date Fri, 03 Apr 2015 20:12:19 GMT
> +import static com.google.common.base.Preconditions.checkNotNull;
> +import static java.util.concurrent.TimeUnit.SECONDS;
> +import static org.jclouds.util.Predicates2.retry;
> +
> +import org.jclouds.openstack.poppy.v1.domain.Service;
> +import org.jclouds.openstack.poppy.v1.domain.ServiceStatus;
> +import org.jclouds.openstack.poppy.v1.features.ServiceApi;
> +import com.google.common.base.Predicate;
> +
> +public class ServicePredicates {
> +   public static Predicate<Service> awaitDeployed(ServiceApi serviceApi) {
> +      StatusUpdatedPredicate statusPredicate = new StatusUpdatedPredicate(serviceApi,
ServiceStatus.DEPLOYED);
> +      return retry(statusPredicate, 1200, 15, 15, SECONDS);
> +   }
> +
> +   private static class StatusUpdatedPredicate implements Predicate<Service> {

I am not following here. I think it already is modeled after ServerStatusPredicate, and is
already generalized, based on:
https://github.com/rackerlabs/jclouds-labs-openstack/blob/service-predicates/openstack-poppy/src/main/java/org/jclouds/openstack/poppy/v1/predicates/ServicePredicates.java#L30

So it will be easy to add another Predicate and just change the status from ServiceStatus.DEPLOYED
to whatever is needed, as it is done in awaitDeployed.

Specifically, StatusUpdatedPredicate will accept any ServiceStatus to monitor.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/186/files#r27752603
Mime
View raw message