added new properties object

This commit is contained in:
Adrian Cole 2012-03-27 14:16:47 -04:00
parent e46cef9fbb
commit 025396be37
12 changed files with 174 additions and 77 deletions

View File

@ -19,7 +19,7 @@
package org.jclouds.eucalyptus; package org.jclouds.eucalyptus;
import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_PORT_OPEN; import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_PORT_OPEN;
import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS; import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS; import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
@ -39,7 +39,7 @@ public class EucalyptusPropertiesBuilder extends EC2PropertiesBuilder {
properties.setProperty(PROPERTY_ENDPOINT, "http://173.205.188.130:8773/services/Eucalyptus"); properties.setProperty(PROPERTY_ENDPOINT, "http://173.205.188.130:8773/services/Eucalyptus");
properties.setProperty(PROPERTY_REGIONS, "Eucalyptus"); properties.setProperty(PROPERTY_REGIONS, "Eucalyptus");
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "admin"); properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "admin");
properties.setProperty(PROPERTY_TIMEOUT_PORT_OPEN, 5 * 60 * 1000 + ""); properties.setProperty(TIMEOUT_PORT_OPEN, 5 * 60 * 1000 + "");
return properties; return properties;
} }

View File

@ -17,9 +17,8 @@
* under the License. * under the License.
*/ */
package org.jclouds.trmk.vcloud_0_8.compute.strategy; package org.jclouds.trmk.vcloud_0_8.compute.strategy;
import static org.jclouds.compute.config.ComputeServiceProperties.BLACKLIST_NODES;
import static org.jclouds.compute.reference.ComputeServiceConstants.COMPUTE_LOGGER; import static org.jclouds.compute.reference.ComputeServiceConstants.COMPUTE_LOGGER;
import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_BLACKLIST_NODES;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -63,7 +62,7 @@ public class TerremarkVCloudListNodesStrategy implements ListNodesStrategy {
Set<String> blackListVAppNames = ImmutableSet.<String> of(); Set<String> blackListVAppNames = ImmutableSet.<String> of();
@Inject(optional = true) @Inject(optional = true)
void setBlackList(@Named(PROPERTY_BLACKLIST_NODES) String blackListNodes) { void setBlackList(@Named(BLACKLIST_NODES) String blackListNodes) {
if (blackListNodes != null && !"".equals(blackListNodes)) if (blackListNodes != null && !"".equals(blackListNodes))
this.blackListVAppNames = ImmutableSet.copyOf(Splitter.on(',').split(blackListNodes)); this.blackListVAppNames = ImmutableSet.copyOf(Splitter.on(',').split(blackListNodes));
} }

View File

@ -17,9 +17,9 @@
* under the License. * under the License.
*/ */
package org.jclouds.compute.config; package org.jclouds.compute.config;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL; import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_ID;
import static org.jclouds.compute.domain.OsFamily.UBUNTU; import static org.jclouds.compute.domain.OsFamily.UBUNTU;
import java.util.Map; import java.util.Map;
@ -175,7 +175,7 @@ public abstract class BaseComputeServiceContextModule extends AbstractModule {
template = provideTemplate(injector, template); template = provideTemplate(injector, template);
String imageId = config.apply(provider + ".image-id"); String imageId = config.apply(provider + ".image-id");
if (imageId == null) if (imageId == null)
imageId = config.apply(ComputeServiceConstants.PROPERTY_IMAGE_ID); imageId = config.apply(IMAGE_ID);
if (imageId != null) if (imageId != null)
template.imageId(imageId); template.imageId(imageId);
return template; return template;

View File

@ -0,0 +1,72 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.compute.config;
/**
*
* @author Adrian Cole
*/
public interface ComputeServiceProperties {
public static final String TIMEOUT_NODE_TERMINATED = "jclouds.compute.timeout.node-terminated";
public static final String TIMEOUT_NODE_RUNNING = "jclouds.compute.timeout.node-running";
public static final String TIMEOUT_NODE_SUSPENDED = "jclouds.compute.timeout.node-suspended";
public static final String TIMEOUT_SCRIPT_COMPLETE = "jclouds.compute.timeout.script-complete";
public static final String TIMEOUT_PORT_OPEN = "jclouds.compute.timeout.port-open";
public static final String INIT_STATUS_INITIAL_PERIOD = "jclouds.compute.init-status.initial-period";
public static final String INIT_STATUS_MAX_PERIOD = "jclouds.compute.init-status.max-period";
/**
* overrides the image specified in the subclass of {@link BaseComputeServiceContextModule#provideTemplate}
*/
public static final String IMAGE_ID = "jclouds.image-id";
/**
* username and, if colon delimited, password of the default user on the image that is or can become root
* <p/>
* ex. {@code ubuntu}
* ex. {@code toor:password}
*/
public static final String IMAGE_LOGIN_USER = "jclouds.image.login-user";
/**
* true if gaining a sudo shell requires a password
*/
public static final String IMAGE_AUTHENTICATE_SUDO = "jclouds.image.authenticate-sudo";
/**
* comma-separated nodes that we shouldn't attempt to list as they are dead
* in the provider for some reason.
*/
public static final String BLACKLIST_NODES = "jclouds.compute.blacklist-nodes";
/**
* os to map of version input string to output string
* <p/>
* ex.
*
* <pre>
* {"centos":{"5.4":"5.4","5.5":"5.5"},"rhel":{"5.4":"5.4","5.5":"5.5"},"ubuntu":{"karmic":"9.10","lucid":"10.04","maverick":"10.10","natty":"11.04"},"windows":{"2008":"2008","Server 2008":"2008","2008 R2":"2008 R2","Server 2008 R2":"2008 R2","2008 SP2":"2008 SP2","Server 2008 SP2":"2008 SP2"}}
* </pre>
*/
public static final String OS_VERSION_MAP_JSON = "jclouds.compute.os-version-map-json";
}

View File

@ -32,8 +32,8 @@ import org.jclouds.compute.predicates.NodeRunning;
import org.jclouds.compute.predicates.NodeSuspended; import org.jclouds.compute.predicates.NodeSuspended;
import org.jclouds.compute.predicates.NodeTerminated; import org.jclouds.compute.predicates.NodeTerminated;
import org.jclouds.compute.predicates.ScriptStatusReturnsZero; import org.jclouds.compute.predicates.ScriptStatusReturnsZero;
import org.jclouds.compute.predicates.TrueIfNullOrTerminatedRefreshAndDoubleCheckOnFalse;
import org.jclouds.compute.predicates.ScriptStatusReturnsZero.CommandUsingClient; import org.jclouds.compute.predicates.ScriptStatusReturnsZero.CommandUsingClient;
import org.jclouds.compute.predicates.TrueIfNullOrTerminatedRefreshAndDoubleCheckOnFalse;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts; import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.predicates.RetryablePredicate; import org.jclouds.predicates.RetryablePredicate;

View File

@ -18,9 +18,24 @@
*/ */
package org.jclouds.compute.reference; package org.jclouds.compute.reference;
import static org.jclouds.compute.config.ComputeServiceProperties.BLACKLIST_NODES;
import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_AUTHENTICATE_SUDO;
import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_ID;
import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_LOGIN_USER;
import static org.jclouds.compute.config.ComputeServiceProperties.INIT_STATUS_INITIAL_PERIOD;
import static org.jclouds.compute.config.ComputeServiceProperties.INIT_STATUS_MAX_PERIOD;
import static org.jclouds.compute.config.ComputeServiceProperties.OS_VERSION_MAP_JSON;
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING;
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED;
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED;
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_PORT_OPEN;
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_SCRIPT_COMPLETE;
import javax.inject.Named; import javax.inject.Named;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.compute.config.ComputeServiceProperties;
import com.google.inject.Inject; import com.google.inject.Inject;
/** /**
@ -31,89 +46,108 @@ public interface ComputeServiceConstants {
public static final String COMPUTE_LOGGER = "jclouds.compute"; public static final String COMPUTE_LOGGER = "jclouds.compute";
public static final String LOCAL_PARTITION_GB_PATTERN = "disk_drive/%s/gb"; public static final String LOCAL_PARTITION_GB_PATTERN = "disk_drive/%s/gb";
public static final String PROPERTY_TIMEOUT_NODE_TERMINATED = "jclouds.compute.timeout.node-terminated";
public static final String PROPERTY_TIMEOUT_NODE_RUNNING = "jclouds.compute.timeout.node-running";
public static final String PROPERTY_TIMEOUT_NODE_SUSPENDED = "jclouds.compute.timeout.node-suspended";
public static final String PROPERTY_TIMEOUT_SCRIPT_COMPLETE = "jclouds.compute.timeout.script-complete";
public static final String PROPERTY_TIMEOUT_PORT_OPEN = "jclouds.compute.timeout.port-open";
public static final String PROPERTY_INIT_STATUS_INITIAL_PERIOD = "jclouds.compute.init-status.initial-period";
public static final String PROPERTY_INIT_STATUS_MAX_PERIOD = "jclouds.compute.init-status.max-period";
/** /**
* overrides the image specified in the subclass of {@link BaseComputeServiceContextModule#provideTemplate} * @see ComputeServiceProperties#TIMEOUT_NODE_TERMINATED
*/ */
public static final String PROPERTY_IMAGE_ID = "jclouds.image-id"; @Deprecated
public static final String PROPERTY_TIMEOUT_NODE_TERMINATED = TIMEOUT_NODE_TERMINATED;
/** /**
* username and, if colon delimited, password of the default user on the image that is or can become root * @see ComputeServiceProperties#TIMEOUT_NODE_RUNNING
* <p/>
* ex. {@code ubuntu}
* ex. {@code toor:password}
*/ */
public static final String PROPERTY_IMAGE_LOGIN_USER = "jclouds.image.login-user"; @Deprecated
public static final String PROPERTY_TIMEOUT_NODE_RUNNING = TIMEOUT_NODE_RUNNING;
/** /**
* true if gaining a sudo shell requires a password * @see ComputeServiceProperties#TIMEOUT_NODE_SUSPENDED
*/ */
public static final String PROPERTY_IMAGE_AUTHENTICATE_SUDO = "jclouds.image.authenticate-sudo"; @Deprecated
public static final String PROPERTY_TIMEOUT_NODE_SUSPENDED = TIMEOUT_NODE_SUSPENDED;
/** /**
* comma-separated nodes that we shouldn't attempt to list as they are dead * @see ComputeServiceProperties#TIMEOUT_SCRIPT_COMPLETE
* in the provider for some reason.
*/ */
public static final String PROPERTY_BLACKLIST_NODES = "jclouds.compute.blacklist-nodes"; @Deprecated
public static final String PROPERTY_TIMEOUT_SCRIPT_COMPLETE = TIMEOUT_SCRIPT_COMPLETE;
/** /**
* os to map of version input string to output string * @see ComputeServiceProperties#TIMEOUT_PORT_OPEN
* <p/>
* ex.
*
* <pre>
* {"centos":{"5.4":"5.4","5.5":"5.5"},"rhel":{"5.4":"5.4","5.5":"5.5"},"ubuntu":{"karmic":"9.10","lucid":"10.04","maverick":"10.10","natty":"11.04"},"windows":{"2008":"2008","Server 2008":"2008","2008 R2":"2008 R2","Server 2008 R2":"2008 R2","2008 SP2":"2008 SP2","Server 2008 SP2":"2008 SP2"}}
* </pre>
*/ */
public static final String PROPERTY_OS_VERSION_MAP_JSON = "jclouds.compute.os-version-map-json"; @Deprecated
public static final String PROPERTY_TIMEOUT_PORT_OPEN = TIMEOUT_PORT_OPEN;
/**
* @see ComputeServiceProperties#INIT_STATUS_INITIAL_PERIOD
*/
@Deprecated
public static final String PROPERTY_INIT_STATUS_INITIAL_PERIOD = INIT_STATUS_INITIAL_PERIOD;
/**
* @see ComputeServiceProperties#INIT_STATUS_MAX_PERIOD
*/
@Deprecated
public static final String PROPERTY_INIT_STATUS_MAX_PERIOD = INIT_STATUS_MAX_PERIOD;
/**
* @see ComputeServiceProperties#IMAGE_ID
*/
@Deprecated
public static final String PROPERTY_IMAGE_ID = IMAGE_ID;
/**
* @see ComputeServiceProperties#IMAGE_LOGIN_USER
*/
@Deprecated
public static final String PROPERTY_IMAGE_LOGIN_USER = IMAGE_LOGIN_USER;
/**
* @see ComputeServiceProperties#IMAGE_AUTHENTICATE_SUDO
*/
@Deprecated
public static final String PROPERTY_IMAGE_AUTHENTICATE_SUDO = IMAGE_AUTHENTICATE_SUDO;
/**
* @see ComputeServiceProperties#BLACKLIST_NODES
*/
@Deprecated
public static final String PROPERTY_BLACKLIST_NODES = BLACKLIST_NODES;
/**
* @see ComputeServiceProperties#OS_VERSION_MAP_JSON
*/
@Deprecated
public static final String PROPERTY_OS_VERSION_MAP_JSON = OS_VERSION_MAP_JSON;
@Singleton @Singleton
public static class InitStatusProperties { public static class InitStatusProperties {
@Inject(optional = true) @Inject(optional = true)
@Named(PROPERTY_INIT_STATUS_INITIAL_PERIOD) @Named(INIT_STATUS_INITIAL_PERIOD)
public long initStatusInitialPeriod = 500; public long initStatusInitialPeriod = 500;
@Inject(optional = true) @Inject(optional = true)
@Named(PROPERTY_INIT_STATUS_MAX_PERIOD) @Named(INIT_STATUS_MAX_PERIOD)
public long initStatusMaxPeriod = 5000; public long initStatusMaxPeriod = 5000;
} }
@Singleton @Singleton
public static class ReferenceData { public static class ReferenceData {
@Inject(optional = true) @Inject(optional = true)
@Named(PROPERTY_OS_VERSION_MAP_JSON) @Named(OS_VERSION_MAP_JSON)
// TODO: switch this to read from resource, failing back to string constant on classpath problem // TODO: switch this to read from resource, failing back to string
// constant on classpath problem
public String osVersionMapJson = "{\"suse\":{\"\":\"\",\"11\":\"11\",\"11 SP1\":\"11 SP1\"},\"debian\":{\"\":\"\",\"lenny\":\"5.0\",\"6\":\"6.0\",\"squeeze\":\"6.0\"},\"centos\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\",\"5.6\":\"5.6\",\"5.7\":\"5.7\",\"6\":\"6.0\",\"6.0\":\"6.0\"},\"rhel\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\",\"5.6\":\"5.6\",\"5.7\":\"5.7\",\"6\":\"6.0\",\"6.0\":\"6.0\"},\"solaris\":{\"\":\"\",\"10\":\"10\"},\"ubuntu\":{\"\":\"\",\"hardy\":\"8.04\",\"karmic\":\"9.10\",\"lucid\":\"10.04\",\"10.04.1\":\"10.04\",\"maverick\":\"10.10\",\"natty\":\"11.04\",\"oneiric\":\"11.10\",\"precise\":\"12.04\"},\"windows\":{\"\":\"\",\"7\":\"7\",\"2003\":\"2003\",\"2003 Standard\":\"2003\",\"2003 R2\":\"2003 R2\",\"2008\":\"2008\",\"2008 Web\":\"2008\",\"2008 Server\":\"2008\",\"Server 2008\":\"2008\",\"2008 R1\":\"2008 R1\",\"2008 R2\":\"2008 R2\",\"Server 2008 R2\":\"2008 R2\",\"2008 Server R2\":\"2008 R2\",\"2008 SP2\":\"2008 SP2\",\"Server 2008 SP2\":\"2008 SP2\"}}"; public String osVersionMapJson = "{\"suse\":{\"\":\"\",\"11\":\"11\",\"11 SP1\":\"11 SP1\"},\"debian\":{\"\":\"\",\"lenny\":\"5.0\",\"6\":\"6.0\",\"squeeze\":\"6.0\"},\"centos\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\",\"5.6\":\"5.6\",\"5.7\":\"5.7\",\"6\":\"6.0\",\"6.0\":\"6.0\"},\"rhel\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\",\"5.6\":\"5.6\",\"5.7\":\"5.7\",\"6\":\"6.0\",\"6.0\":\"6.0\"},\"solaris\":{\"\":\"\",\"10\":\"10\"},\"ubuntu\":{\"\":\"\",\"hardy\":\"8.04\",\"karmic\":\"9.10\",\"lucid\":\"10.04\",\"10.04.1\":\"10.04\",\"maverick\":\"10.10\",\"natty\":\"11.04\",\"oneiric\":\"11.10\",\"precise\":\"12.04\"},\"windows\":{\"\":\"\",\"7\":\"7\",\"2003\":\"2003\",\"2003 Standard\":\"2003\",\"2003 R2\":\"2003 R2\",\"2008\":\"2008\",\"2008 Web\":\"2008\",\"2008 Server\":\"2008\",\"Server 2008\":\"2008\",\"2008 R1\":\"2008 R1\",\"2008 R2\":\"2008 R2\",\"Server 2008 R2\":\"2008 R2\",\"2008 Server R2\":\"2008 R2\",\"2008 SP2\":\"2008 SP2\",\"Server 2008 SP2\":\"2008 SP2\"}}";
} }
@Singleton @Singleton
public static class Timeouts { public static class Timeouts {
@Inject(optional = true) @Inject(optional = true)
@Named(PROPERTY_TIMEOUT_NODE_TERMINATED) @Named(TIMEOUT_NODE_TERMINATED)
public long nodeTerminated = 30 * 1000; public long nodeTerminated = 30 * 1000;
@Inject(optional = true) @Inject(optional = true)
@Named(PROPERTY_TIMEOUT_NODE_RUNNING) @Named(TIMEOUT_NODE_RUNNING)
public long nodeRunning = 1200 * 1000; public long nodeRunning = 1200 * 1000;
@Inject(optional = true) @Inject(optional = true)
@Named(PROPERTY_TIMEOUT_NODE_SUSPENDED) @Named(TIMEOUT_NODE_SUSPENDED)
public long nodeSuspended = 30 * 1000; public long nodeSuspended = 30 * 1000;
@Inject(optional = true) @Inject(optional = true)
@Named(PROPERTY_TIMEOUT_SCRIPT_COMPLETE) @Named(TIMEOUT_SCRIPT_COMPLETE)
public long scriptComplete = 600 * 1000; public long scriptComplete = 600 * 1000;
@Inject(optional = true) @Inject(optional = true)
@Named(PROPERTY_TIMEOUT_PORT_OPEN) @Named(TIMEOUT_PORT_OPEN)
public long portOpen = 600 * 1000; public long portOpen = 600 * 1000;
} }

View File

@ -30,12 +30,12 @@ import java.util.List;
import org.easymock.IAnswer; import org.easymock.IAnswer;
import org.jclouds.Constants; import org.jclouds.Constants;
import org.jclouds.compute.config.ComputeServiceProperties;
import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder; import org.jclouds.compute.domain.NodeMetadataBuilder;
import org.jclouds.compute.domain.NodeState; import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.options.RunScriptOptions; import org.jclouds.compute.options.RunScriptOptions;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts; import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.concurrent.MoreExecutors; import org.jclouds.concurrent.MoreExecutors;
import org.jclouds.concurrent.config.ExecutorServiceModule; import org.jclouds.concurrent.config.ExecutorServiceModule;
@ -72,7 +72,7 @@ public class RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilCompleteTest {
protected void configure() { protected void configure() {
bindConstant().annotatedWith(Names.named(Constants.PROPERTY_USER_THREADS)).to(1); bindConstant().annotatedWith(Names.named(Constants.PROPERTY_USER_THREADS)).to(1);
bindConstant().annotatedWith(Names.named(Constants.PROPERTY_IO_WORKER_THREADS)).to(1); bindConstant().annotatedWith(Names.named(Constants.PROPERTY_IO_WORKER_THREADS)).to(1);
bindConstant().annotatedWith(Names.named(ComputeServiceConstants.PROPERTY_TIMEOUT_SCRIPT_COMPLETE)) bindConstant().annotatedWith(Names.named(ComputeServiceProperties.TIMEOUT_SCRIPT_COMPLETE))
.to(100); .to(100);
install(new FactoryModuleBuilder() install(new FactoryModuleBuilder()
.build(BlockUntilInitScriptStatusIsZeroThenReturnOutput.Factory.class)); .build(BlockUntilInitScriptStatusIsZeroThenReturnOutput.Factory.class));
@ -84,7 +84,7 @@ public class RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilCompleteTest {
@Override @Override
protected void configure() { protected void configure() {
bindConstant().annotatedWith(Names.named(ComputeServiceConstants.PROPERTY_TIMEOUT_SCRIPT_COMPLETE)).to(100l); bindConstant().annotatedWith(Names.named(ComputeServiceProperties.TIMEOUT_SCRIPT_COMPLETE)).to(100l);
} }
}).getInstance(Timeouts.class); }).getInstance(Timeouts.class);

View File

@ -16,13 +16,14 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.compute.reference; package org.jclouds.compute.config;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.util.Properties; import java.util.Properties;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.config.ComputeServiceProperties;
import org.jclouds.compute.reference.ComputeServiceConstants.InitStatusProperties; import org.jclouds.compute.reference.ComputeServiceConstants.InitStatusProperties;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -33,8 +34,8 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "unit", testName = "ComputeServiceConstantsTest") @Test(groups = "unit", testName = "ComputeServicePropertiesTest")
public class ComputeServiceConstantsTest { public class ComputeServicePropertiesTest {
public void testDefaultInitStatusProperties() { public void testDefaultInitStatusProperties() {
InitStatusProperties props = new ComputeServiceContextFactory().createContext("stub", "", "").utils().injector() InitStatusProperties props = new ComputeServiceContextFactory().createContext("stub", "", "").utils().injector()
.getInstance(InitStatusProperties.class); .getInstance(InitStatusProperties.class);
@ -44,8 +45,8 @@ public class ComputeServiceConstantsTest {
public void testOverrideInitStatusProperties() { public void testOverrideInitStatusProperties() {
Properties overrides = new Properties(); Properties overrides = new Properties();
overrides.setProperty(ComputeServiceConstants.PROPERTY_INIT_STATUS_INITIAL_PERIOD, "501"); overrides.setProperty(ComputeServiceProperties.INIT_STATUS_INITIAL_PERIOD, "501");
overrides.setProperty(ComputeServiceConstants.PROPERTY_INIT_STATUS_MAX_PERIOD, "5001"); overrides.setProperty(ComputeServiceProperties.INIT_STATUS_MAX_PERIOD, "5001");
InitStatusProperties props = new ComputeServiceContextFactory() InitStatusProperties props = new ComputeServiceContextFactory()
.createContext("stub", "", "", ImmutableSet.<Module> of(), overrides).utils().injector() .createContext("stub", "", "", ImmutableSet.<Module> of(), overrides).utils().injector()

View File

@ -18,12 +18,11 @@
*/ */
package org.jclouds.virtualbox; package org.jclouds.virtualbox;
import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_BUILD_VERSION; import static org.jclouds.Constants.PROPERTY_BUILD_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_IMAGE_AUTHENTICATE_SUDO; import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_AUTHENTICATE_SUDO;
import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_IMAGE_LOGIN_USER; import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_LOGIN_USER;
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_DEFAULT_DIR; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_DEFAULT_DIR;
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGES_DESCRIPTOR; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGES_DESCRIPTOR;
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE;
@ -58,8 +57,9 @@ public class VirtualBoxPropertiesBuilder extends PropertiesBuilder {
properties.put(PROPERTY_API_VERSION, "4.1.4"); properties.put(PROPERTY_API_VERSION, "4.1.4");
properties.put(PROPERTY_BUILD_VERSION, "4.1.8r75467"); properties.put(PROPERTY_BUILD_VERSION, "4.1.8r75467");
properties.put(PROPERTY_IMAGE_LOGIN_USER, "toor:password");
properties.put(PROPERTY_IMAGE_AUTHENTICATE_SUDO, "true"); properties.put(IMAGE_LOGIN_USER, "toor:password");
properties.put(IMAGE_AUTHENTICATE_SUDO, "true");
properties.put(VIRTUALBOX_INSTALLATION_KEY_SEQUENCE, "<Esc><Esc><Enter> " properties.put(VIRTUALBOX_INSTALLATION_KEY_SEQUENCE, "<Esc><Esc><Enter> "

View File

@ -23,7 +23,7 @@ import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_AMI_QUE
import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_CC_AMI_QUERY; import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_CC_AMI_QUERY;
import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_CC_REGIONS; import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_CC_REGIONS;
import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_GENERATE_INSTANCE_NAMES; import static org.jclouds.aws.ec2.reference.AWSEC2Constants.PROPERTY_EC2_GENERATE_INSTANCE_NAMES;
import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_NODE_SUSPENDED; import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED;
import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS; import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
import java.util.Properties; import java.util.Properties;
@ -42,7 +42,7 @@ public class AWSEC2PropertiesBuilder extends org.jclouds.ec2.EC2PropertiesBuilde
// sometimes, like in ec2, stop takes a very long time, perhaps // sometimes, like in ec2, stop takes a very long time, perhaps
// due to volume management. one example spent 2 minutes moving // due to volume management. one example spent 2 minutes moving
// from stopping->stopped state on an ec2 micro // from stopping->stopped state on an ec2 micro
properties.setProperty(PROPERTY_TIMEOUT_NODE_SUSPENDED, 120 * 1000 + ""); properties.setProperty(TIMEOUT_NODE_SUSPENDED, 120 * 1000 + "");
// auth fail sometimes happens in EC2, as the rc.local script that injects the // auth fail sometimes happens in EC2, as the rc.local script that injects the
// authorized key executes after ssh has started. // authorized key executes after ssh has started.
properties.setProperty("jclouds.ssh.max-retries", "7"); properties.setProperty("jclouds.ssh.max-retries", "7");

View File

@ -20,7 +20,7 @@ package org.jclouds.hpcloud.compute;
import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_NODE_TERMINATED; import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
import static org.jclouds.openstack.nova.v1_1.config.NovaProperties.AUTO_ALLOCATE_FLOATING_IPS; import static org.jclouds.openstack.nova.v1_1.config.NovaProperties.AUTO_ALLOCATE_FLOATING_IPS;
import static org.jclouds.openstack.nova.v1_1.config.NovaProperties.AUTO_GENERATE_KEYPAIRS; import static org.jclouds.openstack.nova.v1_1.config.NovaProperties.AUTO_GENERATE_KEYPAIRS;
@ -42,7 +42,7 @@ public class HPCloudComputePropertiesBuilder extends NovaPropertiesBuilder {
properties.setProperty(PROPERTY_ENDPOINT, "https://region-a.geo-1.identity.hpcloudsvc.com:35357"); properties.setProperty(PROPERTY_ENDPOINT, "https://region-a.geo-1.identity.hpcloudsvc.com:35357");
// deallocating ip addresses can take a while // deallocating ip addresses can take a while
properties.setProperty(PROPERTY_TIMEOUT_NODE_TERMINATED, 60 * 1000 + ""); properties.setProperty(TIMEOUT_NODE_TERMINATED, 60 * 1000 + "");
properties.setProperty(CREDENTIAL_TYPE, "apiAccessKeyCredentials"); properties.setProperty(CREDENTIAL_TYPE, "apiAccessKeyCredentials");
properties.setProperty(AUTO_ALLOCATE_FLOATING_IPS, "true"); properties.setProperty(AUTO_ALLOCATE_FLOATING_IPS, "true");

View File

@ -25,7 +25,6 @@ import java.util.Map;
import org.jclouds.compute.ComputeService; import org.jclouds.compute.ComputeService;
import org.jclouds.compute.options.TemplateOptions; import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.io.Payload;
import org.jclouds.softlayer.features.VirtualGuestClient; import org.jclouds.softlayer.features.VirtualGuestClient;
import com.google.common.net.InternetDomainName; import com.google.common.net.InternetDomainName;
@ -120,14 +119,6 @@ public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneab
return SoftLayerTemplateOptions.class.cast(options.blockOnPort(port, seconds)); return SoftLayerTemplateOptions.class.cast(options.blockOnPort(port, seconds));
} }
/**
* @see TemplateOptions#runScript(Payload)
*/
public static SoftLayerTemplateOptions runScript(Payload script) {
SoftLayerTemplateOptions options = new SoftLayerTemplateOptions();
return SoftLayerTemplateOptions.class.cast(options.runScript(script));
}
/** /**
* @see TemplateOptions#userMetadata(Map) * @see TemplateOptions#userMetadata(Map)
*/ */