Package org.jvnet.hudson.test
Class RunLoadCounter
java.lang.Object
org.jvnet.hudson.test.RunLoadCounter
Utility to determine when a build record is loaded.
- Since:
- 1.517
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Used internally.static final class
Used internally. -
Method Summary
Modifier and TypeMethodDescriptionstatic <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 Details
-
prepare
@Deprecated public static void prepare(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?, ?> project) throws IOExceptionDeprecated.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 ExceptionAsserts 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
-