aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-extensions
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-extensions')
-rw-r--r--tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java38
-rw-r--r--tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java22
2 files changed, 56 insertions, 4 deletions
diff --git a/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java b/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java
index 4a2199f..49d58ea 100644
--- a/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java
+++ b/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java
@@ -64,7 +64,7 @@ public class ProcessWrapper {
public ProcessWrapper() {
}
- public ProcessWrapper(String toBeExecuted, List<String> otherargs, URL u, ContentReaderListener stdoutl, ContentReaderListener stderrl, String[] vars) throws Exception {
+ public ProcessWrapper(String toBeExecuted, List<String> otherargs, URL u){
Assert.assertNotNull(u);
Assert.assertNotNull(toBeExecuted);
Assert.assertTrue(toBeExecuted.trim().length() > 1);
@@ -75,12 +75,24 @@ public class ProcessWrapper {
urledArgs.add(0, toBeExecuted);
urledArgs.add(u.toString());
this.args = urledArgs;
+ this.vars=null;
+ }
+
+ public ProcessWrapper(String toBeExecuted, List<String> otherargs, URL u, ContentReaderListener stdoutl, ContentReaderListener stderrl, String[] vars) throws Exception {
+ this(toBeExecuted, otherargs, u);
this.addStdOutListener(stdoutl);
this.addStdErrListener(stderrl);
this.vars=vars;
}
+ public ProcessWrapper(String toBeExecuted, List<String> otherargs, URL u, List<ContentReaderListener> stdoutl, List<ContentReaderListener> stderrl, String[] vars) throws Exception {
+ this(toBeExecuted, otherargs, u);
+ this.addStdOutListeners(stdoutl);
+ this.addStdErrListeners(stderrl);
+ this.vars=vars;
+ }
+
ProcessWrapper(final List<String> args, File dir, ContentReaderListener stdoutl, ContentReaderListener stderrl, String[] vars) {
this.args = args;
this.dir = dir;
@@ -89,6 +101,14 @@ public class ProcessWrapper {
this.vars = vars;
}
+ public ProcessWrapper(final List<String> args, File dir, List<ContentReaderListener> stdoutl, List<ContentReaderListener> stderrl, String[] vars) {
+ this.args = args;
+ this.dir = dir;
+ this.addStdOutListeners(stdoutl);
+ this.addStdErrListeners(stderrl);
+ this.vars = vars;
+ }
+
public final void addStdOutListener(ContentReaderListener l) {
if (l == null) {
return;
@@ -105,6 +125,22 @@ public class ProcessWrapper {
}
+ public final void addStdOutListeners(List<ContentReaderListener> l) {
+ if (l == null) {
+ return;
+ }
+ stdoutl.addAll(l);
+
+ }
+
+ public final void addStdErrListeners(List<ContentReaderListener> l) {
+ if (l == null) {
+ return;
+ }
+ stderrl.addAll(l);
+
+ }
+
/**
* @return the args
*/
diff --git a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
index 12fde78..6804faa 100644
--- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
+++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java
@@ -573,6 +573,10 @@ public class ServerAccess {
return executeBrowser(getBrowserParams(), resource, stdoutl, stderrl);
}
+ public ProcessResult executeBrowser(String resource, List<ContentReaderListener> stdoutl, List<ContentReaderListener> stderrl) throws Exception {
+ return executeBrowser(getBrowserParams(), resource, stdoutl, stderrl);
+ }
+
/**
* wrapping method to executeProcess (eg: javaws arg arg http://localhost:port/resource)
* will execute default javaws (@see JAVAWS_BUILD_BIN) upon default url upon cached server (@see SERVER_NAME @see getPort(), @see getInstance()))
@@ -592,7 +596,7 @@ public class ServerAccess {
}
public ProcessResult executeBrowser(List<String> otherargs, String resource) throws Exception {
- ProcessWrapper rpw = new ProcessWrapper(getBrowserLocation(), otherargs, getUrlUponThisInstance(resource), null, null, null);
+ ProcessWrapper rpw = new ProcessWrapper(getBrowserLocation(), otherargs, getUrlUponThisInstance(resource));
rpw.setReactingProcess(getCurrentBrowser());//current browser may be null, but it does not metter
return rpw.execute();
}
@@ -603,8 +607,14 @@ public class ServerAccess {
return rpw.execute();
}
+ public ProcessResult executeBrowser(List<String> otherargs, String resource, List<ContentReaderListener> stdoutl, List<ContentReaderListener> stderrl) throws Exception {
+ ProcessWrapper rpw = new ProcessWrapper(getBrowserLocation(), otherargs, getUrlUponThisInstance(resource), stdoutl, stderrl, null);
+ rpw.setReactingProcess(getCurrentBrowser());// current browser may be null, but it does not matter
+ return rpw.execute();
+ }
+
public ProcessResult executeBrowser(Browser b, List<String> otherargs, String resource) throws Exception {
- ProcessWrapper rpw = new ProcessWrapper(b.getBin(), otherargs, getUrlUponThisInstance(resource), null, null, null);
+ ProcessWrapper rpw = new ProcessWrapper(b.getBin(), otherargs, getUrlUponThisInstance(resource));
rpw.setReactingProcess(b);
return rpw.execute();
}
@@ -615,6 +625,12 @@ public class ServerAccess {
return rpw.execute();
}
+ public ProcessResult executeBrowser(Browser b, List<String> otherargs, String resource, List<ContentReaderListener> stdoutl, List<ContentReaderListener> stderrl) throws Exception {
+ ProcessWrapper rpw = new ProcessWrapper(b.getBin(), otherargs, getUrlUponThisInstance(resource), stdoutl, stderrl, null);
+ rpw.setReactingProcess(b);
+ return rpw.execute();
+ }
+
/**
* Create resource on http, on 'localhost' on port on which this cached instance is running
* @param resource
@@ -661,7 +677,7 @@ public class ServerAccess {
* @throws Exception
*/
public static ProcessResult executeProcessUponURL(String toBeExecuted, List<String> otherargs, URL u) throws Exception {
- return new ProcessWrapper(toBeExecuted, otherargs, u, null, null, null).execute();
+ return new ProcessWrapper(toBeExecuted, otherargs, u).execute();
}
public static ProcessResult executeProcessUponURL(String toBeExecuted, List<String> otherargs, URL u, ContentReaderListener stdoutl, ContentReaderListener stderrl) throws Exception {