[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/transport/web ...
Tom Elrod
tom.elrod at jboss.com
Tue Jul 25 15:52:21 EDT 2006
User: telrod
Date: 06/07/25 15:52:21
Modified: src/tests/org/jboss/test/remoting/transport/web
WebInvokerTestClient.java
Log:
JBREM-556 - fixed some problems with remoting versioning.
Revision Changes Path
1.13 +29 -14 JBossRemoting/src/tests/org/jboss/test/remoting/transport/web/WebInvokerTestClient.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WebInvokerTestClient.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/transport/web/WebInvokerTestClient.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- WebInvokerTestClient.java 17 Jul 2006 05:34:39 -0000 1.12
+++ WebInvokerTestClient.java 25 Jul 2006 19:52:21 -0000 1.13
@@ -26,9 +26,9 @@
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.transport.http.HTTPMetadataConstants;
-import org.jboss.remoting.transport.http.WebServerError;
import org.jboss.remoting.transport.web.WebUtil;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -88,11 +88,7 @@
System.out.println("Fifth response should be " + WebInvocationHandler.RESPONSE_VALUE + " and was: " + response);
assertEquals(WebInvocationHandler.RESPONSE_VALUE, response);
- String remotingUserAgentValue = "JBossRemoting - ";
- response = remotingClient.invoke(WebInvocationHandler.USER_AGENT_PARAM, metadata);
- System.out.println("Sixth response start with " + remotingUserAgentValue + " and was: " + response);
- boolean correctUserAgent = ((String)response).startsWith(remotingUserAgentValue);
- assertTrue("User-Agent should be begin with " + remotingUserAgentValue + " but was " + response, correctUserAgent);
+ checkUserAgent(remotingClient, metadata);
makeExceptionInvocation(remotingClient, metadata);
@@ -100,13 +96,13 @@
remotingClient.invokeOneway("Do something", metadata, false);
}
- catch(Throwable throwable)
+ catch (Throwable throwable)
{
throw new Exception(throwable);
}
finally
{
- if(remotingClient != null)
+ if (remotingClient != null)
{
remotingClient.disconnect();
}
@@ -115,6 +111,17 @@
}
+ protected void checkUserAgent(Client remotingClient, Map metadata)
+ throws Throwable
+ {
+ Object response;
+ String remotingUserAgentValue = "JBossRemoting - ";
+ response = remotingClient.invoke(WebInvocationHandler.USER_AGENT_PARAM, metadata);
+ System.out.println("Sixth response start with " + remotingUserAgentValue + " and was: " + response);
+ boolean correctUserAgent = ((String) response).startsWith(remotingUserAgentValue);
+ assertTrue("User-Agent should be begin with " + remotingUserAgentValue + " but was " + response, correctUserAgent);
+ }
+
protected void makeExceptionInvocation(Client remotingClient, Map metadata)
throws Throwable
{
@@ -126,14 +133,22 @@
response = remotingClient.invoke(WebInvocationHandler.THROW_EXCEPTION_PARAM, metadata);
assertTrue("Should have thrown WebServerError and not made it to here.", false);
}
- catch (WebServerError error)
+ catch (IOException error)
+ {
+ // having to check class name instead of just catching type WebServerError so
+ // can use for backwards compatibility tests since WebServerError is new since 2.0.0.CR1.
+ if (error.getClass().getName().endsWith("WebServerError"))
{
assertTrue(true);
}
-
+ else
+ {
+ assertTrue("Did not get WebServerError thrown as expected", false);
+ }
+ }
metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true");
response = remotingClient.invoke(WebInvocationHandler.THROW_EXCEPTION_PARAM, metadata);
- if(response instanceof Exception)
+ if (response instanceof Exception)
{
System.out.println("Return from invocation is of type Exception as expected.");
assertTrue("Received exception return as expected.", true);
@@ -172,13 +187,13 @@
System.out.println("Response should be " + WebInvocationHandler.HTML_PAGE_RESPONSE + " and was: " + response);
assertEquals(WebInvocationHandler.HTML_PAGE_RESPONSE, response);
}
- catch(Throwable throwable)
+ catch (Throwable throwable)
{
throw new Exception(throwable);
}
finally
{
- if(remotingClient != null)
+ if (remotingClient != null)
{
remotingClient.disconnect();
}
More information about the jboss-cvs-commits
mailing list