mirror of https://github.com/apache/jclouds.git
removed deprecated RunScriptOptions & TemplateOptions
This commit is contained in:
parent
025396be37
commit
343470d0a5
|
@ -18,15 +18,13 @@
|
|||
*/
|
||||
package org.jclouds.cloudsigma.compute.options;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.cloudsigma.domain.AffinityType;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.scriptbuilder.domain.Statement;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class CloudSigmaTemplateOptions extends TemplateOptions implements Cloneable {
|
||||
|
||||
public static final CloudSigmaTemplateOptions NONE = new CloudSigmaTemplateOptions();
|
||||
|
@ -110,12 +108,6 @@ public class CloudSigmaTemplateOptions extends TemplateOptions implements Clonea
|
|||
return CloudSigmaTemplateOptions.class.cast(options.userMetadata(userMetadata));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static CloudSigmaTemplateOptions overrideLoginUserWith(String user) {
|
||||
CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions();
|
||||
return options.overrideLoginUserWith(user);
|
||||
}
|
||||
|
||||
public static CloudSigmaTemplateOptions overrideLoginUser(String user) {
|
||||
CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions();
|
||||
return options.overrideLoginUser(user);
|
||||
|
@ -136,18 +128,6 @@ public class CloudSigmaTemplateOptions extends TemplateOptions implements Clonea
|
|||
return options.overrideAuthenticateSudo(authenticateSudo);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static CloudSigmaTemplateOptions overrideLoginCredentialWith(String credential) {
|
||||
CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions();
|
||||
return options.overrideLoginCredentialWith(credential);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static CloudSigmaTemplateOptions overrideCredentialsWith(Credentials credentials) {
|
||||
CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions();
|
||||
return options.overrideCredentialsWith(credentials);
|
||||
}
|
||||
|
||||
public static CloudSigmaTemplateOptions overrideLoginCredentials(LoginCredentials credentials) {
|
||||
CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions();
|
||||
return options.overrideLoginCredentials(credentials);
|
||||
|
@ -188,15 +168,6 @@ public class CloudSigmaTemplateOptions extends TemplateOptions implements Clonea
|
|||
return CloudSigmaTemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public CloudSigmaTemplateOptions runScript(Payload script) {
|
||||
return CloudSigmaTemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -237,33 +208,6 @@ public class CloudSigmaTemplateOptions extends TemplateOptions implements Clonea
|
|||
return CloudSigmaTemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public CloudSigmaTemplateOptions overrideCredentialsWith(Credentials overridingCredentials) {
|
||||
return CloudSigmaTemplateOptions.class.cast(super.overrideCredentialsWith(overridingCredentials));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public CloudSigmaTemplateOptions overrideLoginUserWith(String loginUser) {
|
||||
return CloudSigmaTemplateOptions.class.cast(super.overrideLoginUserWith(loginUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public CloudSigmaTemplateOptions overrideLoginCredentialWith(String loginCredential) {
|
||||
return CloudSigmaTemplateOptions.class.cast(super.overrideLoginCredentialWith(loginCredential));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -23,13 +23,12 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import org.jclouds.cloudstack.options.DeployVirtualMachineOptions;
|
||||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.io.Payload;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
|
@ -254,14 +253,6 @@ public class CloudStackTemplateOptions extends TemplateOptions implements Clonea
|
|||
return CloudStackTemplateOptions.class.cast(options.blockOnPort(port, seconds));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#runScript(Payload)
|
||||
*/
|
||||
public static CloudStackTemplateOptions runScript(Payload script) {
|
||||
CloudStackTemplateOptions options = new CloudStackTemplateOptions();
|
||||
return CloudStackTemplateOptions.class.cast(options.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#userMetadata(Map)
|
||||
*/
|
||||
|
@ -313,15 +304,6 @@ public class CloudStackTemplateOptions extends TemplateOptions implements Clonea
|
|||
return CloudStackTemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#runScript(Payload)
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public CloudStackTemplateOptions runScript(Payload script) {
|
||||
return CloudStackTemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -27,14 +27,12 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.ec2.domain.BlockDeviceMapping;
|
||||
import org.jclouds.ec2.domain.BlockDeviceMapping.MapEBSSnapshotToDevice;
|
||||
import org.jclouds.ec2.domain.BlockDeviceMapping.MapEphemeralDeviceToDevice;
|
||||
import org.jclouds.ec2.domain.BlockDeviceMapping.MapNewVolumeToDevice;
|
||||
import org.jclouds.ec2.domain.BlockDeviceMapping.UnmapDeviceNamed;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.scriptbuilder.domain.Statement;
|
||||
import org.jclouds.util.Preconditions2;
|
||||
|
@ -292,12 +290,6 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return EC2TemplateOptions.class.cast(options.userMetadata(userMetadata));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static EC2TemplateOptions overrideLoginUserWith(String user) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.overrideLoginUserWith(user);
|
||||
}
|
||||
|
||||
public static EC2TemplateOptions overrideLoginUser(String user) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.overrideLoginUser(user);
|
||||
|
@ -318,18 +310,6 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return options.overrideAuthenticateSudo(authenticateSudo);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static EC2TemplateOptions overrideLoginCredentialWith(String credential) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.overrideLoginCredentialWith(credential);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static EC2TemplateOptions overrideCredentialsWith(Credentials credentials) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.overrideCredentialsWith(credentials);
|
||||
}
|
||||
|
||||
public static EC2TemplateOptions overrideLoginCredentials(LoginCredentials credentials) {
|
||||
EC2TemplateOptions options = new EC2TemplateOptions();
|
||||
return options.overrideLoginCredentials(credentials);
|
||||
|
@ -371,15 +351,6 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return EC2TemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public EC2TemplateOptions runScript(Payload script) {
|
||||
return EC2TemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -420,33 +391,6 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return EC2TemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public EC2TemplateOptions overrideCredentialsWith(Credentials overridingCredentials) {
|
||||
return EC2TemplateOptions.class.cast(super.overrideCredentialsWith(overridingCredentials));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public EC2TemplateOptions overrideLoginUserWith(String loginUser) {
|
||||
return EC2TemplateOptions.class.cast(super.overrideLoginUserWith(loginUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public EC2TemplateOptions overrideLoginCredentialWith(String loginCredential) {
|
||||
return EC2TemplateOptions.class.cast(super.overrideLoginCredentialWith(loginCredential));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -25,9 +25,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.openstack.nova.v1_1.NovaClient;
|
||||
import org.jclouds.scriptbuilder.domain.Statement;
|
||||
import org.jclouds.util.Preconditions2;
|
||||
|
@ -339,15 +337,6 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return NovaTemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public NovaTemplateOptions runScript(Payload script) {
|
||||
return NovaTemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -388,33 +377,6 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return NovaTemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public NovaTemplateOptions overrideCredentialsWith(Credentials overridingCredentials) {
|
||||
return NovaTemplateOptions.class.cast(super.overrideCredentialsWith(overridingCredentials));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public NovaTemplateOptions overrideLoginUserWith(String loginUser) {
|
||||
return NovaTemplateOptions.class.cast(super.overrideLoginUserWith(loginUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public NovaTemplateOptions overrideLoginCredentialWith(String loginCredential) {
|
||||
return NovaTemplateOptions.class.cast(super.overrideLoginCredentialWith(loginCredential));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.jclouds.vcloud.compute.options;
|
|||
import java.util.Map;
|
||||
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.util.Preconditions2;
|
||||
import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
|
||||
|
||||
|
@ -139,14 +138,6 @@ public class VCloudTemplateOptions extends TemplateOptions implements Cloneable
|
|||
return VCloudTemplateOptions.class.cast(options.blockOnPort(port, seconds));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#runScript
|
||||
*/
|
||||
public static VCloudTemplateOptions runScript(Payload script) {
|
||||
VCloudTemplateOptions options = new VCloudTemplateOptions();
|
||||
return VCloudTemplateOptions.class.cast(options.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#userMetadata(Map)
|
||||
*/
|
||||
|
@ -226,15 +217,6 @@ public class VCloudTemplateOptions extends TemplateOptions implements Cloneable
|
|||
return VCloudTemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#runScript(Payload)
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public VCloudTemplateOptions runScript(Payload script) {
|
||||
return VCloudTemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -24,7 +24,6 @@ import static com.google.common.base.Preconditions.checkState;
|
|||
import java.util.Map;
|
||||
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.util.Preconditions2;
|
||||
|
||||
/**
|
||||
|
@ -206,16 +205,6 @@ public class TerremarkVCloudTemplateOptions extends TemplateOptions implements C
|
|||
return TerremarkVCloudTemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#runScript(Payload)
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public TerremarkVCloudTemplateOptions runScript(Payload script) {
|
||||
return TerremarkVCloudTemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#userMetadata
|
||||
*/
|
||||
|
|
|
@ -345,14 +345,8 @@ Here's an example of creating and running a small linux node in the group webser
|
|||
(make-option-map
|
||||
kw-memfn-1arg
|
||||
[;; RunScriptOptions
|
||||
;; deprecated
|
||||
:override-credentials-with
|
||||
:override-login-credentials
|
||||
;; deprecated
|
||||
:override-login-user-with
|
||||
:override-login-user
|
||||
;; deprecated
|
||||
:override-login-credential-with
|
||||
:override-login-password :override-login-privateKey
|
||||
:override-authenticate-sudo
|
||||
|
||||
|
|
|
@ -28,9 +28,6 @@ import javax.inject.Singleton;
|
|||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.predicates.AtomicNodeRunning;
|
||||
import org.jclouds.compute.predicates.AtomicNodeSuspended;
|
||||
import org.jclouds.compute.predicates.NodeRunning;
|
||||
import org.jclouds.compute.predicates.NodeSuspended;
|
||||
import org.jclouds.compute.predicates.NodeTerminated;
|
||||
import org.jclouds.compute.predicates.ScriptStatusReturnsZero;
|
||||
import org.jclouds.compute.predicates.ScriptStatusReturnsZero.CommandUsingClient;
|
||||
import org.jclouds.compute.predicates.TrueIfNullOrTerminatedRefreshAndDoubleCheckOnFalse;
|
||||
|
@ -73,34 +70,6 @@ public class ComputeServiceTimeoutsModule extends AbstractModule {
|
|||
timeouts.nodeSuspended);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("NODE_RUNNING")
|
||||
@Deprecated
|
||||
protected Predicate<NodeMetadata> nodeRunning(NodeRunning stateRunning, Timeouts timeouts) {
|
||||
return timeouts.nodeRunning == 0 ? stateRunning : new RetryablePredicate<NodeMetadata>(stateRunning,
|
||||
timeouts.nodeRunning);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("NODE_TERMINATED")
|
||||
@Deprecated
|
||||
protected Predicate<NodeMetadata> serverTerminated(NodeTerminated stateTerminated, Timeouts timeouts) {
|
||||
return timeouts.nodeTerminated == 0 ? stateTerminated : new RetryablePredicate<NodeMetadata>(stateTerminated,
|
||||
timeouts.nodeTerminated);
|
||||
}
|
||||
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("NODE_SUSPENDED")
|
||||
@Deprecated
|
||||
protected Predicate<NodeMetadata> serverSuspended(NodeSuspended stateSuspended, Timeouts timeouts) {
|
||||
return timeouts.nodeSuspended == 0 ? stateSuspended : new RetryablePredicate<NodeMetadata>(stateSuspended,
|
||||
timeouts.nodeSuspended);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("SCRIPT_COMPLETE")
|
||||
|
|
|
@ -22,11 +22,8 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.util.CredentialUtils;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
@ -128,33 +125,16 @@ public class RunScriptOptions {
|
|||
return delegate.shouldWrapInInitScript();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public RunScriptOptions overrideLoginUserWith(String loginUser) {
|
||||
throw new IllegalArgumentException("loginUser is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunScriptOptions overrideLoginUser(String loginUser) {
|
||||
throw new IllegalArgumentException("loginUser is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunScriptOptions overrideLoginCredentialWith(String loginCredential) {
|
||||
throw new IllegalArgumentException("loginCredential is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunScriptOptions wrapInInitScript(boolean wrapInInitScript) {
|
||||
throw new IllegalArgumentException("wrapInInitScript is immutable");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public RunScriptOptions overrideCredentialsWith(Credentials overridingCredentials) {
|
||||
throw new IllegalArgumentException("overridingCredentials is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return delegate.getTaskName();
|
||||
|
@ -193,15 +173,6 @@ public class RunScriptOptions {
|
|||
protected Optional<String> loginPassword;
|
||||
protected Optional<String> loginPrivateKey;
|
||||
|
||||
/**
|
||||
* to be removed in jclouds 1.4.0
|
||||
* @see #overrideLoginCredentials
|
||||
*/
|
||||
@Deprecated
|
||||
public RunScriptOptions overrideCredentialsWith(Credentials overridingCredentials) {
|
||||
return overrideLoginCredentials(LoginCredentials.fromCredentials(overridingCredentials));
|
||||
}
|
||||
|
||||
public RunScriptOptions overrideLoginCredentials(LoginCredentials overridingCredentials) {
|
||||
checkNotNull(overridingCredentials, "overridingCredentials");
|
||||
this.loginUser = overridingCredentials.getUser();
|
||||
|
@ -211,14 +182,6 @@ public class RunScriptOptions {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* to be removed in jclouds 1.4.0
|
||||
* @see #overrideLoginCredentials
|
||||
*/
|
||||
@Deprecated
|
||||
public RunScriptOptions overrideLoginUserWith(String loginUser) {
|
||||
return overrideLoginUser(loginUser);
|
||||
}
|
||||
|
||||
public RunScriptOptions overrideLoginUser(String loginUser) {
|
||||
checkNotNull(loginUser, "loginUser");
|
||||
|
@ -226,23 +189,6 @@ public class RunScriptOptions {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* to be removed in jclouds 1.4.0
|
||||
* @see #overrideLoginCredentials
|
||||
*/
|
||||
@Deprecated
|
||||
public RunScriptOptions overrideLoginCredentialWith(String loginCredential) {
|
||||
checkNotNull(loginCredential, "loginCredential");
|
||||
if (CredentialUtils.isPrivateKeyCredential(loginCredential)) {
|
||||
this.loginPrivateKey = Optional.of(loginCredential);
|
||||
this.loginPassword = Optional.absent();
|
||||
} else {
|
||||
this.loginPrivateKey = Optional.absent();
|
||||
this.loginPassword = Optional.of(loginCredential);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public RunScriptOptions overrideLoginPassword(String password) {
|
||||
checkNotNull(password, "password");
|
||||
this.loginPassword = Optional.of(password);
|
||||
|
@ -350,17 +296,6 @@ public class RunScriptOptions {
|
|||
return authenticateSudo;
|
||||
}
|
||||
|
||||
/**
|
||||
* This will be removed in jclouds 1.4.0
|
||||
* @see #getLoginPassword
|
||||
* @see #getLoginPrivateKey
|
||||
* @see #getLoginUser
|
||||
*/
|
||||
@Deprecated
|
||||
public Credentials getOverridingCredentials() {
|
||||
return DefaultCredentialsFromImageOrOverridingCredentials.overrideDefaultCredentialsWithOptionsIfPresent(null, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the login password has been configured
|
||||
*/
|
||||
|
@ -444,12 +379,6 @@ public class RunScriptOptions {
|
|||
return options.nameTask(name);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static RunScriptOptions overrideLoginUserWith(String user) {
|
||||
RunScriptOptions options = new RunScriptOptions();
|
||||
return options.overrideLoginUserWith(user);
|
||||
}
|
||||
|
||||
public static RunScriptOptions overrideLoginUser(String user) {
|
||||
RunScriptOptions options = new RunScriptOptions();
|
||||
return options.overrideLoginUser(user);
|
||||
|
@ -470,18 +399,6 @@ public class RunScriptOptions {
|
|||
return options.overrideAuthenticateSudo(authenticateSudo);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static RunScriptOptions overrideLoginCredentialWith(String credential) {
|
||||
RunScriptOptions options = new RunScriptOptions();
|
||||
return options.overrideLoginCredentialWith(credential);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static RunScriptOptions overrideCredentialsWith(Credentials credentials) {
|
||||
RunScriptOptions options = new RunScriptOptions();
|
||||
return options.overrideCredentialsWith(credentials);
|
||||
}
|
||||
|
||||
public static RunScriptOptions overrideLoginCredentials(LoginCredentials credentials) {
|
||||
RunScriptOptions options = new RunScriptOptions();
|
||||
return options.overrideLoginCredentials(credentials);
|
||||
|
|
|
@ -22,22 +22,18 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.scriptbuilder.domain.Statement;
|
||||
import org.jclouds.scriptbuilder.domain.Statements;
|
||||
import org.jclouds.util.Strings2;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
@ -153,11 +149,6 @@ public class TemplateOptions extends RunScriptOptions implements Cloneable {
|
|||
return delegate.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateOptions runScript(Payload script) {
|
||||
throw new IllegalArgumentException("script is immutable");
|
||||
}
|
||||
|
||||
/**
|
||||
* unsupported as objects of this class are immutable
|
||||
*/
|
||||
|
@ -236,28 +227,11 @@ public class TemplateOptions extends RunScriptOptions implements Cloneable {
|
|||
return delegate.getLoginPrivateKey();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public TemplateOptions overrideCredentialsWith(Credentials overridingCredentials) {
|
||||
throw new IllegalArgumentException("overridingCredentials is immutable");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public TemplateOptions overrideLoginUserWith(String loginUser) {
|
||||
throw new IllegalArgumentException("loginUser is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateOptions overrideLoginUser(String loginUser) {
|
||||
throw new IllegalArgumentException("loginUser is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateOptions overrideLoginCredentialWith(String loginCredential) {
|
||||
throw new IllegalArgumentException("loginCredential is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends TemplateOptions> T as(Class<T> clazz) {
|
||||
return delegate.as(clazz);
|
||||
|
@ -409,23 +383,6 @@ public class TemplateOptions extends RunScriptOptions implements Cloneable {
|
|||
return clazz.cast(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* to be removed in jclouds 1.4.0
|
||||
*
|
||||
* @see TemplateOptions#runScript(Statement)
|
||||
* @see org.jclouds.io.Payloads
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public TemplateOptions runScript(Payload script) {
|
||||
try {
|
||||
return runScript(Strings2.toStringAndClose(checkNotNull(script, "script").getInput()));
|
||||
} catch (IOException e) {
|
||||
Throwables.propagate(e);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This script will be executed as the root user upon system startup. This
|
||||
* script gets a prologue, so no #!/bin/bash required, path set up, etc
|
||||
|
@ -494,12 +451,6 @@ public class TemplateOptions extends RunScriptOptions implements Cloneable {
|
|||
return options.nameTask(name);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static TemplateOptions overrideLoginUserWith(String user) {
|
||||
TemplateOptions options = new TemplateOptions();
|
||||
return options.overrideLoginUserWith(user);
|
||||
}
|
||||
|
||||
public static TemplateOptions overrideLoginUser(String user) {
|
||||
TemplateOptions options = new TemplateOptions();
|
||||
return options.overrideLoginUser(user);
|
||||
|
@ -520,18 +471,6 @@ public class TemplateOptions extends RunScriptOptions implements Cloneable {
|
|||
return options.overrideAuthenticateSudo(authenticateSudo);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static TemplateOptions overrideLoginCredentialWith(String credential) {
|
||||
TemplateOptions options = new TemplateOptions();
|
||||
return options.overrideLoginCredentialWith(credential);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static TemplateOptions overrideCredentialsWith(Credentials credentials) {
|
||||
TemplateOptions options = new TemplateOptions();
|
||||
return options.overrideCredentialsWith(credentials);
|
||||
}
|
||||
|
||||
public static TemplateOptions overrideLoginCredentials(LoginCredentials credentials) {
|
||||
TemplateOptions options = new TemplateOptions();
|
||||
return options.overrideLoginCredentials(credentials);
|
||||
|
@ -590,16 +529,6 @@ public class TemplateOptions extends RunScriptOptions implements Cloneable {
|
|||
return options.runScript(script);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#runScript(Statement)
|
||||
* @see org.jclouds.io.Payloads
|
||||
*/
|
||||
@Deprecated
|
||||
public static TemplateOptions runScript(Payload script) {
|
||||
TemplateOptions options = new TemplateOptions();
|
||||
return options.runScript(script);
|
||||
}
|
||||
|
||||
/**
|
||||
* please use alternative that uses the {@link org.jclouds.io.Payload}
|
||||
* object
|
||||
|
@ -717,24 +646,6 @@ public class TemplateOptions extends RunScriptOptions implements Cloneable {
|
|||
return TemplateOptions.class.cast(super.blockOnComplete(blockOnComplete));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public TemplateOptions overrideCredentialsWith(Credentials overridingCredentials) {
|
||||
return TemplateOptions.class.cast(super.overrideCredentialsWith(overridingCredentials));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public TemplateOptions overrideLoginUserWith(String loginUser) {
|
||||
return TemplateOptions.class.cast(super.overrideLoginUserWith(loginUser));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public TemplateOptions overrideLoginCredentialWith(String loginCredential) {
|
||||
return TemplateOptions.class.cast(super.overrideLoginCredentialWith(loginCredential));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials) {
|
||||
return TemplateOptions.class.cast(super.overrideLoginCredentials(overridingCredentials));
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
/**
|
||||
* 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.predicates;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
*
|
||||
* Tests to see if a node is active.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @see RefreshAndDoubleCheckOnFailUnlessStateInvalid
|
||||
*/
|
||||
@Deprecated
|
||||
@Singleton
|
||||
public class NodePresentAndInIntendedState implements Predicate<NodeMetadata> {
|
||||
|
||||
private final GetNodeMetadataStrategy client;
|
||||
private final NodeState intended;
|
||||
private final Set<NodeState> invalids;
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public NodePresentAndInIntendedState(NodeState intended, GetNodeMetadataStrategy client) {
|
||||
this(intended, ImmutableSet.of(NodeState.ERROR), client);
|
||||
}
|
||||
|
||||
public NodePresentAndInIntendedState(NodeState intended, Set<NodeState> invalids, GetNodeMetadataStrategy client) {
|
||||
this.intended = intended;
|
||||
this.client = client;
|
||||
this.invalids = invalids;
|
||||
}
|
||||
|
||||
public boolean apply(NodeMetadata node) {
|
||||
logger.trace("looking for state on node %s", checkNotNull(node, "node"));
|
||||
node = refresh(node);
|
||||
if (node == null)
|
||||
return false;
|
||||
logger.trace("%s: looking for node state %s: currently: %s", node.getId(), intended, node.getState());
|
||||
if (invalids.contains(node.getState()))
|
||||
throw new IllegalStateException("node " + node.getId() + " in location " + node.getLocation()
|
||||
+ " is in invalid state "+node.getState());
|
||||
return node.getState() == intended;
|
||||
}
|
||||
|
||||
private NodeMetadata refresh(NodeMetadata node) {
|
||||
if (node == null || node.getId() == null)
|
||||
return null;
|
||||
return client.getNode(node.getId());
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/**
|
||||
* 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.predicates;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
*
|
||||
* Tests to see if a node is running.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @see AtomicNodeRunning
|
||||
*/
|
||||
@Singleton
|
||||
@Deprecated
|
||||
public class NodeRunning extends NodePresentAndInIntendedState {
|
||||
|
||||
@Inject
|
||||
public NodeRunning(GetNodeMetadataStrategy client) {
|
||||
super(NodeState.RUNNING, ImmutableSet.of(NodeState.ERROR, NodeState.TERMINATED), client);
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/**
|
||||
* 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.predicates;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
*
|
||||
* Tests to see if a node is suspended.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @see AtomicNodeSuspended
|
||||
*/
|
||||
@Singleton
|
||||
@Deprecated
|
||||
public class NodeSuspended extends NodePresentAndInIntendedState {
|
||||
|
||||
@Inject
|
||||
public NodeSuspended(GetNodeMetadataStrategy client) {
|
||||
super(NodeState.SUSPENDED, client);
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
/**
|
||||
* 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.predicates;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
*
|
||||
* Tests to see if a node is deleted
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @see TrueIfNullOrTerminatedRefreshAndDoubleCheckOnFalse
|
||||
*/
|
||||
@Singleton
|
||||
@Deprecated
|
||||
public class NodeTerminated implements Predicate<NodeMetadata> {
|
||||
|
||||
private final GetNodeMetadataStrategy client;
|
||||
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Inject
|
||||
public NodeTerminated(GetNodeMetadataStrategy client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public boolean apply(NodeMetadata node) {
|
||||
logger.trace("looking for state on node %s", checkNotNull(node, "node"));
|
||||
node = refresh(node);
|
||||
if (node == null)
|
||||
return true;
|
||||
logger.trace("%s: looking for node state %s: currently: %s",
|
||||
node.getId(), NodeState.TERMINATED, node.getState());
|
||||
return node.getState() == NodeState.TERMINATED;
|
||||
}
|
||||
|
||||
private NodeMetadata refresh(NodeMetadata node) {
|
||||
return client.getNode(node.getId());
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@
|
|||
org.jclouds.compute.options.TemplateOptions$Builder
|
||||
org.jclouds.compute.options.RunScriptOptions
|
||||
org.jclouds.compute.options.RunScriptOptions$Builder
|
||||
org.jclouds.domain.Credentials
|
||||
org.jclouds.domain.LoginCredentials
|
||||
java.util.NoSuchElementException
|
||||
))
|
||||
|
||||
|
@ -99,7 +99,7 @@ list, Alan Dipert and MeikelBrandmeyer."
|
|||
|
||||
(deftest run-script-on-nodes-matching-with-options-test
|
||||
(let [echo (Statements/exec "echo hello")
|
||||
script-options (.. (RunScriptOptions$Builder/overrideCredentialsWith (Credentials. "user" "password"))
|
||||
script-options (.. (RunScriptOptions$Builder/overrideLoginCredentials (.build (.password (.user (org.jclouds.domain.LoginCredentials/builder) "user") "pwd")))
|
||||
(runAsRoot false)
|
||||
(wrapInInitScript false))
|
||||
pred #(= (.getGroup %) "scriptednode")]
|
||||
|
@ -110,7 +110,7 @@ list, Alan Dipert and MeikelBrandmeyer."
|
|||
|
||||
(deftest run-script-on-node-with-options-test
|
||||
(let [echo (Statements/exec "echo hello")
|
||||
script-options (.. (RunScriptOptions$Builder/overrideCredentialsWith (Credentials. "user" "password"))
|
||||
script-options (.. (RunScriptOptions$Builder/overrideLoginCredentials (.build (.password (.user (org.jclouds.domain.LoginCredentials/builder) "user") "pwd")))
|
||||
(runAsRoot false)
|
||||
(wrapInInitScript false))
|
||||
test_node (create-node compute-stub "scriptednode" (build-template compute-stub {}))]
|
||||
|
@ -128,23 +128,23 @@ list, Alan Dipert and MeikelBrandmeyer."
|
|||
(is (> (-> (build-template service {:min-ram 512})
|
||||
bean :hardware bean :ram)
|
||||
512))
|
||||
(let [credentials (org.jclouds.domain.Credentials. "user" "pwd")
|
||||
(let [credentials (.build (.password (.user (org.jclouds.domain.LoginCredentials/builder) "user") "pwd"))
|
||||
f (juxt #(.identity %) #(.credential %))
|
||||
template (build-template
|
||||
service
|
||||
{:override-credentials-with credentials})
|
||||
{:override-login-credentials credentials})
|
||||
node (create-node service "something" template)]
|
||||
(is (= (-> node bean :credentials f)
|
||||
(f credentials)))
|
||||
(let [identity "fred"
|
||||
f #(.identity %)
|
||||
template (build-template service {:override-login-user-with identity})
|
||||
template (build-template service {:override-login-user identity})
|
||||
node (create-node service "something" template)]
|
||||
(is (= (-> node bean :credentials f) identity)))
|
||||
(let [credential "fred"
|
||||
f #(.credential %)
|
||||
template (build-template
|
||||
service {:override-login-credential-with credential})
|
||||
service {:override-login-password credential})
|
||||
node (create-node service "something" template)]
|
||||
(is (= (-> node bean :credentials f) credential)))))
|
||||
(testing "enumerated"
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
/**
|
||||
* 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.predicates;
|
||||
|
||||
import static org.easymock.EasyMock.expect;
|
||||
import static org.easymock.classextension.EasyMock.createMock;
|
||||
import static org.easymock.classextension.EasyMock.replay;
|
||||
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests possible uses of OperatingSystemPredicates
|
||||
*
|
||||
* @author Aled Sage
|
||||
*/
|
||||
@Test(singleThreaded = true, testName = "NodePredicatesTest")
|
||||
public class NodePredicatesTest {
|
||||
|
||||
private NodeMetadata node;
|
||||
private GetNodeMetadataStrategy computeService;
|
||||
|
||||
@BeforeMethod
|
||||
public void setUp() throws Exception {
|
||||
node = createMock(NodeMetadata.class);
|
||||
computeService = createMock(GetNodeMetadataStrategy.class);
|
||||
|
||||
expect(node.getId()).andReturn("myid").anyTimes();
|
||||
expect(computeService.getNode("myid")).andReturn(node).anyTimes();
|
||||
expect(node.getLocation()).andReturn(null).anyTimes();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNodeRunningReturnsTrueWhenRunning() {
|
||||
expect(node.getState()).andReturn(NodeState.RUNNING).atLeastOnce();
|
||||
replay(node);
|
||||
replay(computeService);
|
||||
|
||||
NodeRunning nodeRunning = new NodeRunning(computeService);
|
||||
Assert.assertTrue(nodeRunning.apply(node));
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = IllegalStateException.class)
|
||||
public void testNodeRunningFailsOnTerminated() {
|
||||
expect(node.getState()).andReturn(NodeState.TERMINATED).atLeastOnce();
|
||||
replay(node);
|
||||
replay(computeService);
|
||||
|
||||
NodeRunning nodeRunning = new NodeRunning(computeService);
|
||||
nodeRunning.apply(node);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = IllegalStateException.class)
|
||||
public void testNodeRunningFailsOnError() {
|
||||
expect(node.getState()).andReturn(NodeState.ERROR).atLeastOnce();
|
||||
replay(node);
|
||||
replay(computeService);
|
||||
|
||||
NodeRunning nodeRunning = new NodeRunning(computeService);
|
||||
nodeRunning.apply(node);
|
||||
}
|
||||
}
|
|
@ -25,7 +25,6 @@ import java.util.Map;
|
|||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.glesys.features.ServerClient;
|
||||
import org.jclouds.io.Payload;
|
||||
|
||||
import com.google.common.net.InetAddresses;
|
||||
|
||||
|
@ -115,14 +114,6 @@ public class GleSYSTemplateOptions extends TemplateOptions implements Cloneable
|
|||
return GleSYSTemplateOptions.class.cast(options.blockOnPort(port, seconds));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#runScript(Payload)
|
||||
*/
|
||||
public static GleSYSTemplateOptions runScript(Payload script) {
|
||||
GleSYSTemplateOptions options = new GleSYSTemplateOptions();
|
||||
return GleSYSTemplateOptions.class.cast(options.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#userMetadata(Map)
|
||||
*/
|
||||
|
@ -174,15 +165,6 @@ public class GleSYSTemplateOptions extends TemplateOptions implements Cloneable
|
|||
return GleSYSTemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#runScript(Payload)
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public GleSYSTemplateOptions runScript(Payload script) {
|
||||
return GleSYSTemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -29,7 +29,6 @@ import javax.xml.bind.annotation.XmlAttribute;
|
|||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
@ -133,14 +132,6 @@ public class ResourceType {
|
|||
this.links = builder.links == null ? Collections.<Link>emptySet() : builder.links;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ResourceType(URI href, String type, @Nullable Set<Link> links) {
|
||||
this.href = href;
|
||||
this.type = type;
|
||||
// nullable so that jaxb wont persist empty collections?
|
||||
this.links = links == null ? Collections.<Link>emptySet() : links;
|
||||
}
|
||||
|
||||
protected ResourceType() {
|
||||
// For JAXB
|
||||
}
|
||||
|
|
|
@ -27,12 +27,11 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.jclouds.aws.ec2.options.RequestSpotInstancesOptions;
|
||||
import org.jclouds.cloudwatch.CloudWatchClient;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.ec2.compute.options.EC2TemplateOptions;
|
||||
import org.jclouds.ec2.domain.BlockDeviceMapping;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.scriptbuilder.domain.Statement;
|
||||
import org.jclouds.util.Preconditions2;
|
||||
|
@ -177,11 +176,6 @@ public class AWSEC2TemplateOptions extends EC2TemplateOptions implements Cloneab
|
|||
}
|
||||
|
||||
public static class Builder {
|
||||
@Deprecated
|
||||
public static AWSEC2TemplateOptions overrideLoginUserWith(String user) {
|
||||
AWSEC2TemplateOptions options = new AWSEC2TemplateOptions();
|
||||
return options.overrideLoginUserWith(user);
|
||||
}
|
||||
|
||||
public static AWSEC2TemplateOptions overrideLoginUser(String user) {
|
||||
AWSEC2TemplateOptions options = new AWSEC2TemplateOptions();
|
||||
|
@ -203,18 +197,6 @@ public class AWSEC2TemplateOptions extends EC2TemplateOptions implements Cloneab
|
|||
return options.overrideAuthenticateSudo(authenticateSudo);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static AWSEC2TemplateOptions overrideLoginCredentialWith(String credential) {
|
||||
AWSEC2TemplateOptions options = new AWSEC2TemplateOptions();
|
||||
return options.overrideLoginCredentialWith(credential);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static AWSEC2TemplateOptions overrideCredentialsWith(Credentials credentials) {
|
||||
AWSEC2TemplateOptions options = new AWSEC2TemplateOptions();
|
||||
return options.overrideCredentialsWith(credentials);
|
||||
}
|
||||
|
||||
public static AWSEC2TemplateOptions overrideLoginCredentials(LoginCredentials credentials) {
|
||||
AWSEC2TemplateOptions options = new AWSEC2TemplateOptions();
|
||||
return options.overrideLoginCredentials(credentials);
|
||||
|
@ -550,15 +532,6 @@ public class AWSEC2TemplateOptions extends EC2TemplateOptions implements Cloneab
|
|||
return AWSEC2TemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public AWSEC2TemplateOptions runScript(Payload script) {
|
||||
return AWSEC2TemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -599,33 +572,6 @@ public class AWSEC2TemplateOptions extends EC2TemplateOptions implements Cloneab
|
|||
return AWSEC2TemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public AWSEC2TemplateOptions overrideCredentialsWith(Credentials overridingCredentials) {
|
||||
return AWSEC2TemplateOptions.class.cast(super.overrideCredentialsWith(overridingCredentials));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public AWSEC2TemplateOptions overrideLoginUserWith(String loginUser) {
|
||||
return AWSEC2TemplateOptions.class.cast(super.overrideLoginUserWith(loginUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public AWSEC2TemplateOptions overrideLoginCredentialWith(String loginCredential) {
|
||||
return AWSEC2TemplateOptions.class.cast(super.overrideLoginCredentialWith(loginCredential));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Map;
|
|||
|
||||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.io.Payload;
|
||||
|
||||
/**
|
||||
* Contains options supported by the
|
||||
|
@ -86,14 +85,6 @@ public class GoGridTemplateOptions extends TemplateOptions implements Cloneable
|
|||
return GoGridTemplateOptions.class.cast(options.blockOnPort(port, seconds));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#runScript(Payload)
|
||||
*/
|
||||
public static GoGridTemplateOptions runScript(Payload script) {
|
||||
GoGridTemplateOptions options = new GoGridTemplateOptions();
|
||||
return GoGridTemplateOptions.class.cast(options.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#userMetadata(Map)
|
||||
*/
|
||||
|
@ -145,15 +136,6 @@ public class GoGridTemplateOptions extends TemplateOptions implements Cloneable
|
|||
return GoGridTemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#runScript(Payload)
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public GoGridTemplateOptions runScript(Payload script) {
|
||||
return GoGridTemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -170,15 +170,6 @@ public class SoftLayerTemplateOptions extends TemplateOptions implements Cloneab
|
|||
return SoftLayerTemplateOptions.class.cast(super.installPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TemplateOptions#runScript(Payload)
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public SoftLayerTemplateOptions runScript(Payload script) {
|
||||
return SoftLayerTemplateOptions.class.cast(super.runScript(script));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue