Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 53373 invoked from network); 1 Feb 2002 21:39:36 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 1 Feb 2002 21:39:36 -0000 Received: (qmail 23222 invoked by uid 97); 1 Feb 2002 21:39:36 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 23203 invoked by uid 97); 1 Feb 2002 21:39:36 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 23192 invoked by uid 97); 1 Feb 2002 21:39:35 -0000 Date: 1 Feb 2002 21:39:14 -0000 Message-ID: <20020201213914.24973.qmail@icarus.apache.org> From: sbailliez@apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/remote Server.java TestRunEvent.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N sbailliez 02/02/01 13:39:14 Modified: proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/remote Server.java TestRunEvent.java Log: - Add equals method to event. - Fix server shutdown Revision Changes Path 1.8 +4 -5 jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/remote/Server.java Index: Server.java =================================================================== RCS file: /home/cvs/jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/remote/Server.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Server.java 1 Feb 2002 19:55:48 -0000 1.7 +++ Server.java 1 Feb 2002 21:39:13 -0000 1.8 @@ -111,8 +111,8 @@ } /** return whether there is a client running or not */ - public boolean isRunning() { - return client != null; + public synchronized boolean isRunning() { + return client != null && server != null && messenger != null; } /** start a server to the specified port */ @@ -122,7 +122,7 @@ } /** cancel the connection to the client */ - public void cancel() { + public synchronized void cancel() { if (isRunning()) { TestRunEvent evt = new TestRunEvent(new Integer(-1), TestRunEvent.RUN_STOP); try { @@ -133,7 +133,7 @@ } /** shutdown the server and any running client */ - public void shutdown() { + public synchronized void shutdown() { try { if (messenger != null) { messenger.close(); @@ -174,7 +174,6 @@ } catch (Exception e) { //@fixme this stacktrace might be normal when closing // the socket. So decompose the above in distinct steps - e.printStackTrace(); } finally { cancel(); shutdown(); 1.2 +16 -1 jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/remote/TestRunEvent.java Index: TestRunEvent.java =================================================================== RCS file: /home/cvs/jakarta-ant/proposal/sandbox/junit/src/main/org/apache/tools/ant/taskdefs/optional/junit/remote/TestRunEvent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestRunEvent.java 30 Jan 2002 21:06:49 -0000 1.1 +++ TestRunEvent.java 1 Feb 2002 21:39:13 -0000 1.2 @@ -153,7 +153,22 @@ return props; } + public boolean equals(Object o){ + if (o instanceof TestRunEvent){ + TestRunEvent other = (TestRunEvent)o; + return ( (type == other.type) && + (timestamp == other.timestamp) && + ( name == null ? other.name == null : name.equals(other.name) ) && + ( stacktrace == null ? other.stacktrace == null : stacktrace.equals(other.stacktrace) ) && + ( props == null ? other.props == null : props.equals(other.props) ) ) ; + } + return false; + } + public String toString(){ - return "Id: " + source + ", Type: " + type; + StringBuffer buf = new StringBuffer(); + buf.append("id: ").append(source); + buf.append("type: ").append(type); + return buf.toString(); } } -- To unsubscribe, e-mail: For additional commands, e-mail: