notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1007 - in trunk/main/planet/web: . server/etc/prefs/xmls server/src/main/net/dpml/web/server test test/src test/src/test test/src/test/net test/src/test/net/dpml test/src/test/net/dpml/web test/src/test/net/dpml/web/test
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1007 - in trunk/main/planet/web: . server/etc/prefs/xmls server/src/main/net/dpml/web/server test test/src test/src/test test/src/test/net test/src/test/net/dpml test/src/test/net/dpml/web test/src/test/net/dpml/web/test
- Date: Wed, 1 Feb 2006 18:25:21 +0100
Author: mcconnell
Date: 2006-02-01 18:25:20 +0100 (Wed, 01 Feb 2006)
New Revision: 1007
Added:
trunk/main/planet/web/test/src/test/
trunk/main/planet/web/test/src/test/net/
trunk/main/planet/web/test/src/test/net/dpml/
trunk/main/planet/web/test/src/test/net/dpml/web/
trunk/main/planet/web/test/src/test/net/dpml/web/test/
trunk/main/planet/web/test/src/test/net/dpml/web/test/ServerTestCase.java
Modified:
trunk/main/planet/web/module.xml
trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml
trunk/main/planet/web/server/src/main/net/dpml/web/server/Server.java
trunk/main/planet/web/test/build.xml
Log:
add a server testcase
Modified: trunk/main/planet/web/module.xml
===================================================================
--- trunk/main/planet/web/module.xml 2006-02-01 06:44:41 UTC (rev 1006)
+++ trunk/main/planet/web/module.xml 2006-02-01 17:25:20 UTC (rev 1007)
@@ -6,7 +6,7 @@
<type id="module" alias="true"/>
</types>
- <project name="dpml-http-server" basedir="server">
+ <project name="dpml-web-server" basedir="server">
<types>
<type id="jar"/>
<type id="part"/>
@@ -30,10 +30,17 @@
<type id="jar"/>
<type id="war"/>
</types>
+ <properties>
+ <property name="project.test.fork" value="true"/>
+ </properties>
<dependencies>
<include urn="artifact:jar:servletapi/servletapi#2.4" tag="public"/>
<include urn="artifact:jar:jetty/jetty#6.0.0-20060131"/>
</dependencies>
+ <dependencies scope="test">
+ <include ref="dpml/metro/dpml-part-api"/>
+ <include ref="ant/ant-junit"/>
+ </dependencies>
</project>
</module>
Modified: trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml
===================================================================
--- trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml 2006-02-01
06:44:41 UTC (rev 1006)
+++ trunk/main/planet/web/server/etc/prefs/xmls/jetty.xml 2006-02-01
17:25:20 UTC (rev 1007)
@@ -179,7 +179,6 @@
<!-- =========================================================== -->
<!-- Start the server -->
<!-- =========================================================== -->
- <Set name="stopAtShutdown">true</Set>
<Call name="start"/>
</Configure>
Modified:
trunk/main/planet/web/server/src/main/net/dpml/web/server/Server.java
===================================================================
--- trunk/main/planet/web/server/src/main/net/dpml/web/server/Server.java
2006-02-01 06:44:41 UTC (rev 1006)
+++ trunk/main/planet/web/server/src/main/net/dpml/web/server/Server.java
2006-02-01 17:25:20 UTC (rev 1007)
@@ -41,33 +41,6 @@
* @return a uri referencing a Jetty configuration
*/
URI getConfiguration( URI uri );
-
- /**
- * Get the thread pool.
- * @param pool the fallback thread pool (may be null)
- * @return the thread pool
- */
- //ThreadPool getThreadPool( ThreadPool fallback );
-
- /**
- * Get the request log.
- * @param log the fallback request log (may be null)
- * @return the resolved request log
- */
- //RequestLog getRequestLog( RequestLog log );
-
- /**
- * Get the request log.
- * @param handler the fallback not-found handler
- * @return the resolved handler
- */
- //Handler getNotFoundHandler( Handler handler );
-
- /**
- * Get the stop-at-shutdown policy.
- * @return true if the server should be stopped at shutdown
- */
- //boolean getShutdownPolicy( boolean flag );
}
private final Logger m_logger;
@@ -97,32 +70,6 @@
}
getLogger().info( "ready: " + this );
-
- /*
- ThreadPool pool = context.getThreadPool( null );
- if( null != pool )
- {
- setThreadPool( pool );
- }
-
- RequestLog log = context.getRequestLog( null );
- if( null != log )
- {
- setRequestLog( log );
- }
-
- Handler handler = context.getNotFoundHandler( null );
- if( null != handler )
- {
- setNotFoundHandler( handler );
- }
-
- boolean policy = context.getShutdownPolicy( false );
- if( !policy )
- {
- setStopAtShutdown( policy );
- }
- */
}
private Logger getLogger()
Modified: trunk/main/planet/web/test/build.xml
===================================================================
--- trunk/main/planet/web/test/build.xml 2006-02-01 06:44:41 UTC (rev
1006)
+++ trunk/main/planet/web/test/build.xml 2006-02-01 17:25:20 UTC (rev
1007)
@@ -27,6 +27,12 @@
<property name="war.path" value="${war.dir}/${project.filename}"/>
</target>
+ <target name="prepare" depends="standard.prepare">
+ <mkdir dir="target/test"/>
+ <depot:property name="cached.path" feature="path" type="part"
key="dpml-web-server"/>
+ <copy file="${cached.path}" toFile="target/test/demo.part"/>
+ </target>
+
<target name="package" depends="standard.package">
<echo message="${project.filename}"/>
<mkdir dir="${war.dir}"/>
@@ -40,13 +46,6 @@
description="Unpacks the war file to the root directory.">
<mkdir dir="webapps/test"/>
<unzip src="${war.path}" dest="webapps/test"/>
- <!--
- <copy toDir=".">
- <fileset dir="target">
- <include name="webapps/**"/>
- </fileset>
- </copy>
- -->
</target>
</project>
Added:
trunk/main/planet/web/test/src/test/net/dpml/web/test/ServerTestCase.java
===================================================================
--- trunk/main/planet/web/test/src/test/net/dpml/web/test/ServerTestCase.java
2006-02-01 06:44:41 UTC (rev 1006)
+++ trunk/main/planet/web/test/src/test/net/dpml/web/test/ServerTestCase.java
2006-02-01 17:25:20 UTC (rev 1007)
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2004 Stephen J. McConnell.
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * 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.dpml.web.test;
+
+import java.io.File;
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import net.dpml.part.Controller;
+import net.dpml.part.Component;
+import net.dpml.part.ControlException;
+
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.Handler;
+
+/**
+ * Test a simple component case.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: AbstractDescriptorTestCase.java 1556 2005-01-22 12:43:42Z
niclas $
+ */
+public class ServerTestCase extends TestCase
+{
+ private static final String PATH = "demo.part";
+ private static final String TEST_DIR_KEY = "project.test.dir";
+
+ /**
+ * Test the deployment of the Jetty server.
+ * @exception Exception if an error occurs
+ */
+ public void testServerDeployment() throws Exception
+ {
+ File test = new File( System.getProperty( TEST_DIR_KEY ) );
+ URI uri = new File( test, PATH ).toURI();
+ Controller control = Controller.STANDARD;
+ Component component = control.createComponent( uri );
+ try
+ {
+ Server server = (Server) component.getProvider().getValue( false
);
+ Handler[] handlers = server.getHandlers();
+ assertEquals( "handler count", 2, handlers.length );
+ }
+ catch( ControlException e )
+ {
+ Throwable cause = e.getRootCause();
+ if( cause instanceof SecurityException )
+ {
+ final String error =
+ "Skipping test due to security exception."
+ + cause.getMessage();
+ System.out.println( error );
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ finally
+ {
+ component.deactivate();
+ }
+ }
+
+ static
+ {
+ //System.setProperty( "dpml.logging.config",
"local:properties:dpml/transit/debug" );
+ System.setProperty(
+ "java.util.logging.config.class",
+ System.getProperty(
+ "java.util.logging.config.class",
+ "net.dpml.transit.util.ConfigurationHandler" ) );
+ }
+}
- r1007 - in trunk/main/planet/web: . server/etc/prefs/xmls server/src/main/net/dpml/web/server test test/src test/src/test test/src/test/net test/src/test/net/dpml test/src/test/net/dpml/web test/src/test/net/dpml/web/test, mcconnell at BerliOS, 02/01/2006
Archive powered by MHonArc 2.6.24.