You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by pt...@apache.org on 2008/02/02 16:16:06 UTC

svn commit: r617813 - in /jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples: build.properties ejb/build.xml ivy.xml jetty/build.xml jetty/pom.xml servlet/build.xml

Author: ptahchiev
Date: Sat Feb  2 07:16:05 2008
New Revision: 617813

URL: http://svn.apache.org/viewvc?rev=617813&view=rev
Log:
Jetty samples added

Modified:
    jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/build.properties
    jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/ejb/build.xml
    jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/ivy.xml
    jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/jetty/build.xml
    jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/jetty/pom.xml
    jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/servlet/build.xml

Modified: jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/build.properties
URL: http://svn.apache.org/viewvc/jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/build.properties?rev=617813&r1=617812&r2=617813&view=diff
==============================================================================
--- jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/build.properties (original)
+++ jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/build.properties Sat Feb  2 07:16:05 2008
@@ -9,6 +9,8 @@
 meta.inf.dir=${basedir}/src/main/resources
 src.webapp.dir=${basedir}/src/main/webapp
 
+src.conf.dir=${basedir}/src/main/resources/conf/
+
 #Project Specific Settings
 #cactus.samples.servlet-1.8.0-SNAPSHOT.war
 

Modified: jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/ejb/build.xml
URL: http://svn.apache.org/viewvc/jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/ejb/build.xml?rev=617813&r1=617812&r2=617813&view=diff
==============================================================================
--- jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/ejb/build.xml (original)
+++ jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/ejb/build.xml Sat Feb  2 07:16:05 2008
@@ -1,4 +1,27 @@
-<project name="CactusMaven2Plugin"  xmlns:ivy="antlib:org.apache.ivy.ant" default="test"> 
+
+<!--
+  =============================================================================
+    Build file for the Cactus EJB Sample subproject.
+
+    The following Ant tasks need to be available in your ant installation (i.e.
+    the Ant task themselves and their dependent jars need to be put in
+    ANT_HOME/lib) :
+
+        junit                  [REQUIRED] JUnit Ant task
+
+    The mandatory and optional Ant properties are defined in
+    build.properties.sample. Please read and edit that file.
+
+    This script should be started with the following command line :
+
+        ant <target>
+
+    Run "ant -projecthelp" to get a list of available targets. The default
+    target is "dist"
+  =============================================================================
+-->
+
+<project name="Cactus EJB Sample"  xmlns:ivy="antlib:org.apache.ivy.ant" default="test"> 
 
 	<description>
      Cactus Sample

Modified: jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/ivy.xml
URL: http://svn.apache.org/viewvc/jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/ivy.xml?rev=617813&r1=617812&r2=617813&view=diff
==============================================================================
--- jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/ivy.xml (original)
+++ jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/ivy.xml Sat Feb  2 07:16:05 2008
@@ -2,9 +2,6 @@
 	<info organisation="apache" module="hello-ivy"/>
 
 	<dependencies>
-		<!--dependency org="commons-lang" name="commons-lang" rev="2.0"/>
-		<dependency org="commons-cli" name="commons-cli" rev="1.0"/-->
-		
 		<dependency org="org.apache.cactus" name="cactus.core.framework.uberjar.javaEE.14" rev="1.8.0-SNAPSHOT"/>
 		<dependency org="org.apache.cactus" name="cactus.integration.ant" rev="1.8.0-SNAPSHOT"/>
 		<dependency org="org.apache.cactus" name="cactus.integration.shared.api" rev="1.8.0-SNAPSHOT"/>
@@ -25,5 +22,10 @@
 		<dependency org="javax.servlet" name="jstl" rev="1.1.2"/>
 		<dependency org="geronimo-spec" name="geronimo-spec-ejb" rev="2.1-rc4"/>
 		<dependency org="taglibs" name="standard" rev="1.1.2"/>
+		
+		<dependency org="org.mortbay.jetty" name="jetty" rev="4.2.12"/>
+		<dependency org="tomcat" name="jasper-compiler" rev="4.1.30"/>
+		<dependency org="tomcat" name="jasper-runtime" rev="4.1.30"/>		
+		
 	</dependencies>
 </ivy-module> 

Modified: jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/jetty/build.xml
URL: http://svn.apache.org/viewvc/jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/jetty/build.xml?rev=617813&r1=617812&r2=617813&view=diff
==============================================================================
--- jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/jetty/build.xml (original)
+++ jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/jetty/build.xml Sat Feb  2 07:16:05 2008
@@ -23,192 +23,125 @@
     target is "dist"
   =============================================================================
 -->
-<project name="Cactus Jetty Sample" default="test" basedir=".">
+<project name="Cactus Jetty Sample" xmlns:ivy="antlib:org.apache.ivy.ant" default="test">
 
