mirror of https://github.com/apache/jclouds.git
rewrote aws config to use standard op names
This commit is contained in:
parent
95b1849199
commit
b3901deeb9
|
@ -82,7 +82,7 @@ public class EC2ApiMetadata extends BaseRestApiMetadata {
|
|||
public static Properties defaultProperties() {
|
||||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "default", MINUTES.toMillis(3) + "");
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "AMIClient.describeImagesInRegion", MINUTES.toMillis(5) + "");
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "ec2:DescribeImages", MINUTES.toMillis(5) + "");
|
||||
properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
|
||||
properties.setProperty(PROPERTY_HEADER_TAG, "amz");
|
||||
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "*");
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.jclouds.s3;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.jclouds.Constants.PROPERTY_API_VERSION;
|
||||
import static org.jclouds.Constants.PROPERTY_RELAX_HOSTNAME;
|
||||
|
@ -86,10 +85,9 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
|
|||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "default", SECONDS.toMillis(90) + "");
|
||||
// 512KB/s for max size of 5GB
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "S3Client.getObject", SECONDS.toMillis(5242880 / 512) + "");
|
||||
// 128KB/s for max size of 5GB
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "S3Client.putObject", SECONDS.toMillis(5242880 / 128) + "");
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "S3Client.copyObject", MINUTES.toMillis(10) + "");
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "s3:GetObject", SECONDS.toMillis(5242880 / 512) + "");
|
||||
// 128KB/s for max size of 5GB; applies also to copy object, upload part
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "s3:PutObject", SECONDS.toMillis(5242880 / 128) + "");
|
||||
properties.setProperty(PROPERTY_API_VERSION, S3AsyncClient.VERSION);
|
||||
properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
|
||||
properties.setProperty(PROPERTY_HEADER_TAG, S3Headers.DEFAULT_AMAZON_HEADERTAG);
|
||||
|
|
|
@ -65,7 +65,7 @@ public class SQSApiMetadata extends BaseRestApiMetadata {
|
|||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "default", SECONDS.toMillis(30) + "");
|
||||
// this will gracefully attempt to resolve name issues
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "QueueApi.create", SECONDS.toMillis(61) + "");
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "sqs:CreateQueue", SECONDS.toMillis(61) + "");
|
||||
properties.setProperty(CREATE_QUEUE_MAX_RETRIES, "60");
|
||||
properties.setProperty(CREATE_QUEUE_RETRY_INTERVAL, "1000");
|
||||
properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
|
||||
|
|
|
@ -1,107 +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.concurrent.internal;
|
||||
|
||||
import static org.easymock.EasyMock.createMock;
|
||||
import static org.easymock.EasyMock.expect;
|
||||
import static org.easymock.EasyMock.replay;
|
||||
import static org.easymock.EasyMock.verify;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Tests behavior of ListenableFutureExceptionParser
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", enabled = false, singleThreaded = true)
|
||||
public class SyncProxyTest {
|
||||
|
||||
static ListenableFuture<String> future;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@BeforeMethod
|
||||
void createMockedFuture() throws InterruptedException, ExecutionException, TimeoutException {
|
||||
future = createMock(ListenableFuture.class);
|
||||
expect(future.get(250000000, TimeUnit.NANOSECONDS)).andReturn("foo");
|
||||
replay(future);
|
||||
}
|
||||
|
||||
public static class Async {
|
||||
public ListenableFuture<String> get() {
|
||||
return future;
|
||||
}
|
||||
}
|
||||
|
||||
private static interface Sync {
|
||||
String get();
|
||||
}
|
||||
|
||||
public void testWithDefaultPropTimeout() throws Exception {
|
||||
Sync withOverride = syncProxyForTimeouts(ImmutableMap.of("default", 250L));
|
||||
assertEquals(withOverride.get(), "foo");
|
||||
verify(future);
|
||||
}
|
||||
|
||||
public void testWithClassPropTimeout() throws Exception {
|
||||
Sync withOverride = syncProxyForTimeouts(ImmutableMap.of("default", 50L, "Sync", 250L));
|
||||
assertEquals(withOverride.get(), "foo");
|
||||
verify(future);
|
||||
}
|
||||
|
||||
public void testWithMethodPropTimeout() throws Exception {
|
||||
Sync withOverride = syncProxyForTimeouts(ImmutableMap.of("default", 50L, "Sync", 100L, "Sync.get", 250L));
|
||||
assertEquals(withOverride.get(), "foo");
|
||||
verify(future);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testWithMethodWithNoTimeoutsCallGetDirectly() throws Exception {
|
||||
future = createMock(ListenableFuture.class);
|
||||
expect(future.get()).andReturn("foo");
|
||||
replay(future);
|
||||
|
||||
Sync noOverrides = syncProxyForTimeouts(ImmutableMap.<String, Long> of());
|
||||
|
||||
assertEquals(noOverrides.get(), "foo");
|
||||
verify(future);
|
||||
}
|
||||
|
||||
private Sync syncProxyForTimeouts(ImmutableMap<String, Long> timeouts) throws NoSuchMethodException {
|
||||
// LoadingCache<ForwardInvocationToInterface, Object> cache = CacheBuilder.newBuilder().build(
|
||||
// CacheLoader.from(Functions.<Object> constant(null)));
|
||||
// return FunctionalReflection.newProxy(Sync.class, new SyncProxy(new AlwaysPresentImplicitOptionalConverter(),
|
||||
// cache, ImmutableMap.<Class<?>, Class<?>> of(Sync.class, Async.class), timeouts, Sync.class, new Async()));
|
||||
////
|
||||
// Function<InvocationSuccess, Optional<Object>> optionalConverter, SyncProxy.Factory factory,
|
||||
// AsyncRestClientProxy.Caller.Factory asyncFactory, Map<Class<?>, Class<?>> sync2Async,
|
||||
// @Named("TIMEOUTS") Map<String, Long> timeouts, @Assisted Class<?> declaring, @Assisted Object async
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -57,7 +57,7 @@ public class CloudStackEC2ApiMetadata extends EC2ApiMetadata {
|
|||
|
||||
public static Properties defaultProperties() {
|
||||
Properties properties = EC2ApiMetadata.defaultProperties();
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "AMIClient.describeImagesInRegion", MINUTES.toMillis(15) + "");
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "ec2:DescribeImages", MINUTES.toMillis(15) + "");
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ public class AWSEC2ApiMetadata extends EC2ApiMetadata {
|
|||
public static Properties defaultProperties() {
|
||||
Properties properties = EC2ApiMetadata.defaultProperties();
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "default", SECONDS.toMillis(90) + "");
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "AWSAMIClient.describeImagesInRegion", MINUTES.toMillis(5) + "");
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "SpotInstanceClient.describeSpotPriceHistoryInRegion", MINUTES.toMillis(2) + "");
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "ec2:DescribeImages", MINUTES.toMillis(5) + "");
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "ec2:DescribeSpotInstanceRequests", MINUTES.toMillis(2) + "");
|
||||
properties.remove(PROPERTY_EC2_AMI_OWNERS);
|
||||
// auth fail sometimes happens in EC2, as the rc.local script that injects the
|
||||
// authorized key executes after ssh has started.
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
*/
|
||||
package org.jclouds.aws.s3;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.jclouds.Constants.PROPERTY_TIMEOUTS_PREFIX;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.apis.ApiMetadata;
|
||||
|
@ -60,8 +57,6 @@ public class AWSS3ApiMetadata extends S3ApiMetadata {
|
|||
|
||||
public static Properties defaultProperties() {
|
||||
Properties properties = S3ApiMetadata.defaultProperties();
|
||||
// 128KB/s for max size of 5GB
|
||||
properties.setProperty(PROPERTY_TIMEOUTS_PREFIX + "AWSS3Client.uploadPart", SECONDS.toMillis(5242880 / 128) + "");
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue