JBoss Remoting SVN: r5186 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/web.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-05-10 02:43:28 -0400 (Sun, 10 May 2009)
New Revision: 5186
Modified:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/web/WebInvokerTestClient.java
Log:
JBREM-1079: Made some changes to support http and servlet transports.
Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/web/WebInvokerTestClient.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/web/WebInvokerTestClient.java 2009-05-10 06:42:56 UTC (rev 5185)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/web/WebInvokerTestClient.java 2009-05-10 06:43:28 UTC (rev 5186)
@@ -93,6 +93,15 @@
response = remotingClient.invoke(WebInvocationHandler.STRING_RETURN_PARAM, metadata);
System.out.println("Fifth response should be " + WebInvocationHandler.RESPONSE_VALUE + " and was: " + response);
assertEquals(WebInvocationHandler.RESPONSE_VALUE, response);
+
+ response = remotingClient.invoke(WebInvocationHandler.GET_OBJECT_NAME, metadata);
+ System.out.println("ObjectName: " + response);
+ String locatorURI = getLocatorURI();
+ int index = locatorURI.indexOf(':');
+ String transport = locatorURI.substring(0, index);
+ String params = ("servlet".equals(transport) ? ",createUniqueObjectName=true" : "");
+ String port = ("servlet".equals(transport) ? "8080" : "8888");
+ assertEquals("jboss.remoting:service=invoker,transport= " + transport + ",host=localhost,port=" + port + params, response);
checkUserAgent(remotingClient, metadata);
14 years, 12 months
JBoss Remoting SVN: r5185 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/web.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-05-10 02:42:56 -0400 (Sun, 10 May 2009)
New Revision: 5185
Modified:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/web/WebInvocationHandler.java
Log:
JBREM-1079: Added more cases.
Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/web/WebInvocationHandler.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/web/WebInvocationHandler.java 2009-05-10 06:42:26 UTC (rev 5184)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/web/WebInvocationHandler.java 2009-05-10 06:42:56 UTC (rev 5185)
@@ -22,10 +22,15 @@
package org.jboss.test.remoting.transport.web;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.management.MBeanServer;
+
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.ServerInvocationHandler;
import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.Callback;
import org.jboss.remoting.callback.InvokerCallbackHandler;
/**
@@ -43,11 +48,29 @@
public static final String THROW_EXCEPTION_PARAM = "throw_exception";
public static final String STRING_RETURN_PARAM = "return_string";
public static final String USER_AGENT_PARAM = "user_agent";
+ public static final String GET_OBJECT_NAME = "getObjectName";
public static final String HTML_PAGE_RESPONSE = "<html><head><title>Test HTML page</title></head><body>" +
"<h1>HTTP/Servlet Test HTML page</h1><p>This is a simple page served for test." +
"<p>Should show up in browser or via invoker client</body></html>";
-
-
+ public static final String SET_CONTENT_TYPE = "setContentType";
+ public static final String CONTENT_TYPE = "test/testContentType";
+
+ public static final String GET_ADDRESS = "getAddress";
+ public static final String OPEN_CONNECTION = "openConnection";
+ public static final String SEND_CALLBACK = "sendCallback";
+ public static final String COPY = "copy:";
+ public static final int ANSWER = 17;
+
+ public static final String CHECK_MBEAN_SERVER = "checkMBeanServer";
+ public static final String DEFAULT_DOMAIN = "defaultDomain";
+
+ protected static String HEADER_RESPONSE_KEY = "responseKey";
+ protected static String HEADER_RESPONSE_VALUE = "responseValue";
+ protected static String RETURN_RESPONSE_HEADER = "returnResponseHeader";
+
+ private InvokerCallbackHandler callbackHandler;
+ protected ServerInvoker invoker;
+
/**
* called to handle a specific invocation
*
@@ -90,6 +113,42 @@
// return user agent found in map
return invocation.getRequestPayload().get("user-agent");
}
+ else if (GET_OBJECT_NAME.equals(invocation.getParameter()))
+ {
+ return invoker.getMBeanObjectName();
+ }
+ else if (SET_CONTENT_TYPE.equals(invocation.getParameter()))
+ {
+ Map returnPayload = invocation.getReturnPayload();
+ if (returnPayload == null)
+ {
+ returnPayload = new HashMap();
+ invocation.setReturnPayload(returnPayload);
+ }
+ returnPayload.put("Content-Type", CONTENT_TYPE);
+ return CONTENT_TYPE;
+ }
+ else if (SEND_CALLBACK.equals(invocation.getParameter()))
+ {
+ callbackHandler.handleCallback(new Callback("callback"));
+ return null;
+ }
+ else if (invocation.getParameter() instanceof String && ((String)invocation.getParameter()).startsWith(COPY))
+ {
+ return ((String) invocation.getParameter()).substring(5);
+ }
+ else if (RETURN_RESPONSE_HEADER.equals(invocation.getParameter()))
+ {
+ Map returnPayload = invocation.getReturnPayload();
+ if (returnPayload == null)
+ {
+ returnPayload = new HashMap();
+ invocation.setReturnPayload(returnPayload);
+ }
+ returnPayload.put(HEADER_RESPONSE_KEY, HEADER_RESPONSE_VALUE);
+ System.out.println("returnPayload: " + invocation.getReturnPayload());
+ return invocation.getParameter();
+ }
else
{
return HTML_PAGE_RESPONSE;
@@ -104,7 +163,7 @@
*/
public void addListener(InvokerCallbackHandler callbackHandler)
{
- // NO OP as do not handling callback listeners in this example
+ this.callbackHandler = callbackHandler;
}
/**
@@ -125,7 +184,6 @@
*/
public void setMBeanServer(MBeanServer server)
{
- // NO OP as do not need reference to MBeanServer for this handler
}
/**
@@ -135,7 +193,7 @@
*/
public void setInvoker(ServerInvoker invoker)
{
- // NO OP as do not need reference back to the server invoker
+ this.invoker = invoker;
}
}
\ No newline at end of file
14 years, 12 months
JBoss Remoting SVN: r5184 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ssl.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-05-10 02:42:26 -0400 (Sun, 10 May 2009)
New Revision: 5184
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ssl/SSLServletInvokerExceptionTestClient.java
Log:
JBREM-1079: New unit test.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ssl/SSLServletInvokerExceptionTestClient.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ssl/SSLServletInvokerExceptionTestClient.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ssl/SSLServletInvokerExceptionTestClient.java 2009-05-10 06:42:26 UTC (rev 5184)
@@ -0,0 +1,65 @@
+/*
+* 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.transport.servlet.ssl;
+
+import org.jboss.test.remoting.transport.web.WebInvokerTestClient;
+
+/**
+ * This test is identical to ServletInvokerTestClient except that it, in the case
+ * when an exception is thrown on the server, ServletServerInvoker is instructed
+ * to return the actual exception.
+ *
+ * See JBREM-813.
+ *
+ * @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
+ * @author <a href="mailto:ron.sigal@jboss.com">Ron Sigal</a>
+ */
+public class SSLServletInvokerExceptionTestClient extends WebInvokerTestClient
+{
+ public static final Integer ERROR_RESPONSE_CODE = new Integer(500);
+
+ public String getLocatorURI()
+ {
+ // since doing basic (using default ssl server socket factory)
+ // need to set the system properties to the truststore
+ String trustStoreFilePath = this.getClass().getResource("truststore").getFile();
+ System.setProperty("javax.net.ssl.trustStore", trustStoreFilePath);
+
+ return "sslservlet://localhost:8443/servlet-invoker/ServerInvokerServlet";
+ //return "http://localhost:8080/servlet-invoker/ServerInvokerServlet";
+ }
+
+ public static void main(String[] args)
+ {
+ SSLServletInvokerExceptionTestClient client = new SSLServletInvokerExceptionTestClient();
+ try
+ {
+ client.testPostInvocation();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+}
\ No newline at end of file
14 years, 12 months
JBoss Remoting SVN: r5183 - in remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/marshal: WEB-INF and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-05-10 02:42:11 -0400 (Sun, 10 May 2009)
New Revision: 5183
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/marshal/WEB-INF/
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/marshal/WEB-INF/web.xml
Log:
JBREM-1079: New unit test.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/marshal/WEB-INF/web.xml
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/marshal/WEB-INF/web.xml (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/marshal/WEB-INF/web.xml 2009-05-10 06:42:11 UTC (rev 5183)
@@ -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 4903 2009-03-24 07:33:10Z 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/?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>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>ServerInvokerServlet</servlet-name>
+ <url-pattern>/ServerInvokerServlet/*</url-pattern>
+ </servlet-mapping>
+</web-app>
+
14 years, 12 months
JBoss Remoting SVN: r5182 - 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: 2009-05-10 02:41:02 -0400 (Sun, 10 May 2009)
New Revision: 5182
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/WEB-INF/web.xml
Log:
JBREM-1079: Updated invoker ObjectName.
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 2009-05-10 06:40:41 UTC (rev 5181)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/WEB-INF/web.xml 2009-05-10 06:41:02 UTC (rev 5182)
@@ -16,7 +16,7 @@
<servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
<init-param>
<param-name>invokerName</param-name>
- <param-value>jboss.remoting:host=localhost,port=8080,service=invoker,transport=servlet</param-value>
+ <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>
14 years, 12 months
JBoss Remoting SVN: r5181 - in remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet: preservelines and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-05-10 02:40:41 -0400 (Sun, 10 May 2009)
New Revision: 5181
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/ServletLinePreservationTestClient.java
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/TestInvocationHandler.java
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/readme.txt
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/remoting-servlet-service.xml
Log:
JBREM-1079: New unit tests.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/ServletLinePreservationTestClient.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/ServletLinePreservationTestClient.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/ServletLinePreservationTestClient.java 2009-05-10 06:40:41 UTC (rev 5181)
@@ -0,0 +1,51 @@
+/*
+* 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.transport.servlet.preservelines;
+
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.test.remoting.transport.http.lines.HttpLinePreservationTestCase;
+
+
+/**
+ * Unit tests for JBREM-809.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 8, 2008
+ * </p>
+ */
+public class ServletLinePreservationTestClient extends HttpLinePreservationTestCase
+{
+ protected String getTransport()
+ {
+ return "servlet";
+ }
+
+ protected void setupServer(boolean addConfig, String preserveLines) throws Exception
+ {
+ locatorURI = "servlet://localhost:8080/servlet-invoker/ServerInvokerServlet";
+ serverLocator = new InvokerLocator(locatorURI);
+ }
+
+ public void testPreservationClientNoPreservationServer() {}
+}
\ No newline at end of file
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/TestInvocationHandler.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/TestInvocationHandler.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/TestInvocationHandler.java 2009-05-10 06:40:41 UTC (rev 5181)
@@ -0,0 +1,51 @@
+/*
+* 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.transport.servlet.preservelines;
+
+import javax.management.MBeanServer;
+
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+
+/**
+ * For JBREM-809.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 8, 2008
+ * </p>
+ */
+public 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) {}
+}
\ No newline at end of file
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/readme.txt
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/readme.txt (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/readme.txt 2009-05-10 06:40:41 UTC (rev 5181)
@@ -0,0 +1,40 @@
+The servlet (and sslservlet) transport tests require a web container. Currently, these tests have to be run
+manually (JBREM-139 has been created to automate this). Until then, here are the instructions for running
+the tests manually.
+
+*******************************************************
+***** JBREM-139 is done. *****
+***** See tests.functional.servlet in build.xml. *****
+*******************************************************
+
+servlet
+
+1. Get JBossAS and copy remoting's servlet-invoker.war (from distro or build) to the deploy directory.
+2. Copy the WEB-INF/web.xml under this directory into the that of the servlet-invoker.war/WEB-INF directory.
+3. Copy remoting-servlet-invoker-service.xml to deploy directory.
+4. Copy jboss-remoting-tests.jar to server lib directory
+5. Start web container (JBossAS).
+6. Run ServletLinePreservationTestClient.
+
+
+sslservlet
+
+1. Steps 1-4 above, except use the WEB-INF/web.xml and remoting-servlet-invoker-service.xml that is under the
+servlet/ssl directory.
+2. Copy the servlet/ssl/.keystore file to the server conf directory
+3. Edit jboss-web.deployer/server.xml to enable ssl connector. It should look like following:
+
+ <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
+ maxThreads="150"
+ scheme="https" secure="true" clientAuth="false"
+ address="${jboss.bind.address}"
+ keystoreFile="${jboss.server.home.dir}/conf/.keystore"
+ keystorePass="unit-tests-server"
+ sslProtocol="TLS"/>
+
+
+4. Start web container (JBossAS).
+5. Run SSLServletInvokerTestClient or SSLServletClientAddressTestClient.
+
+
+
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/remoting-servlet-service.xml
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/remoting-servlet-service.xml (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/preservelines/remoting-servlet-service.xml 2009-05-10 06:40:41 UTC (rev 5181)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+ <mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:service=Connector,transport=Servlet"
+ display-name="Servlet transport Connector">
+
+ <attribute name="Configuration">
+ <config>
+ <invoker transport="servlet">
+ <attribute name="serverBindAddress">localhost</attribute>
+ <attribute name="serverBindPort">8080</attribute>
+ <attribute name="preserveLines" isParam="true">true</attribute>
+ <attribute name="path">servlet-invoker/ServerInvokerServlet</attribute>
+ </invoker>
+ <handlers>
+ <handler subsystem="test">org.jboss.test.remoting.transport.servlet.preservelines.TestInvocationHandler</handler>
+ </handlers>
+ </config>
+ </attribute>
+ </mbean>
+</server>
14 years, 12 months
JBoss Remoting SVN: r5180 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/WEB-INF.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-05-10 02:40:14 -0400 (Sun, 10 May 2009)
New Revision: 5180
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/WEB-INF/web.xml
Log:
JBREM-1079: Updated invoker ObjectName.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/WEB-INF/web.xml
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/WEB-INF/web.xml 2009-05-10 06:38:41 UTC (rev 5179)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/WEB-INF/web.xml 2009-05-10 06:40:14 UTC (rev 5180)
@@ -16,7 +16,7 @@
<servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
<init-param>
<param-name>invokerName</param-name>
- <param-value>jboss.remoting:host=localhost,port=8080,service=invoker,transport=servlet</param-value>
+ <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>
14 years, 12 months
JBoss Remoting SVN: r5179 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-05-10 02:38:41 -0400 (Sun, 10 May 2009)
New Revision: 5179
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ResponseCodeTestClient.java
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ServletInvokerNoExceptionTestClient.java
Log:
JBREM-1079: New unit tests.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ResponseCodeTestClient.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ResponseCodeTestClient.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ResponseCodeTestClient.java 2009-05-10 06:38:41 UTC (rev 5179)
@@ -0,0 +1,51 @@
+/*
+* 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.transport.servlet;
+
+import org.jboss.test.remoting.transport.http.headers.ResponseCodeTestCase;
+
+/**
+ * Unit test for JBREM-728.
+ *
+ * @author <a href="mailto:ron.sigal@jboss.com">Ron Sigal</a>
+ * <p>
+ * Copyright (c) November 24, 2007
+ * </p>
+ *
+ */
+public class ResponseCodeTestClient extends ResponseCodeTestCase
+{
+ protected String getTransport()
+ {
+ return "servlet";
+ }
+
+ protected void setupServer()
+ {
+ locatorURI = "servlet://localhost:8080/servlet-invoker/ServerInvokerServlet";
+ port = 8080;
+ }
+
+ protected void shutdownServer()
+ {
+ }
+}
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ServletInvokerNoExceptionTestClient.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ServletInvokerNoExceptionTestClient.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/ServletInvokerNoExceptionTestClient.java 2009-05-10 06:38:41 UTC (rev 5179)
@@ -0,0 +1,59 @@
+/*
+* 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.transport.servlet;
+
+import org.jboss.test.remoting.transport.web.WebInvokerTestClient;
+
+/**
+ * This test is identical to ServletInvokerTestClient except that it, in the case
+ * when an exception is thrown on the server, ServletServerInvoker is explicitly instructed
+ * not to return the actual exception.
+ *
+ * See JBREM-813 and JBREM-675.
+ *
+ * @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
+ * @author <a href="mailto:ron.sigal@jboss.com">Ron Sigal</a>
+ */
+public class ServletInvokerNoExceptionTestClient extends WebInvokerTestClient
+{
+ public static final Integer ERROR_RESPONSE_CODE = new Integer(500);
+
+ public String getLocatorURI()
+ {
+ return "servlet://localhost:8080/servlet-invoker/ServerInvokerServlet";
+ }
+
+ public static void main(String[] args)
+ {
+ ServletInvokerNoExceptionTestClient client = new ServletInvokerNoExceptionTestClient();
+ try
+ {
+ client.testPostInvocation();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+}
\ No newline at end of file
14 years, 12 months
JBoss Remoting SVN: r5178 - in remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet: nopreservelines and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-05-10 02:38:10 -0400 (Sun, 10 May 2009)
New Revision: 5178
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/ServletNoLinePreservationTestClient.java
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/TestInvocationHandler.java
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/readme.txt
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/remoting-servlet-service.xml
Log:
JBREM-1079: New unit test.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/ServletNoLinePreservationTestClient.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/ServletNoLinePreservationTestClient.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/ServletNoLinePreservationTestClient.java 2009-05-10 06:38:10 UTC (rev 5178)
@@ -0,0 +1,52 @@
+/*
+* 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.transport.servlet.nopreservelines;
+
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.test.remoting.transport.http.lines.HttpLinePreservationTestCase;
+
+
+/**
+ * Unit tests for JBREM-809.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 8, 2008
+ * </p>
+ */
+public class ServletNoLinePreservationTestClient extends HttpLinePreservationTestCase
+{
+ protected String getTransport()
+ {
+ return "servlet";
+ }
+
+ protected void setupServer(boolean addConfig, String preserveLines) throws Exception
+ {
+ locatorURI = "servlet://localhost:8080/servlet-invoker/ServerInvokerServlet";
+ serverLocator = new InvokerLocator(locatorURI);
+ }
+
+ public void testLinePreservationClientConfig() {}
+ public void testLinePreservationClientMetadata() {}
+}
\ No newline at end of file
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/TestInvocationHandler.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/TestInvocationHandler.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/TestInvocationHandler.java 2009-05-10 06:38:10 UTC (rev 5178)
@@ -0,0 +1,51 @@
+/*
+* 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.transport.servlet.nopreservelines;
+
+import javax.management.MBeanServer;
+
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+
+/**
+ * For JBREM-809.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 8, 2008
+ * </p>
+ */
+public 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) {}
+}
\ No newline at end of file
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/readme.txt
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/readme.txt (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/readme.txt 2009-05-10 06:38:10 UTC (rev 5178)
@@ -0,0 +1,40 @@
+The servlet (and sslservlet) transport tests require a web container. Currently, these tests have to be run
+manually (JBREM-139 has been created to automate this). Until then, here are the instructions for running
+the tests manually.
+
+*******************************************************
+***** JBREM-139 is done. *****
+***** See tests.functional.servlet in build.xml. *****
+*******************************************************
+
+servlet
+
+1. Get JBossAS and copy remoting's servlet-invoker.war (from distro or build) to the deploy directory.
+2. Copy the WEB-INF/web.xml under this directory into the that of the servlet-invoker.war/WEB-INF directory.
+3. Copy remoting-servlet-invoker-service.xml to deploy directory.
+4. Copy jboss-remoting-tests.jar to server lib directory
+5. Start web container (JBossAS).
+6. Run ServletLinePreservationTestClient.
+
+
+sslservlet
+
+1. Steps 1-4 above, except use the WEB-INF/web.xml and remoting-servlet-invoker-service.xml that is under the
+servlet/ssl directory.
+2. Copy the servlet/ssl/.keystore file to the server conf directory
+3. Edit jboss-web.deployer/server.xml to enable ssl connector. It should look like following:
+
+ <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
+ maxThreads="150"
+ scheme="https" secure="true" clientAuth="false"
+ address="${jboss.bind.address}"
+ keystoreFile="${jboss.server.home.dir}/conf/.keystore"
+ keystorePass="unit-tests-server"
+ sslProtocol="TLS"/>
+
+
+4. Start web container (JBossAS).
+5. Run SSLServletInvokerTestClient or SSLServletClientAddressTestClient.
+
+
+
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/remoting-servlet-service.xml
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/remoting-servlet-service.xml (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/nopreservelines/remoting-servlet-service.xml 2009-05-10 06:38:10 UTC (rev 5178)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+ <mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:service=Connector,transport=Servlet"
+ display-name="Servlet transport Connector">
+
+ <attribute name="Configuration">
+ <config>
+ <invoker transport="servlet">
+ <attribute name="serverBindAddress">localhost</attribute>
+ <attribute name="serverBindPort">8080</attribute>
+ <attribute name="preserveLines" isParam="true">false</attribute>
+ <attribute name="path">servlet-invoker/ServerInvokerServlet</attribute>
+ </invoker>
+ <handlers>
+ <handler subsystem="test">org.jboss.test.remoting.transport.servlet.nopreservelines.TestInvocationHandler</handler>
+ </handlers>
+ </config>
+ </attribute>
+ </mbean>
+</server>
14 years, 12 months
JBoss Remoting SVN: r5177 - in remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http: lines and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-05-10 02:37:35 -0400 (Sun, 10 May 2009)
New Revision: 5177
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/lines/
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/lines/HttpLinePreservationTestCase.java
Log:
JBREM-1079: New unit test.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/lines/HttpLinePreservationTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/lines/HttpLinePreservationTestCase.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/lines/HttpLinePreservationTestCase.java 2009-05-10 06:37:35 UTC (rev 5177)
@@ -0,0 +1,411 @@
+/*
+* 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.transport.http.lines;
+
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+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.InvokerCallbackHandler;
+import org.jboss.remoting.marshal.http.HTTPUnMarshaller;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+import org.jboss.remoting.transport.web.WebUtil;
+
+
+/**
+ *
+ * Unit tests for JBREM-809.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 8, 2008
+ * </p>
+ */
+public class HttpLinePreservationTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(HttpLinePreservationTestCase.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 testLinePreservationClientConfig() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, "true");
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(HTTPUnMarshaller.PRESERVE_LINES, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ Properties headerProps = new Properties();
+ headerProps.put(HTTPMetadataConstants.CONTENTTYPE, WebUtil.PLAIN);
+ HashMap metadata = new HashMap();
+ metadata.put("HEADER", headerProps);
+ metadata.put(Client.RAW, "true");
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789").append("\r\n");
+ String message = sb.toString();
+ assertEquals(message, client.invoke(message, metadata));
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testLinePreservationClientMetadata() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, "true");
+
+ // 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");
+
+ Properties headerProps = new Properties();
+ headerProps.put(HTTPMetadataConstants.CONTENTTYPE, WebUtil.PLAIN);
+ HashMap metadata = new HashMap();
+ metadata.put("HEADER", headerProps);
+ metadata.put(Client.RAW, "true");
+ metadata.put(HTTPUnMarshaller.PRESERVE_LINES, "true");
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789");
+ String message = sb.toString();
+ assertEquals(message, client.invoke(message, metadata));
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testNoLinePreservationClientConfigServerConfig() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, "false");
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(HTTPUnMarshaller.PRESERVE_LINES, "false");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ Properties headerProps = new Properties();
+ headerProps.put(HTTPMetadataConstants.CONTENTTYPE, WebUtil.PLAIN);
+ HashMap metadata = new HashMap();
+ metadata.put("HEADER", headerProps);
+ metadata.put(Client.RAW, "true");
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789").append("\r\n");
+ String sent = sb.toString();
+ sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789");
+ String received = sb.toString();
+ assertEquals(received, client.invoke(sent, metadata));
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testNoLinePreservationClientMetadataServerConfig() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, "false");
+
+ // 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");
+
+ Properties headerProps = new Properties();
+ headerProps.put(HTTPMetadataConstants.CONTENTTYPE, WebUtil.PLAIN);
+ HashMap metadata = new HashMap();
+ metadata.put("HEADER", headerProps);
+ metadata.put(Client.RAW, "true");
+ metadata.put(HTTPUnMarshaller.PRESERVE_LINES, "false");
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789").append("\r\n");
+ String sent = sb.toString();
+ sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789");
+ String received = sb.toString();
+ assertEquals(received, client.invoke(sent, metadata));
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testNoLinePreservationClientConfigServerDefault() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(false, null);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(HTTPUnMarshaller.PRESERVE_LINES, "false");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ Properties headerProps = new Properties();
+ headerProps.put(HTTPMetadataConstants.CONTENTTYPE, WebUtil.PLAIN);
+ HashMap metadata = new HashMap();
+ metadata.put("HEADER", headerProps);
+ metadata.put(Client.RAW, "true");
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789").append("\r\n");
+ String sent = sb.toString();
+ sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789");
+ String received = sb.toString();
+ assertEquals(received, client.invoke(sent, metadata));
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testNoLinePreservationClientMetadataServerDefault() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(false, null);
+
+ // 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");
+
+ Properties headerProps = new Properties();
+ headerProps.put(HTTPMetadataConstants.CONTENTTYPE, WebUtil.PLAIN);
+ HashMap metadata = new HashMap();
+ metadata.put("HEADER", headerProps);
+ metadata.put(Client.RAW, "true");
+ metadata.put(HTTPUnMarshaller.PRESERVE_LINES, "false");
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789").append("\r\n");
+ String sent = sb.toString();
+ sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789");
+ String received = sb.toString();
+ assertEquals(received, client.invoke(sent, metadata));
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testNoLinePreservationClientServerDefault() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(false, null);
+
+ // 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");
+
+ Properties headerProps = new Properties();
+ headerProps.put(HTTPMetadataConstants.CONTENTTYPE, WebUtil.PLAIN);
+ HashMap metadata = new HashMap();
+ metadata.put("HEADER", headerProps);
+ metadata.put(Client.RAW, "true");
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789").append("\r\n");
+ String sent = sb.toString();
+ sb = new StringBuffer();
+ for (int i = 0; i < 1000; i++)
+ sb.append("0123456789");
+ String received = sb.toString();
+ assertEquals(received, client.invoke(sent, metadata));
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected String getTransport()
+ {
+ return "http";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer(boolean addConfig, String preserveLines) throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ 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 (addConfig)
+ {
+ config.put(HTTPUnMarshaller.PRESERVE_LINES, preserveLines);
+ }
+
+ 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) {}
+ }
+}
\ No newline at end of file
14 years, 12 months