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