Mercurial > hg > release > icedtea-web-1.8
changeset 587:e04380d3306f
additions to test-extensions needed for the new AWTFramework
author | Jana Fabrikova <jfabriko@redhat.com> |
---|---|
date | Tue, 18 Dec 2012 13:58:24 +0100 |
parents | 1fe2a4f7981f |
children | 892cc7f39358 |
files | ChangeLog tests/reproducers/simple/SingleInstanceServiceTest/testcases/SingleInstanceTest.java tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java |
diffstat | 4 files changed, 75 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Dec 11 20:32:26 2012 +0100 +++ b/ChangeLog Tue Dec 18 13:58:24 2012 +0100 @@ -1,3 +1,21 @@ +2012-12-18 Jana Fabrikova <jfabriko@redhat.com> + + * /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 <jvanek@redhat.com> Added jacoco code coverage support
--- a/tests/reproducers/simple/SingleInstanceServiceTest/testcases/SingleInstanceTest.java Tue Dec 11 20:32:26 2012 +0100 +++ b/tests/reproducers/simple/SingleInstanceServiceTest/testcases/SingleInstanceTest.java Tue Dec 18 13:58:24 2012 +0100 @@ -109,7 +109,7 @@ 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 {
--- a/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java Tue Dec 11 20:32:26 2012 +0100 +++ b/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java Tue Dec 18 13:58:24 2012 +0100 @@ -64,7 +64,7 @@ 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 @@ 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 @@ 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 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 */
--- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java Tue Dec 11 20:32:26 2012 +0100 +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java Tue Dec 18 13:58:24 2012 +0100 @@ -573,6 +573,10 @@ 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 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 @@ 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 @@ 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 @@ * @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 {