Package org.opentestfactory.utils.shell
Class Platform
java.lang.Object
org.opentestfactory.utils.shell.Platform
- Direct Known Subclasses:
PosixPlatform,WindowsPlatform
For testability, we encapsulate plateform-dependant behavior in a strategy family.
- Author:
- edegenetais
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddShellSpawnCommandIfNeeded(String localCommand) Depending on what works or doesn't on the platform, may decide wether to open a shell.voidaddStatementFromLine(Iterator<String> lineIterator, StringBuffer command) Perform platform-related changes to prepare the command string for execution.protected abstract StringchangeIntoInSHellCommand(String localCommand) static final PlatformThis function returns aPlatforminstance tuned to the local platform.abstract Stringprotected booleanisMultistatement(String localCommand) protected abstract booleanneedsShellOnPlatform(String command) protected abstract StringprepareStatement(String query)
-
Constructor Details
-
Platform
public Platform()
-
-
Method Details
-
getLocalPlatform
This function returns aPlatforminstance tuned to the local platform.- Returns:
- the
Platforminstance.
-
getPlatformStatementSeparator
-
addShellSpawnCommandIfNeeded
Depending on what works or doesn't on the platform, may decide wether to open a shell. Opening a shell may be done for example in order to obtain shell interpreter functions that are unavailable when we are merely creating a new process wiht the first command part as executable name. Shell opening is performed by adding platform specific parts to the commandline before executing it.- Parameters:
localCommand- the local command string.- Returns:
- the localCommand string with shell-opening part added.
-
isMultistatement
-
needsShellOnPlatform
-
prepareStatement
-
addStatementFromLine
Perform platform-related changes to prepare the command string for execution.- Parameters:
lineIterator-command-
-
changeIntoInSHellCommand
-