vmassol 01/08/19 08:12:42 Modified: cactus/src/ant/org/apache/commons/cactus/ant RunServerTestsTask.java StartServerHelper.java StartServerTask.java StopServerHelper.java StopServerTask.java Log: align with coding conventions Revision Changes Path 1.3 +17 -15 jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/RunServerTestsTask.java Index: RunServerTestsTask.java =================================================================== RCS file: /home/cvs/jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/RunServerTestsTask.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- RunServerTestsTask.java 2001/08/09 17:53:38 1.2 +++ RunServerTestsTask.java 2001/08/19 15:12:42 1.3 @@ -82,14 +82,16 @@ * when this task was executed.</li> * </ul> * - * @version @version@ + * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a> + * + * @version $Id: RunServerTestsTask.java,v 1.3 2001/08/19 15:12:42 vmassol Exp $ */ public class RunServerTestsTask extends Task { /** * the test target name. */ - private String m_TestTarget; + private String testTarget; /** * The helper object used to start the server. We use a helper so that it @@ -97,7 +99,7 @@ * with Ant 1.3 and before there are classloaders issues with calling a * custom task from another custom task. Using a helper is a workaround. */ - private StartServerHelper m_StartHelper; + private StartServerHelper startHelper; /** * The helper object used to stop the server. We use a helper so that it @@ -105,15 +107,15 @@ * with Ant 1.3 and before there are classloaders issues with calling a * custom task from another custom task. Using a helper is a workaround. */ - private StopServerHelper m_StopHelper; + private StopServerHelper stopHelper; /** * Initialize the task. */ public void init() { - m_StartHelper = new StartServerHelper(this); - m_StopHelper = new StopServerHelper(this); + this.startHelper = new StartServerHelper(this); + this.stopHelper = new StopServerHelper(this); } /** @@ -127,7 +129,7 @@ } finally { // Make sure we stop the server but only if it were not already // started before the execution of this task. - if (!m_StartHelper.isServerAlreadyStarted()) { + if (!this.startHelper.isServerAlreadyStarted()) { callStop(); } } @@ -138,7 +140,7 @@ */ private void callStart() { - m_StartHelper.execute(); + this.startHelper.execute(); } /** @@ -146,7 +148,7 @@ */ private void callStop() { - m_StopHelper.execute(); + this.stopHelper.execute(); } /** @@ -160,7 +162,7 @@ callee.setTaskName(getTaskName()); callee.setLocation(location); callee.init(); - callee.setTarget(m_TestTarget); + callee.setTarget(this.testTarget); callee.execute(); } @@ -171,7 +173,7 @@ */ public void setStartTarget(String theStartTarget) { - m_StartHelper.setStartTarget(theStartTarget); + this.startHelper.setStartTarget(theStartTarget); } /** @@ -181,7 +183,7 @@ */ public void setStopTarget(String theStopTarget) { - m_StopHelper.setStopTarget(theStopTarget); + this.stopHelper.setStopTarget(theStopTarget); } /** @@ -191,8 +193,8 @@ */ public void setTestURL(String theTestURL) { - m_StartHelper.setTestURL(theTestURL); - m_StopHelper.setTestURL(theTestURL); + this.startHelper.setTestURL(theTestURL); + this.stopHelper.setTestURL(theTestURL); } /** @@ -202,7 +204,7 @@ */ public void setTestTarget(String theTestTarget) { - m_TestTarget = theTestTarget; + this.testTarget = theTestTarget; } } 1.5 +30 -21 jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/StartServerHelper.java Index: StartServerHelper.java =================================================================== RCS file: /home/cvs/jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/StartServerHelper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- StartServerHelper.java 2001/08/09 17:53:39 1.4 +++ StartServerHelper.java 2001/08/19 15:12:42 1.5 @@ -69,33 +69,38 @@ * trying to call a URL.</li> * </ul>. * - * @version @version@ + * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a> + * + * @version $Id: StartServerHelper.java,v 1.5 2001/08/19 15:12:42 vmassol Exp $ */ public class StartServerHelper implements Runnable { /** * The URL that is continuously pinged to verify if the server is running. */ - private URL m_TestURL; + private URL testURL; /** * The Ant target name that will start the web server/servlet engine. */ - private String m_StartTarget; + private String startTarget; /** * The tasks that wraps around this helper class */ - private Task m_Task; + private Task task; /** * True if the server was already started when this task is executed. */ - private boolean m_IsServerAlreadyStarted = false; + private boolean isServerAlreadyStarted = false; + /** + * @return true if the server has already been started. + */ public boolean isServerAlreadyStarted() { - return m_IsServerAlreadyStarted; + return this.isServerAlreadyStarted; } /** @@ -103,7 +108,7 @@ */ public StartServerHelper(Task theTask) { - m_Task = theTask; + this.task = theTask; } /** @@ -112,27 +117,29 @@ public void execute() throws BuildException { // Verify that a test URL has been specified - if (m_TestURL == null) { + if (this.testURL == null) { throw new BuildException("A testURL attribute must be specified"); } // Verify that a start target has been specified - if (m_StartTarget == null) { - throw new BuildException("A startTarget Ant target name must be specified"); + if (this.startTarget == null) { + throw new BuildException("A startTarget Ant target name must " + + "be specified"); } // Try connecting in case the server is already running. If so, does // nothing try { - HttpURLConnection connection = (HttpURLConnection)m_TestURL.openConnection(); + HttpURLConnection connection = + (HttpURLConnection)this.testURL.openConnection(); connection.connect(); readFully(connection); connection.disconnect(); // Server is already running. Record this information so that we // don't stop it afterwards. - m_IsServerAlreadyStarted = true; + this.isServerAlreadyStarted = true; return; @@ -159,7 +166,8 @@ while (true) { try { - HttpURLConnection connection = (HttpURLConnection)m_TestURL.openConnection(); + HttpURLConnection connection = + (HttpURLConnection)this.testURL.openConnection(); connection.connect(); readFully(connection); connection.disconnect(); @@ -188,7 +196,8 @@ static void readFully(HttpURLConnection connection) throws IOException { // finish reading it to prevent (harmless) server-side exceptions - BufferedInputStream is = new BufferedInputStream(connection.getInputStream()); + BufferedInputStream is = + new BufferedInputStream(connection.getInputStream()); byte[] buffer = new byte[256]; while((is.read(buffer)) > 0) {} is.close(); @@ -202,14 +211,14 @@ { // Call the Ant target using the "antcall" task. CallTarget callee; - callee = (CallTarget)(m_Task.getProject().createTask("antcall")); - callee.setOwningTarget(m_Task.getOwningTarget()); - callee.setTaskName(m_Task.getTaskName()); - callee.setLocation(m_Task.getLocation()); + callee = (CallTarget)(this.task.getProject().createTask("antcall")); + callee.setOwningTarget(this.task.getOwningTarget()); + callee.setTaskName(this.task.getTaskName()); + callee.setLocation(this.task.getLocation()); callee.init(); - callee.setTarget(m_StartTarget); + callee.setTarget(this.startTarget); callee.execute(); // Should never reach this point as the target is blocking, unless the @@ -222,7 +231,7 @@ public void setTestURL(String theTestURL) { try { - m_TestURL = new URL(theTestURL); + this.testURL = new URL(theTestURL); } catch (MalformedURLException e) { throw new BuildException("Bad URL [" + theTestURL + "]", e); } @@ -233,7 +242,7 @@ */ public void setStartTarget(String theStartTarget) { - m_StartTarget = theStartTarget; + this.startTarget = theStartTarget; } } 1.2 +8 -6 jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/StartServerTask.java Index: StartServerTask.java =================================================================== RCS file: /home/cvs/jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/StartServerTask.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- StartServerTask.java 2001/04/09 11:52:34 1.1 +++ StartServerTask.java 2001/08/19 15:12:42 1.2 @@ -69,21 +69,23 @@ * trying to call a URL.</li> * </ul>. * - * @version @version@ + * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a> + * + * @version $Id: StartServerTask.java,v 1.2 2001/08/19 15:12:42 vmassol Exp $ */ public class StartServerTask extends Task { /** * Helper class */ - private StartServerHelper m_Helper; + private StartServerHelper helper; /** * Initialization */ public void init() { - m_Helper = new StartServerHelper(this); + this.helper = new StartServerHelper(this); } /** @@ -91,7 +93,7 @@ */ public void execute() throws BuildException { - m_Helper.execute(); + this.helper.execute(); } /** @@ -102,7 +104,7 @@ */ public void setTestURL(String theTestURL) { - m_Helper.setTestURL(theTestURL); + this.helper.setTestURL(theTestURL); } /** @@ -113,7 +115,7 @@ */ public void setStartTarget(String theStartTarget) { - m_Helper.setStartTarget(theStartTarget); + this.helper.setStartTarget(theStartTarget); } } 1.5 +23 -18 jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/StopServerHelper.java Index: StopServerHelper.java =================================================================== RCS file: /home/cvs/jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/StopServerHelper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- StopServerHelper.java 2001/08/09 17:53:39 1.4 +++ StopServerHelper.java 2001/08/19 15:12:42 1.5 @@ -65,31 +65,33 @@ * the servlet engine to be stopped by trying to continously connect to a test * URL. If it succeeds it means the server is not stopped yet ! * - * @version @version@ + * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a> + * + * @version $Id: StopServerHelper.java,v 1.5 2001/08/19 15:12:42 vmassol Exp $ */ public class StopServerHelper implements Runnable { /** * The URL that is continuously pinged to verify if the server is stopped */ - private URL m_TestURL; + private URL testURL; /** * The Ant target name that will stop the web server/servlet engine. */ - private String m_StopTarget; + private String stopTarget; /** * The tasks that wraps around this helper class */ - private Task m_Task; + private Task task; /** * @param theTask the Ant task that is calling this helper */ public StopServerHelper(Task theTask) { - m_Task = theTask; + this.task = theTask; } /** @@ -98,18 +100,20 @@ public void execute() throws BuildException { // Verify that a test URL has been specified - if (m_TestURL == null) { + if (this.testURL == null) { throw new BuildException("A testURL attribute must be specified"); } // Verify that a stop target has been specified - if (m_StopTarget == null) { - throw new BuildException("A stopTarget Ant target name must be specified"); + if (this.stopTarget == null) { + throw new BuildException("A stopTarget Ant target name must be " + + "specified"); } // Try connecting in case the server is already stopped. try { - HttpURLConnection connection = (HttpURLConnection)m_TestURL.openConnection(); + HttpURLConnection connection = + (HttpURLConnection)this.testURL.openConnection(); connection.connect(); StartServerHelper.readFully(connection); connection.disconnect(); @@ -133,7 +137,8 @@ while (true) { try { - HttpURLConnection connection = (HttpURLConnection)m_TestURL.openConnection(); + HttpURLConnection connection = + (HttpURLConnection)this.testURL.openConnection(); connection.connect(); StartServerHelper.readFully(connection); connection.disconnect(); @@ -156,7 +161,7 @@ throw new BuildException("Interruption during sleep", e); } - m_Task.log("Server stopped !"); + this.task.log("Server stopped !"); // We're done ... Ant will continue processing other tasks } @@ -169,14 +174,14 @@ { // Call the Ant target using the "antcall" task. CallTarget callee; - callee = (CallTarget)(m_Task.getProject().createTask("antcall")); - callee.setOwningTarget(m_Task.getOwningTarget()); - callee.setTaskName(m_Task.getTaskName()); - callee.setLocation(m_Task.getLocation()); + callee = (CallTarget)(this.task.getProject().createTask("antcall")); + callee.setOwningTarget(this.task.getOwningTarget()); + callee.setTaskName(this.task.getTaskName()); + callee.setLocation(this.task.getLocation()); callee.init(); - callee.setTarget(m_StopTarget); + callee.setTarget(this.stopTarget); callee.execute(); } @@ -186,7 +191,7 @@ public void setTestURL(String theTestURL) { try { - m_TestURL = new URL(theTestURL); + this.testURL = new URL(theTestURL); } catch (MalformedURLException e) { throw new BuildException("Bad URL [" + theTestURL + "]", e); } @@ -197,7 +202,7 @@ */ public void setStopTarget(String theStopTarget) { - m_StopTarget = theStopTarget; + this.stopTarget = theStopTarget; } } 1.3 +8 -6 jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/StopServerTask.java Index: StopServerTask.java =================================================================== RCS file: /home/cvs/jakarta-commons/cactus/src/ant/org/apache/commons/cactus/ant/StopServerTask.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StopServerTask.java 2001/08/09 17:53:39 1.2 +++ StopServerTask.java 2001/08/19 15:12:42 1.3 @@ -66,21 +66,23 @@ * when the start task was invoked, then it is not stopped when this tasks * executes. * - * @version @version@ + * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a> + * + * @version $Id: StopServerTask.java,v 1.3 2001/08/19 15:12:42 vmassol Exp $ */ public class StopServerTask extends Task { /** * Helper class */ - private StopServerHelper m_Helper; + private StopServerHelper helper; /** * Initialization */ public void init() { - m_Helper = new StopServerHelper(this); + this.helper = new StopServerHelper(this); } /** @@ -88,7 +90,7 @@ */ public void execute() throws BuildException { - m_Helper.execute(); + this.helper.execute(); } /** @@ -99,7 +101,7 @@ */ public void setTestURL(String theTestURL) { - m_Helper.setTestURL(theTestURL); + this.helper.setTestURL(theTestURL); } /** @@ -110,7 +112,7 @@ */ public void setStopTarget(String theStopTarget) { - m_Helper.setStopTarget(theStopTarget); + this.helper.setStopTarget(theStopTarget); } }