-  <!-- Give user a chance to override without editing this file
-       (and without typing -D each time it compiles it) -->
-  <property file="build.properties" />
-  <property file="${user.home}/build.properties" />
-
-  <!-- Global project properties -->
-  <property name="project.name.text" value="Cactus Jetty Sample"/>
-  <property name="project.name.file" value="sample-jetty"/>
-  <property name="project.version" value="@version@"/>
-
-  <!-- Prefix to add to all distributable files -->
-  <property name="project.prefix" value="jakarta-"/>
-
-  <!-- Generic properties -->
-  <property name="year" value="@year@"/>
-  <property name="debug" value="on"/>
-  <property name="optimize" value="off"/>
-  <property name="deprecation" value="off"/>
-
-  <!-- Properties for the Cactus tests -->
-  <property name="cactus.port" value="8080"/>
-  <property name="tools.jar" location="${java.home}/../lib/tools.jar"/>
+  <description>
+     Cactus Jetty Sample
+     ---------------------------------------------------------
+     Sample web-application that demonstrates how Cactus can
+     be used using the Jetty integration for unit testing 
+     classes that use the servlet API (such as servlets, 
+     filters and tag libraries).
+  </description>
 
-  <!--
+ <!--
      ========================================================================
-       Set the properties related to the source tree.
+       Initialize properties.
      ========================================================================
-  -->
-  <property name="src.dir" location="src"/>
-  <property name="src.java.dir" location="${src.dir}/java"/>
-  <property name="src.conf.dir" location="${src.dir}/conf"/>
-  <property name="src.cactus.dir" location="${src.dir}/test-cactus"/>
-  <property name="src.webapp.dir" location="${src.dir}/webapp"/>
-
-  <!--
+  -->	
+  <target name="init" depends="">
+  
+	  <property name="cactus.sample.app.type" value="servlet"/>
+		<property name="cactus.sample.archive.type" value="war"/>
+    
+    <property file="../build.properties"/>
+	 
+	
+		<path id="cactus.classpath">
+			<fileset dir="${ivy.lib.dir}">
+        <include name="*.jar"/>
+      </fileset>
+      <dirset dir="../servlet/target/">
+        <include name="classes"/>
+      </dirset>
+		</path>
+		
+  </target>
+  
+<!--
      ========================================================================
-       Set the properties related to the target area
+       Prepare the folder structure.
      ========================================================================
   -->
-  <!-- Destination locations for the build -->
-  <property name="target.dir" location="target"/>
-  <property name="target.classes.dir" location="${target.dir}/classes"/>
-  <property name="target.classes.java.dir"
-      location="${target.classes.dir}/java"/>
-  <property name="target.classes.cactus.dir"
-      location="${target.classes.dir}/cactus"/>
-  <property name="target.testreports.dir"
-      location="${target.dir}/test-reports"/>
-
-  <!-- Distribution directory, i.e. where the expanded distibutable files
-       are located -->
-  <property name="dist.dir" location="dist"/>
+	<target name="prepare" depends="init">
+		<mkdir dir="${build.dir}"/>
+		<mkdir dir="${logs.dir}"/>
+		<mkdir dir="${reports.dir}"/>
+	</target>
 
-  <!--
+<!--
      ========================================================================
-       Set the properties related to the required libraries
+       Resolve Ivy dependencies.
      ========================================================================
   -->
+	<target name="resolve" description="Retrieve dependencies with ivy" depends="prepare">
+		<ivy:configure file="../ivysettings.xml" />
+		<ivy:retrieve file="../ivy.xml" sync="true"/>
+  </target>
 
-  <!-- Libraries required for the sample project -->
-  <property name="servlet.jar"
-      location="../../lib/@servlet.jar.name@"/>
-  <path id="project.classpath">
-    <pathelement location="${servlet.jar}"/>
-  </path>
-
-  <!-- Libraries required for the Cactus tests -->
-  <property name="aspectjrt.jar"
-      location="../../lib/@aspectjrt.jar.name@"/>
-  <property name="cactus.jar"
-      location="../../lib/@cactus.jar.name@"/>
-  <property name="cargo.jar"
-      location="../../lib/@cargo.jar.name@"/>
-  <property name="cargo.ant.jar"
-      location="../../lib/@cargo.ant.jar.name@"/>
-  <property name="commons.httpclient.jar"
-      location="../../lib/@commons.httpclient.jar.name@"/>
-  <property name="commons.logging.jar"
-      location="../../lib/@commons.logging.jar.name@"/>
-  <property name="jasper-compiler.jar"
-      location="../../lib/@jasper-compiler.jar.name@"/>
-  <property name="jasper-runtime.jar"
-      location="../../lib/@jasper-runtime.jar.name@"/>
-  <property name="jetty.jar"
-      location="../../lib/@jetty.jar.name@"/>
-  <property name="junit.jar"
-      location="../../lib/@junit.jar.name@"/>
-  <property name="htmlunit.jar"
-      location="../../lib/@htmlunit.jar.name@"/>
-
-  <path id="cactus.classpath">
-    <path refid="project.classpath"/>
-    <pathelement location="${aspectjrt.jar}"/>
-    <pathelement location="${cactus.jar}"/>
-    <pathelement location="${cargo.jar}"/>
-    <pathelement location="${cargo.ant.jar}"/>
-    <pathelement location="${commons.httpclient.jar}"/>
-    <pathelement location="${commons.logging.jar}"/>
-    <pathelement location="${jasper-compiler.jar}"/>
-    <pathelement location="${jasper-runtime.jar}"/>
-    <pathelement location="${jetty.jar}"/>
-    <pathelement location="${junit.jar}"/>
-    <pathelement location="${htmlunit.jar}"/>
-    <@clover.begin@pathelement location="${clover.jar}"/@clover.end@>
-  </path>
-
-  <!--
+<!--
      ========================================================================
-       Initialize the build. Must be called by all targets
+       Load external ant tasks.
      ========================================================================
   -->
-  <target name="init">
-
-    <condition property="properties.ok">
-      <and>
-        <available file="${servlet.jar}"/>
-      </and>
-    </condition>
-    <fail unless="properties.ok">Missing property or property pointing to an invalid file
-(check your build.properties file)</fail>
+	<target name="load.tasks" depends="resolve">
+		<taskdef resource="cactus.tasks"
+			 classpathref="cactus.classpath">
+		</taskdef>
+	</target>
 
-    <tstamp/>
 
-  </target>
 
-  <!--
+<!--
      ========================================================================
-       Compiles the sources
+       Compile source classes as well as cactus classes.
      ========================================================================
   -->
-  <!-- Compiles the java sources -->
-  <target name="compile.java" depends="init">
-
-    <mkdir dir="${target.classes.java.dir}"/>
-    <javac destdir="${target.classes.java.dir}"
-        deprecation="${deprecation}" optimize="${optimize}">
-      <src path="${src.java.dir}"/>
-      <classpath>
-        <path refid="project.classpath"/>
-      </classpath>
-    </javac>
-
-  </target>
-
-  <!-- Compiles the Cactus test sources -->
-  <target name="compile.cactus" depends="compile.java">
-
-    <mkdir dir="${target.classes.cactus.dir}"/>
-    <javac destdir="${target.classes.cactus.dir}"
-        deprecation="${deprecation}" optimize="${optimize}">
-      <src path="${src.cactus.dir}"/>
-      <classpath>
-        <path refid="cactus.classpath"/>
-        <pathelement location="${httpunit.jar}"/>
-        <pathelement location="${target.classes.java.dir}"/>
-      </classpath>
-    </javac>
-
-  </target>
-
-  <target name="compile" depends="compile.java, compile.cactus"
-      description="Compile the sources"/>
+	<!--Note that if some dependency is missing in the classpath, instead of compilation errors,
+      Ivy reports to Maven 'No Compiler Found' error. -->
+	<target name="compile" depends="load.tasks">
+		
+		<javac srcdir="${src.dir}"
+		       destdir="${build.dir}"
+		       classpathref="cactus.classpath"/>
+		
+		<javac srcdir="${cactus.src.dir}"
+		       destdir="${build.dir}"
+			     classpathref="cactus.classpath"/>
+	</target>
 
   <!--
      ========================================================================
-       Create the runtime war file
+       Create the runtime war file.
      ========================================================================
   -->
-  <target name="war" depends="compile.java"
-      description="Generate the runtime war">
+	<target name="package-war" depends="compile">
+		<war destfile="${servlet.archive.name}" webxml="${basedir}/src/main/webapp/WEB-INF/web.xml">
+		  <fileset dir="${basedir}/src/main/webapp/WEB-INF">
+        <exclude name="cactus-report.xsl"/>
+        <exclude name="cactus-web.xml"/>
+        <exclude name="web.xml"/>
+      </fileset>
+      <fileset dir="${basedir}/src/main/webapp">
+        <include name="test/test.jsp"/>
+        <include name="org/apache/jsp/jspRedirector.jsp"/>
+      </fileset>
+			<classes dir="${build.dir}"/>
+			<lib dir="${ivy.lib.dir}">
+				<include name="**.jar"/>
+				<exclude name="jsp-api-2.0.jar"/>
+        <exclude name="servlet-api-2.5.jar"/>
+			</lib>	
+		</war>
+	</target>
 
