[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/errors ...
Ron Sigal
ron_sigal at yahoo.com
Sun Oct 29 02:16:10 EST 2006
User: rsigal
Date: 06/10/29 02:16:10
Modified: src/tests/org/jboss/test/remoting/transport/http/errors
ErrorHTTPInvokerTestClient.java
Log:
JBREM-620: Added a unit tests that verifies that if http transport is not sending raw payloads, i.e., doing native Remoting communication, HTTPClientInvoker will throw Exceptions as they are generated on the serer side.
Revision Changes Path
1.5 +53 -2 JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/errors/ErrorHTTPInvokerTestClient.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ErrorHTTPInvokerTestClient.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/transport/http/errors/ErrorHTTPInvokerTestClient.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- ErrorHTTPInvokerTestClient.java 24 Jul 2006 05:17:34 -0000 1.4
+++ ErrorHTTPInvokerTestClient.java 29 Oct 2006 07:16:10 -0000 1.5
@@ -48,7 +48,11 @@
}
- public void testInvocation() throws Exception
+ /**
+ * In this case, the payload will be sent raw, the Exception will be return raw,
+ * and HTTPClientInvoker should return a WebServerError.
+ */
+ public void testRawInvocation() throws Exception
{
Client remotingClient = null;
@@ -93,12 +97,59 @@
}
+
+ /**
+ * In this case, the payload will be wrapped in an InvocationRequest, the Exception
+ * will be wrapped in an InvocationRequest, and the original Exception should be
+ * thrown.
+ */
+ public void testCookedInvocation() throws Exception
+ {
+ Client remotingClient = null;
+
+ try
+ {
+ InvokerLocator locator = new InvokerLocator(getLocatorURI());
+ System.out.println("Calling remoting server with locator uri of: " + getLocatorURI());
+
+ remotingClient = new Client(locator);
+ remotingClient.connect();
+
+ Map metadata = new HashMap();
+ metadata.put("TYPE", "POST");
+
+ try
+ {
+ Object response = remotingClient.invoke(WebInvocationHandler.THROW_EXCEPTION_PARAM, metadata);
+ assertTrue("Did not get exception thrown as expected.", false);
+ }
+ catch(Exception e)
+ {
+ assertTrue("Caught exception as expected",
+ ErrorHTTPInvokerTestServer.EXCEPTION_MSG.equals(e.getMessage()));
+ }
+ }
+ catch(Throwable throwable)
+ {
+ throw new Exception(throwable);
+ }
+ finally
+ {
+ if(remotingClient != null)
+ {
+ remotingClient.disconnect();
+ }
+ }
+
+ }
+
public static void main(String[] args)
{
ErrorHTTPInvokerTestClient client = new ErrorHTTPInvokerTestClient();
try
{
- client.testInvocation();
+ client.testRawInvocation();
+ client.testCookedInvocation();
}
catch(Exception e)
{
More information about the jboss-cvs-commits
mailing list