regressions for beta-7

This commit is contained in:
Adrian Cole 2010-09-19 19:12:44 -07:00
parent 1b113808d4
commit 1981b15837
17 changed files with 115 additions and 50 deletions

View File

@ -127,6 +127,14 @@
<name>test.initializer</name>
<value>${test.initializer}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.url</name>
<value>${jclouds.blobstore.httpstream.url}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.md5</name>
<value>${jclouds.blobstore.httpstream.md5}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -43,12 +43,13 @@ import org.jclouds.aws.ec2.domain.KeyPair;
import org.jclouds.aws.ec2.domain.PlacementGroup;
import org.jclouds.aws.ec2.domain.PlacementGroup.State;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.internal.BaseComputeService;
import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.compute.strategy.DestroyNodeStrategy;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.strategy.ListNodesStrategy;
@ -81,14 +82,14 @@ public class EC2ComputeService extends BaseComputeService {
DestroyNodeStrategy destroyNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
Provider<TemplateOptions> templateOptionsProvider,
@Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning,
@Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils,
@Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils, Timeouts timeouts,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, EC2Client ec2Client,
Map<RegionAndName, KeyPair> credentialsMap, @Named("SECURITY") Map<RegionAndName, String> securityGroupMap,
@Named("PLACEMENT") Map<RegionAndName, String> placementGroupMap,
@Named("DELETED") Predicate<PlacementGroup> placementGroupDeleted) {
super(context, images, sizes, locations, listNodesStrategy, getNodeMetadataStrategy, runNodesAndAddToSetStrategy,
rebootNodeStrategy, destroyNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning,
nodeTerminated, utils, executor);
nodeTerminated, utils, timeouts, executor);
this.ec2Client = ec2Client;
this.credentialsMap = credentialsMap;
this.securityGroupMap = securityGroupMap;

View File

