Issue 121: tuned timeouts

git-svn-id: http://jclouds.googlecode.com/svn/trunk@2294 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-11-16 00:19:49 +00:00
parent bc238bc507
commit df95eb10bb
7 changed files with 41 additions and 26 deletions

View File

@ -49,6 +49,8 @@ import org.jclouds.atmosonline.saas.functions.ParseObjectFromHeadersAndHttpConte
import org.jclouds.atmosonline.saas.functions.ParseSystemMetadataFromHeaders;
import org.jclouds.atmosonline.saas.functions.ReturnEndpointIfAlreadyExists;
import org.jclouds.atmosonline.saas.options.ListOptions;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.attr.ConsistencyModels;
import org.jclouds.blobstore.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.blobstore.functions.ThrowKeyNotFoundOn404;
import org.jclouds.http.functions.ReturnFalseOn404;
@ -73,6 +75,7 @@ import org.jclouds.rest.annotations.SkipEncoding;
@Endpoint(AtmosStorage.class)
@RequestFilters(SignRequest.class)
@SkipEncoding( { '/' })
@ConsistencyModel(ConsistencyModels.EVENTUAL)
public interface AtmosStorageAsyncClient {
AtmosObject newObject();

View File

@ -115,12 +115,15 @@ public interface CloudFilesClient {
boolean deleteContainerIfEmpty(String container);
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
ListContainerResponse<ObjectInfo> listObjects(String container, ListContainerOptions... options);
boolean containerExists(String container);
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
String putObject(String container, CFObject object);
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
CFObject getObject(String container, String name, GetOptions... options);
MutableObjectInfoWithMetadata getObjectInfo(String container, String name);

View File

@ -71,14 +71,17 @@ public class RackspaceAuthenticationRestModule extends AbstractModule {
protected AuthenticationResponse provideAuthenticationResponse(RestClientFactory factory,
@Named(PROPERTY_RACKSPACE_USER) String user, @Named(PROPERTY_RACKSPACE_KEY) String key)
throws InterruptedException, ExecutionException, TimeoutException {
return factory.create(RackspaceAuthentication.class).authenticate(user, key).get(10,TimeUnit.SECONDS);
return factory.create(RackspaceAuthentication.class).authenticate(user, key).get(30,
TimeUnit.SECONDS);
}
@Provides
@Authentication
protected String provideAuthenticationToken(RestClientFactory factory,
@Named(PROPERTY_RACKSPACE_USER) String user, @Named(PROPERTY_RACKSPACE_KEY) String key) throws InterruptedException, ExecutionException, TimeoutException {
return factory.create(RackspaceAuthentication.class).authenticate(user, key).get(10,TimeUnit.SECONDS).getAuthToken();
@Named(PROPERTY_RACKSPACE_USER) String user, @Named(PROPERTY_RACKSPACE_KEY) String key)
throws InterruptedException, ExecutionException, TimeoutException {
return factory.create(RackspaceAuthentication.class).authenticate(user, key).get(30,
TimeUnit.SECONDS).getAuthToken();
}
@Provides

View File

@ -110,14 +110,15 @@ public class CloudFilesClientLiveTest extends
assert cdnMetadata == null || !cdnMetadata.isCDNEnabled() : containerNameWithoutCDN
+ " should not have metadata";
} catch (ContainerNotFoundException e) {
} catch (HttpResponseException e) {
}
try {
cdnMetadata = context.getApi().getCDNMetadata("DoesNotExist");
assert false : "should not exist";
} catch (ContainerNotFoundException e) {
} catch (HttpResponseException e) {
}
// List CDN metadata for containers, and ensure all CDN info is available for enabled
// container
SortedSet<ContainerCDNMetadata> cdnMetadataList = context.getApi().listCDNContainers();
@ -169,7 +170,7 @@ public class CloudFilesClientLiveTest extends
assertTrue(context.getApi().disableCDN(containerNameWithCDN));
cdnMetadata = context.getApi().getCDNMetadata(containerNameWithCDN);
assertEquals(cdnMetadata.isCDNEnabled(), false);
assertEquals(cdnMetadata.isCDNEnabled(), false);
} finally {
recycleContainer(containerNameWithCDN);
recycleContainer(containerNameWithoutCDN);

View File

@ -162,11 +162,6 @@ public class CloudServersClientLiveTest {
assert null != response;
long serverCount = response.size();
assertTrue(serverCount >= 0);
for (Server server : response) {
Server newDetails = client.getServer(server.getId());
assertEquals(newDetails.getId(), server.getId());
// other verifications might fail due to other testing
}
}
public void testListFlavors() throws Exception {

View File

@ -41,11 +41,14 @@ import org.jclouds.vcloud.domain.VDC;
*/
@Timeout(duration = 45, timeUnit = TimeUnit.SECONDS)
public interface VCloudClient {
@Timeout(duration = 90, timeUnit = TimeUnit.SECONDS)
Catalog getCatalog();
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
VDC getDefaultVDC();
@Timeout(duration = 90, timeUnit = TimeUnit.SECONDS)
TasksList getDefaultTasksList();
Task deployVApp(int vAppId);

View File

@ -37,6 +37,7 @@ import org.jclouds.rest.RestClientFactory;
import org.jclouds.vcloud.VCloudAsyncClient;
import org.jclouds.vcloud.VCloudClient;
import org.jclouds.vcloud.VCloudDiscovery;
import org.jclouds.vcloud.domain.Organization;
import org.jclouds.vcloud.endpoints.Catalog;
import org.jclouds.vcloud.endpoints.Network;
import org.jclouds.vcloud.endpoints.TasksList;
@ -74,13 +75,6 @@ public class VCloudRestClientModule extends AbstractModule {
return SyncProxy.create(VCloudClient.class, client);
}
@Provides
@Catalog
@Singleton
protected URI provideCatalog(VCloudDiscovery discovery) throws InterruptedException, ExecutionException, TimeoutException {
return discovery.getOrganization().get(45, TimeUnit.SECONDS).getCatalog().getLocation();
}
@Provides
@CatalogItemRoot
@Singleton
@ -95,12 +89,25 @@ public class VCloudRestClientModule extends AbstractModule {
return vcloudUri.toASCIIString() + "/vapp";
}
@Provides
@Singleton
protected Organization provideOrganization(VCloudDiscovery discovery) throws ExecutionException,
TimeoutException, InterruptedException {
return discovery.getOrganization().get(60, TimeUnit.SECONDS);
}
@Provides
@VDC
@Singleton
protected URI provideDefaultVDC(VCloudDiscovery discovery) throws InterruptedException, ExecutionException, TimeoutException {
return discovery.getOrganization().get(45, TimeUnit.SECONDS).getVDCs().values().iterator()
.next().getLocation();
protected URI provideDefaultVDC(Organization org) {
return org.getVDCs().values().iterator().next().getLocation();
}
@Provides
@Catalog
@Singleton
protected URI provideCatalog(Organization org) {
return org.getCatalog().getLocation();
}
@Provides
@ -108,14 +115,14 @@ public class VCloudRestClientModule extends AbstractModule {
@Singleton
protected URI provideDefaultNetwork(VCloudAsyncClient client) throws InterruptedException,
ExecutionException, TimeoutException {
return client.getDefaultVDC().get(45, TimeUnit.SECONDS).getAvailableNetworks().values()
return client.getDefaultVDC().get(60, TimeUnit.SECONDS).getAvailableNetworks().values()
.iterator().next().getLocation();
}
@Provides
@TasksList
@Singleton
protected URI provideDefaultTasksList(VCloudDiscovery discovery) throws InterruptedException, ExecutionException, TimeoutException {
return discovery.getOrganization().get(45, TimeUnit.SECONDS).getTasksLists().values().iterator().next().getLocation();
protected URI provideDefaultTasksList(Organization org) {
return org.getTasksLists().values().iterator().next().getLocation();
}
}