Class GenericTestUtils

java.lang.Object
org.apache.hadoop.hbase.GenericTestUtils

public abstract class GenericTestUtils extends Object
Test provides some very generic helpers which might be used across the tests
  • Field Details

  • Constructor Details

  • Method Details

    • getMethodName

      public static String getMethodName()
      Extracts the name of the method where the invocation has happened
      Returns:
      String name of the invoking method
    • uniqueSequenceId

      public static int uniqueSequenceId()
      Generates a process-wide unique sequence number.
      Returns:
      a unique sequence number
    • assertExists

      public static void assertExists(File f)
      Assert that a given file exists.
    • assertGlobEquals

      public static void assertGlobEquals(File dir, String pattern, String... expectedMatches) throws IOException
      List all of the files in 'dir' that match the regex 'pattern'. Then check that this list is identical to 'expectedMatches'.
      Throws:
      IOException - if the dir is inaccessible
    • waitFor

      public static void waitFor(org.apache.hbase.thirdparty.com.google.common.base.Supplier<Boolean> check, int checkEveryMillis, int waitForMillis) throws TimeoutException, InterruptedException
      Throws:
      TimeoutException
      InterruptedException
    • assertMatches

      public static void assertMatches(String output, String pattern)
    • assertValueNear

      public static void assertValueNear(long expected, long actual, long allowedError)
    • assertValueWithinRange

      public static void assertValueWithinRange(long expectedMin, long expectedMax, long actual)
    • assertNoThreadsMatching

      public static void assertNoThreadsMatching(String regex)
      Assert that there are no threads running whose name matches the given regular expression.
      Parameters:
      regex - the regex to match against