@ -271,6 +271,14 @@
<name>test.initializer</name>
<value>${test.initializer}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.url</name>
<value>${jclouds.blobstore.httpstream.url}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.md5</name>
<value>${jclouds.blobstore.httpstream.md5}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -140,6 +140,14 @@
<name>test.initializer</name>
<value>${test.initializer}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.url</name>
<value>${jclouds.blobstore.httpstream.url}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.md5</name>
<value>${jclouds.blobstore.httpstream.md5}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -73,7 +73,7 @@ public class AzureBlobClientLiveTest {
private String containerPrefix = System.getProperty("user.name") + "-azureblob";
private BlobStoreContext context;
protected String provider = "azurequeue";
protected String provider = "azureblob";
protected String identity;
protected String credential;
protected String endpoint;

View File

@ -127,7 +127,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
public Void apply(Blob from) {
try {
assertEquals(CryptoStreams.md5(from.getPayload()), oneHundredOneConstitutionsMD5);
checkContentDispostion(from, expectedContentDisposition);
checkContentDisposition(from, expectedContentDisposition);
} catch (IOException e) {
Throwables.propagate(e);
}
@ -156,16 +156,6 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
context.getBlobStore().putBlob(containerName, sourceObject);
}
/**
* Methods for checking Content-Disposition. In this way, in implementations that do not support
* the new field, it is easy to override with empty, and allow the rest of the test to work.
*
* @param blob
* @param expected
*/
protected void checkContentDispostion(Blob blob, String expected) {
assertEquals(blob.getPayload().getContentMetadata().getContentDisposition(), expected);
}
@Test(groups = { "integration", "live" })
public void testGetIfModifiedSince() throws InterruptedException {

View File

@ -30,6 +30,8 @@ import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nullable;
import javax.annotation.Resource;
@ -45,15 +47,16 @@ import org.jclouds.compute.RunNodesException;
import org.jclouds.compute.RunScriptOnNodesException;
import org.jclouds.compute.callables.RunScriptOnNode;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.options.RunScriptOptions;
import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.predicates.NodePredicates;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.compute.strategy.DestroyNodeStrategy;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.strategy.ListNodesStrategy;
@ -63,6 +66,7 @@ import org.jclouds.compute.util.ComputeUtils;
import org.jclouds.domain.Location;
import org.jclouds.io.Payload;
import org.jclouds.logging.Logger;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.ssh.ExecResponse;
import org.jclouds.ssh.SshClient;
@ -100,6 +104,7 @@ public class BaseComputeService implements ComputeService {
protected final Predicate<NodeMetadata> nodeRunning;
protected final Predicate<NodeMetadata> nodeTerminated;
protected final ComputeUtils utils;
protected final Timeouts timeouts;
protected final ExecutorService executor;
@Inject
@ -110,7 +115,7 @@ public class BaseComputeService implements ComputeService {
DestroyNodeStrategy destroyNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
Provider<TemplateOptions> templateOptionsProvider,
@Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning,
@Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils,
@Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils, Timeouts timeouts,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.context = checkNotNull(context, "context");
this.images = checkNotNull(images, "images");
@ -126,6 +131,7 @@ public class BaseComputeService implements ComputeService {
this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning");
this.nodeTerminated = checkNotNull(nodeTerminated, "nodeTerminated");
this.utils = checkNotNull(utils, "utils");
this.timeouts = checkNotNull(timeouts, "timeouts");
this.executor = checkNotNull(executor, "executor");
}
@ -145,9 +151,9 @@ public class BaseComputeService implements ComputeService {
throws RunNodesException {
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
checkNotNull(template.getLocation(), "location");
logger.debug(">> running %d node%s tag(%s) location(%s) image(%s) hardwareProfile(%s) options(%s)", count, count > 1 ? "s"
: "", tag, template.getLocation().getId(), template.getImage().getId(), template.getHardware().getId(),
template.getOptions());
logger.debug(">> running %d node%s tag(%s) location(%s) image(%s) hardwareProfile(%s) options(%s)", count,
count > 1 ? "s" : "", tag, template.getLocation().getId(), template.getImage().getId(), template
.getHardware().getId(), template.getOptions());
Set<NodeMetadata> nodes = Sets.newHashSet();
Map<NodeMetadata, Exception> badNodes = Maps.newLinkedHashMap();
Map<?, Future<Void>> responses = runNodesAndAddToSetStrategy.execute(tag, count, template, nodes, badNodes);
@ -179,11 +185,27 @@ public class BaseComputeService implements ComputeService {
* {@inheritDoc}
*/
@Override
public void destroyNode(String id) {
public void destroyNode(final String id) {
checkNotNull(id, "id");
logger.debug(">> destroying node(%s)", id);
NodeMetadata node = destroyNodeStrategy.execute(id);
boolean successful = node == null ? true : nodeTerminated.apply(node);
final AtomicReference<NodeMetadata> node = new AtomicReference<NodeMetadata>();
RetryablePredicate<String> tester = new RetryablePredicate<String>(new Predicate<String>() {
@Override
public boolean apply(String input) {
try {
NodeMetadata md = destroyNodeStrategy.execute(id);
if (md != null)
node.set(md);
return true;
} catch (IllegalStateException e) {
logger.warn("<< illegal state destroying node(%s)", id);
return false;
}
}
}, timeouts.nodeRunning, 1000, TimeUnit.MILLISECONDS);
boolean successful = tester.apply(id) && (node.get() == null || nodeTerminated.apply(node.get()));
logger.debug("<< destroyed node(%s) success(%s)", id, successful);
}

View File

@ -43,7 +43,7 @@ public interface ComputeServiceConstants {
public static final String PROPERTY_BLACKLIST_NODES = "jclouds.compute.blacklist.nodes";
@Singleton
static class Timeouts {
public static class Timeouts {
@Inject(optional = true)
@Named(PROPERTY_TIMEOUT_NODE_TERMINATED)
public long nodeTerminated = 30 * 1000;

View File

@ -170,9 +170,8 @@ public abstract class BaseComputeServiceLiveTest {
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiversion = System.getProperty("test." + provider + ".apiversion");
}
protected Properties setupProperties() {

View File

@ -45,6 +45,7 @@ import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.ProvisionException;
/**
* Generates RESTful clients from appropriately annotated interfaces.
@ -132,6 +133,8 @@ public class SyncProxy implements InvocationHandler {
try {
return ((ListenableFuture<?>) methodMap.get(method).invoke(delegate, args)).get(timeoutMap.get(method),
TimeUnit.NANOSECONDS);
} catch (ProvisionException e) {
throw throwTypedExceptionOrCause(method.getExceptionTypes(), e);
} catch (ExecutionException e) {
throw throwTypedExceptionOrCause(method.getExceptionTypes(), e);
} catch (Exception e) {

View File

@ -40,8 +40,10 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.http.TransformingHttpCommand;
import org.jclouds.internal.ClassMethodArgs;
import org.jclouds.logging.Logger;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.InvocationContext;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.util.Utils;
import com.google.common.base.Function;
import com.google.common.util.concurrent.Futures;
@ -117,6 +119,9 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
((InvocationContext) exceptionParser).setContext((GeneratedHttpRequest<T>) request);
}
} catch (RuntimeException e) {
AuthorizationException aex = Utils.getFirstThrowableOfType(e, AuthorizationException.class);
if (aex != null)
e = aex;
if (exceptionParser != null) {
try {
return Futures.immediateFuture(exceptionParser.apply(e));

View File

@ -158,6 +158,14 @@
<name>test.initializer</name>
<value>${test.initializer}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.url</name>
<value>${jclouds.blobstore.httpstream.url}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.md5</name>
<value>${jclouds.blobstore.httpstream.md5}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -71,8 +71,10 @@ public class ParseCloudServersErrorFromHttpResponse implements HttpErrorHandler
break;
case 409:
exception = new IllegalStateException(content);
break;
default:
exception = new HttpResponseException(command, response, content);
break;
}
} finally {
releasePayload(response);

View File

@ -73,7 +73,7 @@ public class RackspaceAuthenticationLiveTest {
authentication.authenticate("foo", "bar").get(10, TimeUnit.SECONDS);
}
protected String provider = "rackspace";
protected String provider = "cloudservers";
protected String identity;
protected String credential;
protected String endpoint;

View File

@ -47,6 +47,10 @@ public interface VCloudError {
* A conflict was detected between sections of an OVF descriptor.
*/
CONFLICT,
/**
* The entity is busy
*/
BUSY_ENTITY,
/**
* An attempt to instantiate a vAppTemplate or use a vAppTemplate or a Vm in a composition did
* not include an AllEULAsAccepted element with a value of true.

View File

@ -41,6 +41,7 @@ import org.jclouds.util.Utils;
import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.VCloudResponseException;
import org.jclouds.vcloud.domain.VCloudError;
import org.jclouds.vcloud.domain.VCloudError.MinorCode;
import org.jclouds.vcloud.util.VCloudUtils;
/**
@ -87,7 +88,12 @@ public class ParseVCloudErrorFromHttpResponse implements HttpErrorHandler {
switch (response.getStatusCode()) {
case 400:
if (error != null && error.getMinorErrorCode() != null
&& error.getMinorErrorCode() == MinorCode.BUSY_ENTITY)
exception = new IllegalStateException(message, exception);
else
exception = new IllegalArgumentException(message, exception);
break;
case 401:
case 403:
exception = new AuthorizationException(command.getRequest(), message);

View File

@ -30,12 +30,13 @@ import javax.inject.Singleton;
import org.jclouds.Constants;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.internal.BaseComputeService;
import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.compute.strategy.DestroyNodeStrategy;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.strategy.ListNodesStrategy;
@ -65,19 +66,20 @@ public class TerremarkVCloudComputeService extends BaseComputeService {
ListNodesStrategy listNodesStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy,
RunNodesAndAddToSetStrategy runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy,
DestroyNodeStrategy destroyNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
Provider<TemplateOptions> templateOptionsProvider, @Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning,
@Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils,
Provider<TemplateOptions> templateOptionsProvider,
@Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning,
@Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils, Timeouts timeouts,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, CleanupOrphanKeys cleanupOrphanKeys,
ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap, NodeMetadataToOrgAndName nodeToOrgAndName) {
super(context, images, sizes, locations, listNodesStrategy, getNodeMetadataStrategy, runNodesAndAddToSetStrategy,
rebootNodeStrategy, destroyNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning,
nodeTerminated, utils, executor);
nodeTerminated, utils, timeouts, executor);
this.cleanupOrphanKeys = cleanupOrphanKeys;
}
/**
* like {@link BaseComputeService#destroyNodesMatching} except that this will
* clean implicit keypairs.
* like {@link BaseComputeService#destroyNodesMatching} except that this will clean implicit
* keypairs.
*/
@Override
public Set<? extends NodeMetadata> destroyNodesMatching(Predicate<NodeMetadata> filter) {
@ -87,8 +89,7 @@ public class TerremarkVCloudComputeService extends BaseComputeService {
}
/**
* returns template options, except of type
* {@link TerremarkVCloudTemplateOptions}.
* returns template options, except of type {@link TerremarkVCloudTemplateOptions}.
*/
@Override
public TerremarkVCloudTemplateOptions templateOptions() {