aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--tests/reproducers/simple/SingleInstanceServiceTest/testcases/SingleInstanceTest.java2
-rw-r--r--tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java38
-rw-r--r--tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java22
4 files changed, 75 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a304e09..15c8e27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2012-12-18 Jana Fabrikova <[email protected]>
+
+ * /tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java:
+ Added several new versions of method (executeBrowser) with lists
+ of ContentReaderListeners as arguments.
+ * /tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java:
+ Added new versions of the (constructor of ProcessWrapper) and methods
+ (addStdOutListeners) and (addStdErrListeners) for adding
+ ContentReaderListeners using List<ContentReaderListener>
+ instead of one ContentReaderListener as argument.
+ Added a new version of (constructor of ProcessWrapper) with
+ less arguments that is used instead of calling the constructor
+ with several arguments passed as null, thus causing ambiguity.
+ * /tests/reproducers/simple/SingeInstanceServiceTest/testcases/SingleInstanceTest.java:
+ Modified the call of (executeBrowser) method with null arguments
+ into a call of new method without the null arguments
+ -getting rid of an ambiguous call.
+
2012-12-11 Jiri Vanek <[email protected]>
Added jacoco code coverage support
diff --git a/tests/reproducers/simple/SingleInstanceServiceTest/testcases/SingleInstanceTest.java b/tests/reproducers/simple/SingleInstanceServiceTest/testcases/SingleInstanceTest.java
index 93e89d8..22fb429 100644
--- a/tests/reproducers/simple/SingleInstanceServiceTest/testcases/SingleInstanceTest.java
+++ b/tests/reproducers/simple/SingleInstanceServiceTest/testcases/SingleInstanceTest.java
@@ -109,7 +109,7 @@ public class SingleInstanceTest extends BrowserTest {
try {
boolean isJavawsTest = isJnlp(launchFile);
pr = isJavawsTest ? server.executeJavawsHeadless(launchFile, null, null)
- : server.executeBrowser(launchFile, null, null);
+ : server.executeBrowser(launchFile);
} catch (Exception ex) {
ServerAccess.logException(ex);
} finally {
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 {