dblevins 2005/01/03 17:34:07
Modified: modules/core/src/test/org/openejb/server/httpd
HttpServerTest.java
Log:
Added a daemon that uses ActiveIO at the beginning of the chain and related
test.
Revision Changes Path
1.6 +30 -10
openejb/modules/core/src/test/org/openejb/server/httpd/HttpServerTest.java
Index: HttpServerTest.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/core/src/test/org/openejb/server/httpd/HttpServerTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HttpServerTest.java 22 Dec 2004 05:42:39 -0000 1.5
+++ HttpServerTest.java 3 Jan 2005 22:34:07 -0000 1.6
@@ -59,16 +59,13 @@
import org.apache.geronimo.kernel.jmx.JMXUtil;
import org.apache.geronimo.kernel.management.State;
import org.apache.log4j.BasicConfigurator;
-import org.openejb.server.ServerService;
-import org.openejb.server.ServiceDaemon;
-import org.openejb.server.StandardServiceStack;
-import org.openejb.server.StandardServiceStackGBean;
+import org.openejb.server.*;
public class HttpServerTest extends TestCase {
- static {
- BasicConfigurator.configure();
- }
+// static {
+// BasicConfigurator.configure();
+// }
public void testBareService() throws Exception {
ServerService service = new HttpServer(new TestHttpListener());
@@ -76,7 +73,7 @@
HttpURLConnection connection = null;
try {
- daemon.setSoTimeout(100);
+ daemon.setSoTimeout(1000);
daemon.doStart();
int port = daemon.getPort();
@@ -89,16 +86,39 @@
connection.disconnect();
daemon.doStop();
}
+ }
+
+ public void testBareChannelService() throws Exception {
+ ServerService service = new HttpServer(new TestHttpListener());
+ SynchChannelServerDaemon daemon = new
SynchChannelServerDaemon("HTTP", service, InetAddress.getByName("localhost"),
0);
+ HttpURLConnection connection = null;
+
+ try {
+ daemon.setSoTimeout(1000);
+ daemon.doStart();
+
+ int port = daemon.getPort();
+ URL url = new URL("http://localhost:" + port +
"/this/should/hit/something");
+ connection = (HttpURLConnection) url.openConnection();
+ int responseCode = connection.getResponseCode();
+ assertEquals("HTTP response code should be 204",
HttpURLConnection.HTTP_NO_CONTENT, responseCode);
+ } finally {
+ if (connection != null ) {
+ connection.disconnect();
+ }
+ daemon.doStop();
+ }
}
+
public void testServiceStack() throws Exception {
ServerService service = new HttpServer(new TestHttpListener());
StandardServiceStack serviceStack = new StandardServiceStack("HTTP",
0, InetAddress.getByName("localhost"), null, 1, 5, null, null, service);
HttpURLConnection connection = null;
try {
- serviceStack.setSoTimeout(100);
+ serviceStack.setSoTimeout(1000);
serviceStack.doStart();
int port = serviceStack.getPort();