Class CarbonCommandToolsUtil


  • public class CarbonCommandToolsUtil
    extends Object
    Provides utility methods for carbon tools automation
    • Constructor Detail

      • CarbonCommandToolsUtil

        public CarbonCommandToolsUtil()
    • Method Detail

      • isScriptRunSuccessfully

        public static boolean isScriptRunSuccessfully​(String directory,
                                                      String[] cmdArray,
                                                      String expectedString)
                                               throws CarbonToolsIntegrationTestException
        This method is to execute commands and reading the logs to find the expected string.
        Parameters:
        directory - - Directory which has the file to be executed .
        cmdArray - - Command array to be executed.
        expectedString - - Expected string in the log.
        Returns:
        boolean - true : Found the expected string , false : not found the expected string.
        Throws:
        CarbonToolsIntegrationTestException - - Error while getting the command directory
      • isServerStartedUp

        public static boolean isServerStartedUp​(org.wso2.carbon.automation.engine.context.AutomationContext automationContext,
                                                int portOffset)
                                         throws CarbonToolsIntegrationTestException
        This method to check whether server is up or not This method wait for some time to check login status by checking the port and login This will throw an exception if port is not open or couldn't login
        Parameters:
        automationContext - - AutomationContext
        Returns:
        true: If server is up else false
        Throws:
        CarbonToolsIntegrationTestException - - Error while waiting for login
      • isServerDown

        public static boolean isServerDown​(int portOffset)
        This method is to check whether server is down or not
        Parameters:
        portOffset - - port offset
        Returns:
        boolean - if server is down true : else false
      • waitForFileCreation

        public static boolean waitForFileCreation​(String filePathString)
        This method to check file has created or not
        Parameters:
        filePathString - - file path
        Returns:
        - if file created true else false
      • getCurrentOperatingSystem

        public static String getCurrentOperatingSystem()
        Provides current operating system
        Returns:
        if current os is windows return true : else false
      • serverShutdown

        public static void serverShutdown​(String backendURL,
                                          String userName,
                                          String password,
                                          int portOffset)
                                   throws CarbonToolsIntegrationTestException
        This method is to shutdown carbon server using admin credentials
        Parameters:
        backendURL - - server backend url
        userName - - admin username
        password - - admin password
        portOffset - - port offset
        Throws:
        CarbonToolsIntegrationTestException - - Error while server shutting down
      • getDataSourceInformation

        public static DataSourceBean getDataSourceInformation​(String dataSourceName)
                                                       throws XPathExpressionException
        Get the data source information from the automation configuration file
        Parameters:
        dataSourceName - - Data source name given in the configuration file
        Returns:
        DataSourceInformation - Information about the data source.
        Throws:
        XPathExpressionException - - Throws if an exception occurred when getting data for configuration file