JBoss Remoting SVN: r5735 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/ssl/timeout.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-02-19 13:31:41 -0500 (Fri, 19 Feb 2010)
New Revision: 5735
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/ssl/timeout/SSLBisocketDefaultTimeoutTestCase.java
Log:
JBREM-1188: New unit test.
Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/ssl/timeout/SSLBisocketDefaultTimeoutTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/ssl/timeout/SSLBisocketDefaultTimeoutTestCase.java (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/bisocket/ssl/timeout/SSLBisocketDefaultTimeoutTestCase.java 2010-02-19 18:31:41 UTC (rev 5735)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.transport.bisocket.ssl.timeout;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.transport.ClientFactory;
+import org.jboss.remoting.transport.ClientInvoker;
+import org.jboss.remoting.transport.socket.ServerAddress;
+import org.jboss.remoting.transport.sslbisocket.SSLBisocketClientInvoker;
+import org.jboss.test.remoting.transport.socket.timeout.SocketDefaultTimeoutTestCase;
+
+
+/**
+ * Unit tests for JBREM-1188.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 16, 2010
+ */
+public class SSLBisocketDefaultTimeoutTestCase extends SocketDefaultTimeoutTestCase
+{
+ private static Logger log = Logger.getLogger(SSLBisocketDefaultTimeoutTestCase.class);
+
+
+ protected Class getClientFactoryClass()
+ {
+ return TestSSLBisocketClientFactory.class;
+ }
+
+
+ protected Class getClientInvokerClass()
+ {
+ return TestSSLBisocketClientInvoker.class;
+ }
+
+
+ public static class TestSSLBisocketClientFactory implements ClientFactory
+ {
+ public ClientInvoker createClientInvoker(InvokerLocator locator, Map config) throws IOException
+ {
+ ClientInvoker clientInvoker = new TestSSLBisocketClientInvoker(locator, config);
+ log.info("TestClientFaotory.createClientInvoker() returning " + clientInvoker);
+ return clientInvoker;
+ }
+ public boolean supportsSSL()
+ {
+ return true;
+ }
+ }
+
+
+ public static class TestSSLBisocketClientInvoker extends SSLBisocketClientInvoker
+ {
+ public TestSSLBisocketClientInvoker(InvokerLocator locator, Map configuration) throws IOException
+ {
+ super(locator, configuration);
+ }
+ public TestSSLBisocketClientInvoker(InvokerLocator locator) throws IOException
+ {
+ super(locator);
+ }
+ public ServerAddress getServerAddress()
+ {
+ return address;
+ }
+ public String toString()
+ {
+ return "TestSSLBisocketClientInvoker";
+ }
+ }
+}
\ No newline at end of file
14 years, 9 months
JBoss Remoting SVN: r5734 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/ssl/timeout.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-02-19 13:27:42 -0500 (Fri, 19 Feb 2010)
New Revision: 5734
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/ssl/timeout/SSLBisocketDefaultTimeoutTestCase.java
Log:
JBREM-1188: New unit test.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/ssl/timeout/SSLBisocketDefaultTimeoutTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/ssl/timeout/SSLBisocketDefaultTimeoutTestCase.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/ssl/timeout/SSLBisocketDefaultTimeoutTestCase.java 2010-02-19 18:27:42 UTC (rev 5734)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.transport.bisocket.ssl.timeout;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.transport.ClientFactory;
+import org.jboss.remoting.transport.ClientInvoker;
+import org.jboss.remoting.transport.socket.ServerAddress;
+import org.jboss.remoting.transport.sslbisocket.SSLBisocketClientInvoker;
+import org.jboss.test.remoting.transport.socket.timeout.SocketDefaultTimeoutTestCase;
+
+
+/**
+ * Unit tests for JBREM-1188.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 16, 2010
+ */
+public class SSLBisocketDefaultTimeoutTestCase extends SocketDefaultTimeoutTestCase
+{
+ private static Logger log = Logger.getLogger(SSLBisocketDefaultTimeoutTestCase.class);
+
+
+ protected Class getClientFactoryClass()
+ {
+ return TestSSLBisocketClientFactory.class;
+ }
+
+
+ protected Class getClientInvokerClass()
+ {
+ return TestSSLBisocketClientInvoker.class;
+ }
+
+
+ public static class TestSSLBisocketClientFactory implements ClientFactory
+ {
+ public ClientInvoker createClientInvoker(InvokerLocator locator, Map config) throws IOException
+ {
+ ClientInvoker clientInvoker = new TestSSLBisocketClientInvoker(locator, config);
+ log.info("TestClientFaotory.createClientInvoker() returning " + clientInvoker);
+ return clientInvoker;
+ }
+ public boolean supportsSSL()
+ {
+ return true;
+ }
+ }
+
+
+ public static class TestSSLBisocketClientInvoker extends SSLBisocketClientInvoker
+ {
+ public TestSSLBisocketClientInvoker(InvokerLocator locator, Map configuration) throws IOException
+ {
+ super(locator, configuration);
+ }
+ public TestSSLBisocketClientInvoker(InvokerLocator locator) throws IOException
+ {
+ super(locator);
+ }
+ public ServerAddress getServerAddress()
+ {
+ return address;
+ }
+ public String toString()
+ {
+ return "TestSSLBisocketClientInvoker";
+ }
+ }
+}
\ No newline at end of file
14 years, 9 months
JBoss Remoting SVN: r5733 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/timeout.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-02-19 13:27:16 -0500 (Fri, 19 Feb 2010)
New Revision: 5733
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/timeout/BisocketDefaultTimeoutTestCase.java
Log:
JBREM-1188: New unit test.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/timeout/BisocketDefaultTimeoutTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/timeout/BisocketDefaultTimeoutTestCase.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/timeout/BisocketDefaultTimeoutTestCase.java 2010-02-19 18:27:16 UTC (rev 5733)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.transport.bisocket.timeout;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.transport.ClientFactory;
+import org.jboss.remoting.transport.ClientInvoker;
+import org.jboss.remoting.transport.bisocket.BisocketClientInvoker;
+import org.jboss.remoting.transport.socket.ServerAddress;
+import org.jboss.test.remoting.transport.socket.timeout.SocketDefaultTimeoutTestCase;
+
+
+/**
+ * Unit tests for JBREM-1188.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 16, 2010
+ */
+public class BisocketDefaultTimeoutTestCase extends SocketDefaultTimeoutTestCase
+{
+ private static Logger log = Logger.getLogger(BisocketDefaultTimeoutTestCase.class);
+
+
+ protected Class getClientFactoryClass()
+ {
+ return TestBisocketClientFactory.class;
+ }
+
+
+ protected Class getClientInvokerClass()
+ {
+ return TestBisocketClientInvoker.class;
+ }
+
+
+ public static class TestBisocketClientFactory implements ClientFactory
+ {
+ public ClientInvoker createClientInvoker(InvokerLocator locator, Map config) throws IOException
+ {
+ ClientInvoker clientInvoker = new TestBisocketClientInvoker(locator, config);
+ log.info("TestClientFaotory.createClientInvoker() returning " + clientInvoker);
+ return clientInvoker;
+ }
+ public boolean supportsSSL()
+ {
+ return false;
+ }
+ }
+
+
+ public static class TestBisocketClientInvoker extends BisocketClientInvoker
+ {
+ public TestBisocketClientInvoker(InvokerLocator locator, Map configuration) throws IOException
+ {
+ super(locator, configuration);
+ }
+ public TestBisocketClientInvoker(InvokerLocator locator) throws IOException
+ {
+ super(locator);
+ }
+ public ServerAddress getServerAddress()
+ {
+ return address;
+ }
+ public String toString()
+ {
+ return "TestBisocketClientInvoker";
+ }
+ }
+}
\ No newline at end of file
14 years, 9 months
JBoss Remoting SVN: r5732 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/timeout.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-02-19 13:26:40 -0500 (Fri, 19 Feb 2010)
New Revision: 5732
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/timeout/SocketDefaultTimeoutTestCase.java
Log:
JBREM-1188: Renamed from DefaultTimeoutTestCase.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/timeout/SocketDefaultTimeoutTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/timeout/SocketDefaultTimeoutTestCase.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/timeout/SocketDefaultTimeoutTestCase.java 2010-02-19 18:26:40 UTC (rev 5732)
@@ -0,0 +1,241 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.transport.socket.timeout;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.InvokerRegistry;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.ClientFactory;
+import org.jboss.remoting.transport.ClientInvoker;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.ServerFactory;
+import org.jboss.remoting.transport.socket.ServerAddress;
+import org.jboss.remoting.transport.socket.SocketClientInvoker;
+import org.jboss.remoting.transport.socket.SocketServerInvoker;
+
+
+/**
+ * Unit tests for JBREM-1188.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 16, 2010
+ */
+public class SocketDefaultTimeoutTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(SocketDefaultTimeoutTestCase.class);
+
+ private static boolean firstTime = true;
+
+ protected String host;
+ protected int port;
+ protected String locatorURI;
+ protected InvokerLocator serverLocator;
+ protected Connector connector;
+ protected TestInvocationHandler invocationHandler;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ InvokerRegistry.registerInvokerFactories(getTransport(), getClientFactoryClass(), TestServerFactory.class);
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testDefaultTimeout() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+ Method getServerAddress = getClientInvokerClass().getMethod("getServerAddress", new Class[]{});
+ getServerAddress.setAccessible(true);
+ ClientInvoker clientInvoker = client.getInvoker();
+ ServerAddress address = (ServerAddress) getServerAddress.invoke(clientInvoker, new Object[]{});
+ log.info("timeout in use: " + address.timeout);
+ assertEquals(SocketClientInvoker.SO_TIMEOUT_DEFAULT, address.timeout);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected String getTransport()
+ {
+ return "test";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer() throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "/?" + metadata;
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraServerConfig(config);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ protected Class getClientFactoryClass()
+ {
+ return TestSocketClientFactory.class;
+ }
+
+
+ protected Class getClientInvokerClass()
+ {
+ return TestSocketClientInvoker.class;
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+
+
+ static public class TestSocketClientInvoker extends SocketClientInvoker
+ {
+ public TestSocketClientInvoker(InvokerLocator locator, Map configuration) throws IOException
+ {
+ super(locator, configuration);
+ }
+ public TestSocketClientInvoker(InvokerLocator locator)
+ {
+ super(locator);
+ }
+ public ServerAddress getServerAddress()
+ {
+ return address;
+ }
+ public String toString()
+ {
+ return "TestSocketClientInvoker";
+ }
+ }
+
+
+ public static class TestSocketClientFactory implements ClientFactory
+ {
+ public ClientInvoker createClientInvoker(InvokerLocator locator, Map config) throws IOException
+ {
+ ClientInvoker clientInvoker = new TestSocketClientInvoker(locator, config);
+ log.info("TestClientFaotory.createClientInvoker() returning " + clientInvoker);
+ return clientInvoker;
+ }
+ public boolean supportsSSL()
+ {
+ return false;
+ }
+ }
+
+
+ public static class TestServerFactory implements ServerFactory
+ {
+ public ServerInvoker createServerInvoker(InvokerLocator locator, Map config) throws IOException
+ {
+ log.info("TestServerFactory.createServerInvoker() called");
+ return new SocketServerInvoker(locator, config);
+ }
+ public boolean supportsSSL()
+ {
+ return false;
+ }
+ }
+}
\ No newline at end of file
14 years, 9 months
JBoss Remoting SVN: r5731 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/ssl/timeout.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-02-19 13:25:56 -0500 (Fri, 19 Feb 2010)
New Revision: 5731
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/ssl/timeout/SSLSocketDefaultTimeoutTestCase.java
Log:
JBREM-1188: New unit test.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/ssl/timeout/SSLSocketDefaultTimeoutTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/ssl/timeout/SSLSocketDefaultTimeoutTestCase.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/socket/ssl/timeout/SSLSocketDefaultTimeoutTestCase.java 2010-02-19 18:25:56 UTC (rev 5731)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.transport.socket.ssl.timeout;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.transport.ClientFactory;
+import org.jboss.remoting.transport.ClientInvoker;
+import org.jboss.remoting.transport.socket.ServerAddress;
+import org.jboss.remoting.transport.sslsocket.SSLSocketClientInvoker;
+import org.jboss.test.remoting.transport.socket.timeout.SocketDefaultTimeoutTestCase;
+
+
+/**
+ * Unit tests for JBREM-1188.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 16, 2010
+ */
+public class SSLSocketDefaultTimeoutTestCase extends SocketDefaultTimeoutTestCase
+{
+ private static Logger log = Logger.getLogger(SSLSocketDefaultTimeoutTestCase.class);
+
+
+ protected Class getClientFactoryClass()
+ {
+ return TestSSLSocketClientFactory.class;
+ }
+
+
+ protected Class getClientInvokerClass()
+ {
+ return TestSSLSocketClientInvoker.class;
+ }
+
+
+ public static class TestSSLSocketClientFactory implements ClientFactory
+ {
+ public ClientInvoker createClientInvoker(InvokerLocator locator, Map config) throws IOException
+ {
+ ClientInvoker clientInvoker = new TestSSLSocketClientInvoker(locator, config);
+ log.info("TestClientFaotory.createClientInvoker() returning " + clientInvoker);
+ return clientInvoker;
+ }
+ public boolean supportsSSL()
+ {
+ return true;
+ }
+ }
+
+
+ public static class TestSSLSocketClientInvoker extends SSLSocketClientInvoker
+ {
+ public TestSSLSocketClientInvoker(InvokerLocator locator, Map configuration) throws IOException
+ {
+ super(locator, configuration);
+ }
+ public TestSSLSocketClientInvoker(InvokerLocator locator) throws IOException
+ {
+ super(locator);
+ }
+ public ServerAddress getServerAddress()
+ {
+ return address;
+ }
+ public String toString()
+ {
+ return "TestSSLSocketClientInvoker";
+ }
+ }
+}
\ No newline at end of file
14 years, 9 months
JBoss Remoting SVN: r5730 - remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-02-19 12:36:10 -0500 (Fri, 19 Feb 2010)
New Revision: 5730
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/SocketClientInvoker.java
Log:
JBREM-1188: configureParameters() sets timeout to SO_TIMEOUT_DEFAULT.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/SocketClientInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/SocketClientInvoker.java 2010-02-18 01:16:41 UTC (rev 5729)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/SocketClientInvoker.java 2010-02-19 17:36:10 UTC (rev 5730)
@@ -82,6 +82,10 @@
protected void configureParameters()
{
super.configureParameters();
+
+ // For JBREM-1188
+ timeout = SO_TIMEOUT_DEFAULT;
+
Map params = configuration;
if (params != null)
{
14 years, 9 months
JBoss Remoting SVN: r5729 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/classloader.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-02-17 20:16:41 -0500 (Wed, 17 Feb 2010)
New Revision: 5729
Modified:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java
Log:
JBREM-1184: Captured System.out to look for NPE.
Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java 2010-02-18 01:14:52 UTC (rev 5728)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java 2010-02-18 01:16:41 UTC (rev 5729)
@@ -22,6 +22,8 @@
package org.jboss.test.remoting.classloader;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
import java.lang.reflect.Field;
import java.net.InetAddress;
import java.util.HashMap;
@@ -65,10 +67,10 @@
*/
public class RemoteClassloaderTestCase extends TestCase
{
- private static Logger log = Logger.getLogger(RemoteClassloaderTestCase.class);
+ private ByteArrayOutputStream baos;
+ private PrintStream originalPrintStream;
+ private Logger log;
- private static boolean firstTime = true;
-
protected String host;
protected int port;
protected String locatorURI;
@@ -79,16 +81,18 @@
public void setUp() throws Exception
{
- if (firstTime)
- {
- firstTime = false;
- Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO);
- Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
- String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
- PatternLayout layout = new PatternLayout(pattern);
- ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- Logger.getRootLogger().addAppender(consoleAppender);
- }
+ originalPrintStream = System.out;
+ baos = new ByteArrayOutputStream();
+ PrintStream ps = new PrintStream(baos);
+ System.setOut(ps);
+
+ Logger.getLogger("org.jboss.remoting").setLevel(Level.DEBUG);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ log = Logger.getLogger(RemoteClassloaderTestCase.class);
}
@@ -122,6 +126,12 @@
fail("expected ClassNotFoundException: got " + t);
}
+ System.setOut(originalPrintStream);
+ String s = new String(baos.toByteArray());
+ System.out.println(s);
+ assertTrue(s.indexOf("java.lang.NullPointerException") == -1);
+ assertTrue(s.indexOf("Can not load remote class bytes: server returned null class") >= 0);
+
shutdownServer();
log.info(getName() + " PASSES");
}
14 years, 9 months
JBoss Remoting SVN: r5728 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-02-17 20:14:52 -0500 (Wed, 17 Feb 2010)
New Revision: 5728
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java
Log:
JBREM-1184: Removed reference to MalformedLocatorTestCase.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java 2010-02-18 01:12:43 UTC (rev 5727)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java 2010-02-18 01:14:52 UTC (rev 5728)
@@ -55,7 +55,6 @@
import org.jboss.remoting.transport.Connector;
import org.jboss.remoting.transport.PortUtil;
import org.jboss.remoting.util.SecurityUtility;
-import org.jboss.test.remoting.locator.MalformedLocatorTestCase;
/**
@@ -97,7 +96,7 @@
PatternLayout layout = new PatternLayout(pattern);
ConsoleAppender consoleAppender = new ConsoleAppender(layout);
Logger.getRootLogger().addAppender(consoleAppender);
- log = Logger.getLogger(MalformedLocatorTestCase.class);
+ log = Logger.getLogger(RemoteClassloaderTestCase.class);
}
14 years, 9 months
JBoss Remoting SVN: r5727 - remoting2/branches/2.x/src/etc.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-02-17 20:12:43 -0500 (Wed, 17 Feb 2010)
New Revision: 5727
Modified:
remoting2/branches/2.x/src/etc/remoting.security.policy.tests
Log:
JBREM-1184: Noted that RemoteClassloaderTestCase uses setIO RuntimePermission.
Modified: remoting2/branches/2.x/src/etc/remoting.security.policy.tests
===================================================================
--- remoting2/branches/2.x/src/etc/remoting.security.policy.tests 2010-02-18 01:07:26 UTC (rev 5726)
+++ remoting2/branches/2.x/src/etc/remoting.security.policy.tests 2010-02-18 01:12:43 UTC (rev 5727)
@@ -194,9 +194,11 @@
permission org.jboss.naming.JndiPermission "detection", "lookup";
permission org.jboss.naming.JndiPermission "detection/*", "rebind";
permission org.jboss.naming.JndiPermission "detection/*", "unbind";
-
+
+ // MalformedLocatorTestCase, RemoteClassloaderTestCase
+ permission java.lang.RuntimePermission "setIO";
+
// MalformedLocatorTestCase
- permission java.lang.RuntimePermission "setIO";
permission java.util.PropertyPermission "suppressHostWarning", "write";
// TODO - this stuff ought to be in privileged blocks within the Ant JUnit task
14 years, 9 months
JBoss Remoting SVN: r5726 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-02-17 20:07:26 -0500 (Wed, 17 Feb 2010)
New Revision: 5726
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java
Log:
JBREM-1184: Captured System.out to look for NPE.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java 2010-02-18 00:49:20 UTC (rev 5725)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/RemoteClassloaderTestCase.java 2010-02-18 01:07:26 UTC (rev 5726)
@@ -22,8 +22,13 @@
package org.jboss.test.remoting.classloader;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
import java.lang.reflect.Field;
import java.net.InetAddress;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -49,6 +54,8 @@
import org.jboss.remoting.marshal.MarshallerLoaderHandler;
import org.jboss.remoting.transport.Connector;
import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.util.SecurityUtility;
+import org.jboss.test.remoting.locator.MalformedLocatorTestCase;
/**
@@ -65,10 +72,10 @@
*/
public class RemoteClassloaderTestCase extends TestCase
{
- private static Logger log = Logger.getLogger(RemoteClassloaderTestCase.class);
+ private ByteArrayOutputStream baos;
+ private PrintStream originalPrintStream;
+ private Logger log;
- private static boolean firstTime = true;
-
protected String host;
protected int port;
protected String locatorURI;
@@ -79,16 +86,18 @@
public void setUp() throws Exception
{
- if (firstTime)
- {
- firstTime = false;
- Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO);
- Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
- String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
- PatternLayout layout = new PatternLayout(pattern);
- ConsoleAppender consoleAppender = new ConsoleAppender(layout);
- Logger.getRootLogger().addAppender(consoleAppender);
- }
+ originalPrintStream = System.out;
+ baos = new ByteArrayOutputStream();
+ PrintStream ps = new PrintStream(baos);
+ setOut(ps);
+
+ Logger.getLogger("org.jboss.remoting").setLevel(Level.DEBUG);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ log = Logger.getLogger(MalformedLocatorTestCase.class);
}
@@ -122,6 +131,12 @@
fail("expected ClassNotFoundException: got " + t);
}
+ setOut(originalPrintStream);
+ String s = new String(baos.toByteArray());
+ System.out.println(s);
+ assertTrue(s.indexOf("java.lang.NullPointerException") == -1);
+ assertTrue(s.indexOf("Can not load remote class bytes: server returned null class") >= 0);
+
shutdownServer();
log.info(getName() + " PASSES");
}
@@ -175,6 +190,31 @@
}
+ static private void setOut(final PrintStream ps)
+ {
+ if (SecurityUtility.skipAccessControl())
+ {
+ System.setOut(ps);
+ return;
+ }
+
+ try
+ {
+ AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ System.setOut(ps);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (RuntimeException) e.getCause();
+ }
+ }
+
static class TestInvocationHandler implements ServerInvocationHandler
{
public void addListener(InvokerCallbackHandler callbackHandler) {}
14 years, 9 months