JCLOUDS-534: Address Guava 17 compatibility issues

Corrected with:

find -name \*.java | xargs sed -i 's/new Stopwatch();/Stopwatch.createUnstarted();/'
find -name \*.java | xargs sed -i 's/new Stopwatch().start();/Stopwatch.createStarted();/'
This commit is contained in:
Andrew Gaul 2014-04-11 14:04:46 -07:00
parent b5218e0ce6
commit 7af18d4843
6 changed files with 10 additions and 10 deletions

View File

@ -59,7 +59,7 @@ public class SQSErrorRetryHandlerTest {
HttpCommand command = createHttpCommandForFailureCount(59);
Stopwatch watch = new Stopwatch().start();
Stopwatch watch = Stopwatch.createStarted();
assertTrue(retry.shouldRetryRequestOnError(command, response, error));
assertEquals(command.getFailureCount(), 60);
// allow for slightly inaccurate system timers
@ -75,7 +75,7 @@ public class SQSErrorRetryHandlerTest {
HttpCommand command = createHttpCommandForFailureCount(60);
Stopwatch watch = new Stopwatch().start();
Stopwatch watch = Stopwatch.createStarted();
assertFalse(retry.shouldRetryRequestOnError(command, response, error));
assertEquals(command.getFailureCount(), 61);
assertTrue(watch.stop().elapsed(TimeUnit.MILLISECONDS) < 100);

View File

@ -62,7 +62,7 @@ public class PollNodeRunning implements Function<AtomicReference<NodeMetadata>,
String originalId = node.get().getId();
NodeMetadata originalNode = node.get();
try {
Stopwatch stopwatch = new Stopwatch().start();
Stopwatch stopwatch = Stopwatch.createStarted();
if (!nodeRunning.apply(node)) {
long timeWaited = stopwatch.elapsed(TimeUnit.MILLISECONDS);
if (node.get() == null) {

View File

@ -656,7 +656,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
protected ServiceStats trackAvailabilityOfProcessOnNode(Statement process, String processName, NodeMetadata node) {
ServiceStats stats = new ServiceStats();
Stopwatch watch = new Stopwatch().start();
Stopwatch watch = Stopwatch.createStarted();
ExecResponse exec = client.runScriptOnNode(node.getId(), process, runAsRoot(false).wrapInInitScript(false));
stats.backgroundProcessMilliseconds = watch.elapsed(TimeUnit.MILLISECONDS);
watch.reset().start();
@ -697,7 +697,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
ImmutableMap<String, String> userMetadata = ImmutableMap.<String, String> of("test", group);
ImmutableSet<String> tags = ImmutableSet. of(group);
Stopwatch watch = new Stopwatch().start();
Stopwatch watch = Stopwatch.createStarted();
NodeMetadata node = getOnlyElement(client.createNodesInGroup(group, 1,
inboundPorts(22, 8080).blockOnPort(22, 300).userMetadata(userMetadata).tags(tags)));
long createSeconds = watch.elapsed(TimeUnit.SECONDS);

View File

@ -102,7 +102,7 @@ public class ConcurrentOpenSocketFinderTest {
OpenSocketFinder finder = new ConcurrentOpenSocketFinder(socketAlwaysClosed, nodeRunning, userExecutor);
Stopwatch stopwatch = new Stopwatch();
Stopwatch stopwatch = Stopwatch.createUnstarted();
stopwatch.start();
try {
finder.findOpenSocketOnNode(node, 22, timeoutMs, MILLISECONDS);

View File

@ -123,7 +123,7 @@ public class PresentWhenApiVersionLexicographicallyAtOrAfterSinceApiVersionTest
public void testCacheIsFasterWhenNoAnnotationPresent() {
InvocationSuccess keyPairApi = getKeyPairApi();
ImplicitOptionalConverter fn = forApiVersion("2011-07-15");
Stopwatch watch = new Stopwatch().start();
Stopwatch watch = Stopwatch.createStarted();
fn.apply(keyPairApi);
long first = watch.stop().elapsed(TimeUnit.MICROSECONDS);
watch.reset().start();
@ -137,7 +137,7 @@ public class PresentWhenApiVersionLexicographicallyAtOrAfterSinceApiVersionTest
public void testCacheIsFasterWhenAnnotationPresent() {
InvocationSuccess floatingIpApi = getKeyPairApi();
ImplicitOptionalConverter fn = forApiVersion("2011-07-15");
Stopwatch watch = new Stopwatch().start();
Stopwatch watch = Stopwatch.createStarted();
fn.apply(floatingIpApi);
long first = watch.stop().elapsed(TimeUnit.MICROSECONDS);
watch.reset().start();

View File

@ -52,7 +52,7 @@ public class Predicates2Test {
@BeforeMethod
public void setUp() {
stopwatch = new Stopwatch();
stopwatch = Stopwatch.createUnstarted();
}
@Test
@ -161,7 +161,7 @@ public class Predicates2Test {
RepeatedAttemptsPredicate(int succeedOnAttempt) {
this.succeedOnAttempt = succeedOnAttempt;
this.stopwatch = new Stopwatch();
this.stopwatch = Stopwatch.createUnstarted();
stopwatch.start();
}
@Override