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 final class 
    Used internally.
    static final class 
    Used internally.
  • Method Summary

    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • 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 which prepare(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?, ?>) was called prior to creating builds
      thunk - 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 which prepare(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?, ?>) was called prior to creating builds
      max - the maximum number of build records we expect to load
      thunk - a task which is expected to load some build records
      Returns:
      the result of the task, if any
      Throws:
      Exception - if the task failed
      AssertionError - if one more than max build record is loaded