mirror of https://github.com/apache/jclouds.git
Issue 334: changed AWSEC2ComputeServiceLiveTest.testExtendedOptionsAndLogin to use aws-cloudwatch
This commit is contained in:
parent
e766248327
commit
982e92fe9f
|
@ -61,12 +61,6 @@
|
||||||
<type>test-jar</type>
|
<type>test-jar</type>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds.provider</groupId>
|
|
||||||
<artifactId>aws-ec2</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jclouds.driver</groupId>
|
<groupId>org.jclouds.driver</groupId>
|
||||||
<artifactId>jclouds-log4j</artifactId>
|
<artifactId>jclouds-log4j</artifactId>
|
||||||
|
|
|
@ -58,6 +58,12 @@
|
||||||
<type>test-jar</type>
|
<type>test-jar</type>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jclouds.provider</groupId>
|
||||||
|
<artifactId>aws-cloudwatch</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jclouds</groupId>
|
<groupId>org.jclouds</groupId>
|
||||||
<artifactId>jclouds-core</artifactId>
|
<artifactId>jclouds-core</artifactId>
|
||||||
|
|
|
@ -20,12 +20,16 @@ package org.jclouds.aws.ec2.compute;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.aws.ec2.AWSEC2Client;
|
import org.jclouds.aws.ec2.AWSEC2Client;
|
||||||
import org.jclouds.aws.ec2.domain.AWSRunningInstance;
|
import org.jclouds.aws.ec2.domain.AWSRunningInstance;
|
||||||
import org.jclouds.aws.ec2.domain.MonitoringState;
|
import org.jclouds.aws.ec2.domain.MonitoringState;
|
||||||
import org.jclouds.aws.ec2.services.AWSSecurityGroupClient;
|
import org.jclouds.aws.ec2.services.AWSSecurityGroupClient;
|
||||||
|
import org.jclouds.cloudwatch.CloudWatchAsyncClient;
|
||||||
|
import org.jclouds.cloudwatch.CloudWatchClient;
|
||||||
|
import org.jclouds.cloudwatch.domain.Datapoint;
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.options.TemplateOptions;
|
import org.jclouds.compute.options.TemplateOptions;
|
||||||
import org.jclouds.compute.predicates.NodePredicates;
|
import org.jclouds.compute.predicates.NodePredicates;
|
||||||
|
@ -38,12 +42,17 @@ import org.jclouds.ec2.domain.SecurityGroup;
|
||||||
import org.jclouds.ec2.services.InstanceClient;
|
import org.jclouds.ec2.services.InstanceClient;
|
||||||
import org.jclouds.ec2.services.KeyPairClient;
|
import org.jclouds.ec2.services.KeyPairClient;
|
||||||
import org.jclouds.ec2.util.IpPermissions;
|
import org.jclouds.ec2.util.IpPermissions;
|
||||||
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
|
import org.jclouds.rest.RestContext;
|
||||||
|
import org.jclouds.rest.RestContextFactory;
|
||||||
import org.jclouds.scriptbuilder.domain.Statements;
|
import org.jclouds.scriptbuilder.domain.Statements;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.ImmutableSortedSet;
|
import com.google.common.collect.ImmutableSortedSet;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -73,7 +82,7 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
|
||||||
|
|
||||||
TemplateOptions options = client.templateOptions();
|
TemplateOptions options = client.templateOptions();
|
||||||
|
|
||||||
// Date before = new Date();
|
Date before = new Date();
|
||||||
|
|
||||||
options.as(AWSEC2TemplateOptions.class).enableMonitoring();
|
options.as(AWSEC2TemplateOptions.class).enableMonitoring();
|
||||||
options.as(AWSEC2TemplateOptions.class).spotPrice(0.3f);
|
options.as(AWSEC2TemplateOptions.class).spotPrice(0.3f);
|
||||||
|
@ -114,20 +123,17 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
|
||||||
assertEquals(instance.getKeyName(), group);
|
assertEquals(instance.getKeyName(), group);
|
||||||
assertEquals(instance.getMonitoringState(), MonitoringState.ENABLED);
|
assertEquals(instance.getMonitoringState(), MonitoringState.ENABLED);
|
||||||
|
|
||||||
// TODO when the cloudwatchclient is finished
|
|
||||||
|
|
||||||
// RestContext<CloudWatchClient, CloudWatchAsyncClient> monitoringContext = new
|
RestContext<CloudWatchClient, CloudWatchAsyncClient> monitoringContext = new RestContextFactory()
|
||||||
// RestContextFactory().createContext(
|
.createContext("aws-cloudwatch", identity, credential, ImmutableSet.<Module> of(new Log4JLoggingModule()));
|
||||||
// "cloudwatch", identity, credential, ImmutableSet.<Module> of(new Log4JLoggingModule()));
|
|
||||||
//
|
try {
|
||||||
// try {
|
Set<Datapoint> datapoints = monitoringContext.getApi().getMetricStatisticsInRegion(instance.getRegion(),
|
||||||
// Set<Datapoint> datapoints =
|
"CPUUtilization", before, new Date(), 60, "Average");
|
||||||
// monitoringContext.getApi().getMetricStatisticsInRegion(instance.getRegion(),
|
assert datapoints != null;
|
||||||
// "CPUUtilization", before, new Date(), 60, "Average");
|
} finally {
|
||||||
// assert datapoints != null;
|
monitoringContext.close();
|
||||||
// } finally {
|
}
|
||||||
// monitoringContext.close();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// make sure we made our dummy group and also let in the user's group
|
// make sure we made our dummy group and also let in the user's group
|
||||||
assertEquals(Sets.newTreeSet(instance.getGroupIds()), ImmutableSortedSet.<String> of("jclouds#" + group + "#"
|
assertEquals(Sets.newTreeSet(instance.getGroupIds()), ImmutableSortedSet.<String> of("jclouds#" + group + "#"
|
||||||
|
|
Loading…
Reference in New Issue