[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/shutdown ...
Ron Sigal
ron_sigal at yahoo.com
Mon Jul 9 18:22:08 EDT 2007
User: rsigal
Date: 07/07/09 18:22:08
Modified: src/tests/org/jboss/test/remoting/shutdown Tag:
remoting_2_x AbstractClient.java
Log:
JBREM-768: (1) Changed System.out.println() calls to log.info() calls; (2) now removes ConnectionListener.
Revision Changes Path
No revision
No revision
1.1.2.6 +20 -15 JBossRemoting/src/tests/org/jboss/test/remoting/shutdown/AbstractClient.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractClient.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/shutdown/AbstractClient.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -b -r1.1.2.5 -r1.1.2.6
--- AbstractClient.java 7 Jul 2007 04:00:09 -0000 1.1.2.5
+++ AbstractClient.java 9 Jul 2007 22:22:08 -0000 1.1.2.6
@@ -27,7 +27,9 @@
import junit.framework.TestCase;
+import org.apache.log4j.Logger;
import org.jboss.remoting.Client;
+import org.jboss.remoting.ConnectionListener;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.ServerInvoker;
import org.jboss.remoting.callback.Callback;
@@ -37,13 +39,14 @@
/**
* @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1.2.5 $
+ * @version $Revision: 1.1.2.6 $
* <p>
* Copyright Jan 19, 2007
* </p>
*/
public abstract class AbstractClient extends TestCase
{
+ private static Logger log = Logger.getLogger(AbstractClient.class);
private String transport;
private Map extraConfig;
@@ -52,8 +55,8 @@
{
this.transport = transport;
this.extraConfig = new HashMap(config);
- System.out.println("client transport: " + transport);
- System.out.println("log4j.configuration: " + System.getProperty("log4j.configuration"));
+ log.info("client transport: " + transport);
+ log.info("log4j.configuration: " + System.getProperty("log4j.configuration"));
Runtime.getRuntime().traceMethodCalls(true);
}
@@ -82,36 +85,38 @@
clientConfig.put(InvokerLocator.CLIENT_LEASE_PERIOD, "1000");
Client client = new Client(locator, clientConfig);
client.connect();
- System.out.println("client connected");
- client.addConnectionListener(new ShutdownTestServer.TestListener(), 1000);
+ log.info("client connected");
+ ConnectionListener listener = new ShutdownTestServer.TestListener();
+ client.addConnectionListener(listener, 1000);
Integer i = (Integer) client.invoke(new Integer(17));
if (18 != i.intValue())
throw new Exception("invocation failed");
- System.out.println("invocation successful");
+ log.info("invocation successful");
TestCallbackHandler callbackHandler1 = new TestCallbackHandler();
HashMap metadata = new HashMap();
metadata.put(ServerInvoker.BLOCKING_TIMEOUT, "2000");
metadata.put(ServerInvoker.BLOCKING_MODE, ServerInvoker.BLOCKING);
client.addListener(callbackHandler1, metadata, null, false);
- System.out.println("added blocking listener 1");
+ log.info("added blocking listener 1");
TestCallbackHandler callbackHandler2 = new TestCallbackHandler();
metadata.clear();
metadata.put(CallbackPoller.CALLBACK_POLL_PERIOD, "500");
metadata.put(ServerInvoker.BLOCKING_MODE, ServerInvoker.NONBLOCKING);
client.addListener(callbackHandler2, metadata, null, false);
- System.out.println("added nonblocking listener 2");
+ log.info("added nonblocking listener 2");
Thread.sleep(2000);
if (!callbackHandler1.receivedCallback)
{
- System.out.println("callback 1 failed");
+ log.info("callback 1 failed");
throw new Exception("callback 1 failed");
}
if (!callbackHandler2.receivedCallback)
{
- System.out.println("callback 2 failed");
+ log.info("callback 2 failed");
throw new Exception("callback 2 failed");
}
- System.out.println("callback successful");
+ log.info("callback successful");
+ client.removeConnectionListener(listener);
client.removeListener(callbackHandler1);
client.removeListener(callbackHandler2);
client.disconnect();
@@ -125,17 +130,17 @@
}
catch (InterruptedException e)
{
- System.out.println("interrupted");
+ log.info("interrupted");
}
}
};
t.setDaemon(daemon());
t.start();
- System.out.println("client disconnected");
+ log.info("client disconnected");
}
catch (Exception e)
{
- System.out.println("exception in client: " + e);
+ log.info("exception in client: " + e);
System.exit(1);
}
}
@@ -168,7 +173,7 @@
public void handleCallback(Callback callback) throws HandleCallbackException
{
receivedCallback = true;
- System.out.println("received callback: " + callback);
+ log.info("received callback: " + callback);
}
}
}
More information about the jboss-cvs-commits
mailing list