com.rational.test.ft.script

Class ScriptUtilities

  • java.lang.Object
    • com.rational.test.ft.script.ScriptUtilities


  • public class ScriptUtilities
    extends java.lang.Object
    Defines utility methods. These methods are external so that they can be invoked when not executing in the context of a script, for example, at record time.
    Since:
    RFT1.0
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CHROME_RUNTIME_ARGS 
      protected static com.rational.test.ft.util.FtDebug debug
      Provides basic run functionality.
      static java.lang.String RATIONAL_FT_BOOTSTRAP 
    • Constructor Summary

      Constructors 
      Constructor and Description
      ScriptUtilities() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void callScript(RationalTestScript caller, RationalTestScript callee, java.lang.Object[] args, int iterationCount)
      This is an internal method used to perform cross datastore calls and is not to be utilized by users.
      static void closeJarFile(java.util.jar.JarFile jarfile) 
      static java.lang.String getBrowserProfilePath(java.lang.String browserType) 
      static java.lang.String getOperatingSystemVersion()
      Exposes a description of the operating system including version information.
      static java.lang.String getScriptFileName(java.lang.String scriptName, java.lang.String datastore)
      Converts the full class name to the file name for the program source.
      static java.lang.String getValidBrowserNameSupported(java.lang.String browName) 
      static com.rational.test.ft.sys.OSProcessInformation run(java.lang.String command, java.lang.String workingDirectory)
      Executes the specified command and returns the process information associated with the created process.
      static com.rational.test.ft.sys.OSProcessInformation runJava(java.lang.String main, java.lang.String classpath, java.lang.String workingDirectory, java.lang.String jvm, java.lang.String jvmOptions)
      Provides basic run functionality for a Java program.
      static boolean shellExecute(java.lang.String fileName)
      Takes a file name and starts up the program associated with the file extension.
      static com.rational.test.ft.util.StartAppInfo startApp(com.rational.test.ft.config.Application appl)
      Provides start-application functionality.
      static com.rational.test.ft.util.StartAppInfo startApp(com.rational.test.ft.config.Application appl, java.lang.String symbolicName)
      Provides start-application functionality.
      protected static com.rational.test.ft.util.StartAppInfo startApp(com.rational.test.ft.config.Application appl, java.lang.String[] args, com.rational.test.ft.enabler.JVMList jvmList, com.rational.test.ft.enabler.BrowserList browserList, com.rational.test.ft.util.Defaults defaults)
      Provides start-application functionality.
      protected static com.rational.test.ft.util.StartAppInfo startApp(com.rational.test.ft.config.Application appl, java.lang.String symbolicName, java.lang.String[] args, com.rational.test.ft.enabler.JVMList jvmList, com.rational.test.ft.enabler.BrowserList browserList, com.rational.test.ft.util.Defaults defaults)
      Provides start-application functionality.
      static com.rational.test.ft.util.StartAppInfo startApp(java.lang.String symbolicName)
      Provides start-application functionality.
      static com.rational.test.ft.util.StartAppInfo startApp(java.lang.String symbolicName, java.lang.String[] args)
      Provides start-application functionality.
      static com.rational.test.ft.sys.OSProcessInformation startBrowser(java.lang.String url)
      Provides basic start-browser functionality.
      static com.rational.test.ft.sys.OSProcessInformation startBrowser(java.lang.String browserName, java.lang.String url)
      Starts a specific browser by specifying the logical name.
      • Methods inherited from class java.lang.Object

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

      • debug

        protected static final com.rational.test.ft.util.FtDebug debug
        Provides basic run functionality.
        Since:
        RFT1.0
      • CHROME_RUNTIME_ARGS

        public static final java.lang.String CHROME_RUNTIME_ARGS
        See Also:
        Constant Field Values
      • RATIONAL_FT_BOOTSTRAP

        public static final java.lang.String RATIONAL_FT_BOOTSTRAP
        See Also:
        Constant Field Values
    • Constructor Detail

      • ScriptUtilities

        public ScriptUtilities()
    • Method Detail

      • run

        public static com.rational.test.ft.sys.OSProcessInformation run(java.lang.String command,
                                                                        java.lang.String workingDirectory)
                                                                 throws RunException
        Executes the specified command and returns the process information associated with the created process. If the command does not start, an appropriate exception is thrown.
        Throws:
        RunException
        Parameters:
        command - the executable file to run. This file is located on the executable path if a full file name specification is not provided.
        workingDirectory - the startup directory for the command
        Returns:
        The process information associated with the associated command. An exception is thrown if the process does not start.
        Since:
        RFT1.0
      • runJava

        public static com.rational.test.ft.sys.OSProcessInformation runJava(java.lang.String main,
                                                                            java.lang.String classpath,
                                                                            java.lang.String workingDirectory,
                                                                            java.lang.String jvm,
                                                                            java.lang.String jvmOptions)
                                                                     throws RunException
        Provides basic run functionality for a Java program.
        Throws:
        RunException
        Since:
        RFT1.0
      • startApp

        public static com.rational.test.ft.util.StartAppInfo startApp(java.lang.String symbolicName)
                                                               throws RunException
        Provides start-application functionality. startApp differs from run and runJava because the application name is a logical name that is looked up in the configuration file to map it to the actual details about how to run the application.
        Throws:
        RunException
        Parameters:
        symbolicName - the logical name of the application
        Since:
        RFT1.0
      • startApp

        public static com.rational.test.ft.util.StartAppInfo startApp(java.lang.String symbolicName,
                                                                      java.lang.String[] args)
                                                               throws RunException
        Provides start-application functionality. startApp differs from run and runJava because the application name is a logical name that is looked up in the configuration file to map it to the actual details about how to run the application. For example, the configuration file can specify the location of the executable file or the location of the main class for Java programs. This method avoids hard coding details, which may change from one test machine to another.
        Throws:
        RunException
        Parameters:
        symbolicName - the logical name of the application
        args[] - arguments to pass to the started application
        Since:
        RFT1.0
      • startApp

        public static com.rational.test.ft.util.StartAppInfo startApp(com.rational.test.ft.config.Application appl)
                                                               throws RunException
        Provides start-application functionality.
        Throws:
        RunException
        Parameters:
        appl - the application
        args[] - arguments to pass to the application
        Since:
        RFT1.0
      • startApp

        public static com.rational.test.ft.util.StartAppInfo startApp(com.rational.test.ft.config.Application appl,
                                                                      java.lang.String symbolicName)
                                                               throws RunException
        Provides start-application functionality.
        Throws:
        RunException
        Parameters:
        appl - the application
        symbolicName - the logical name of the application
        args[] - arguments to pass to the application
        Since:
        RFT1.0
      • startApp

        protected static com.rational.test.ft.util.StartAppInfo startApp(com.rational.test.ft.config.Application appl,
                                                                         java.lang.String[] args,
                                                                         com.rational.test.ft.enabler.JVMList jvmList,
                                                                         com.rational.test.ft.enabler.BrowserList browserList,
                                                                         com.rational.test.ft.util.Defaults defaults)
                                                                  throws RunException
        Provides start-application functionality.
        Throws:
        RunException
        Parameters:
        appl - the application
        args - arguments to pass to the application
        jvmList - list of JVMs
        browserList - list of browsers
        defaults - default JVM and browser
        Since:
        RFT1.0
      • startApp

        protected static com.rational.test.ft.util.StartAppInfo startApp(com.rational.test.ft.config.Application appl,
                                                                         java.lang.String symbolicName,
                                                                         java.lang.String[] args,
                                                                         com.rational.test.ft.enabler.JVMList jvmList,
                                                                         com.rational.test.ft.enabler.BrowserList browserList,
                                                                         com.rational.test.ft.util.Defaults defaults)
                                                                  throws RunException
        Provides start-application functionality.
        Throws:
        RunException
        Parameters:
        appl - the application
        symbolicName - the logical name of the application
        args - arguments to pass to the application
        jvmList - list of JVMs
        browserList - list of browsers
        defaults - default JVM and browser
        Since:
        RFT1.0
      • closeJarFile

        public static void closeJarFile(java.util.jar.JarFile jarfile)
      • getValidBrowserNameSupported

        public static java.lang.String getValidBrowserNameSupported(java.lang.String browName)
      • startBrowser

        public static com.rational.test.ft.sys.OSProcessInformation startBrowser(java.lang.String browserName,
                                                                                 java.lang.String url)
                                                                          throws RunException
        Starts a specific browser by specifying the logical name.
        Throws:
        RunException
        Since:
        RFT1.0
      • getBrowserProfilePath

        public static java.lang.String getBrowserProfilePath(java.lang.String browserType)
      • startBrowser

        public static com.rational.test.ft.sys.OSProcessInformation startBrowser(java.lang.String url)
                                                                          throws RunException
        Provides basic start-browser functionality.
        Throws:
        RunException
        Since:
        RFT1.0
      • shellExecute

        public static boolean shellExecute(java.lang.String fileName)
        Takes a file name and starts up the program associated with the file extension. (This is the same as double-clicking on the file from Explorer.) For example, on an .htm file, this brings up the default browser. This makes use of Windows ShellExecute; it is not implemented in UNIX.
        Parameters:
        fileName - the file to pass to Windows ShellExecute
        Returns:
        true when ShellExecute succeeds
        Since:
        RFT1.0
      • getScriptFileName

        public static java.lang.String getScriptFileName(java.lang.String scriptName,
                                                         java.lang.String datastore)
        Converts the full class name to the file name for the program source.
        Since:
        RFT1.0
      • getOperatingSystemVersion

        public static java.lang.String getOperatingSystemVersion()
        Exposes a description of the operating system including version information. The format of the resulting String is host dependent.
        Returns:
        The operating system version information.
      • callScript

        public static void callScript(RationalTestScript caller,
                                      RationalTestScript callee,
                                      java.lang.Object[] args,
                                      int iterationCount)
        This is an internal method used to perform cross datastore calls and is not to be utilized by users.