Package org.jvnet.hudson.test
Class RunLoadCounter
- java.lang.Object
-
- org.jvnet.hudson.test.RunLoadCounter
-
public final class RunLoadCounter extends Object
Utility to determine when a build record is loaded.- Since:
- 1.517
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RunLoadCounter.Marker
Used internally.static class
RunLoadCounter.MarkerAdder
Used internally.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> T
assertMaxLoads(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?,?> project, int max, Callable<T> thunk)
Asserts that at most a certain number of build records are loaded as a result of some task.static int
countLoads(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?,?> project, Runnable thunk)
Counts how many build records are loaded as a result of some task.static void
prepare(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?,?> project)
Deprecated.No longer needed.
-
-
-
Method Detail
-
prepare
@Deprecated public static void prepare(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?,?> project) throws IOException
Deprecated.No longer needed.- Throws:
IOException
-
countLoads
public static int countLoads(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?,?> project, Runnable thunk)
Counts how many build records are loaded as a result of some task.- Parameters:
project
- a project on whichprepare(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?, ?>)
was called prior to creating buildsthunk
- a task which is expected to load some build records- Returns:
- how many build records were actually loaded as a result
-
assertMaxLoads
public static <T> T assertMaxLoads(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?,?> project, int max, Callable<T> thunk) throws Exception
Asserts that at most a certain number of build records are loaded as a result of some task.- Type Parameters:
T
- the return value type- Parameters:
project
- a project on whichprepare(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?, ?>)
was called prior to creating buildsmax
- the maximum number of build records we expect to loadthunk
- a task which is expected to load some build records- Returns:
- the result of the task, if any
- Throws:
Exception
- if the task failedAssertionError
- if one more than max build record is loaded
-
-