[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/transport/web ...
Ron Sigal
ron_sigal at yahoo.com
Thu Nov 1 03:40:19 EDT 2007
User: rsigal
Date: 07/11/01 03:40:19
Modified: src/tests/org/jboss/test/remoting/transport/web Tag:
remoting_2_x WebInvokerTestClient.java
Log:
JBREM-838: Added test for setting content-type on server.
Revision Changes Path
No revision
No revision
1.13.4.4 +30 -4 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.3
retrieving revision 1.13.4.4
diff -u -b -r1.13.4.3 -r1.13.4.4
--- WebInvokerTestClient.java 1 Nov 2007 03:41:22 -0000 1.13.4.3
+++ WebInvokerTestClient.java 1 Nov 2007 07:40:19 -0000 1.13.4.4
@@ -22,6 +22,13 @@
package org.jboss.test.remoting.transport.web;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
import junit.framework.TestCase;
import org.apache.log4j.Logger;
@@ -31,10 +38,6 @@
import org.jboss.remoting.transport.http.WebServerError;
import org.jboss.remoting.transport.web.WebUtil;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
/**
* @author <a href="mailto:tom.elrod at jboss.com">Tom Elrod</a>
*/
@@ -48,6 +51,7 @@
{
testPostInvocationSub(true);
testPostInvocationSub(false);
+ checkContentType();
}
/**
@@ -212,6 +216,28 @@
metadata.remove(HTTPMetadataConstants.NO_THROW_ON_ERROR);
}
+ protected void checkContentType() throws Exception
+ {
+ String urlString = getLocatorURI();
+ int pos = urlString.indexOf("servlet");
+ if (pos == 0)
+ {
+ urlString = "http" + urlString.substring("servlet".length());
+ }
+ URL url = new URL(urlString);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setDoOutput(true);
+ conn.setDoInput(true);
+ byte[] requestBytes = WebInvocationHandler.SET_CONTENT_TYPE.getBytes();
+ OutputStream os = conn.getOutputStream();
+ os.write(requestBytes);
+
+ // Verify that content-type is the value set in the ServerInvocationHandler.
+ String contentType = conn.getContentType();
+ log.info("content-type: " + contentType);
+ assertEquals(WebInvocationHandler.CONTENT_TYPE, contentType);
+ }
+
public void testGetInvocation() throws Exception
{
testGetInvocationSub(true);
More information about the jboss-cvs-commits
mailing list