diff --git a/core/src/main/java/org/jclouds/predicates/RetryablePredicate.java b/core/src/main/java/org/jclouds/predicates/RetryablePredicate.java index 6f32a238be..2b1f6fdb30 100644 --- a/core/src/main/java/org/jclouds/predicates/RetryablePredicate.java +++ b/core/src/main/java/org/jclouds/predicates/RetryablePredicate.java @@ -74,7 +74,7 @@ public class RetryablePredicate implements Predicate { } long nextMaxInterval(long attempt, Date end) { - long interval = (period * (long) Math.pow(attempt, 2l)); + long interval = (period * (long) Math.pow(attempt, 1.5)); long max = end.getTime() - System.currentTimeMillis(); return (interval > max) ? max : interval; } diff --git a/ibmdev/src/main/java/org/jclouds/ibmdev/IBMDeveloperCloudPropertiesBuilder.java b/ibmdev/src/main/java/org/jclouds/ibmdev/IBMDeveloperCloudPropertiesBuilder.java index d70025228c..85e0092edc 100644 --- a/ibmdev/src/main/java/org/jclouds/ibmdev/IBMDeveloperCloudPropertiesBuilder.java +++ b/ibmdev/src/main/java/org/jclouds/ibmdev/IBMDeveloperCloudPropertiesBuilder.java @@ -24,6 +24,7 @@ package org.jclouds.ibmdev; import static com.google.common.base.Preconditions.checkNotNull; +import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_NODE_RUNNING; import static org.jclouds.ibmdev.reference.IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT; import static org.jclouds.ibmdev.reference.IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_LOCATION; import static org.jclouds.ibmdev.reference.IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_PASSWORD; @@ -44,8 +45,10 @@ public class IBMDeveloperCloudPropertiesBuilder extends PropertiesBuilder { protected Properties defaultProperties() { Properties properties = super.defaultProperties(); properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT, - "https://www-180.ibm.com/cloud/enterprise/beta/api/rest/20090403"); + "https://www-180.ibm.com/cloud/enterprise/beta/api/rest/20090403"); properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_LOCATION, "1"); + properties.setProperty(PROPERTY_TIMEOUT_NODE_RUNNING, (15 * 60 * 1000) + + ""); return properties; } @@ -58,15 +61,18 @@ public class IBMDeveloperCloudPropertiesBuilder extends PropertiesBuilder { withCredentials(id, secret); } - public IBMDeveloperCloudPropertiesBuilder withCredentials(String id, String secret) { - properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_USER, checkNotNull(id, "user")); - properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_PASSWORD, checkNotNull(secret, "password")); + public IBMDeveloperCloudPropertiesBuilder withCredentials(String id, + String secret) { + properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_USER, checkNotNull(id, + "user")); + properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_PASSWORD, checkNotNull( + secret, "password")); return this; } public IBMDeveloperCloudPropertiesBuilder withEndpoint(URI endpoint) { - properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT, - checkNotNull(endpoint, "endpoint").toString()); + properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT, checkNotNull( + endpoint, "endpoint").toString()); return this; } } diff --git a/ibmdev/src/main/java/org/jclouds/ibmdev/options/CreateInstanceOptions.java b/ibmdev/src/main/java/org/jclouds/ibmdev/options/CreateInstanceOptions.java index e5e3dee94a..fb247cd34b 100644 --- a/ibmdev/src/main/java/org/jclouds/ibmdev/options/CreateInstanceOptions.java +++ b/ibmdev/src/main/java/org/jclouds/ibmdev/options/CreateInstanceOptions.java @@ -74,7 +74,8 @@ public class CreateInstanceOptions extends BaseHttpRequestOptions { * @param configurationData * extra configuration to pass to the instance */ - public CreateInstanceOptions configurationData(Map configurationData) { + public CreateInstanceOptions configurationData( + Map configurationData) { checkNotNull(configurationData, "configurationData"); for (Entry entry : configurationData.entrySet()) { formParameters.removeAll(entry.getKey()); @@ -100,7 +101,8 @@ public class CreateInstanceOptions extends BaseHttpRequestOptions { /** * @see CreateInstanceOptions#configurationData(Map ) */ - public static CreateInstanceOptions configurationData(Map configurationData) { + public static CreateInstanceOptions configurationData( + Map configurationData) { CreateInstanceOptions options = new CreateInstanceOptions(); return options.configurationData(configurationData); } @@ -108,7 +110,8 @@ public class CreateInstanceOptions extends BaseHttpRequestOptions { /** * @see CreateInstanceOptions#mountVolume(String, String ) */ - public static CreateInstanceOptions mountVolume(String id, String mountPoint) { + public static CreateInstanceOptions mountVolume(String id, + String mountPoint) { CreateInstanceOptions options = new CreateInstanceOptions(); return options.mountVolume(id, mountPoint); } @@ -124,7 +127,8 @@ public class CreateInstanceOptions extends BaseHttpRequestOptions { /** * @see CreateInstanceOptions#authorizePublicKey(String ) */ - public static CreateInstanceOptions authorizePublicKey(String publicKeyName) { + public static CreateInstanceOptions authorizePublicKey( + String publicKeyName) { CreateInstanceOptions options = new CreateInstanceOptions(); return options.authorizePublicKey(publicKeyName); } diff --git a/ibmdev/src/test/java/org/jclouds/ibmdev/IBMDeveloperCloudClientLiveTest.java b/ibmdev/src/test/java/org/jclouds/ibmdev/IBMDeveloperCloudClientLiveTest.java index a5813e28c3..f0ba69e216 100644 --- a/ibmdev/src/test/java/org/jclouds/ibmdev/IBMDeveloperCloudClientLiveTest.java +++ b/ibmdev/src/test/java/org/jclouds/ibmdev/IBMDeveloperCloudClientLiveTest.java @@ -328,7 +328,7 @@ public class IBMDeveloperCloudClientLiveTest { ImmutableMap.of("insight_admin_password", "myPassword1", "db2_admin_password", "myPassword2", "report_user_password", "myPassword3")) - .authorizePublicKey(key.getName()).attachIp(ip.getId())); + .authorizePublicKey(key.getName())); try { assertIpHostAndStatusNEW(instance); assertConsistent(instance, TAG); @@ -342,12 +342,14 @@ public class IBMDeveloperCloudClientLiveTest { long start = System.currentTimeMillis(); assert new RetryablePredicate(new InstanceActive(connection), - 600, 2, TimeUnit.SECONDS).apply(instance) : connection - .getInstance(instance.getId()); + 15 * 60 * 1000).apply(instance) : connection.getInstance(instance + .getId()); System.out.println(((System.currentTimeMillis() - start) / 1000) + " seconds"); + instance = connection.getInstance(instance.getId()); + try { assertIpHostAndStatusACTIVE(instance); assertConsistent(instance, TAG);