Class CarbonCommandToolsUtil
java.lang.Object
org.wso2.carbon.integration.tests.common.utils.CarbonCommandToolsUtil
Provides utility methods for carbon tools automation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringProvides current operating systemstatic DataSourceBeangetDataSourceInformation(String dataSourceName) Get the data source information from the automation configuration filestatic booleanisScriptRunSuccessfully(String directory, String[] cmdArray, String expectedString) This method is to execute commands and reading the logs to find the expected string.static booleanisServerDown(int portOffset) This method is to check whether server is down or notstatic booleanisServerStartedUp(org.wso2.carbon.automation.engine.context.AutomationContext automationContext, int portOffset) 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 loginstatic ProcessThis method is to execute commands and return the Processstatic voidserverShutdown(int portOffset) This method is to shutdown carbon serverstatic voidserverShutdown(String backendURL, String userName, String password, int portOffset) This method is to shutdown carbon server using admin credentialsstatic booleanwaitForFileCreation(String filePathString) This method to check file has created or not
-
Constructor Details
-
CarbonCommandToolsUtil
public CarbonCommandToolsUtil()
-
-
Method Details
-
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
-
runScript
public static Process runScript(String directory, String[] cmdArray) throws CarbonToolsIntegrationTestException This method is to execute commands and return the Process- Parameters:
directory- - Directory which has the file to be executed .cmdArray- - Command array to be executed- Returns:
- Process - executed process
- Throws:
CarbonToolsIntegrationTestException- - Error while getting the execution 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
This method to check file has created or not- Parameters:
filePathString- - file path- Returns:
- - if file created true else false
-
getCurrentOperatingSystem
Provides current operating system- Returns:
- if current os is windows return true : else false
-
serverShutdown
This method is to shutdown carbon server- Parameters:
portOffset- - port offset- Throws:
CarbonToolsIntegrationTestException- - Error occurred while shutdown the server
-
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 urluserName- - admin usernamepassword- - admin passwordportOffset- - 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
-