JBoss Remoting SVN: r5400 - remoting2/branches/2.2.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-08-29 20:37:05 -0400 (Sat, 29 Aug 2009)
New Revision: 5400
Modified:
remoting2/branches/2.2/local.properties
Log:
JBREM-1145: (1) Now uses AS 4.2.3.GA; (2) shorted started time wait.
Modified: remoting2/branches/2.2/local.properties
===================================================================
--- remoting2/branches/2.2/local.properties 2009-08-30 00:36:17 UTC (rev 5399)
+++ remoting2/branches/2.2/local.properties 2009-08-30 00:37:05 UTC (rev 5400)
@@ -1,4 +1,4 @@
-jboss.home=c://cygwin/home/rsigal/workspace.new/EAP_4_3_0_GA_CP03/build/output/jboss-4.3.0.GA_CP03
-as.startup.time=220
+jboss.home=c://cygwin/home/rsigal/JBoss/JBossAS/jboss-4.2.3.GA
+as.startup.time=40
as.shutdown.time=10
shell=c:/cygwin/bin/sh.exe
\ No newline at end of file
15 years, 2 months
JBoss Remoting SVN: r5399 - remoting2/branches/2.2.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-08-29 20:36:17 -0400 (Sat, 29 Aug 2009)
New Revision: 5399
Modified:
remoting2/branches/2.2/build.xml
Log:
JBREM-1145: Added unit tests for servlet transport.
Modified: remoting2/branches/2.2/build.xml
===================================================================
--- remoting2/branches/2.2/build.xml 2009-08-27 14:36:59 UTC (rev 5398)
+++ remoting2/branches/2.2/build.xml 2009-08-30 00:36:17 UTC (rev 5399)
@@ -952,7 +952,6 @@
<env key="Path" path="${env.Path}${path.separator}c:/cygwin/usr/bin"/>
<env key="JBOSS_HOME" value="${jboss.home}"/>
<arg file="${jboss.home}/bin/run.sh"/>
- <arg value="-c default"/>
</exec>
<echo>Going to sleep for ${as.startup.time} seconds</echo>
<sleep seconds="${as.startup.time}"/>
@@ -989,6 +988,7 @@
<antcall target="AS.start"/>
<antcall target="tests.servlet" inheritrefs="true"/>
<antcall target="tests.servlet.callback" inheritrefs="true"/>
+ <antcall target="tests.servlet.marshal" inheritrefs="true"/>
<antcall target="tests.servlet.marshal.config" inheritrefs="true"/>
<antcall target="tests.servlet.marshal.noconfig" inheritrefs="true"/>
<antcall target="tests.servlet.nopreservelines" inheritrefs="true"/>
@@ -1057,6 +1057,36 @@
<delete file="${jboss.deploy.dir}/remoting-servlet-service.xml"/>
</target>
+ <target name="tests.servlet.marshal" depends="tests.servlet.config">
+ <copy file="${servlet.tests.dir}/marshal/remoting-servlet-service.xml" todir="${jboss.deploy.dir}" overwrite="true"/>
+ <sleep seconds="2"/>
+ <copy todir="${jboss.deploy.dir}">
+ <fileset dir="${output.lib.dir}">
+ <include name="servlet-invoker.war/**"/>
+ </fileset>
+ </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"/>
+ <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}"/>
+ <classpath>
+ <path refid="tests.classpath"/>
+ <pathelement location="${output.lib.dir}/jboss-remoting-tests.jar"/>
+ </classpath>
+ <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+ extension="-java_serialization.xml"/>
+ <batchtest fork="yes" todir="${output.tests.results}" haltonfailure="no">
+ <fileset dir="${tests.compile.dir}">
+ <include name="**/remoting/transport/servlet/marshal/*TestClient.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ <delete dir="${jboss.deploy.dir}/servlet-invoker.war"/>
+ <delete file="${jboss.deploy.dir}/remoting-servlet-service.xml"/>
+ </target>
+
<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"/>
15 years, 2 months
JBoss Remoting SVN: r5398 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-08-27 10:36:59 -0400 (Thu, 27 Aug 2009)
New Revision: 5398
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
Log:
JBREM-1145: Changed test for InvocationResponse returned as String.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java 2009-08-27 14:36:30 UTC (rev 5397)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java 2009-08-27 14:36:59 UTC (rev 5398)
@@ -120,21 +120,12 @@
// Do invocation.
Object o = client.invoke("abc");
+
+ // Show that an InvocationResponse was incorrectly returned as a Strin..
assertTrue(o instanceof String);
String result = (String) o;
+ assertTrue(result.indexOf("org.jboss.remoting.InvocationResponse") >= 0);
- // Show that an InvocationResponse was incorrectly returned as a String, starting with
- // the ObjectInputStream header bytes.
- byte[] bytes = result.getBytes();
- System.out.print("bytes: ");
- for (int i = 0; i < bytes.length; i++)
- System.out.print(bytes[i] + " ");
- System.out.println("");
- assertEquals(-84, bytes[0]);
- assertEquals(-19, bytes[1]);
- assertEquals(0, bytes[2]);
- assertEquals(5, bytes[3]);
-
// Check remoting content type handling.
validateOrdinaryInvocation(client);
@@ -161,21 +152,12 @@
// Do invocation.
Object o = client.invoke("abc");
+
+ // Show that an InvocationResponse was incorrectly returned as a String.
assertTrue(o instanceof String);
String result = (String) o;
+ assertTrue(result.indexOf("org.jboss.remoting.InvocationResponse") >= 0);
- // Show that an InvocationResponse was incorrectly returned as a String, starting with
- // the ObjectInputStream header bytes.
- byte[] bytes = result.getBytes();
- System.out.print("bytes: ");
- for (int i = 0; i < bytes.length; i++)
- System.out.print(bytes[i] + " ");
- System.out.println("");
- assertEquals(-84, bytes[0]);
- assertEquals(-19, bytes[1]);
- assertEquals(0, bytes[2]);
- assertEquals(5, bytes[3]);
-
// Check remoting content type handling.
validateOrdinaryInvocation(client);
15 years, 3 months
JBoss Remoting SVN: r5397 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/marshal.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-08-27 10:36:30 -0400 (Thu, 27 Aug 2009)
New Revision: 5397
Modified:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
Log:
JBREM-1145: (1) Changed test for InvocationResponse returned as String; (2) added logging.
Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java 2009-08-27 04:33:11 UTC (rev 5396)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java 2009-08-27 14:36:30 UTC (rev 5397)
@@ -114,27 +114,19 @@
HashMap clientConfig = new HashMap();
clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
addExtraClientConfig(clientConfig);
+ log.info("connecting to: " + serverLocator);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Do invocation.
Object o = client.invoke("abc");
+
+ // Show that an InvocationResponse was incorrectly returned as a Strin..
assertTrue(o instanceof String);
String result = (String) o;
+ assertTrue(result.indexOf("org.jboss.remoting.InvocationResponse") >= 0);
- // Show that an InvocationResponse was returned as a String, starting with
- // the ObjectInputStream header bytes.
- byte[] bytes = result.getBytes();
- System.out.print("bytes: ");
- for (int i = 0; i < bytes.length; i++)
- System.out.print(bytes[i] + " ");
- System.out.println("");
- assertEquals(-84, bytes[0]);
- assertEquals(-19, bytes[1]);
- assertEquals(0, bytes[2]);
- assertEquals(5, bytes[3]);
-
// Check remoting content type handling.
validateOrdinaryInvocation(client);
@@ -157,25 +149,16 @@
addExtraClientConfig(clientConfig);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Do invocation.
Object o = client.invoke("abc");
+
+ // Show that an InvocationResponse was incorrectly returned as a String.
assertTrue(o instanceof String);
String result = (String) o;
+ assertTrue(result.indexOf("org.jboss.remoting.InvocationResponse") >= 0);
- // Show that an InvocationResponse was returned as a String, starting with
- // the ObjectInputStream header bytes.
- byte[] bytes = result.getBytes();
- System.out.print("bytes: ");
- for (int i = 0; i < bytes.length; i++)
- System.out.print(bytes[i] + " ");
- System.out.println("");
- assertEquals(-84, bytes[0]);
- assertEquals(-19, bytes[1]);
- assertEquals(0, bytes[2]);
- assertEquals(5, bytes[3]);
-
// Check remoting content type handling.
validateOrdinaryInvocation(client);
@@ -198,7 +181,7 @@
addExtraClientConfig(clientConfig);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Test connections.
assertEquals("abc", client.invoke("abc"));
@@ -226,7 +209,7 @@
addExtraClientConfig(clientConfig);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Test connections.
Map metadata = new HashMap();
@@ -256,7 +239,7 @@
addExtraClientConfig(clientConfig);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Test connections.
Map metadata = new HashMap();
@@ -286,7 +269,7 @@
addExtraClientConfig(clientConfig);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Test connections.
Map metadata = new HashMap();
15 years, 3 months
JBoss Remoting SVN: r5396 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-08-27 00:33:11 -0400 (Thu, 27 Aug 2009)
New Revision: 5396
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
Log:
JBREM-1145: Fixed derivation of useRemotingContentType value.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java 2009-08-27 04:31:25 UTC (rev 5395)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java 2009-08-27 04:33:11 UTC (rev 5396)
@@ -110,11 +110,11 @@
}
val = configuration.get(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE);
- if (val != null && val instanceof String)
+ if (val instanceof String)
{
useRemotingContentType = Boolean.valueOf((String) val).booleanValue();
}
- else
+ else if (val != null)
{
log.warn(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE + " value should be a String: " + val);
}
15 years, 3 months
JBoss Remoting SVN: r5395 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-08-27 00:31:25 -0400 (Thu, 27 Aug 2009)
New Revision: 5395
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
Log:
JBREM-1145: Added logging.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java 2009-08-26 19:47:33 UTC (rev 5394)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java 2009-08-27 04:31:25 UTC (rev 5395)
@@ -83,7 +83,7 @@
if (firstTime)
{
firstTime = false;
- Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO);
+ Logger.getLogger("org.jboss.remoting").setLevel(Level.TRACE);
Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
PatternLayout layout = new PatternLayout(pattern);
@@ -113,9 +113,10 @@
HashMap clientConfig = new HashMap();
clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
addExtraClientConfig(clientConfig);
+ log.info("connecting to: " + serverLocator);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Do invocation.
Object o = client.invoke("abc");
@@ -156,7 +157,7 @@
addExtraClientConfig(clientConfig);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Do invocation.
Object o = client.invoke("abc");
@@ -197,7 +198,7 @@
addExtraClientConfig(clientConfig);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Test connections.
assertEquals("abc", client.invoke("abc"));
@@ -225,7 +226,7 @@
addExtraClientConfig(clientConfig);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Test connections.
Map metadata = new HashMap();
@@ -255,7 +256,7 @@
addExtraClientConfig(clientConfig);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Test connections.
Map metadata = new HashMap();
@@ -285,7 +286,7 @@
addExtraClientConfig(clientConfig);
Client client = new Client(serverLocator, clientConfig);
client.connect();
- log.info("client is connected");
+ log.info("client is connected to " + serverLocator);
// Test connections.
Map metadata = new HashMap();
15 years, 3 months
JBoss Remoting SVN: r5394 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/marshal.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-08-26 15:47:33 -0400 (Wed, 26 Aug 2009)
New Revision: 5394
Modified:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
Log:
JBREM-1145: Added new tests to account for making new content type test optional.
Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java 2009-08-26 19:46:43 UTC (rev 5393)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java 2009-08-26 19:47:33 UTC (rev 5394)
@@ -103,28 +103,109 @@
}
- public void testOrdinaryInvocation() throws Throwable
+ public void testOrdinaryInvocationDefault() throws Throwable
{
log.info("entering " + getName());
// Start server.
- setupServer();
+ setupServer(false, 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 client = new Client(serverLocator, clientConfig);
client.connect();
log.info("client is connected");
+ // Do invocation.
+ Object o = client.invoke("abc");
+ assertTrue(o instanceof String);
+ String result = (String) o;
+
+ // Show that an InvocationResponse was returned as a String, starting with
+ // the ObjectInputStream header bytes.
+ byte[] bytes = result.getBytes();
+ System.out.print("bytes: ");
+ for (int i = 0; i < bytes.length; i++)
+ System.out.print(bytes[i] + " ");
+ System.out.println("");
+ assertEquals(-84, bytes[0]);
+ assertEquals(-19, bytes[1]);
+ assertEquals(0, bytes[2]);
+ assertEquals(5, bytes[3]);
+
+ // Check remoting content type handling.
+ validateOrdinaryInvocation(client);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testOrdinaryInvocationRemotingContentTypeFalse() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, false);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Do invocation.
+ Object o = client.invoke("abc");
+ assertTrue(o instanceof String);
+ String result = (String) o;
+
+ // Show that an InvocationResponse was returned as a String, starting with
+ // the ObjectInputStream header bytes.
+ byte[] bytes = result.getBytes();
+ System.out.print("bytes: ");
+ for (int i = 0; i < bytes.length; i++)
+ System.out.print(bytes[i] + " ");
+ System.out.println("");
+ assertEquals(-84, bytes[0]);
+ assertEquals(-19, bytes[1]);
+ assertEquals(0, bytes[2]);
+ assertEquals(5, bytes[3]);
+
+ // Check remoting content type handling.
+ validateOrdinaryInvocation(client);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testOrdinaryInvocationRemotingContentTypeTrue() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, true);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
// Test connections.
assertEquals("abc", client.invoke("abc"));
log.info("connection is good");
// Check remoting content type handling.
- validateOrdinaryInvocation();
+ validateOrdinaryInvocation(client);
client.disconnect();
shutdownServer();
@@ -132,19 +213,18 @@
}
- public void testRawStringMessage() throws Throwable
+ public void testRawStringMessageDefault() throws Throwable
{
log.info("entering " + getName());
// Start server.
- setupServer();
+ setupServer(false, 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 client = new Client(serverLocator, clientConfig);
client.connect();
log.info("client is connected");
@@ -155,7 +235,7 @@
log.info("connection is good");
// Check remoting content type handling.
- validateRawStringMessage();
+ validateRawStringMessage(client);
client.disconnect();
shutdownServer();
@@ -163,8 +243,68 @@
}
- protected void validateOrdinaryInvocation()
+ public void testRawStringMessageRemotingContentTypeFalse() throws Throwable
{
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, false);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ Map metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ assertEquals("abc", client.invoke("abc", metadata));
+ log.info("connection is good");
+
+ // Check remoting content type handling.
+ validateRawStringMessage(client);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testRawStringMessageRemotingContentTypeTrue() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, true);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ Map metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ assertEquals("abc", client.invoke("abc", metadata));
+ log.info("connection is good");
+
+ // Check remoting content type handling.
+ validateRawStringMessage(client);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected void validateOrdinaryInvocation(Client client) throws Throwable
+ {
assertEquals(6, TestMarshaller.marshallers.size());
assertEquals(HTTPMetadataConstants.REMOTING_CONTENT_TYPE_NON_STRING, ((TestMarshaller)TestMarshaller.marshallers.get(3)).type);
assertEquals(HTTPMetadataConstants.REMOTING_CONTENT_TYPE_NON_STRING, ((TestMarshaller)TestMarshaller.marshallers.get(5)).type);
@@ -174,7 +314,7 @@
}
- protected void validateRawStringMessage()
+ protected void validateRawStringMessage(Client client) throws Throwable
{
assertEquals(6, TestMarshaller.marshallers.size());
assertEquals(HTTPMetadataConstants.REMOTING_CONTENT_TYPE_STRING, ((TestMarshaller)TestMarshaller.marshallers.get(3)).type);
@@ -195,7 +335,7 @@
protected void addExtraServerConfig(Map config) {}
- protected void setupServer() throws Exception
+ protected void setupServer(boolean addUseRemotingContentType, boolean useRemotingContentType) throws Exception
{
host = InetAddress.getLocalHost().getHostAddress();
port = PortUtil.findFreePort(host);
@@ -206,6 +346,10 @@
{
locatorURI += "&" + metadata;
}
+ if (addUseRemotingContentType)
+ {
+ locatorURI += "&useRemotingContentType=" + useRemotingContentType;
+ }
serverLocator = new InvokerLocator(locatorURI);
log.info("Starting remoting server with locator uri of: " + locatorURI);
HashMap config = new HashMap();
15 years, 3 months
JBoss Remoting SVN: r5393 - in remoting2/branches/2.2/src/main/org/jboss/remoting: transport/coyote and 1 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-08-26 15:46:43 -0400 (Wed, 26 Aug 2009)
New Revision: 5393
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPMetadataConstants.java
Log:
JBREM-1145: Made use of new content type test optional.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java 2009-08-26 19:44:41 UTC (rev 5392)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java 2009-08-26 19:46:43 UTC (rev 5393)
@@ -26,6 +26,7 @@
import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.remoting.marshal.serializable.SerializableUnMarshaller;
import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+import org.jboss.remoting.transport.web.WebUtil;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -228,11 +229,56 @@
private boolean isBinaryData(Map metadata) throws IOException
{
+ String useRemotingContentType = (String) metadata.get(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE);
+ if (Boolean.valueOf(useRemotingContentType).booleanValue())
+ {
+ return isBinaryDataNew(metadata);
+ }
+ else
+ {
+ return isBinaryDataOld(metadata);
+ }
+ }
+
+ private boolean isBinaryDataOld(Map metadata) throws IOException
+ {
+ if (log.isTraceEnabled()) log.trace(this + " using isBinaryDataOld()");
boolean isBinary = false;
if(metadata != null)
{
// need to get the content type
+ Object value = metadata.get("Content-Type");
+ if(value == null)
+ {
+ value = metadata.get("content-type");
+ }
+ if(value != null)
+ {
+ if(value instanceof List)
+ {
+ List valueList = (List) value;
+ if(valueList != null && valueList.size() > 0)
+ {
+ value = valueList.get(0);
+ }
+ }
+ isBinary = WebUtil.isBinary((String) value);
+ }
+ }
+
+ if (log.isTraceEnabled()) log.trace(this + " isBinary: " + isBinary);
+ return isBinary;
+ }
+
+ private boolean isBinaryDataNew(Map metadata) throws IOException
+ {
+ if (log.isTraceEnabled()) log.trace(this + " using isBinaryDataNew()");
+ boolean isBinary = true;
+
+ if(metadata != null)
+ {
+ // need to get the content type
String remotingContentType = null;
Object o = metadata.get(HTTPMetadataConstants.REMOTING_CONTENT_TYPE);
if (o instanceof List)
@@ -245,11 +291,29 @@
}
else
{
- log.warn(this + " unrecognized remotingContentType: " + o);
+ o = metadata.get(HTTPMetadataConstants.REMOTING_CONTENT_TYPE_LC);
+ if (o instanceof List)
+ {
+ remotingContentType = (String) ((List) o).get(0);
+ }
+ else if (o instanceof String)
+ {
+ remotingContentType = (String) o;
+ }
+ else if (o != null)
+ {
+ log.debug(this + " unrecognized remotingContentType: " + o);
+ }
}
-
- isBinary = HTTPMetadataConstants.REMOTING_CONTENT_TYPE_NON_STRING.equals(remotingContentType);
+
+ if (log.isTraceEnabled()) log.trace(this + " remotingContentType: " + remotingContentType);
+ if (remotingContentType != null)
+ {
+ isBinary = HTTPMetadataConstants.REMOTING_CONTENT_TYPE_NON_STRING.equals(remotingContentType);
+ }
}
+
+ if (log.isTraceEnabled()) log.trace(this + " isBinary: " + isBinary);
return isBinary;
}
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2009-08-26 19:44:41 UTC (rev 5392)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/coyote/CoyoteInvoker.java 2009-08-26 19:46:43 UTC (rev 5393)
@@ -80,6 +80,8 @@
protected ProtocolHandler protocolHandler = null;
protected String URIEncoding = null;
+
+ protected String useRemotingContentType = "false";
/** Indicates if client is HTTPClientInvoker */
protected boolean isRemotingUserAgent;
@@ -178,7 +180,17 @@
{
URIEncoding = String.valueOf(value);
}
-
+
+ value = config.get(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE);
+ if (value != null && value instanceof String)
+ {
+ useRemotingContentType = (String) value;
+ }
+ else
+ {
+ log.warn(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE + " value should be a String: " + value);
+ }
+ log.debug(this + " useRemotingContentType: " + useRemotingContentType);
}
protected ServerSocketFactory getDefaultServerSocketFactory() throws IOException
@@ -481,6 +493,7 @@
{
// must be POST or PUT
UnMarshaller unmarshaller = getUnMarshaller();
+ request.put(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE, useRemotingContentType);
Object obj = null;
if (unmarshaller instanceof VersionedUnMarshaller)
obj = ((VersionedUnMarshaller)unmarshaller).read(request.getInputStream(), request, version);
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2009-08-26 19:44:41 UTC (rev 5392)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2009-08-26 19:46:43 UTC (rev 5393)
@@ -102,7 +102,8 @@
protected static final Logger log = Logger.getLogger(HTTPClientInvoker.class);
protected boolean unmarshalNullStream = true;
-
+ protected boolean useRemotingContentType = false;
+
private Object timeoutThreadPoolLock = new Object();
private ThreadPool timeoutThreadPool;
@@ -272,6 +273,8 @@
{
conn.setRequestProperty(HTTPMetadataConstants.CONTENTTYPE, WebUtil.getContentType(invocation));
}
+
+ metadata.put(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE, Boolean.toString(useRemotingContentType));
// set the remoting version
conn.setRequestProperty(HTTPMetadataConstants.REMOTING_VERSION_HEADER, new Integer(Version.getDefaultVersion()).toString());
@@ -549,6 +552,8 @@
map.put(HTTPUnMarshaller.PRESERVE_LINES, o);
}
+ map.put(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE, Boolean.toString(useRemotingContentType));
+
try
{
if (unmarshaller instanceof VersionedUnMarshaller)
@@ -562,6 +567,7 @@
}
catch (IOException e)
{
+ log.trace(this + " unable to read response", e);
if (-1 == is.read())
{
throw new EOFException();
@@ -936,6 +942,22 @@
val + " to a boolean value.");
}
}
+
+ val = configuration.get(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE);
+ if (val != null)
+ {
+ try
+ {
+ useRemotingContentType = Boolean.valueOf((String)val).booleanValue();
+ log.debug(this + " setting useRemotingContent to " + useRemotingContentType);
+ }
+ catch (Exception e)
+ {
+ log.warn(this + " could not convert " +
+ HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE + " value of " +
+ val + " to a boolean value.");
+ }
+ }
}
/**
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPMetadataConstants.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPMetadataConstants.java 2009-08-26 19:44:41 UTC (rev 5392)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/http/HTTPMetadataConstants.java 2009-08-26 19:46:43 UTC (rev 5393)
@@ -65,8 +65,11 @@
/** Used to distinguish special case of payload of type String. */
public static final String REMOTING_CONTENT_TYPE = "remotingContentType";
+ public static final String REMOTING_CONTENT_TYPE_LC = "remotingcontenttype";
public static final String REMOTING_CONTENT_TYPE_STRING = "remotingContentTypeString";
public static final String REMOTING_CONTENT_TYPE_NON_STRING = "remotingContentTypeNonString";
+
+ public static final String USE_REMOTING_CONTENT_TYPE = "useRemotingContentType";
}
\ No newline at end of file
15 years, 3 months
JBoss Remoting SVN: r5392 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-08-26 15:44:41 -0400 (Wed, 26 Aug 2009)
New Revision: 5392
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
Log:
JBREM-1145: Added new tests to account for making new content type test optional.
Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java 2009-08-26 19:41:52 UTC (rev 5391)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/marshal/HttpContentTypeTestCase.java 2009-08-26 19:44:41 UTC (rev 5392)
@@ -102,28 +102,109 @@
}
- public void testOrdinaryInvocation() throws Throwable
+ public void testOrdinaryInvocationDefault() throws Throwable
{
log.info("entering " + getName());
// Start server.
- setupServer();
+ setupServer(false, 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 client = new Client(serverLocator, clientConfig);
client.connect();
log.info("client is connected");
+ // Do invocation.
+ Object o = client.invoke("abc");
+ assertTrue(o instanceof String);
+ String result = (String) o;
+
+ // Show that an InvocationResponse was incorrectly returned as a String, starting with
+ // the ObjectInputStream header bytes.
+ byte[] bytes = result.getBytes();
+ System.out.print("bytes: ");
+ for (int i = 0; i < bytes.length; i++)
+ System.out.print(bytes[i] + " ");
+ System.out.println("");
+ assertEquals(-84, bytes[0]);
+ assertEquals(-19, bytes[1]);
+ assertEquals(0, bytes[2]);
+ assertEquals(5, bytes[3]);
+
+ // Check remoting content type handling.
+ validateOrdinaryInvocation(client);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testOrdinaryInvocationRemotingContentTypeFalse() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, false);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Do invocation.
+ Object o = client.invoke("abc");
+ assertTrue(o instanceof String);
+ String result = (String) o;
+
+ // Show that an InvocationResponse was incorrectly returned as a String, starting with
+ // the ObjectInputStream header bytes.
+ byte[] bytes = result.getBytes();
+ System.out.print("bytes: ");
+ for (int i = 0; i < bytes.length; i++)
+ System.out.print(bytes[i] + " ");
+ System.out.println("");
+ assertEquals(-84, bytes[0]);
+ assertEquals(-19, bytes[1]);
+ assertEquals(0, bytes[2]);
+ assertEquals(5, bytes[3]);
+
+ // Check remoting content type handling.
+ validateOrdinaryInvocation(client);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testOrdinaryInvocationRemotingContentTypeTrue() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, true);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
// Test connections.
assertEquals("abc", client.invoke("abc"));
log.info("connection is good");
// Check remoting content type handling.
- validateOrdinaryInvocation();
+ validateOrdinaryInvocation(client);
client.disconnect();
shutdownServer();
@@ -131,19 +212,18 @@
}
- public void testRawStringMessage() throws Throwable
+ public void testRawStringMessageDefault() throws Throwable
{
log.info("entering " + getName());
// Start server.
- setupServer();
+ setupServer(false, 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 client = new Client(serverLocator, clientConfig);
client.connect();
log.info("client is connected");
@@ -154,7 +234,7 @@
log.info("connection is good");
// Check remoting content type handling.
- validateRawStringMessage();
+ validateRawStringMessage(client);
client.disconnect();
shutdownServer();
@@ -162,8 +242,68 @@
}
- protected void validateOrdinaryInvocation()
+ public void testRawStringMessageRemotingContentTypeFalse() throws Throwable
{
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, false);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ Map metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ assertEquals("abc", client.invoke("abc", metadata));
+ log.info("connection is good");
+
+ // Check remoting content type handling.
+ validateRawStringMessage(client);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testRawStringMessageRemotingContentTypeTrue() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer(true, true);
+
+ // Create client.
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ Map metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ assertEquals("abc", client.invoke("abc", metadata));
+ log.info("connection is good");
+
+ // Check remoting content type handling.
+ validateRawStringMessage(client);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected void validateOrdinaryInvocation(Client client) throws Throwable
+ {
assertEquals(6, TestMarshaller.marshallers.size());
assertEquals(HTTPMetadataConstants.REMOTING_CONTENT_TYPE_NON_STRING, ((TestMarshaller)TestMarshaller.marshallers.get(3)).type);
assertEquals(HTTPMetadataConstants.REMOTING_CONTENT_TYPE_NON_STRING, ((TestMarshaller)TestMarshaller.marshallers.get(5)).type);
@@ -173,7 +313,7 @@
}
- protected void validateRawStringMessage()
+ protected void validateRawStringMessage(Client client) throws Throwable
{
assertEquals(6, TestMarshaller.marshallers.size());
assertEquals(HTTPMetadataConstants.REMOTING_CONTENT_TYPE_STRING, ((TestMarshaller)TestMarshaller.marshallers.get(3)).type);
@@ -194,7 +334,7 @@
protected void addExtraServerConfig(Map config) {}
- protected void setupServer() throws Exception
+ protected void setupServer(boolean addUseRemotingContentType, boolean useRemotingContentType) throws Exception
{
host = InetAddress.getLocalHost().getHostAddress();
port = PortUtil.findFreePort(host);
@@ -205,6 +345,10 @@
{
locatorURI += "&" + metadata;
}
+ if (addUseRemotingContentType)
+ {
+ locatorURI += "&useRemotingContentType=" + useRemotingContentType;
+ }
serverLocator = new InvokerLocator(locatorURI);
log.info("Starting remoting server with locator uri of: " + locatorURI);
HashMap config = new HashMap();
15 years, 3 months
JBoss Remoting SVN: r5391 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2009-08-26 15:41:52 -0400 (Wed, 26 Aug 2009)
New Revision: 5391
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
Log:
JBREM-1145: Made use of new content type test optional.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java 2009-08-26 19:39:51 UTC (rev 5390)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/servlet/ServletServerInvoker.java 2009-08-26 19:41:52 UTC (rev 5391)
@@ -71,6 +71,8 @@
private static final Logger log = Logger.getLogger(ServletServerInvoker.class);
private boolean unwrapSingletonArrays;
+
+ private boolean useRemotingContentType;
public ServletServerInvoker(InvokerLocator locator)
{
@@ -106,6 +108,17 @@
val + " to a boolean value.");
}
}
+
+ val = configuration.get(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE);
+ if (val != null && val instanceof String)
+ {
+ useRemotingContentType = Boolean.valueOf((String) val).booleanValue();
+ }
+ else
+ {
+ log.warn(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE + " value should be a String: " + val);
+ }
+ log.debug(this + " useRemotingContentType: " + useRemotingContentType);
}
public void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
@@ -317,6 +330,13 @@
if (path != null)
metadata.put(HTTPMetadataConstants.PATH, path);
+ metadata.put(HTTPMetadataConstants.USE_REMOTING_CONTENT_TYPE, Boolean.toString(useRemotingContentType));
+ String remotingContentType = (String) metadata.get(HTTPMetadataConstants.REMOTING_CONTENT_TYPE);
+ if (remotingContentType == null)
+ {
+ remotingContentType = (String) metadata.get(HTTPMetadataConstants.REMOTING_CONTENT_TYPE_LC);
+ }
+
String requestContentType = request.getContentType();
@@ -358,7 +378,8 @@
}
else
{
- if(WebUtil.isBinary(requestContentType))
+ if((useRemotingContentType && HTTPMetadataConstants.REMOTING_CONTENT_TYPE_NON_STRING.equalsIgnoreCase(remotingContentType))
+ || (!useRemotingContentType && WebUtil.isBinary(requestContentType)))
{
invocationRequest = getInvocationRequest(metadata, obj);
}
@@ -394,6 +415,7 @@
if (checkForNoExceptionReturn(metadata))
{
log.trace("Returning error message instead of Exception");
+ response.addHeader(HTTPMetadataConstants.REMOTING_CONTENT_TYPE, HTTPMetadataConstants.REMOTING_CONTENT_TYPE_STRING);
response.sendError(500, "Error occurred processing invocation request. ");
return retval;
}
@@ -472,7 +494,15 @@
retval = outputStream.toByteArray();
response.setContentLength(retval.length);
}
-
+
+ if (responseObject instanceof String)
+ {
+ response.addHeader(HTTPMetadataConstants.REMOTING_CONTENT_TYPE, HTTPMetadataConstants.REMOTING_CONTENT_TYPE_STRING);
+ }
+ else
+ {
+ response.addHeader(HTTPMetadataConstants.REMOTING_CONTENT_TYPE, HTTPMetadataConstants.REMOTING_CONTENT_TYPE_NON_STRING);
+ }
}
catch(ClassNotFoundException e)
{
15 years, 3 months