public class Utility extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
retryCountSeconds |
| Constructor and Description |
|---|
Utility() |
| Modifier and Type | Method and Description |
|---|---|
static File |
assertFileDoesNotExist(String filePath)
Verify file from specified filePath doesn't exist
|
static File |
assertFileExists(String filePath)
Verify file from specified filePath exists
|
static void |
assertIsEmpty(File folder)
Asserting folder/File is empty based on its size
|
static String |
buildPath(String parent,
String... paths)
Helper for building strings of the resource passed as parameter
|
static File |
checkFileInPath(String fileName,
String path)
Search recursively in path
|
static void |
checkObjectIsInitialized(Object model,
String message) |
static String |
cmisDocTypeToExtentions(org.alfresco.dataprep.CMISUtil.DocumentType cmisDocumentType) |
static String |
convertBackslashToSlash(String value) |
static void |
deleteFolder(File folder) |
static Process |
executeCommandOnUnix(String command)
Execute any Terminal commands
Example:
executeOnWin("ls -la")
|
static String |
executeOnUnix(String command)
Execute any Terminal commands
Example:
executeOnWin("ls -la")
|
static void |
executeOnUnixNoWait(String command) |
static void |
executeOnWin(String command)
Example:
executeOnWin("mkdir 'a'")
|
static String |
executeOnWinAndReturnOutput(String command)
Method to retrieve a process output as String
|
static String |
getEnvironmentPropertyFile() |
static File |
getFileWithSize(String fileName,
int sizeMB)
Create a new
File with specific size (MB) |
static File |
getMountedApp(File fromLocation) |
static String |
getOSName() |
static String |
getParentPath(String fullPath)
If we have
"/test/something/now"
this method will return "/test/something"
|
static Properties |
getProperties(Class<?> classz,
String propertieFileName) |
static String |
getResourceTestDataContent(String fileName) |
static File |
getResourceTestDataFile(String fileName) |
static String |
getSystemOrFileProperty(String key,
Properties properties) |
static File |
getTestResourceFile(String filePath)
Return a file from the filePath location
|
static String |
getTextFromClipboard()
Get text copied to System Clipboard
|
static boolean |
isProcessRunning(String processName)
Check if process identified by
|
static boolean |
isPropertyEnabled(String key)
Check if property identified by key in *.properties file is enabled or not
|
static boolean |
isWinServiceRunning(String serviceName) |
static void |
killProcessExcludingMaven(String processName)
Kill process excluding Maven
|
static void |
killProcessName(String processName)
Kill a process using it's name.
|
static String |
prettyPrintJsonString(String unformattetJson)
Pretty prints unformatted JSON
|
static String |
removeLastSlash(String sourcePath)
If the path ends with /, methods return the path without last /
|
static File |
setNewFile(FileModel fileModel)
Get new
File with content based on file model. |
static void |
sleep(int interval,
int maxTime,
RetryOperation callback)
We will wait until the interval is passed from current run and retry until the maxTime is reached
|
static String |
splitGuidVersion(String guidWithVersion) |
static String |
toUrlParams(String url,
Map<String,String> params)
Generate URL query string from key value parameters
|
static void |
waitToLoopTime(int seconds,
String... info)
We will wait until the
|
static void |
waitUntilProcessFinishes(String processName,
int timeout,
int loopTime)
Wait until process finish to run
|
static boolean |
waitUntilProcessIsRunning(String processName)
Wait until process is running, or the retryCountSeconds is reached
|
public static void checkObjectIsInitialized(Object model, String message) throws Exception
Exceptionpublic static File getTestResourceFile(String filePath) throws TestConfigurationException
filePath - ExceptionTestConfigurationExceptionpublic static File getResourceTestDataFile(String fileName) throws TestConfigurationException
TestConfigurationExceptionpublic static String getResourceTestDataContent(String fileName) throws Exception
fileName - Exceptionpublic static String cmisDocTypeToExtentions(org.alfresco.dataprep.CMISUtil.DocumentType cmisDocumentType)
public static String buildPath(String parent, String... paths)
parent - paths - public static String getParentPath(String fullPath)
fullPath - public static String removeLastSlash(String sourcePath)
sourcePath - public static Properties getProperties(Class<?> classz, String propertieFileName) throws TestConfigurationException
TestConfigurationExceptionpublic static boolean isPropertyEnabled(String key)
key - public static void waitToLoopTime(int seconds,
String... info)
seconds - public static void sleep(int interval,
int maxTime,
RetryOperation callback)
throws Exception
interval - maxTime - callback - Exceptionpublic static String prettyPrintJsonString(String unformattetJson)
unformattetJson - public static String toUrlParams(String url, Map<String,String> params) throws UnsupportedEncodingException
url - params - UnsupportedEncodingExceptionpublic static String getEnvironmentPropertyFile()
public static File checkFileInPath(String fileName, String path)
fileName - path - public static File getFileWithSize(String fileName, int sizeMB) throws Exception
File with specific size (MB)public static String getSystemOrFileProperty(String key, Properties properties)
public static void executeOnUnixNoWait(String command) throws IOException
IOExceptionpublic static String executeOnUnix(String command)
command - public static Process executeCommandOnUnix(String command)
command - public static void executeOnWin(String command) throws Exception
command - Exceptionpublic static File assertFileExists(String filePath)
filePath - full path of the filepublic static File assertFileDoesNotExist(String filePath)
filePath - full path of the filepublic static void killProcessName(String processName) throws IOException
processName - IOExceptionpublic static void killProcessExcludingMaven(String processName) throws IOException
processName - IOExceptionpublic static File setNewFile(FileModel fileModel)
File with content based on file model.
The new file will be deleted in the end.public static boolean isProcessRunning(String processName)
processName - public static File getMountedApp(File fromLocation) throws TestConfigurationException
fromLocation - File mounted on TestConfigurationExceptionpublic static String getTextFromClipboard() throws IOException, UnsupportedFlavorException
IOExceptionUnsupportedFlavorExceptionpublic static String executeOnWinAndReturnOutput(String command) throws Exception
command - Exceptionpublic static void assertIsEmpty(File folder)
folder - public static boolean waitUntilProcessIsRunning(String processName)
processName - public static void waitUntilProcessFinishes(String processName, int timeout, int loopTime)
processName - timeout - loopTime - public static String getOSName() throws IOException
IOExceptionCopyright © 2005–2019 Alfresco Software. All rights reserved.