JBoss Remoting SVN: r6070 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-08-05 16:12:12 -0400 (Thu, 05 Aug 2010)
New Revision: 6070
Modified:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF/web.xml
Log:
JBREM-1241: Reverting to correct contents.
Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF/web.xml
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF/web.xml 2010-08-05 20:09:17 UTC (rev 6069)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/marshal/config/WEB-INF/web.xml 2010-08-05 20:12:12 UTC (rev 6070)
@@ -16,7 +16,7 @@
<servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
<init-param>
<param-name>locatorUrl</param-name>
- <param-value>servlet://localhost:8080/servlet-invoker/ServerInvokerServlet</param-value>
+ <param-value>servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?marshaller=org.jboss.test.remoting.marshall.config.ConfigTestMarshaller&unmarshaller=org.jboss.test.remoting.marshall.config.ConfigTestUnmarshaller</param-value>
<description>The servlet server invoker locator url</description>
</init-param>
<load-on-startup>1</load-on-startup>
14 years, 7 months
JBoss Remoting SVN: r6069 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/WEB-INF.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-08-05 16:09:17 -0400 (Thu, 05 Aug 2010)
New Revision: 6069
Modified:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/WEB-INF/web.xml
Log:
JBREM-1241: Reverting to correct contents.
Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/WEB-INF/web.xml
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/WEB-INF/web.xml 2010-08-05 19:56:20 UTC (rev 6068)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/WEB-INF/web.xml 2010-08-05 20:09:17 UTC (rev 6069)
@@ -4,11 +4,11 @@
"http://java.sun.com/dtd/web-app_2_3.dtd">
<!-- The the JBossRemoting server invoker servlet web.xml descriptor
-$Id: web.xml 4837 2009-01-18 05:40:05Z ron.sigal(a)jboss.com $
+$Id: web.xml 4903 2009-03-24 07:33:10Z ron.sigal(a)jboss.com $
-->
<web-app>
<servlet>
- <servlet-name>ServerInvokerServlet</servlet-name>
+ <servlet-name>ServerInvokerServletOK</servlet-name>
<description>The ServerInvokerServlet receives requests via HTTP
protocol from within a web container and passes it onto the
ServletServerInvoker for processing.
@@ -16,14 +16,53 @@
<servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
<init-param>
<param-name>locatorUrl</param-name>
- <param-value>servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?createUniqueObjectName=true&useAllParams=true&blockingMode=blocking</param-value>
+ <param-value>servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?version=OK</param-value>
<description>The servlet server invoker locator url</description>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
+
+ <servlet>
+ <servlet-name>ServerInvokerServletCR</servlet-name>
+ <description>The ServerInvokerServlet receives requests via HTTP
+ protocol from within a web container and passes it onto the
+ ServletServerInvoker for processing.
+ </description>
+ <servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
+ <init-param>
+ <param-name>locatorUrl</param-name>
+ <param-value>servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?version=CR</param-value>
+ <description>The servlet server invoker locator url</description>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>ServerInvokerServletLF</servlet-name>
+ <description>The ServerInvokerServlet receives requests via HTTP
+ protocol from within a web container and passes it onto the
+ ServletServerInvoker for processing.
+ </description>
+ <servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
+ <init-param>
+ <param-name>locatorUrl</param-name>
+ <param-value>servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?version=LF</param-value>
+ <description>The servlet server invoker locator url</description>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
<servlet-mapping>
- <servlet-name>ServerInvokerServlet</servlet-name>
- <url-pattern>/ServerInvokerServlet/*</url-pattern>
+ <servlet-name>ServerInvokerServletOK</servlet-name>
+ <url-pattern>/ServerInvokerServlet/OK/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ServerInvokerServletCR</servlet-name>
+ <url-pattern>/ServerInvokerServlet/CR/*</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ServerInvokerServletLF</servlet-name>
+ <url-pattern>/ServerInvokerServlet/LF/*</url-pattern>
+ </servlet-mapping>
</web-app>
14 years, 7 months
JBoss Remoting SVN: r6068 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-08-05 15:56:20 -0400 (Thu, 05 Aug 2010)
New Revision: 6068
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/WEB-INF/
Log:
Copied: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/WEB-INF (from rev 6067, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/WEB-INF)
14 years, 7 months
JBoss Remoting SVN: r6065 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/WEB-INF.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-08-05 15:54:18 -0400 (Thu, 05 Aug 2010)
New Revision: 6065
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/WEB-INF/web.xml
Log:
Copied: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/WEB-INF/web.xml (from rev 6064, remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/callback/WEB-INF/web.xml)
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/WEB-INF/web.xml (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/WEB-INF/web.xml 2010-08-05 19:54:18 UTC (rev 6065)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<!-- The the JBossRemoting server invoker servlet web.xml descriptor
+$Id: web.xml 4837 2009-01-18 05:40:05Z ron.sigal(a)jboss.com $
+-->
+<web-app>
+ <servlet>
+ <servlet-name>ServerInvokerServlet</servlet-name>
+ <description>The ServerInvokerServlet receives requests via HTTP
+ protocol from within a web container and passes it onto the
+ ServletServerInvoker for processing.
+ </description>
+ <servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
+ <init-param>
+ <param-name>locatorUrl</param-name>
+ <param-value>servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?createUniqueObjectName=true&useAllParams=true&blockingMode=blocking</param-value>
+ <description>The servlet server invoker locator url</description>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>ServerInvokerServlet</servlet-name>
+ <url-pattern>/ServerInvokerServlet/*</url-pattern>
+ </servlet-mapping>
+</web-app>
+
14 years, 7 months
JBoss Remoting SVN: r6063 - remoting2/branches/2.2.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-08-05 15:00:14 -0400 (Thu, 05 Aug 2010)
New Revision: 6063
Modified:
remoting2/branches/2.2/build.xml
Log:
JBREM-1241: Added sleep time to servlet targets.
Modified: remoting2/branches/2.2/build.xml
===================================================================
--- remoting2/branches/2.2/build.xml 2010-08-05 18:58:25 UTC (rev 6062)
+++ remoting2/branches/2.2/build.xml 2010-08-05 19:00:14 UTC (rev 6063)
@@ -1223,7 +1223,7 @@
<target name="tests.servlet">
<copy file="${servlet.tests.dir}/remoting-servlet-service.xml" todir="${jboss.deploy.dir}" overwrite="true"/>
- <sleep seconds="2"/>
+ <sleep seconds="5"/>
<copy todir="${jboss.deploy.dir}">
<fileset dir="${output.lib.dir}">
<include name="servlet-invoker.war/**"/>
@@ -1231,7 +1231,7 @@
</copy>
<copy file="${servlet.tests.dir}/WEB-INF/web.xml"
todir="${jboss.deploy.dir}/servlet-invoker.war/WEB-INF" overwrite="true"/>
- <sleep seconds="2"/>
+ <sleep seconds="5"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
<jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
@@ -1265,7 +1265,7 @@
<target name="tests.servlet.callback">
<copy file="${servlet.tests.dir}/callback/remoting-servlet-service.xml" todir="${jboss.deploy.dir}" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<copy todir="${jboss.deploy.dir}" overwrite="true">
<fileset dir="${output.lib.dir}">
<include name="servlet-invoker.war/**"/>
@@ -1273,7 +1273,7 @@
</copy>
<copy file="${servlet.tests.dir}/callback/WEB-INF/web.xml"
todir="${jboss.deploy.dir}/servlet-invoker.war/WEB-INF" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
<jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
@@ -1307,7 +1307,7 @@
<target name="tests.servlet.contenttype">
<copy file="${servlet.tests.dir}/contenttype/remoting-servlet-service.xml" todir="${jboss.deploy.dir}" overwrite="true"/>
- <sleep seconds="2"/>
+ <sleep seconds="5"/>
<copy todir="${jboss.deploy.dir}">
<fileset dir="${output.lib.dir}">
<include name="servlet-invoker.war/**"/>
@@ -1315,7 +1315,7 @@
</copy>
<copy file="${servlet.tests.dir}/contenttype/WEB-INF/web.xml"
todir="${jboss.deploy.dir}/servlet-invoker.war/WEB-INF" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
<jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
@@ -1349,7 +1349,7 @@
<target name="tests.servlet.marshal">
<copy file="${servlet.tests.dir}/marshal/remoting-servlet-service.xml" todir="${jboss.deploy.dir}" overwrite="true"/>
- <sleep seconds="2"/>
+ <sleep seconds="5"/>
<copy todir="${jboss.deploy.dir}">
<fileset dir="${output.lib.dir}">
<include name="servlet-invoker.war/**"/>
@@ -1357,7 +1357,7 @@
</copy>
<copy file="${servlet.tests.dir}/marshal/WEB-INF/web.xml"
todir="${jboss.deploy.dir}/servlet-invoker.war/WEB-INF" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
<jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
@@ -1391,7 +1391,7 @@
<target name="tests.servlet.marshal.config">
<copy file="${servlet.tests.dir}/marshal/config/remoting-servlet-service.xml" todir="${jboss.deploy.dir}" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<copy todir="${jboss.deploy.dir}">
<fileset dir="${output.lib.dir}">
<include name="servlet-invoker.war/**"/>
@@ -1399,7 +1399,7 @@
</copy>
<copy file="${servlet.tests.dir}/marshal/config/WEB-INF/web.xml"
todir="${jboss.deploy.dir}/servlet-invoker.war/WEB-INF" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
<jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
@@ -1433,7 +1433,7 @@
<target name="tests.servlet.marshal.noconfig">
<copy file="${servlet.tests.dir}/marshal/noconfig/remoting-servlet-service.xml" todir="${jboss.deploy.dir}" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<copy todir="${jboss.deploy.dir}">
<fileset dir="${output.lib.dir}">
<include name="servlet-invoker.war/**"/>
@@ -1441,7 +1441,7 @@
</copy>
<copy file="${servlet.tests.dir}/marshal/noconfig/WEB-INF/web.xml"
todir="${jboss.deploy.dir}/servlet-invoker.war/WEB-INF" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
<jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
@@ -1476,7 +1476,7 @@
<target name="tests.servlet.nopreservelines">
<copy file="${servlet.tests.dir}/nopreservelines/remoting-servlet-service.xml" todir="${jboss.deploy.dir}" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<copy todir="${jboss.deploy.dir}">
<fileset dir="${output.lib.dir}">
<include name="servlet-invoker.war/**"/>
@@ -1484,7 +1484,7 @@
</copy>
<copy file="${servlet.tests.dir}/nopreservelines/WEB-INF/web.xml"
todir="${jboss.deploy.dir}/servlet-invoker.war/WEB-INF" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
<jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
@@ -1518,7 +1518,7 @@
<target name="tests.servlet.preservelines">
<copy file="${servlet.tests.dir}/preservelines/remoting-servlet-service.xml" todir="${jboss.deploy.dir}" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<copy todir="${jboss.deploy.dir}" overwrite="true">
<fileset dir="${output.lib.dir}">
<include name="servlet-invoker.war/**"/>
@@ -1526,7 +1526,7 @@
</copy>
<copy file="${servlet.tests.dir}/preservelines/WEB-INF/web.xml"
todir="${jboss.deploy.dir}/servlet-invoker.war/WEB-INF" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<junit printsummary="true" fork="yes" includeantruntime="true">
<jvmarg value="-Dloader.path=${output.lib.dir}/jboss-remoting-loading-tests.jar"/>
<jvmarg value="-D${remoting.metadata.key}=${metadata}"/>
@@ -1560,7 +1560,7 @@
<target name="tests.servlet.ssl">
<copy file="${servlet.tests.dir}/ssl/remoting-sslservlet-service.xml" todir="${jboss.deploy.dir}" overwrite="true"/>
- <sleep seconds="4"/>
+ <sleep seconds="5"/>
<copy todir="${jboss.deploy.dir}">
<fileset dir="${output.lib.dir}">
<include name="servlet-invoker.war/**"/>
14 years, 7 months
JBoss Remoting SVN: r6062 - in remoting2/branches/2.2/src/tests/org/jboss/test/remoting: template and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-08-05 14:58:25 -0400 (Thu, 05 Aug 2010)
New Revision: 6062
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/template/
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/template/TestCaseTemplate.java
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/template/WriteTimeoutTestParent.java
Log:
JBREM-1240: Adding template directory.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/template/TestCaseTemplate.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/template/TestCaseTemplate.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/template/TestCaseTemplate.java 2010-08-05 18:58:25 UTC (rev 6062)
@@ -0,0 +1,170 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.template;
+
+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.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+public class TestCaseTemplate extends TestCase
+{
+ private static Logger log = Logger.getLogger(TestCaseTemplate.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);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testMethod() 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");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected String getTransport()
+ {
+ return "socket";
+ }
+
+
+ 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();
+ }
+
+
+ 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 class TestCallbackHandler implements InvokerCallbackHandler
+ {
+ public void handleCallback(Callback callback) throws HandleCallbackException
+ {
+ log.info("received callback");
+ }
+ }
+}
\ No newline at end of file
Property changes on: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/template/TestCaseTemplate.java
___________________________________________________________________
Name: svn:executable
+ *
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/template/WriteTimeoutTestParent.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/template/WriteTimeoutTestParent.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/template/WriteTimeoutTestParent.java 2010-08-05 18:58:25 UTC (rev 6062)
@@ -0,0 +1,845 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, 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.template;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.rmi.MarshalException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.net.ServerSocketFactory;
+import javax.net.SocketFactory;
+
+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.CannotConnectException;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.Remoting;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.bisocket.Bisocket;
+import org.jboss.remoting.transport.socket.SocketServerInvoker;
+import org.jboss.remoting.transport.socket.SocketWrapper;
+
+
+/**
+ * Unit tests for JBREM-1120.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Apr 22, 2009
+ * </p>
+ */
+public abstract class WriteTimeoutTestParent extends TestCase
+{
+ private static Logger log = Logger.getLogger(WriteTimeoutTestParent.class);
+
+ private static boolean firstTime = true;
+ protected static int secondaryServerSocketPort;
+ protected static boolean callbackTest;
+
+ 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);
+ }
+
+ TestOutputStream.counter = 0;
+ callbackTest = false;
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testClientWriteTimeout() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(false, false, "", -1, -1);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(SocketWrapper.WRITE_TIMEOUT, "1000");
+ SocketFactory sf = (SocketFactory) getSocketFactoryConstructor().newInstance(new Object[]{new Integer(5000), new Integer(1)});
+ clientConfig.put(Remoting.CUSTOM_SOCKET_FACTORY, sf);
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ log.info("**************************************");
+ log.info("*** WorkerThread error is expected ***");
+ log.info("**************************************");
+
+ // Test client side write timeout.
+ try
+ {
+ client.invoke("abc");
+ }
+ catch (MarshalException e)
+ {
+ log.info(e.getMessage());
+ assertNotNull(e.getMessage());
+ log.info("e.getMessage(): " + e.getMessage());
+ assertTrue(e.getMessage().startsWith("Failed to communicate. Problem during marshalling/unmarshalling"));
+ assertTrue(e.getCause() instanceof IOException);
+ IOException ioe = (IOException) e.getCause();
+ assertEquals("closed", ioe.getMessage());
+ log.info("got expected Exception");
+ }
+ catch (Throwable t)
+ {
+ log.error("got unexpected Exception", t);
+ fail("got unexpected Exception");
+ }
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testServerWriteTimeout() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, false, "1000", 5000, 1);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put("numberOfCallRetries", "1");
+ clientConfig.put("timeout", "10000");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ log.info("**************************************");
+ log.info("*** WorkerThread error is expected ***");
+ log.info("**************************************");
+
+ // Test server side write timeout.
+ try
+ {
+ client.invoke("abc");
+ }
+ catch (MarshalException e)
+ {
+ log.info(e.getMessage());
+// assertNotNull(e.getMessage());
+// assertTrue(e.getMessage().startsWith("Unable to perform invocation"));
+// assertTrue(e.getCause() instanceof EOFException);
+ log.info("got expected Exception");
+ }
+ catch (Throwable t)
+ {
+ log.error("got unexpected Exception", t);
+ fail("got unexpected Exception");
+ }
+
+ // Test server invoker state.
+ Thread.sleep(4000);
+ SocketServerInvoker serverInvoker = (SocketServerInvoker) connector.getServerInvoker();
+ assertEquals(0, serverInvoker.getCurrentClientPoolSize());
+ assertEquals(1, serverInvoker.getCurrentThreadPoolSize());
+ log.info("used ServerThread has returned to threadPool");
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testClientCallbackWriteTimeout() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ if (isBisocket(getTransport()))
+ {
+ callbackTest = true;
+ }
+ setupServer(false, false, "", -1, -1);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(SocketWrapper.WRITE_TIMEOUT, "1000");
+ if (isBisocket(getTransport()))
+ {
+ SocketFactory sf = (SocketFactory) getSocketFactoryConstructor().newInstance(new Object[]{new Integer(5000), new Integer(1)});
+ clientConfig.put(Remoting.CUSTOM_SOCKET_FACTORY, sf);
+ }
+ else
+ {
+ ServerSocketFactory ssf = (ServerSocketFactory) getServerSocketFactoryConstructor().newInstance(new Object[]{new Integer(5000), new Integer(-1)});
+ clientConfig.put(Remoting.CUSTOM_SERVER_SOCKET_FACTORY, ssf);
+ }
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connection
+ client.invoke("abc");
+ log.info("connection is good");
+
+ // Test client callback write timeout.
+ log.info("registering callback handler");
+ log.info("**************************************");
+ log.info("*** WorkerThread error is expected ***");
+ log.info("**************************************");
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ HashMap metadata = new HashMap();
+ if (isBisocket(getTransport()))
+ {
+// metadata.put(SocketWrapper.WRITE_TIMEOUT, "1000");
+ metadata.put(Remoting.SOCKET_FACTORY_NAME, getSocketFactoryClassName());
+ metadata.put("numberOfCallRetries", "1");
+ metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+ metadata.put(Bisocket.PING_FREQUENCY, "11111111");
+ }
+ else
+ {
+// metadata.put(SocketWrapper.WRITE_TIMEOUT, "1000");
+ metadata.put(ServerInvoker.SERVER_SOCKET_FACTORY, getServerSocketFactoryClassName());
+ metadata.put("numberOfCallRetries", "1");
+ }
+ client.addListener(callbackHandler, metadata, null, true);
+ log.info("called Client.addListener()");
+
+ // Test server invoker state.
+ // Wait for local ServerThread to time out. Might take a while in bisocket transports, since
+ // the request to get a socket for the callback client invoker needs its own write on the
+ // control socket.
+ Thread.sleep(20000);
+ log.info("back from sleep");
+ Set callbackConnectors = client.getCallbackConnectors(callbackHandler);
+ assertEquals(1, callbackConnectors.size());
+ Connector callbackConnector = (Connector) callbackConnectors.iterator().next();
+ SocketServerInvoker serverInvoker = (SocketServerInvoker) callbackConnector.getServerInvoker();
+ assertEquals(0, serverInvoker.getCurrentClientPoolSize());
+ assertEquals(1, serverInvoker.getCurrentThreadPoolSize());
+ log.info("used ServerThread has returned to threadPool");
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testServerCallbackWriteTimeout() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ if (isBisocket(getTransport()))
+ {
+ callbackTest = true;
+ setupServer(true, false, "1000", 5000, 1);
+ }
+ else
+ {
+ setupServer(false, true, "1000", 5000, 1);
+ }
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put("numberOfCallRetries", "1");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connection
+ client.invoke("abc");
+ log.info("connection is good");
+
+ // Test server callback write timeout.
+ log.info("registering callback handler");
+ log.info("**************************************");
+ log.info("*** WorkerThread error is expected ***");
+ log.info("**************************************");
+ HashMap metadata = new HashMap();
+ if (isBisocket(getTransport()))
+ {
+ metadata.put(Bisocket.IS_CALLBACK_SERVER, "true");
+ }
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ client.addListener(callbackHandler, metadata, null, true);
+ log.info("added listener");
+
+ // Test server invoker state.
+ Thread.sleep(20000);
+ log.info("waking up");
+ Throwable t = invocationHandler.t;
+ assertTrue(t instanceof HandleCallbackException);
+ log.info("t.getCause:", t.getCause());
+ if (t.getCause() instanceof MarshalException)
+ {
+ MarshalException e = (MarshalException) t.getCause();
+ assertNotNull(e.getMessage());
+ assertTrue(e.getMessage().startsWith("Failed to communicate. Problem during marshalling/unmarshalling"));
+ assertTrue(e.getCause() instanceof IOException);
+ IOException ioe = (IOException) e.getCause();
+ assertEquals("closed", ioe.getMessage());
+ }
+ else
+ {
+ assertTrue(t.getCause() instanceof CannotConnectException);
+ log.info("t.getCause().getCause(): ", t.getCause().getCause());
+ assertTrue(t.getCause().getCause() instanceof InvocationTargetException);
+ log.info("t.getCause().getCause().getCause(): ", t.getCause().getCause().getCause());
+// assertTrue(t.getCause().getCause().getCause() instanceof SSLProtocolException);
+ assertTrue(t.getCause().getCause().getCause() instanceof IOException);
+ assertEquals("closed", t.getCause().getCause().getCause().getMessage());
+ }
+ log.info("got expected Exception");
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected abstract String getTransport();
+
+ protected boolean isBisocket(String transport)
+ {
+ return transport.indexOf("bisocket") >= 0;
+ }
+
+ protected String getServerSocketFactoryClassName()
+ {
+ return TestServerSocketFactory.class.getName();
+ }
+
+ protected Constructor getServerSocketFactoryConstructor() throws NoSuchMethodException
+ {
+ return TestServerSocketFactory.class.getConstructor(new Class[]{int.class, int.class});
+ }
+
+ protected String getSocketFactoryClassName()
+ {
+ return TestSocketFactory.class.getName();
+ }
+
+ protected Constructor getSocketFactoryConstructor() throws NoSuchMethodException
+ {
+ return TestSocketFactory.class.getConstructor(new Class[]{int.class, int.class});
+ }
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer(boolean setWriteTimeout, boolean setCallbackWriteTimeout,
+ String writeTimeout, int blockingTime, int initialWrites) 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");
+ if (isBisocket(getTransport()))
+ {
+ secondaryServerSocketPort = PortUtil.findFreePort(host);
+ config.put(Bisocket.SECONDARY_BIND_PORT, Integer.toString(secondaryServerSocketPort));
+ config.put(Bisocket.PING_FREQUENCY, "11111111");
+ }
+ if (setWriteTimeout)
+ {
+ config.put(SocketWrapper.WRITE_TIMEOUT, writeTimeout);
+ ServerSocketFactory ssf = (ServerSocketFactory) getServerSocketFactoryConstructor().newInstance(new Object[]{new Integer(blockingTime), new Integer(initialWrites)});
+ config.put(Remoting.CUSTOM_SERVER_SOCKET_FACTORY, ssf);
+ }
+ if (setCallbackWriteTimeout)
+ {
+ config.put(SocketWrapper.WRITE_TIMEOUT, writeTimeout);
+ SocketFactory sf = (SocketFactory) getSocketFactoryConstructor().newInstance(new Object[]{new Integer(blockingTime), new Integer(initialWrites)});
+ config.put(Remoting.CUSTOM_SOCKET_FACTORY, sf);
+ }
+ if (callbackTest)
+ {
+ config.put("numberOfCallRetries", "1");
+ }
+ 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();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ Throwable t;
+
+ public void addListener(final InvokerCallbackHandler callbackHandler)
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ log.info("sending callback");
+ callbackHandler.handleCallback(new Callback("callback"));
+ }
+ catch (Throwable t)
+ {
+ log.info("throwable: ", t);
+ TestInvocationHandler.this.t = t;
+ }
+ }
+ }.start();
+ }
+ 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 class TestCallbackHandler implements InvokerCallbackHandler
+ {
+ public void handleCallback(Callback callback) throws HandleCallbackException
+ {
+ log.info("received callback");
+ }
+ }
+
+
+ static public class TestServerSocketFactory extends ServerSocketFactory
+ {
+ int timeout;
+ int initialWrites;
+
+ public TestServerSocketFactory()
+ {
+ this.timeout = 5000;
+ this.initialWrites = -1;
+ }
+ public TestServerSocketFactory(int timeout, int initialWrites)
+ {
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public ServerSocket createServerSocket() throws IOException
+ {
+ ServerSocket ss = null;
+ if (callbackTest)
+ {
+ ss = ServerSocketFactory.getDefault().createServerSocket();
+ }
+ else
+ {
+ ss = new TestServerSocket(timeout, initialWrites);
+ }
+ log.info("returning: " + ss);
+ return ss;
+ }
+ public ServerSocket createServerSocket(int port) throws IOException
+ {
+ ServerSocket ss = null;
+ if (callbackTest && port != secondaryServerSocketPort)
+ {
+ ss = ServerSocketFactory.getDefault().createServerSocket(port);
+ }
+ else
+ {
+ ss = new TestServerSocket(port, timeout, initialWrites);
+ }
+ log.info("returning: " + ss);
+ return ss;
+ }
+
+ public ServerSocket createServerSocket(int port, int backlog) throws IOException
+ {
+ ServerSocket ss = null;
+ if (callbackTest && port != secondaryServerSocketPort)
+ {
+ ss = ServerSocketFactory.getDefault().createServerSocket(port, backlog);
+ }
+ else
+ {
+ ss = new TestServerSocket(port, backlog, timeout, initialWrites);
+ }
+ log.info("returning: " + ss);
+ return ss;
+ }
+
+ public ServerSocket createServerSocket(int port, int backlog, InetAddress ifAddress) throws IOException
+ {
+ ServerSocket ss = null;
+ if (callbackTest && port != secondaryServerSocketPort)
+ {
+ ss = ServerSocketFactory.getDefault().createServerSocket(port, backlog, ifAddress);
+ }
+ else
+ {
+ ss = new TestServerSocket(port, backlog, ifAddress, timeout, initialWrites);
+ }
+ log.info("returning: " + ss);
+ return ss;
+ }
+ }
+
+
+ static class TestServerSocket extends ServerSocket
+ {
+ int timeout;
+ int initialWrites;
+
+ public TestServerSocket(int timeout, int initialWrites) throws IOException
+ {
+ super();
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public TestServerSocket(int port, int timeout, int initialWrites) throws IOException
+ {
+ super(port);
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public TestServerSocket(int port, int backlog, int timeout, int initialWrites) throws IOException
+ {
+ super(port, backlog);
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public TestServerSocket(int port, int backlog, InetAddress bindAddr, int timeout, int initialWrites) throws IOException
+ {
+ super(port, backlog, bindAddr);
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public Socket accept() throws IOException
+ {
+ Socket s = new TestSocket(timeout, initialWrites);
+ implAccept(s);
+ return s;
+ }
+ public String toString()
+ {
+ return "TestServerSocket[" + getLocalPort() + "]";
+ }
+ }
+
+
+ public static class TestSocketFactory extends SocketFactory
+ {
+ int timeout;
+ int initialWrites = -1;
+
+ public TestSocketFactory()
+ {
+ timeout = 5000;
+ }
+ public TestSocketFactory(int timeout, int initialWrites)
+ {
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public Socket createSocket()
+ {
+ log.info("callbackTest: " + callbackTest);
+ Socket s = null;
+ if (callbackTest)
+ {
+ s = new Socket();
+ }
+ else
+ {
+ s = new TestSocket(timeout, initialWrites);
+ }
+ log.info(this + " returning " + s);
+ return s;
+ }
+ public Socket createSocket(String arg0, int arg1) throws IOException, UnknownHostException
+ {
+ log.info("callbackTest: " + callbackTest + ", port: " + arg1);
+ Socket s = null;
+ if (callbackTest && arg1 != secondaryServerSocketPort)
+ {
+ s = new Socket(arg0, arg1);
+ }
+ else
+ {
+ s = new TestSocket(arg0, arg1, timeout, initialWrites);
+ }
+ log.info(this + " returning " + s);
+ return s;
+ }
+
+ public Socket createSocket(InetAddress arg0, int arg1) throws IOException
+ {
+ log.info("callbackTest: " + callbackTest + ", port: " + arg1);
+ Socket s = null;
+ if (callbackTest && arg1 != secondaryServerSocketPort)
+ {
+ s = new Socket(arg0, arg1);
+ }
+ else
+ {
+ s = new TestSocket(arg0, arg1, timeout, initialWrites);
+ }
+ log.info(this + " returning " + s);
+ return s;
+ }
+
+ public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) throws IOException, UnknownHostException
+ {
+ log.info("callbackTest: " + callbackTest + ", port: " + arg1);
+ Socket s = null;
+ if (callbackTest && arg1 != secondaryServerSocketPort)
+ {
+ s = new Socket(arg0, arg1);
+ }
+ else
+ {
+ s = new TestSocket(arg0, arg1, arg2, arg3, timeout, initialWrites);
+ }
+ log.info(this + " returning " + s);
+ return s;
+ }
+
+ public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, int arg3) throws IOException
+ {
+ log.info("callbackTest: " + callbackTest + ", port: " + arg1);
+ Socket s = null;
+ if (callbackTest && arg1 != secondaryServerSocketPort)
+ {
+ s = new Socket(arg0, arg1);
+ }
+ else
+ {
+ s = new TestSocket(arg0, arg1, arg2, arg3, timeout, initialWrites);
+ }
+ log.info(this + " returning " + s);
+ return s;
+ }
+ }
+
+ static class TestSocket extends Socket
+ {
+ int timeout;
+ int initialWrites;
+
+ public TestSocket(int timeout, int initialWrites)
+ {
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public TestSocket(String host, int port, int timeout, int initialWrites) throws UnknownHostException, IOException
+ {
+ super(host, port);
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public TestSocket(InetAddress address, int port, int timeout, int initialWrites) throws IOException
+ {
+ super(address, port);
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public TestSocket(String host, int port, InetAddress localAddr, int localPort, int timeout, int initialWrites) throws IOException
+ {
+ super(host, port, localAddr, localPort);
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public TestSocket(InetAddress address, int port, InetAddress localAddr, int localPort, int timeout, int initialWrites) throws IOException
+ {
+ super(address, port, localAddr, localPort);
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public OutputStream getOutputStream() throws IOException
+ {
+ return new TestOutputStream(super.getOutputStream(), timeout, initialWrites);
+ }
+ public String toString()
+ {
+ return "TestSocket[" + getLocalPort() + "->" + getPort() + "]";
+ }
+ }
+
+ static class TestOutputStream extends OutputStream
+ {
+ OutputStream os;
+ int timeout;
+ boolean closed;
+ int initialWrites;
+ boolean doWait = true;
+ public static int counter;
+
+ public TestOutputStream(OutputStream os, int timeout, int initialWrites)
+ {
+ this.os = os;
+ this.timeout = timeout;
+ this.initialWrites = initialWrites;
+ }
+ public void close()throws IOException
+ {
+ closed = true;
+ super.close();
+ log.info(this + " closed");
+ }
+ public void write(int b) throws IOException
+ {
+ System.out.print("b: " + b);
+ if (closed)
+ {
+ log.info("TestOutputStream closed, cannot write");
+ throw new IOException("closed");
+ }
+ if (doWait && ++counter > initialWrites)
+ {
+ try
+ {
+ log.info("TestOutputStream.write() sleeping: " + timeout);
+ Thread.sleep(timeout);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ os.write(b);
+ }
+ public void write(byte b[], int off, int len) throws IOException
+ {
+ System.out.print("b: ");
+ for (int i = 0; i < len; i++)
+ {
+ System.out.print(b[i] + " ");
+ }
+ System.out.println("");
+ if (closed)
+ {
+ log.info("TestOutputStream closed, cannot write");
+ throw new IOException("closed");
+ }
+ log.info("TestOutputStream: counter = " + counter + ", initialWrites = " + initialWrites);
+ if (++counter > initialWrites)
+ {
+ try
+ {
+ log.info("TestOutputStream.write() sleeping: " + timeout);
+ Thread.sleep(timeout);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ if (closed)
+ {
+ log.info("TestOutputStream closed, cannot write");
+ throw new IOException("closed");
+ }
+ try
+ {
+ log.info(this + " calling write()");
+ doWait = false;
+ os.write(b, off, len);
+ os.flush();
+ doWait = true;
+ log.info(this + " back from write()");
+ }
+ catch (IOException e)
+ {
+ log.info("exception: ", e);
+ throw e;
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/template/WriteTimeoutTestParent.java
___________________________________________________________________
Name: svn:executable
+ *
14 years, 7 months
JBoss Remoting SVN: r6061 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/WEB-INF.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-08-05 14:52:58 -0400 (Thu, 05 Aug 2010)
New Revision: 6061
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/WEB-INF/web.xml
Log:
JBREM-1241: Reverting to correct contents.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/WEB-INF/web.xml
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/WEB-INF/web.xml 2010-08-05 18:48:46 UTC (rev 6060)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/WEB-INF/web.xml 2010-08-05 18:52:58 UTC (rev 6061)
@@ -4,65 +4,25 @@
"http://java.sun.com/dtd/web-app_2_3.dtd">
<!-- The the JBossRemoting server invoker servlet web.xml descriptor
-$Id: web.xml 4903 2009-03-24 07:33:10Z ron.sigal(a)jboss.com $
+$Id: web.xml 3291 2008-01-15 05:03:53Z ron.sigal(a)jboss.com $
-->
<web-app>
<servlet>
- <servlet-name>ServerInvokerServletOK</servlet-name>
+ <servlet-name>ServerInvokerServlet</servlet-name>
<description>The ServerInvokerServlet receives requests via HTTP
protocol from within a web container and passes it onto the
ServletServerInvoker for processing.
</description>
<servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
<init-param>
- <param-name>locatorUrl</param-name>
- <param-value>servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?version=OK</param-value>
- <description>The servlet server invoker locator url</description>
+ <param-name>invokerName</param-name>
+ <param-value>jboss.remoting:service=invoker,transport=servlet</param-value>
+ <description>The servlet server invoker</description>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
-
- <servlet>
- <servlet-name>ServerInvokerServletCR</servlet-name>
- <description>The ServerInvokerServlet receives requests via HTTP
- protocol from within a web container and passes it onto the
- ServletServerInvoker for processing.
- </description>
- <servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
- <init-param>
- <param-name>locatorUrl</param-name>
- <param-value>servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?version=CR</param-value>
- <description>The servlet server invoker locator url</description>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet>
- <servlet-name>ServerInvokerServletLF</servlet-name>
- <description>The ServerInvokerServlet receives requests via HTTP
- protocol from within a web container and passes it onto the
- ServletServerInvoker for processing.
- </description>
- <servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
- <init-param>
- <param-name>locatorUrl</param-name>
- <param-value>servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?version=LF</param-value>
- <description>The servlet server invoker locator url</description>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
<servlet-mapping>
- <servlet-name>ServerInvokerServletOK</servlet-name>
- <url-pattern>/ServerInvokerServlet/OK/*</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>ServerInvokerServletCR</servlet-name>
- <url-pattern>/ServerInvokerServlet/CR/*</url-pattern>
+ <servlet-name>ServerInvokerServlet</servlet-name>
+ <url-pattern>/ServerInvokerServlet/*</url-pattern>
</servlet-mapping>
- <servlet-mapping>
- <servlet-name>ServerInvokerServletLF</servlet-name>
- <url-pattern>/ServerInvokerServlet/LF/*</url-pattern>
- </servlet-mapping>
-</web-app>
-
+</web-app>
\ No newline at end of file
14 years, 7 months