Skip to content

Commit be3ab6a

Browse files
committed
Merge branch 'develop' of github.com:oracle/weblogic-deploy-tooling into develop
2 parents 61f48fd + 5af6d40 commit be3ab6a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

core/src/test/java/oracle/weblogic/deploy/aliases/TypeUtilsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import org.python.core.PyTuple;
2020

2121
import static org.junit.jupiter.api.Assertions.assertEquals;
22+
import static org.junit.jupiter.api.Assertions.assertNotNull;
2223
import static org.junit.jupiter.api.Assertions.assertNull;
2324
import static org.junit.jupiter.api.Assertions.assertThrows;
24-
import static org.powermock.utils.Asserts.assertNotNull;
2525

2626
public class TypeUtilsTest {
2727
@Test

system-test/src/test/java/oracle/weblogic/deploy/integration/utils/Runner.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.io.IOException;
55
import java.io.InputStreamReader;
66
import java.io.PrintWriter;
7+
import java.util.HashMap;
78
import java.util.Map;
89

910
import oracle.weblogic.deploy.logging.PlatformLogger;
@@ -54,12 +55,27 @@ public static CommandResult run(String command) throws IOException, InterruptedE
5455
* @throws InterruptedException if the wait is interrupted before the process completes
5556
*/
5657
public static CommandResult run(String command, PrintWriter output) throws IOException, InterruptedException {
58+
return run(command, output, new HashMap<>());
59+
}
60+
61+
/**
62+
* Run the provided shell command, and send stdout/stderr to the PrintWriter.
63+
* @param command external command to be executed
64+
* @param output PrintWriter to receive stdout
65+
* @param environment values to insert into the new process environment
66+
* @return result from running the provided command
67+
* @throws IOException if process start fails
68+
* @throws InterruptedException if the wait is interrupted before the process completes
69+
*/
70+
public static CommandResult run(String command, PrintWriter output, Map<String,String> environment) throws IOException, InterruptedException {
5771
ProcessBuilder pb = new ProcessBuilder("/bin/sh", "-c", command);
5872
Process p = null;
5973

6074
try {
6175
pb.redirectErrorStream(true);
6276
p = pb.start();
77+
Map<String, String> processEnv = pb.environment();
78+
processEnv.putAll(environment);
6379

6480
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream(), UTF_8));
6581
StringBuilder processOut = new StringBuilder();

0 commit comments

Comments
 (0)