Package org.infinispan.commons.test
Class TestResourceTracker
- java.lang.Object
-
- org.infinispan.commons.test.TestResourceTracker
-
public class TestResourceTracker extends Object
Keeps track of resources created by tests and cleans them up at the end of the test.- Since:
- 7.0
- Author:
- Dan Berindei
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTestResourceTracker.Cleaner<T>
-
Constructor Summary
Constructors Constructor Description TestResourceTracker()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddResource(String testName, TestResourceTracker.Cleaner<?> cleaner)static voidaddResource(TestResourceTracker.Cleaner<?> cleaner)Add a resource to the current thread's running test.static voidcleanUpResources(String testName)static StringgetCurrentTestName()static StringgetCurrentTestShortName()static StringgetNameForIndex(int i)static StringgetNextNodeName()static StringgetNextTestThreadName()static voidsetThreadTestName(String testName)static voidsetThreadTestNameIfMissing(String testName)static voidtestFinished(String testName)Called on the "main" test thread, after any configuration method.static voidtestStarted(String testName)Called on the "main" test thread, before any configuration method.static voidtestThreadStarted(String testName)Should be called by the user on any "background" test thread that creates resources, e.g.
-
-
-
Method Detail
-
addResource
public static void addResource(String testName, TestResourceTracker.Cleaner<?> cleaner)
-
addResource
public static void addResource(TestResourceTracker.Cleaner<?> cleaner)
Add a resource to the current thread's running test.
-
cleanUpResources
public static void cleanUpResources(String testName)
-
getCurrentTestShortName
public static String getCurrentTestShortName()
-
getCurrentTestName
public static String getCurrentTestName()
-
testStarted
public static void testStarted(String testName)
Called on the "main" test thread, before any configuration method.
-
testFinished
public static void testFinished(String testName)
Called on the "main" test thread, after any configuration method.
-
testThreadStarted
public static void testThreadStarted(String testName)
Should be called by the user on any "background" test thread that creates resources, e.g. at the beginning of a test with a@Test(timeout=n)annotation.- Parameters:
testName-
-
setThreadTestName
public static void setThreadTestName(String testName)
-
setThreadTestNameIfMissing
public static void setThreadTestNameIfMissing(String testName)
-
getNextNodeName
public static String getNextNodeName()
-
getNextTestThreadName
public static String getNextTestThreadName()
-
getNameForIndex
public static String getNameForIndex(int i)
-
-