[mud4j-commit] SF.net SVN: mud4j: [100] trunk/mud4j-web/src
Status: Pre-Alpha
Brought to you by:
mpurland
|
From: <mpu...@us...> - 2007-01-14 00:37:24
|
Revision: 100
http://mud4j.svn.sourceforge.net/mud4j/?rev=100&view=rev
Author: mpurland
Date: 2007-01-13 16:28:26 -0800 (Sat, 13 Jan 2007)
Log Message:
-----------
Add functional jetty test for web.
Added Paths:
-----------
trunk/mud4j-web/src/test/
trunk/mud4j-web/src/test/functional/
trunk/mud4j-web/src/test/functional/net/
trunk/mud4j-web/src/test/functional/net/sf/
trunk/mud4j-web/src/test/functional/net/sf/mud4j/
trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/
trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/JettyWebServerTest.java
Added: trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/JettyWebServerTest.java
===================================================================
--- trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/JettyWebServerTest.java (rev 0)
+++ trunk/mud4j-web/src/test/functional/net/sf/mud4j/web/JettyWebServerTest.java 2007-01-14 00:28:26 UTC (rev 100)
@@ -0,0 +1,106 @@
+/**
+ * Copyright 2006 Matthew Purland (m.p...@gm...)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.mud4j.web;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+import net.sf.mud4j.web.server.JettyWebServer;
+import net.sf.mud4j.web.server.WebServer;
+
+/**
+ * Test web server using Jetty.
+ *
+ * @author Matthew Purland
+ */
+public class JettyWebServerTest extends TestCase {
+
+ public final static int JETTY_PORT = 8081;
+ private WebServer server;
+
+// private Thread serverThread;
+
+
+ public void setUp() {
+ server = new JettyWebServer(JETTY_PORT);
+
+// Runnable serverRunnable = new WebServerThread(server) {
+//
+// @Override
+// public void run() {
+// WebServer server = getServer();
+//
+// try {
+// server.start();
+// }
+// catch (IOException e) {
+// throw new RuntimeException(e);
+// }
+//
+// while (!Thread.interrupted()) {
+// try {
+// Thread.sleep(100);
+// }
+// catch (InterruptedException e) {
+// throw new RuntimeException(e);
+// }
+// }
+// }
+// };
+
+// serverThread = new Thread(serverRunnable, "WebServer thread");
+ }
+
+// public void startServer() {
+// serverThread.start();
+// }
+//
+// public void stopServer() throws IOException {
+// serverThread.interrupt();
+// server.stop();
+// }
+
+
+ public void tearDown() throws IOException {
+// stopServer();
+ server.stop();
+ }
+
+ /**
+ * Test the startup of the Jetty server.
+ * @throws IOException
+ */
+ public void testStartup() throws IOException {
+ server.start();
+
+ // Assert that the server is running
+ assertTrue("Server is not running after it has started.", server.isStarted());
+ }
+
+
+ /**
+ * Test the startup and stopping of the Jetty server.
+ * @throws IOException
+ */
+ public void testStartupAndStop() throws IOException {
+ server.start();
+
+ server.stop();
+
+ // Assert that the server is stopped
+ assertTrue("Server is stopped after telling to stop.", server.isStopped());
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|