public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static void |
checkPortAvailability(int port)
Check whether given port is in use or not.
|
static void |
checkPortsAvailability(int[] ports)
Check whether given ports are in use or not.
|
static void |
copyFile(Path source,
Path target)
Copy a file.
|
static void |
deleteFolder(File folder)
Delete a given folder and all it's content.
|
static void |
extractFile(String sourceFilePath,
String extractedDir)
Unzip a zip file into a given location.
|
static String |
getOSName()
Return the system property value of os.name.
|
static void |
waitForPortsToClose(int[] ports,
int timeout)
This method will wait until given ports are closed within given timeout value in mills.
|
static void |
waitForPortsToOpen(int[] ports,
long timeout,
boolean verbose,
String hostName)
This method will wait for given ports to open until given timeout period.
|
public static void waitForPortsToOpen(int[] ports, long timeout, boolean verbose, String hostName) throws RuntimeException
ports
- The port values that needs to be checkedtimeout
- The timeout waiting for the port to openverbose
- if verbose is set to true,hostName
- The hostname that needs to be checkedRuntimeException
- if the port is not opened within the timeoutpublic static void waitForPortsToClose(int[] ports, int timeout)
ports
- - http ports valuestimeout
- - max time to waitpublic static void checkPortAvailability(int port) throws BallerinaTestException
port
- - port numberBallerinaTestException
- if port is already in usepublic static void checkPortsAvailability(int[] ports)
ports
- - http ports valuespublic static void extractFile(String sourceFilePath, String extractedDir) throws IOException, BallerinaTestException
sourceFilePath
- - zip file need to extractextractedDir
- - destination path given file to extractIOException
- if an i/o exception occurs when extracting the fileBallerinaTestException
- if ballerina test exception occurs when extracting the filepublic static String getOSName()
public static void copyFile(Path source, Path target) throws BallerinaTestException
source
- The source filetarget
- The target fileBallerinaTestException
- if copying failedpublic static void deleteFolder(File folder)
folder
- The folder to delete.Copyright © 2018 WSO2. All rights reserved.