Class PythonEnvironmentTest
java.lang.Object
test.de.iip_ecosphere.platform.services.environment.AbstractEnvironmentTest
test.de.iip_ecosphere.platform.services.environment.PythonEnvironmentTest
Integration test for the Python environment.
- Author:
- Sakshi Singh, SSE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ProcesscreatePythonProcess(File dir, String... args) Creates and starts a Python process.static ProcessCreates and starts a Python process.static ProcesscreatePythonProcess(String... args) Creates and starts a Python process with home directory "./src/test/python".static ProcessCreates and starts a Python process with home directory "./src/test/python".private static voidredirectIO(InputStream src, PrintStream dest, Consumer<String> cons) Redirects an input stream to another stream (in parallel).voidsetup()Sets up plugins.voidTests the Python implementation.private voidtestPythonEnvironment(String protocol) Tests the Python implementation.Methods inherited from class test.de.iip_ecosphere.platform.services.environment.AbstractEnvironmentTest
testAas, testAasResult
-
Constructor Details
-
PythonEnvironmentTest
public PythonEnvironmentTest()
-
-
Method Details
-
setup
public void setup()Sets up plugins. Non-static so that loading is inherited. -
redirectIO
Redirects an input stream to another stream (in parallel).- Parameters:
src- the source streamdest- the destination streamcons- optional consumer to analyze received lines, may be null for none
-
createPythonProcess
Creates and starts a Python process.- Parameters:
dir- the home dir where to find the script/run it withinargs- the process arguments for the script including python arguments (first), script and script arguments- Returns:
- the created process
- Throws:
IOException- if process creation fails
-
createPythonProcess
public static Process createPythonProcess(File dir, Consumer<String> stdCons, Consumer<String> errCons, String... args) throws IOException Creates and starts a Python process.- Parameters:
dir- the home dir where to find the script/run it withinstdCons- optional consumer on standard out, may be nullerrCons- optional consumer on standard error, may be nullargs- the process arguments for the script including python arguments (first), script and script arguments- Returns:
- the created process
- Throws:
IOException- if process creation fails
-
createPythonProcess
Creates and starts a Python process with home directory "./src/test/python".- Parameters:
args- the process arguments for the script including python arguments (first), script and script arguments- Returns:
- the created process
- Throws:
IOException- if process creation fails
-
createPythonProcess
public static Process createPythonProcess(Consumer<String> stdCons, Consumer<String> errCons, String... args) throws IOException Creates and starts a Python process with home directory "./src/test/python".- Parameters:
stdCons- optional consumer on standard out, may be nullerrCons- optional consumer on standard error, may be nullargs- the process arguments for the script including python arguments (first), script and script arguments- Returns:
- the created process
- Throws:
IOException- if process creation fails
-
testPythonEnvironment
Tests the Python implementation.- Throws:
IOException- shall not occurExecutionException- shall not occur
-
testPythonEnvironment
Tests the Python implementation.- Parameters:
protocol- the AAS implementation protocol (seeAasFactory.getProtocols()- Throws:
IOException- shall not occurExecutionException- shall not occur
-