[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/socketfactory ...
Ron Sigal
ron_sigal at yahoo.com
Wed Jan 17 00:19:35 EST 2007
User: rsigal
Date: 07/01/17 00:19:35
Added: src/tests/org/jboss/test/remoting/socketfactory
StaticTestListener.java TestListener.java
FailingTestListener.java
Log:
JBREM-298: Pulled listener classes out of CreationListenerTestRoot.
Revision Changes Path
1.2 +54 -0 JBossRemoting/src/tests/org/jboss/test/remoting/socketfactory/StaticTestListener.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StaticTestListener.java
===================================================================
RCS file: StaticTestListener.java
diff -N StaticTestListener.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ StaticTestListener.java 17 Jan 2007 05:19:35 -0000 1.2
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.socketfactory;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.jboss.remoting.socketfactory.SocketCreationListener;
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.2 $
+ * <p>
+ * Copyright Jan 16, 2007
+ * </p>
+ */
+public class StaticTestListener implements SocketCreationListener
+{
+ private static boolean visited;
+
+ public void socketCreated(Socket socket, Object source) throws IOException
+ {
+ visited = true;
+ }
+
+ public static boolean visited()
+ {
+ return visited;
+ }
+
+ public static void reset()
+ {
+ visited = false;
+ }
+}
1.2 +72 -0 JBossRemoting/src/tests/org/jboss/test/remoting/socketfactory/TestListener.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TestListener.java
===================================================================
RCS file: TestListener.java
diff -N TestListener.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ TestListener.java 17 Jan 2007 05:19:35 -0000 1.2
@@ -0,0 +1,72 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.socketfactory;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+import javax.net.SocketFactory;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.socketfactory.SocketCreationListener;
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.2 $
+ * <p>
+ * Copyright Jan 16, 2007
+ * </p>
+ */
+public class TestListener implements SocketCreationListener
+{
+ private static Logger log = Logger.getLogger(TestListener.class);
+ private boolean visited;
+ private boolean client;
+
+ public void socketCreated(Socket socket, Object source) throws IOException
+ {
+ visited = true;
+ if (source instanceof SocketFactory)
+ client = true;
+ else if (source instanceof ServerSocket)
+ client = false;
+ else
+ log.error("unrecognized socket source: " + source);
+ log.info(this + ": " + source);
+ }
+
+ public boolean visited()
+ {
+ return visited;
+ }
+
+ public boolean isClient()
+ {
+ return client;
+ }
+
+ public void reset()
+ {
+ visited = false;
+ }
+}
1.2 +42 -0 JBossRemoting/src/tests/org/jboss/test/remoting/socketfactory/FailingTestListener.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FailingTestListener.java
===================================================================
RCS file: FailingTestListener.java
diff -N FailingTestListener.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ FailingTestListener.java 17 Jan 2007 05:19:35 -0000 1.2
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.remoting.socketfactory;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.jboss.remoting.socketfactory.SocketCreationListener;
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.2 $
+ * <p>
+ * Copyright Jan 16, 2007
+ * </p>
+ */
+public class FailingTestListener implements SocketCreationListener
+{
+ public void socketCreated(Socket socket, Object source) throws IOException
+ {
+ throw new IOException();
+ }
+}
More information about the jboss-cvs-commits
mailing list