From cc383fcf7288977d01608d9da4d9d84d167e1aad Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Thu, 7 Nov 2013 09:59:22 -0500 Subject: Reproducer test cleanup to remove deprecation warnings and type checking warnings. ServerAccess.ProcessResult removed and reference replaced with ProcessResult. junit.framework.assert replaced in favour of org.junit.Assert. Added parameterized typing to instantiation of several fields and local variables where the declaration was already parameterized. --- .../net/sourceforge/jnlp/ContentReader.java | 2 +- .../net/sourceforge/jnlp/ProcessWrapper.java | 14 +++++++------- .../net/sourceforge/jnlp/ServerAccess.java | 16 +++------------- 3 files changed, 11 insertions(+), 21 deletions(-) (limited to 'tests/test-extensions/net/sourceforge') diff --git a/tests/test-extensions/net/sourceforge/jnlp/ContentReader.java b/tests/test-extensions/net/sourceforge/jnlp/ContentReader.java index dd7ab89..da47f6e 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/ContentReader.java +++ b/tests/test-extensions/net/sourceforge/jnlp/ContentReader.java @@ -52,7 +52,7 @@ class ContentReader implements Runnable { StringBuilder sb = new StringBuilder(); private final InputStream is; private boolean done; - final List listeners = new ArrayList(1); + final List listeners = new ArrayList(1); public String getContent() { return sb.toString(); diff --git a/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java b/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java index 9b2dbbb..6c9cdd4 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java +++ b/tests/test-extensions/net/sourceforge/jnlp/ProcessWrapper.java @@ -56,8 +56,8 @@ public class ProcessWrapper { private List args; private File dir; - private final List stdoutl = new ArrayList(1); - private final List stderrl = new ArrayList(1); + private final List stdoutl = new ArrayList(1); + private final List stderrl = new ArrayList(1); private String[] vars; private ReactingProcess reactingProcess; @@ -73,9 +73,9 @@ public class ProcessWrapper { Assert.assertNotNull(toBeExecuted); Assert.assertTrue(toBeExecuted.trim().length() > 1); if (otherargs == null) { - otherargs = new ArrayList(1); + otherargs = new ArrayList(1); } - List urledArgs = new ArrayList(otherargs); + List urledArgs = new ArrayList(otherargs); urledArgs.add(0, toBeExecuted); urledArgs.add(s); this.args = urledArgs; @@ -201,7 +201,7 @@ public class ProcessWrapper { this.vars = vars; } - public ServerAccess.ProcessResult execute() throws Exception { + public ProcessResult execute() throws Exception { if (reactingProcess !=null ){ reactingProcess.beforeProcess(""); }; @@ -222,7 +222,7 @@ public class ProcessWrapper { } if (t.deadlyException != null) { pa.setCanRun(false); - return new ServerAccess.ProcessResult("", "", null, true, Integer.MIN_VALUE, t.deadlyException); + return new ProcessResult("", "", null, true, Integer.MIN_VALUE, t.deadlyException); } ContentReader crs = new ContentReader(t.getP().getInputStream(), stdoutl); ContentReader cre = new ContentReader(t.getP().getErrorStream(), stderrl); @@ -244,7 +244,7 @@ public class ProcessWrapper { pa.setCanRun(false); // ServerAccess.logOutputReprint(t.getP().exitValue()); when process is killed, this throws exception - ServerAccess.ProcessResult pr = new ServerAccess.ProcessResult(crs.getContent(), cre.getContent(), t.getP(), pa.wasTerminated(), t.getExitCode(), null); + ProcessResult pr = new ProcessResult(crs.getContent(), cre.getContent(), t.getP(), pa.wasTerminated(), t.getExitCode(), null); if (ServerAccess.PROCESS_LOG) { ServerAccess.log(pr.stdout, true, false); ServerAccess.log(pr.stderr, false, true); diff --git a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java index 31e81ad..6f45a23 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java @@ -55,6 +55,7 @@ import java.net.ServerSocket; import java.net.URL; import java.util.ArrayList; import java.util.List; +import net.sourceforge.jnlp.ProcessResult; import net.sourceforge.jnlp.browsertesting.Browser; import net.sourceforge.jnlp.browsertesting.BrowserFactory; import net.sourceforge.jnlp.browsertesting.Browsers; @@ -270,7 +271,7 @@ public class ServerAccess { if (this.currentBrowser==null) return null; List l1=this.currentBrowser.getComaptibilitySwitches(); List l2=this.currentBrowser.getDefaultSwitches(); - List l= new ArrayList(); + List l= new ArrayList(); if (l1!=null)l.addAll(l1); if (l2!=null)l.addAll(l2); return l; @@ -832,15 +833,4 @@ public class ServerAccess { return new ProcessWrapper(args, dir, stdoutl, stderrl, vars).execute(); } - /** - * this is temprary solution until refactoring is fully done - * Use net.sourceforge.jnlp.ProcessResult instead - */ - @Deprecated - public static class ProcessResult extends net.sourceforge.jnlp.ProcessResult { - - public ProcessResult(String stdout, String stderr, Process process, boolean wasTerminated, Integer r, Throwable deadlyException) { - super(stdout, stderr, process, wasTerminated, r, deadlyException); - } - } - } +} -- cgit v1.2.3