-    <war warfile="${target.dir}/${project.name.file}.war"
-         webxml="${src.webapp.dir}/WEB-INF/web.xml">
-      <classes dir="${target.classes.java.dir}"/>
-    </war>
-
-  </target>
 
   <!--
      ========================================================================
        Generate the distributable files
      ========================================================================
   -->
-  <target name="dist" depends="clean, war, test"
+  <target name="dist" depends="clean, package-war, test"
       description="Generate the distributable files">
 
     <copy todir="${dist.dir}"
@@ -228,35 +161,31 @@
 
   </target>
 
-  <!--
+<!--
      ========================================================================
        Run the tests on Jetty.
      ========================================================================
   -->
   <target name="test" depends="compile">
 
-    <mkdir dir="${target.testreports.dir}"/>
-
     <junit fork="yes" failureproperty="tests.failed">
       <sysproperty key="cactus.contextURL"
-          value="http://localhost:${cactus.port}/test"/>
+          value="http://localhost:${cargo.servlet.port}/test"/>
       <sysproperty key="cactus.jetty.resourceDir" file="${src.webapp.dir}"/>
       <sysproperty key="cactus.jetty.config" file="${src.conf.dir}/jetty.xml"/>
       <classpath>
         <path refid="cactus.classpath"/>
-        <pathelement location="${target.classes.java.dir}"/>
-        <pathelement location="${target.classes.cactus.dir}"/>
-        <pathelement location="${tools.jar}"/>
+        <pathelement location="${build.dir}"/>
       </classpath>
       <formatter type="brief" usefile="false"/>
       <formatter type="xml"/>
-      <test todir="${target.testreports.dir}"
+      <test todir="${reports.dir}"
           name="org.apache.cactus.sample.jetty.TestJettyAll"/>
     </junit>
 
-    <junitreport todir="${target.testreports.dir}">
-      <fileset dir="${target.testreports.dir}" includes="TEST-*.xml"/>
-      <report todir="${target.testreports.dir}" format="frames"/>
+    <junitreport todir="${reports.dir}">
+      <fileset dir="${reports.dir}" includes="TEST-*.xml"/>
+      <report todir="${reports.dir}" format="frames"/>
     </junitreport>
 
     <fail if="tests.failed">At least one test failed!</fail>

Modified: jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/jetty/pom.xml
URL: http://svn.apache.org/viewvc/jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/jetty/pom.xml?rev=617813&r1=617812&r2=617813&view=diff
==============================================================================
--- jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/jetty/pom.xml (original)
+++ jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/jetty/pom.xml Sat Feb  2 07:16:05 2008
@@ -69,6 +69,21 @@
 			<artifactId>ivy</artifactId>
 			<version>2.0.0-beta1</version>
 		</dependency>
+		<dependency>
+		  <groupId>org.mortbay.jetty</groupId>
+			<artifactId>jetty</artifactId>
+			<version>4.2.12</version>
+		</dependency>
+		<dependency>
+		  <groupId>tomcat</groupId>
+			<artifactId>jasper-compiler</artifactId>
+			<version>4.1.30</version>
+		</dependency>
+		<dependency>
+		  <groupId>tomcat</groupId>
+			<artifactId>jasper-runtime</artifactId>
+			<version>4.1.30</version>
+		</dependency>
 	</dependencies>
 	<build>
 		<plugins>

Modified: jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/servlet/build.xml
URL: http://svn.apache.org/viewvc/jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/servlet/build.xml?rev=617813&r1=617812&r2=617813&view=diff
==============================================================================
--- jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/servlet/build.xml (original)
+++ jakarta/cactus/branches/CACTUS_TRUNK_MAMOUTH/samples/servlet/build.xml Sat Feb  2 07:16:05 2008
@@ -1,4 +1,27 @@
-<project name="CactusMaven2Plugin"  xmlns:ivy="antlib:org.apache.ivy.ant" default="test"> 
+<?xml version="1.0"?>
+
+<!--
+  =============================================================================
+    Build file for the Cactus Servlet Sample subproject.
+
+    The following Ant tasks need to be available in your ant installation (i.e.
+    the Ant task themselves and their dependent jars need to be put in
+    ANT_HOME/lib) :
+
+        junit                  [REQUIRED] JUnit Ant task
+
+    The mandatory and optional Ant properties are defined in
+    build.properties.sample. Please read and edit that file.
+
+    This script should be started with the following command line :
+
+        ant <target>
+
+    Run "ant -projecthelp" to get a list of available targets. The default
+    target is "dist"
+  =============================================================================
+-->
+<project name="Cactus Servlet Sample"  xmlns:ivy="antlib:org.apache.ivy.ant" default="test"> 
 
 	<description>
      Cactus Sample



---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org