Strict string replacement & improved live test

This commit is contained in:
andreisavu 2011-12-22 17:40:22 +02:00
parent b5228d2299
commit 529dc4f687
2 changed files with 5 additions and 2 deletions

View File

@ -58,7 +58,7 @@ public enum Unit {
UNRECOGNIZED; UNRECOGNIZED;
public String value() { public String value() {
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()).replace("Per", "/")); return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()).replace("PerSecond", "/Second"));
} }
@Override @Override

View File

@ -28,6 +28,8 @@ import java.util.Set;
import org.jclouds.Constants; import org.jclouds.Constants;
import org.jclouds.cloudwatch.domain.Datapoint; import org.jclouds.cloudwatch.domain.Datapoint;
import org.jclouds.cloudwatch.domain.Statistics; import org.jclouds.cloudwatch.domain.Statistics;
import org.jclouds.cloudwatch.domain.Unit;
import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextFactory; import org.jclouds.rest.RestContextFactory;
@ -94,7 +96,8 @@ public class CloudWatchClientLiveTest {
cal.add(Calendar.MINUTE, -60 * 24 * 3); // 3 days cal.add(Calendar.MINUTE, -60 * 24 * 3); // 3 days
Set<Datapoint> datapoints = client.getMetricStatisticsInRegion( Set<Datapoint> datapoints = client.getMetricStatisticsInRegion(
region, "CPUUtilization", "AWS/EC2", cal.getTime(), new Date(), 180, Statistics.AVERAGE); region, "CPUUtilization", "AWS/EC2", cal.getTime(), new Date(), 180, Statistics.AVERAGE,
GetMetricStatisticsOptions.Builder.unit(Unit.PERCENT));
return checkNotNull(datapoints, "Got null response for EC2 datapoints in region "); return checkNotNull(datapoints, "Got null response for EC2 datapoints in region ");
} }