Class SysGlobals


  • public final class SysGlobals
    extends java.lang.Object
    Global names for system properties controlling the behavior of JUnit4 ANT task and RandomizedRunner.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private SysGlobals​(java.lang.String prefix)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String CURRENT_PREFIX()
      Static singleton's property prefix.
      static SysGlobals initializeWith​(java.lang.String prefix)  
      static java.lang.String prefixProperty​(java.lang.String propertyName)
      Prefix a given property name with a common prefix.
      private java.lang.String prefixWith​(java.lang.String prefix, java.lang.String propertyName)  
      private static SysGlobals singleton()  
      static java.lang.String SYSPROP_APPEND_SEED()
      If true, append seed parameter to all methods.
      static java.lang.String SYSPROP_ASSERTS()
      Returns the property name to express the desired status of assertions during tests.
      static java.lang.String SYSPROP_ITERATIONS()
      The global override for the number of each test's repetitions.
      static java.lang.String SYSPROP_KILLATTEMPTS()
      If there's a runaway thread, how many times do we try to interrupt and then kill it before we give up? Runaway threads may affect other tests (bad idea).
      static java.lang.String SYSPROP_KILLWAIT()
      If there's a runaway thread, how long should we wait between iterations of putting a silver bullet through its heart?
      static java.lang.String SYSPROP_PREFIX()
      Global system property that holds the prefix used by other properties.
      static java.lang.String SYSPROP_RANDOM_SEED()
      System property with an integer defining global initialization seeds for all random generators.
      static java.lang.String SYSPROP_STACKFILTERING()
      Enable or disable stack filtering.
      static java.lang.String SYSPROP_TESTCLASS()
      Global override for picking out a single test class to execute.
      static java.lang.String SYSPROP_TESTFILTER()
      Global test filter.
      static java.lang.String SYSPROP_TESTMETHOD()
      Global override for picking out a single test method to execute.
      static java.lang.String SYSPROP_TIMEOUT()
      Global override for a single test case's maximum execution time after which it is considered out of control and an attempt to interrupt it is executed.
      static java.lang.String SYSPROP_TIMEOUT_SUITE()
      Global override for entire suite's maximum execution time after which it is considered out of control.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CHILDVM_SYSPROP_JVM_ID

        public static final java.lang.String CHILDVM_SYSPROP_JVM_ID
        System property passed to forked VMs: VM ID (sequential integer between 0 and the (number of concurrent jvms - 1)).
        See Also:
        Constant Field Values
      • CHILDVM_SYSPROP_JVM_COUNT

        public static final java.lang.String CHILDVM_SYSPROP_JVM_COUNT
        System property passed to forked VMs: the number of concurrent JVMs.
        See Also:
        Constant Field Values
      • lock

        private static final java.lang.Object lock
      • DEFAULT_PREFIX

        private static final java.lang.String DEFAULT_PREFIX
        Default prefix for all properties.
        See Also:
        Constant Field Values
      • SYSPROP_PREFIX

        private static final java.lang.String SYSPROP_PREFIX
        A common prefix for all system properties used by randomizedtesting packages. It is discouraged to change this property but it may be used to resolve conflicts with packages that have overlapping property names.
        See Also:
        Constant Field Values
      • singleton

        private static SysGlobals singleton
        Global singleton. Initialized once.
      • singletonInitStack

        private static java.lang.StackTraceElement[] singletonInitStack
        Singleton initialization stack for easier debugging.
      • prefix

        private final java.lang.String prefix
        Initialized singleton's prefix.
      • SYSPROP_STACKFILTERING

        private final java.lang.String SYSPROP_STACKFILTERING
      • SYSPROP_RANDOM_SEED

        private final java.lang.String SYSPROP_RANDOM_SEED
      • SYSPROP_ITERATIONS

        private final java.lang.String SYSPROP_ITERATIONS
      • SYSPROP_TESTCLASS

        private final java.lang.String SYSPROP_TESTCLASS
      • SYSPROP_TESTMETHOD

        private final java.lang.String SYSPROP_TESTMETHOD
      • SYSPROP_TESTFILTER

        private final java.lang.String SYSPROP_TESTFILTER
      • SYSPROP_KILLATTEMPTS

        private final java.lang.String SYSPROP_KILLATTEMPTS
      • SYSPROP_KILLWAIT

        private final java.lang.String SYSPROP_KILLWAIT
      • SYSPROP_TIMEOUT

        private final java.lang.String SYSPROP_TIMEOUT
      • SYSPROP_TIMEOUT_SUITE

        private final java.lang.String SYSPROP_TIMEOUT_SUITE
      • SYSPROP_APPEND_SEED

        private final java.lang.String SYSPROP_APPEND_SEED
      • SYSPROP_ASSERTS

        private final java.lang.String SYSPROP_ASSERTS
    • Constructor Detail

      • SysGlobals

        private SysGlobals​(java.lang.String prefix)
    • Method Detail

      • prefixWith

        private java.lang.String prefixWith​(java.lang.String prefix,
                                            java.lang.String propertyName)
      • singleton

        private static SysGlobals singleton()
      • initializeWith

        public static SysGlobals initializeWith​(java.lang.String prefix)
      • SYSPROP_PREFIX

        public static java.lang.String SYSPROP_PREFIX()
        Global system property that holds the prefix used by other properties.
      • CURRENT_PREFIX

        public static java.lang.String CURRENT_PREFIX()
        Static singleton's property prefix. Initializes it if not already initialized.
      • SYSPROP_STACKFILTERING

        public static java.lang.String SYSPROP_STACKFILTERING()
        Enable or disable stack filtering.
      • SYSPROP_RANDOM_SEED

        public static java.lang.String SYSPROP_RANDOM_SEED()
        System property with an integer defining global initialization seeds for all random generators. Should guarantee test reproducibility.
      • SYSPROP_ITERATIONS

        public static java.lang.String SYSPROP_ITERATIONS()
        The global override for the number of each test's repetitions.
      • SYSPROP_TESTCLASS

        public static java.lang.String SYSPROP_TESTCLASS()
        Global override for picking out a single test class to execute. All other classes are ignored. The property can contain "globbing patterns" similar to shell expansion patterns. For example:
         *MyTest
         
        will pick all classes ending in MyTest (in any package, including nested static classes if they appear on input).
      • SYSPROP_TESTMETHOD

        public static java.lang.String SYSPROP_TESTMETHOD()
        Global override for picking out a single test method to execute. If a matching method exists in more than one class, it will be executed.
      • SYSPROP_TESTFILTER

        public static java.lang.String SYSPROP_TESTFILTER()
        Global test filter.
      • SYSPROP_KILLATTEMPTS

        public static java.lang.String SYSPROP_KILLATTEMPTS()
        If there's a runaway thread, how many times do we try to interrupt and then kill it before we give up? Runaway threads may affect other tests (bad idea).
      • SYSPROP_KILLWAIT

        public static java.lang.String SYSPROP_KILLWAIT()
        If there's a runaway thread, how long should we wait between iterations of putting a silver bullet through its heart?
      • SYSPROP_TIMEOUT

        public static java.lang.String SYSPROP_TIMEOUT()
        Global override for a single test case's maximum execution time after which it is considered out of control and an attempt to interrupt it is executed.

        The timeout value should be in milliseconds. If the value is trailed by a "!" then the timeout value takes precedence over annotations, otherwise annotations take precedence over the default timeout. This is useful for running debugging sessions, for example, when default timeouts may be too short.

        See Also:
        RandomizedRunner.DEFAULT_TIMEOUT
      • SYSPROP_TIMEOUT_SUITE

        public static java.lang.String SYSPROP_TIMEOUT_SUITE()
        Global override for entire suite's maximum execution time after which it is considered out of control.

        The timeout value should be in milliseconds. If the value is trailed by a "!" then the timeout value takes precedence over annotations, otherwise annotations take precedence over the default timeout. This is useful for running debugging sessions, for example, when default timeouts may be too short.

        See Also:
        RandomizedRunner.DEFAULT_TIMEOUT_SUITE
      • SYSPROP_APPEND_SEED

        public static java.lang.String SYSPROP_APPEND_SEED()
        If true, append seed parameter to all methods. Methods that are for some reason repeated (due to Repeat annotation or multiple Seeds, for example) are always postfixed with the seed to discriminate tests from each other. Otherwise many GUI clients have a problem in telling which test result was which.
      • SYSPROP_ASSERTS

        public static java.lang.String SYSPROP_ASSERTS()
        Returns the property name to express the desired status of assertions during tests.
        See Also:
        RequireAssertionsRule
      • prefixProperty

        public static java.lang.String prefixProperty​(java.lang.String propertyName)
        Prefix a given property name with a common prefix. The prefix itself can be overridden using SYSPROP_PREFIX. This method initializes static singleton property names so it shouldn't be called on class initialization anywhere.