[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/transport/web ...
Ron Sigal
ron_sigal at yahoo.com
Fri Nov 2 02:54:20 EDT 2007
User: rsigal
Date: 07/11/02 02:54:20
Modified: src/tests/org/jboss/test/remoting/transport/web Tag:
remoting_2_x WebInvokerTestClient.java
Log:
JBREM-838: (1) Fixed race condition from two uses of metadata in oneway invocations; (2) replaced System.out.println() with log.debug().
Revision Changes Path
No revision
No revision
1.13.4.5 +20 -17 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.13.4.4
retrieving revision 1.13.4.5
diff -u -b -r1.13.4.4 -r1.13.4.5
--- WebInvokerTestClient.java 1 Nov 2007 07:40:19 -0000 1.13.4.4
+++ WebInvokerTestClient.java 2 Nov 2007 06:54:19 -0000 1.13.4.5
@@ -65,7 +65,7 @@
try
{
InvokerLocator locator = new InvokerLocator(getLocatorURI());
- System.out.println("Calling remoting server with locator uri of: " + getLocatorURI());
+ log.debug("Calling remoting server with locator uri of: " + getLocatorURI());
remotingClient = new Client(locator);
remotingClient.connect();
@@ -104,11 +104,11 @@
// test with null return expected
response = remotingClient.invoke(WebInvocationHandler.NULL_RETURN_PARAM, metadata);
- System.out.println("First response should be null and was: " + response);
+ log.debug("First response should be null and was: " + response);
assertNull(response);
response = remotingClient.invoke("Do something", metadata);
- System.out.println("Second response should be " + WebInvocationHandler.HTML_PAGE_RESPONSE + " and was: " + response);
+ log.debug("Second response should be " + WebInvocationHandler.HTML_PAGE_RESPONSE + " and was: " + response);
assertEquals(WebInvocationHandler.HTML_PAGE_RESPONSE, response);
if (raw)
@@ -116,11 +116,11 @@
headerProps.put("Content-Type", WebUtil.BINARY);
}
response = remotingClient.invoke(new ComplexObject(2, "foo", true), metadata);
- System.out.println("Third response should be " + WebInvocationHandler.OBJECT_RESPONSE_VALUE + " and was: " + response);
+ log.debug("Third response should be " + WebInvocationHandler.OBJECT_RESPONSE_VALUE + " and was: " + response);
assertEquals(WebInvocationHandler.OBJECT_RESPONSE_VALUE, response);
response = remotingClient.invoke(new ComplexObject(2, "foo", true, 3000), metadata);
- System.out.println("Fourth response should be " + WebInvocationHandler.LARGE_OBJECT_RESPONSE_VALUE + " and was: " + response);
+ log.debug("Fourth response should be " + WebInvocationHandler.LARGE_OBJECT_RESPONSE_VALUE + " and was: " + response);
assertEquals(WebInvocationHandler.LARGE_OBJECT_RESPONSE_VALUE, response);
if (raw)
@@ -128,14 +128,15 @@
headerProps.put("Content-Type", "application/soap+xml");
}
response = remotingClient.invoke(WebInvocationHandler.STRING_RETURN_PARAM, metadata);
- System.out.println("Fifth response should be " + WebInvocationHandler.RESPONSE_VALUE + " and was: " + response);
+ log.debug("Fifth response should be " + WebInvocationHandler.RESPONSE_VALUE + " and was: " + response);
assertEquals(WebInvocationHandler.RESPONSE_VALUE, response);
checkUserAgent(remotingClient, metadata);
- remotingClient.invokeOneway("Do something", metadata, true);
-
- remotingClient.invokeOneway("Do something", metadata, false);
+ HashMap onewayMetadata1 = new HashMap(metadata);
+ HashMap onewayMetadata2 = new HashMap(metadata);
+ remotingClient.invokeOneway("Do something", onewayMetadata1, true);
+ remotingClient.invokeOneway("Do something", onewayMetadata2, false);
makeExceptionInvocation(remotingClient, metadata);
@@ -159,7 +160,7 @@
Object response;
String remotingUserAgentValue = "JBossRemoting - ";
response = remotingClient.invoke(WebInvocationHandler.USER_AGENT_PARAM, metadata);
- System.out.println("Sixth response start with " + remotingUserAgentValue + " and was: " + response);
+ log.debug("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);
}
@@ -172,13 +173,13 @@
try
{
- log.info("making exception invocation");
+ log.debug("making exception invocation");
response = remotingClient.invoke(WebInvocationHandler.THROW_EXCEPTION_PARAM, metadata);
assertTrue("Should have thrown WebServerError and not made it to here.", false);
}
catch (Exception error)
{
- log.info("exception: " + error + " " + error.getMessage());
+ log.debug("exception: " + error + " " + error.getMessage());
// 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.
@@ -193,6 +194,8 @@
{
assertTrue("Did not get WebServerError", error instanceof WebServerError);
assertNotNull(error.getMessage());
+ log.debug("message: " + error.getMessage());
+ log.debug("message type: " + error.getMessage().getClass());
assertTrue(error.getMessage().startsWith("Error received when calling on web server."));
}
else
@@ -205,7 +208,7 @@
response = remotingClient.invoke(WebInvocationHandler.THROW_EXCEPTION_PARAM, metadata);
if (response instanceof Exception)
{
- log.info("Return from invocation is of type Exception as expected.");
+ log.debug("Return from invocation is of type Exception as expected.");
assertTrue("Received exception return as expected.", true);
}
else
@@ -234,7 +237,7 @@
// Verify that content-type is the value set in the ServerInvocationHandler.
String contentType = conn.getContentType();
- log.info("content-type: " + contentType);
+ log.debug("content-type: " + contentType);
assertEquals(WebInvocationHandler.CONTENT_TYPE, contentType);
}
@@ -251,7 +254,7 @@
try
{
InvokerLocator locator = new InvokerLocator(getLocatorURI());
- System.out.println("Calling remoting server with locator uri of: " + getLocatorURI());
+ log.debug("Calling remoting server with locator uri of: " + getLocatorURI());
remotingClient = new Client(locator);
remotingClient.connect();
@@ -267,11 +270,11 @@
// test with null return expected
response = remotingClient.invoke((Object) null, metadata);
- System.out.println("Response should be " + WebInvocationHandler.HTML_PAGE_RESPONSE + " and was: " + response);
+ log.debug("Response should be " + WebInvocationHandler.HTML_PAGE_RESPONSE + " and was: " + response);
assertEquals(WebInvocationHandler.HTML_PAGE_RESPONSE, response);
response = remotingClient.invoke((Object) null, metadata);
- System.out.println("Response should be " + WebInvocationHandler.HTML_PAGE_RESPONSE + " and was: " + response);
+ log.debug("Response should be " + WebInvocationHandler.HTML_PAGE_RESPONSE + " and was: " + response);
assertEquals(WebInvocationHandler.HTML_PAGE_RESPONSE, response);
}
catch (Throwable throwable)
More information about the jboss-cvs-commits
mailing list