aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-extensions/net/sourceforge/jnlp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-extensions/net/sourceforge/jnlp')
-rw-r--r--tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java31
-rw-r--r--tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java32
2 files changed, 52 insertions, 11 deletions
diff --git a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
index 7981054..35fb53f 100644
--- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
+++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
@@ -54,9 +54,7 @@ import java.net.MalformedURLException;
import java.net.ServerSocket;
import java.net.URL;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import net.sourceforge.jnlp.browsertesting.Browser;
import net.sourceforge.jnlp.browsertesting.BrowserFactory;
import net.sourceforge.jnlp.browsertesting.Browsers;
@@ -504,7 +502,7 @@ public class ServerAccess {
return executeJavawsHeadless(null, resource);
}
public ProcessResult executeJavawsHeadless(String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception {
- return executeJavawsHeadless(null, resource,stdoutl,stderrl);
+ return executeJavawsHeadless(null, resource,stdoutl,stderrl,null);
}
/**
@@ -517,15 +515,19 @@ public class ServerAccess {
* @throws Exception
*/
public ProcessResult executeJavawsHeadless(List<String> otherargs, String resource) throws Exception {
- return executeJavawsHeadless(otherargs, resource,null,null);
+ return executeJavawsHeadless(otherargs, resource,null,null,null);
}
- public ProcessResult executeJavawsHeadless(List<String> otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception {
+ public ProcessResult executeJavawsHeadless(List<String> otherargs, String resource, String[] vars) throws Exception {
+ return executeJavawsHeadless(otherargs, resource,null,null,vars);
+ }
+
+ public ProcessResult executeJavawsHeadless(List<String> otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl,String[] vars) throws Exception {
if (otherargs == null) {
otherargs = new ArrayList<String>(1);
}
List<String> headlesList = new ArrayList<String>(otherargs);
headlesList.add(HEADLES_OPTION);
- return executeJavaws(headlesList, resource,stdoutl,stderrl);
+ return executeJavaws(headlesList, resource,stdoutl,stderrl,vars);
}
@@ -563,6 +565,9 @@ public class ServerAccess {
public ProcessResult executeJavaws(List<String> otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception {
return executeProcessUponURL(getJavawsLocation(), otherargs, getUrlUponThisInstance(resource),stdoutl,stderrl);
}
+ public ProcessResult executeJavaws(List<String> otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl,String[] vars) throws Exception {
+ return executeProcessUponURL(getJavawsLocation(), otherargs, getUrlUponThisInstance(resource),stdoutl,stderrl,vars);
+ }
public ProcessResult executeBrowser(List<String> otherargs, String resource) throws Exception {
return executeProcessUponURL(getBrowserLocation(), otherargs, getUrlUponThisInstance(resource));
@@ -620,6 +625,9 @@ public class ServerAccess {
}
public static ProcessResult executeProcessUponURL(String toBeExecuted, List<String> otherargs, URL u,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception {
+ return executeProcess(otherargs, null, stdoutl, stderrl, null);
+ }
+ public static ProcessResult executeProcessUponURL(String toBeExecuted, List<String> otherargs, URL u,ContentReaderListener stdoutl,ContentReaderListener stderrl,String[] vars) throws Exception {
Assert.assertNotNull(u);
Assert.assertNotNull(toBeExecuted);
Assert.assertTrue(toBeExecuted.trim().length() > 1);
@@ -629,7 +637,7 @@ public class ServerAccess {
List<String> urledArgs = new ArrayList<String>(otherargs);
urledArgs.add(0, toBeExecuted);
urledArgs.add(u.toString());
- return executeProcess(urledArgs, stdoutl, stderrl);
+ return executeProcess(urledArgs, stdoutl, stderrl,vars);
}
public static ProcessResult executeProcess(final List<String> args) throws Exception {
@@ -638,6 +646,9 @@ public class ServerAccess {
public static ProcessResult executeProcess(final List<String> args,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception {
return executeProcess(args, null,stdoutl,stderrl);
}
+ public static ProcessResult executeProcess(final List<String> args,ContentReaderListener stdoutl,ContentReaderListener stderrl,String[] vars) throws Exception {
+ return executeProcess(args, null,stdoutl,stderrl,vars);
+ }
/**
* utility method to lunch process, get its stdout/stderr, its return value and to kill it if running to long (@see PROCESS_TIMEOUT)
*
@@ -767,7 +778,11 @@ public class ServerAccess {
}
public static ProcessResult executeProcess(final List<String> args, File dir, ContentReaderListener stdoutl, ContentReaderListener stderrl) throws Exception {
- ThreadedProcess t = new ThreadedProcess(args, dir);
+ return executeProcess(args, dir, stdoutl, stderrl,null);
+
+ }
+ public static ProcessResult executeProcess(final List<String> args, File dir, ContentReaderListener stdoutl, ContentReaderListener stderrl,String[] vars) throws Exception {
+ ThreadedProcess t = new ThreadedProcess(args, dir,vars);
if (PROCESS_LOG) {
String connectionMesaage = createConnectionMessage(t);
log(connectionMesaage, true, true);
diff --git a/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java b/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java
index 32f515a..2ee6b84 100644
--- a/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java
+++ b/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java
@@ -51,6 +51,7 @@ class ThreadedProcess extends Thread {
List<String> args;
Integer exitCode;
Boolean running;
+ String[] variables;
File dir;
Throwable deadlyException = null;
/*
@@ -75,15 +76,36 @@ class ThreadedProcess extends Thread {
return exitCode;
}
+ public void setVariables(String[] variables) {
+ this.variables = variables;
+ }
+
+ public String[] getVariables() {
+ return variables;
+ }
+
+
+
public ThreadedProcess(List<String> args) {
this.args = args;
}
public ThreadedProcess(List<String> args, File dir) {
- this.args = args;
+ this(args);
this.dir = dir;
}
+ public ThreadedProcess(List<String> args,String[] vars) {
+ this(args);
+ this.variables = vars;
+ }
+
+ public ThreadedProcess(List<String> args, File dir,String[] vars) {
+ this(args,dir);
+ this.variables = vars;
+ }
+
+
public String getCommandLine() {
String commandLine = "unknown command";
try {
@@ -110,9 +132,13 @@ class ThreadedProcess extends Thread {
running = true;
Runtime r = Runtime.getRuntime();
if (dir == null) {
- p = r.exec(args.toArray(new String[0]));
+ if (variables == null) {
+ p = r.exec(args.toArray(new String[0]));
+ } else {
+ p = r.exec(args.toArray(new String[0]), variables);
+ }
} else {
- p = r.exec(args.toArray(new String[0]), new String[0], dir);
+ p = r.exec(args.toArray(new String[0]), variables, dir);
}
try {
exitCode = p.waitFor();