Class JemmyProperties


  • public class JemmyProperties
    extends Object
    Keeps default Jemmy properties.
    Author:
    Alexandre Iline (alexandre.iline@sun.com)
    • Constructor Detail

      • JemmyProperties

        protected JemmyProperties()
    • Method Detail

      • getMajorVersion

        public static String getMajorVersion()
        Returns major version (like 1.0).
        Returns:
        a String representing the major version value.
      • getMinorVersion

        public static String getMinorVersion()
        Returns minor version (like 1).
        Returns:
        a String representing the minor version value.
      • getBuild

        public static String getBuild()
        Returns build (like 20011231 (yyyymmdd)).
        Returns:
        a String representing the build value.
      • getFullVersion

        public static String getFullVersion()
        Returns full version string (like 1.0.1-20011231).
        Returns:
        a String representing the full version value.
      • getVersion

        public static String getVersion()
        Returns version string (like 1.0.1).
        Returns:
        a String representing the short version value.
      • push

        public static JemmyProperties push()
        Creates a copy of the current JemmyProperties object and pushes it into the properties stack.
        Returns:
        New current properties.
      • pop

        public static JemmyProperties pop()
        Pops last pushed properties from the properties stack. If stack has just one element, does nothing.
        Returns:
        Poped properties.
      • removeCurrentProperty

        public static Object removeCurrentProperty​(String propertyName)
        Removes a property from current properties list.
        Parameters:
        propertyName - a property key.
        Returns:
        previous property value
      • getCurrentKeys

        public static String[] getCurrentKeys()
        Returns the current key values.
        Returns:
        an array of Strings representing the current key values
      • setCurrentTimeouts

        public static Timeouts setCurrentTimeouts​(Timeouts to)
        Just like getProperties().setTimeouts(to).
        Parameters:
        to - New timeouts
        Returns:
        old timeouts.
        See Also:
        getCurrentTimeouts()
      • setCurrentTimeout

        public static long setCurrentTimeout​(String name,
                                             long newValue)
        Just like getProperties().getTimeouts().setTimeout(name, newValue).
        Parameters:
        name - a timeout name
        newValue - a timeout value
        Returns:
        previous timeout value
        See Also:
        getCurrentTimeout(java.lang.String)
      • getCurrentTimeout

        public static long getCurrentTimeout​(String name)
        Just like getProperties().getTimeouts().getTimeout(name).
        Parameters:
        name - a timeout name
        Returns:
        a timeout value
        See Also:
        setCurrentTimeout(java.lang.String, long)
      • initCurrentTimeout

        public static long initCurrentTimeout​(String name,
                                              long newValue)
        Just like getProperties().getTimeouts().initTimeout(name, newValue).
        Parameters:
        name - a timeout name
        newValue - a timeout value
        Returns:
        a timeout value
        See Also:
        setCurrentTimeout(java.lang.String, long)
      • setCurrentOutput

        public static TestOut setCurrentOutput​(TestOut out)
        Just like getProperties().setOutput(out).
        Parameters:
        out - new output
        Returns:
        a TestOut object representing the current output.
        See Also:
        getCurrentOutput()
      • setCurrentBundleManager

        public static BundleManager setCurrentBundleManager​(BundleManager resources)
        Just like getProperties().setBundleManager(resources).
        Parameters:
        resources - new BundleManager
        Returns:
        a BundleManager object representing the current bundle manager.
        See Also:
        getCurrentBundleManager()
      • getCurrentResource

        public static String getCurrentResource​(String key)
        Just like getProperties().getBundleManager().getResource(key).
        Parameters:
        key - a resource key.
        Returns:
        a resource value
      • getCurrentResource

        public static String getCurrentResource​(String bundleID,
                                                String key)
        Just like getProperties().getBundleManager().getResource(bundleID, key).
        Parameters:
        key - a resource key.
        bundleID - a bundle ID
        Returns:
        a resource value
      • setCurrentDragAndDropStepLength

        public static int setCurrentDragAndDropStepLength​(int model)
        Specifies the current drag and drop step length value.
        Parameters:
        model - Pixel count to move mouse during one drag'n'drop step.
        Returns:
        Previous value.
        See Also:
        setDragAndDropStepLength(int), getCurrentDragAndDropStepLength()
      • getProperties

        public static JemmyProperties getProperties()
        Peeks upper JemmyProperties instance from stack.
        Returns:
        a JemmyProperties object representing the properties value.
      • main

        public static void main​(String[] argv)
        Prints full version into satndart output.
        Parameters:
        argv - Application args.
      • push

        protected static JemmyProperties push​(JemmyProperties props)
        Pushes properties stack.
        Parameters:
        props - a JemmyProperties instance to put into the stack head.
        Returns:
        a JemmyProperties object.
      • initProperties

        public void initProperties​(String prop_file)
        Method to initialize timeouts and resources.
        Parameters:
        prop_file - File to get filenames from.
        Can contain definition of variables TIMEOUTS_FILE - full path to timeouts file,
        RESOURCE_FILE - full path to resource file.
        See Also:
        initProperties()
      • initProperties

        public void initProperties()
        Method to initialize timeouts and resources.
        Uses jemmy.properties system property to find file.
        See Also:
        initProperties(String)
      • initDispatchingModel

        public void initDispatchingModel​(boolean queue,
                                         boolean robot,
                                         boolean shortcut)
        Initializes dispatching model.
        Parameters:
        queue - Notifies that event queue dispatching should be used.
        robot - Notifies that robot dispatching should be used.
        shortcut - Notifies that event shorcutting should be used.
      • initDispatchingModel

        public void initDispatchingModel​(boolean queue,
                                         boolean robot,
                                         boolean shortcut,
                                         boolean smooth)
        Initializes dispatching model.
        Parameters:
        queue - Notifies that event queue dispatching should be used.
        robot - Notifies that robot dispatching should be used.
        shortcut - Notifies that event shorcutting should be used.
      • initDispatchingModel

        public void initDispatchingModel​(boolean queue,
                                         boolean robot)
        Initializes dispatching model.
        Parameters:
        queue - Notifies that event queue dispatching should be used.
        robot - Notifies that robot dispatching should be used.
      • initDispatchingModel

        public void initDispatchingModel()
        Initializes dispatching model. Uses "jemmy.queue_dispatching" and "jemmy.robot_dispatching" system properties to determine what model should be used. Possible values for the both properties:
        "off" - switch mode off.
        "on" - switch mode on.
        "" - use default value.
        See Also:
        getDefaultDispatchingModel()
      • setTimeouts

        public Timeouts setTimeouts​(Timeouts to)
        Changes timeouts.
        Parameters:
        to - new timeouts.
        Returns:
        old timeouts.
        See Also:
        getTimeouts()
      • setTimeout

        public long setTimeout​(String name,
                               long newValue)
        Changes a timeouts value.
        Parameters:
        name - Timeout name
        newValue - New timeout value
        Returns:
        previous timeout value
        See Also:
        getTimeout(java.lang.String)
      • initTimeout

        public long initTimeout​(String name,
                                long newValue)
        Inits a timeouts value.
        Parameters:
        name - Timeout name
        newValue - New timeout value
        Returns:
        a timeout value
      • setOutput

        public TestOut setOutput​(TestOut out)
        Changes output.
        Parameters:
        out - new output.
        Returns:
        old output.
        See Also:
        getOutput()
      • getResource

        public String getResource​(String key)
        Returns resource value.
        Parameters:
        key - Resource key.
        Returns:
        resource value
      • getResource

        public String getResource​(String bundleID,
                                  String key)
        Returns resource value from the specified bundle.
        Parameters:
        bundleID - Id of a bundle to get resource from.
        key - Resource key.
        Returns:
        resource value
      • removeProperty

        public Object removeProperty​(String name)
        Removes the property.
        Parameters:
        name - A name of the property to be removed.
        Returns:
        previous property value
      • getKeys

        public String[] getKeys()
        Returns the key values.
        Returns:
        an array of Strings representing the key values.
      • copyTo

        public void copyTo​(JemmyProperties properties)
        Copy all properties from this instance into another.
        Parameters:
        properties - a JemmyProperties instance to copy properties into.
      • cloneThis

        protected JemmyProperties cloneThis()
        Creates an exact copy on this instance.
        Returns:
        new JemmyProperties object.