This is an automated email from the ASF dual-hosted git repository. upthewaterspout pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git
commit 1954e9220a5b890449916d6e5c38a61518eace00 Author: Dan Smith <[email protected]> AuthorDate: Tue Oct 16 16:11:28 2018 -0700 GEODE-5424: Adding a spotless rule to enforce using GeodeAwaitility Any tests that use regular awaitility will now fail the spotless check, to avoid checking tests that don't pick up our default wait time. --- .../java/org/apache/geode/test/awaitility/GeodeAwaitility.java | 10 +++++----- gradle/spotless.gradle | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/geode-junit/src/main/java/org/apache/geode/test/awaitility/GeodeAwaitility.java b/geode-junit/src/main/java/org/apache/geode/test/awaitility/GeodeAwaitility.java index 94cfdbd..bc508ea 100644 --- a/geode-junit/src/main/java/org/apache/geode/test/awaitility/GeodeAwaitility.java +++ b/geode-junit/src/main/java/org/apache/geode/test/awaitility/GeodeAwaitility.java @@ -17,12 +17,12 @@ package org.apache.geode.test.awaitility; import java.util.concurrent.TimeUnit; -import org.awaitility.Awaitility; import org.awaitility.Duration; import org.awaitility.core.ConditionFactory; /** - * Utility to set consistent defaults for {@link Awaitility} calls for all geode tests + * Utility to set consistent defaults for {@link org.awaitility.Awaitility} calls for all geode + * tests */ public class GeodeAwaitility { @@ -36,7 +36,7 @@ public class GeodeAwaitility { * Start building an await statement using Geode's default test timeout * * @return a {@link ConditionFactory} that is a builder for the await - * @see Awaitility#await() + * @see org.awaitility.Awaitility#await() */ public static ConditionFactory await() { return await(null); @@ -48,10 +48,10 @@ public class GeodeAwaitility { * @param alias A name for this await, if you test has multiple await statements * * @return a {@link ConditionFactory} that is a builder for the await - * @see Awaitility#await(String) + * @see org.awaitility.Awaitility#await(String) */ public static ConditionFactory await(String alias) { - return Awaitility.await(alias) + return org.awaitility.Awaitility.await(alias) .atMost(TIMEOUT) .pollDelay(POLL_DELAY) .pollInterval(POLL_INTERVAL); diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle index 3eeea10..a521409 100644 --- a/gradle/spotless.gradle +++ b/gradle/spotless.gradle @@ -42,6 +42,11 @@ subprojects { throw new AssertionError("Do not use wildcard imports. 'spotlessApply' cannot resolve this issue."); } } + custom 'Refuse Awaitility import', { + if(it =~ /import\s+(static\s+)?org.awaitility.Awaitility.*/) { + throw new AssertionError("Do not use Awaitility.await(). Use GeodeAwaitility.await() instead. 'spotlessApply' cannot resolve this issue.") + } + } importOrderFile "${project(':geode-core').projectDir}/../etc/eclipseOrganizeImports.importorder" custom 'Remove unhelpful javadoc stubs', {
