mirror of https://github.com/apache/jclouds.git
Issue 980: timestamp on ec2 requests are in the future
This commit is contained in:
parent
d980b4fd42
commit
d29fbba783
|
@ -27,9 +27,6 @@ import java.net.URI;
|
|||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.apis.ApiMetadata;
|
||||
import org.jclouds.aws.domain.Region;
|
||||
import org.jclouds.aws.filters.FormSigner;
|
||||
|
@ -111,8 +108,7 @@ public class CloudWatchAsyncClientTest extends BaseAsyncClientTest<CloudWatchAsy
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String provideTimeStamp(final DateService dateService,
|
||||
@Named(Constants.PROPERTY_SESSION_INTERVAL) int expiration) {
|
||||
protected String provideTimeStamp(final DateService dateService) {
|
||||
return "2009-11-08T15:54:08.897Z";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,6 @@ import static com.google.common.collect.Maps.transformValues;
|
|||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.aws.domain.Region;
|
||||
import org.jclouds.cloudwatch.config.CloudWatchRestClientModule;
|
||||
import org.jclouds.date.DateService;
|
||||
|
@ -69,8 +66,7 @@ public class BaseCloudWatchExpectTest<T> extends BaseRestClientExpectTest<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String provideTimeStamp(final DateService dateService,
|
||||
@Named(Constants.PROPERTY_SESSION_INTERVAL) int expiration) {
|
||||
protected String provideTimeStamp(final DateService dateService) {
|
||||
return "2009-11-08T15:54:08.897Z";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,8 +59,7 @@ public abstract class BaseEC2ComputeServiceExpectTest<T> extends BaseRestClientE
|
|||
private static final class TestEC2RestClientModule extends EC2RestClientModule<EC2Client, EC2AsyncClient> {
|
||||
@Override
|
||||
@Provides
|
||||
protected String provideTimeStamp(final DateService dateService,
|
||||
@Named(Constants.PROPERTY_SESSION_INTERVAL) final int expiration) {
|
||||
protected String provideTimeStamp(DateService dateService) {
|
||||
return CONSTANT_DATE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public abstract class BaseEC2AsyncClientTest<T> extends BaseAsyncClientTest<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String provideTimeStamp(DateService dateService, int expiration) {
|
||||
protected String provideTimeStamp(DateService dateService) {
|
||||
return "2009-11-08T15:54:08.897Z";
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,8 @@ package org.jclouds.openstack.nova.ec2.internal;
|
|||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.date.DateService;
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
|
@ -45,8 +43,7 @@ public abstract class BaseNovaEC2RestClientExpectTest extends BaseRestClientExpe
|
|||
private static final class TestNovaEC2RestClientModule extends NovaEC2RestClientModule {
|
||||
@Override
|
||||
@Provides
|
||||
protected String provideTimeStamp(final DateService dateService,
|
||||
@Named(Constants.PROPERTY_SESSION_INTERVAL) final int expiration) {
|
||||
protected String provideTimeStamp(DateService dateService) {
|
||||
return CONSTANT_DATE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,8 @@ package org.jclouds.aws.config;
|
|||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.aws.filters.FormSigner;
|
||||
import org.jclouds.date.DateService;
|
||||
import org.jclouds.date.TimeStamp;
|
||||
|
@ -59,9 +57,8 @@ public abstract class FormSigningRestClientModule<S, A> extends AWSRestClientMod
|
|||
|
||||
@Provides
|
||||
@TimeStamp
|
||||
protected String provideTimeStamp(final DateService dateService,
|
||||
@Named(Constants.PROPERTY_SESSION_INTERVAL) final int expiration) {
|
||||
return dateService.iso8601DateFormat(new Date(System.currentTimeMillis() + (expiration * 1000)));
|
||||
protected String provideTimeStamp(DateService dateService) {
|
||||
return dateService.iso8601DateFormat(new Date(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
@ -23,9 +23,6 @@ import static org.testng.Assert.assertEquals;
|
|||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.apis.ApiMetadata;
|
||||
import org.jclouds.aws.filters.FormSigner;
|
||||
import org.jclouds.date.DateService;
|
||||
|
@ -162,8 +159,7 @@ public class ELBAsyncClientTest extends BaseAsyncClientTest<ELBAsyncClient> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String provideTimeStamp(final DateService dateService,
|
||||
@Named(Constants.PROPERTY_SESSION_INTERVAL) int expiration) {
|
||||
protected String provideTimeStamp(final DateService dateService) {
|
||||
return "2009-11-08T15:54:08.897Z";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public abstract class BaseAWSEC2AsyncClientTest<T> extends BaseAsyncClientTest<T
|
|||
protected static class StubAWSEC2RestClientModule extends AWSEC2RestClientModule {
|
||||
|
||||
@Override
|
||||
protected String provideTimeStamp(DateService dateService, int expiration) {
|
||||
protected String provideTimeStamp(DateService dateService) {
|
||||
return "2009-11-08T15:54:08.897Z";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue