Author: craigmcc Date: Sat Oct 9 16:50:41 2004 New Revision: 54191 Added: struts/trunk/struts-faces/core-library/LICENSE.txt - copied unchanged from rev 54187, struts/trunk/struts-faces/LICENSE.txt struts/trunk/struts-faces/core-library/NOTICE.txt - copied unchanged from rev 54187, struts/trunk/struts-faces/NOTICE.txt struts/trunk/struts-faces/core-library/build.xml - copied, changed from rev 54187, struts/trunk/struts-faces/build.xml struts/trunk/struts-faces/core-library/src/conf/ - copied from rev 54187, struts/trunk/struts-faces/src/conf/ struts/trunk/struts-faces/core-library/src/java/ - copied from rev 54187, struts/trunk/struts-faces/src/java/ struts/trunk/struts-faces/core-library/src/test/ struts/trunk/struts-faces/core-library/src/test/org/ struts/trunk/struts-faces/core-library/src/test/org/apache/ struts/trunk/struts-faces/core-library/src/test/org/apache/struts/ struts/trunk/struts-faces/core-library/src/test/org/apache/struts/faces/ struts/trunk/struts-faces/core-library/src/test/org/apache/struts/faces/util/ struts/trunk/struts-faces/core-library/src/test/org/apache/struts/faces/util/Bundle.properties struts/trunk/struts-faces/core-library/src/test/org/apache/struts/faces/util/MessagesMapTestCase.java Log: Add a simple unit test for MessagesMap, primarily to verify the correct setup of the build.xml file for the Struts-Faces Integration Library itself.
Copied: struts/trunk/struts-faces/core-library/build.xml (from rev 54187, struts/trunk/struts-faces/build.xml) ============================================================================== --- struts/trunk/struts-faces/build.xml (original) +++ struts/trunk/struts-faces/core-library/build.xml Sat Oct 9 16:50:41 2004 @@ -14,26 +14,28 @@ See the License for the specific language governing permissions and limitations under the License. + $Id$ + --> -<project name="jakarta-struts-faces" default="compile" basedir="."> +<project name="Struts-Faces Core Library" default="library" basedir="."> - <!-- ===================== Initialize Property Values =================== --> + <!-- ===================== Initialize Property Values ==================== --> <!-- Initialize property values --> <property file="build.properties"/> + <property file="../build.properties"/> <property file="../../build.properties"/> - <property file="../../../build.properties"/> <property file="${user.home}/build.properties"/> <!-- Dependency home directory defaults --> - <property name="htmlunit.home" value="/usr/local/htmlunit-1.2.3"/> <property name="jsf.home" value="/usr/local/jsf-1_1"/> <property name="jstl.home" value="/usr/local/standard-1.0.3"/> + <property name="junit.home" value="/usr/local/junit-3.8.1"/> <property name="server.home" value="/usr/local/jakarta-tomcat-5.0.25"/> <property name="struts.home" value="/usr/local/jakarta-struts-1.1"/> @@ -56,6 +58,7 @@ <property name="jsf-impl.jar" value="${jsf.home}/lib/jsf-impl.jar"/> <property name="jsp-api.jar" value="${server.home}/common/lib/jsp-api.jar"/> <property name="jstl.jar" value="${jstl.home}/lib/jstl.jar"/> + <property name="junit.jar" value="${junit.home}/junit.jar"/> <property name="servlet.jar" value="${server.home}/common/lib/servlet.jar"/> <property name="standard.jar" value="${jstl.home}/lib/standard.jar"/> <property name="struts.jar" value="${struts.home}/lib/struts.jar"/> @@ -70,7 +73,7 @@ classpath="${jsf-impl.jar}"/> <!-- Build Defaults --> - <property name="build.home" value="${basedir}/build"/> + <property name="build.home" value="${basedir}/target"/> <property name="dist.home" value="${basedir}/dist"/> <property name="project.name" value="Struts-Faces Integration Library"/> <property name="project.package" value="org.apache.struts.faces"/> @@ -83,8 +86,14 @@ <property name="compile.optimize" value="true"/> - <!-- Construct Classpath --> - <path id="classpath"> + <!-- Unit Test Defaults --> + <property name="test.haltonerror" value="true"/> + <property name="test.haltonfailure" value="true"/> + <property name="test.runner" value="junit.textui.TestRunner"/> + + + <!-- Compile Classpath --> + <path id="compile.classpath"> <pathelement location="${commons-beanutils.jar}"/> <pathelement location="${commons-collections.jar}"/> <pathelement location="${commons-digester.jar}"/> @@ -98,93 +107,79 @@ <pathelement location="${build.home}/classes"/> </path> - <!-- System Integration Test Client Classpath --> - <path id="sysclient.classpath"> + + <!-- Test Classpath --> + <path id="test.classpath"> + <pathelement location="${commons-beanutils.jar}"/> + <pathelement location="${commons-collections.jar}"/> + <pathelement location="${commons-digester.jar}"/> + <pathelement location="${commons-logging.jar}"/> + <pathelement location="${commons-validator.jar}"/> + <pathelement location="${jsf-api.jar}"/> + <pathelement location="${jsp-api.jar}"/> + <pathelement location="${jstl.jar}"/> <pathelement location="${junit.jar}"/> - <fileset dir="${htmlunit.home}/lib" - includes="*.jar"/> - <pathelement location="${build.home}/sysclient"/> + <pathelement location="${servlet.jar}"/> + <pathelement location="${struts.jar}"/> + <pathelement location="${build.home}/classes"/> + <pathelement location="${build.home}/test-classes"/> </path> - <!-- Custom Tomcat Integration --> - <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/> - <taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/> - <taskdef name="list" classname="org.apache.catalina.ant.ListTask"/> - <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/> - <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask"/> - <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/> - <property name="password" value="tomcat"/> - <property name="url" value="http://localhost:8080/manager"/> - <property name="username" value="tomcat"/> - - <property name="example.path" value="/struts-faces"/> - <property name="example2.path" value="/struts-faces2"/> - <property name="systest.path" value="/struts-faces-systest"/> + <!-- ==================== Maintenance Targets ============================ --> - <!-- System Integration Test Settings --> - <property name="systest.state.saving" value="server"/> - <property name="systest.url" value="http://localhost:8080${systest.path}"/> - - - - <!-- ===================== LIBRARY: Maintenance ========================= --> - - - <target name="clean" - description="Clean all build directories"> - <delete dir="${build.home}"/> - <delete dir="${dist.home}"/> - </target> - - - <target name="init"> - <echo message="---------- ${project.name} ${project.version} ----------"/> - <filter token="name" value="${project.name}"/> - <filter token="package" value="${project.package}"/> - <filter token="state" value="${systest.state.saving}"/> - <filter token="version" value="${project.version}"/> - <echo message="jsf-api.jar = ${jsf-api.jar}"/> - <echo message="jsf-impl.jar = ${jsf-impl.jar}"/> - <echo message="struts-jar = ${struts.jar}"/> - <echo message="jsfri.present = ${jsfri.present}"/> - <echo message="myfaces.present= ${myfaces.present}"/> + <target name="clean" + description="Clean all build directories"> + <delete dir="${build.home}"/> + <delete dir="${dist.home}"/> </target> - <target name="list" description="List installed webapps on Tomcat"> - <list url="${url}" username="${username}" password="${password}"/> + <target name="init"> + <echo message="---------- ${project.name} ${project.version} -----------"/> + <filter token="name" value="${project.name}"/> + <filter token="package" value="${project.package}"/> + <filter token="state" value="${systest.state.saving}"/> + <filter token="version" value="${project.version}"/> + <echo message="jsf-api.jar = ${jsf-api.jar}"/> + <echo message="jsf-impl.jar = ${jsf-impl.jar}"/> + <echo message="struts-jar = ${struts.jar}"/> + <echo message="jsfri.present = ${jsfri.present}"/> + <echo message="myfaces.present= ${myfaces.present}"/> </target> - <target name="prepare" depends="init"> - <mkdir dir="${build.home}"/> - <mkdir dir="${build.home}/classes"/> - <mkdir dir="${build.home}/classes/META-INF"/> - <mkdir dir="${build.home}/conf"/> - <mkdir dir="${build.home}/lib"/> - <mkdir dir="${dist.home}"/> - <mkdir dir="${dist.home}/docs"/> - <mkdir dir="${dist.home}/docs/api"/> + <target name="prepare" depends="init"> + <mkdir dir="${build.home}"/> + <mkdir dir="${build.home}/classes"/> + <mkdir dir="${build.home}/classes/META-INF"/> + <mkdir dir="${build.home}/conf"/> + <mkdir dir="${build.home}/lib"/> + <mkdir dir="${dist.home}"/> + <mkdir dir="${dist.home}/docs"/> + <mkdir dir="${dist.home}/docs/api"/> </target> - <target name="static" depends="prepare"> + <target name="static" depends="prepare"> <tstamp/> - <copy todir="${build.home}/conf" filtering="on"> - <fileset dir="src/conf" includes="*.MF"/> + <copy todir="${build.home}/conf" + filtering="on"> + <fileset dir="src/conf" + includes="*.MF"/> </copy> - <copy todir="${build.home}/classes/META-INF"> - <fileset dir="src/conf" includes="*faces-config.xml"/> + <copy todir="${build.home}/classes/META-INF"> + <fileset dir="src/conf" + includes="*faces-config.xml"/> </copy> </target> - <!-- ============== LIBRARY: Compile Library Components ================= --> + <!-- =================== Compile Library Components ====================== --> - <target name="compile" depends="static" - description="Compile integration library"> + <target name="compile" depends="static" + description="Compile core integration library"> <!-- Compile Java Sources --> <javac srcdir="src/java" @@ -192,7 +187,7 @@ debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}"> - <classpath refid="classpath" /> + <classpath refid="compile.classpath" /> </javac> <!-- Copy non-Java Sources --> @@ -220,8 +215,8 @@ </target> - <target name="library" depends="compile" - description="Package integration library"> + <target name="library" depends="compile" + description="Package integration library"> <jar jarfile="${build.home}/lib/struts-faces.jar" basedir="${build.home}/classes" @@ -230,11 +225,11 @@ </target> - <!-- ==================== LIBRARY: Documentation ======================= --> + <!-- ===================== Generate Documentation ======================== --> - <target name="docs" depends="prepare" - description="Create generated documentation and JavaDocs"> + <target name="docs" depends="prepare" + description="Create generated documentation and JavaDocs"> <style basedir="src/conf" destdir="${dist.home}/docs" @@ -252,497 +247,62 @@ windowtitle="${project.name} (Version ${project.version})" doctitle="${project.name} (Version ${project.version})" bottom="Copyright © 2003-2004 - The Apache Software Foundation"> - <classpath refid="classpath"/> + <classpath refid="compile.classpath"/> </javadoc> </target> - <!-- ===================== EXAMPLE: Create Webapp ======================= --> - - - <target name="example.prepare" depends="library"> - - <echo message="------------ ${project.name} Example Webapp -------------"/> - <mkdir dir="${build.home}/webapps"/> - <mkdir dir="${build.home}/webapps/example"/> - - </target> - - - <target name="example.static" depends="example.prepare"> - - <!-- Copy static web resources --> - <copy todir="${build.home}/webapps/example"> - <fileset dir="web/example"/> - </copy> - - <!-- Copy required configuration files --> - <copy todir="${build.home}/webapps/example/WEB-INF"> - <fileset dir="${build.home}/conf"> - <include name="*.tld"/> - </fileset> - </copy> - <copy todir="${build.home}/webapps/example/WEB-INF"> - <fileset dir="${struts.home}/lib"> - <include name="*.tld"/> - <include name="valid*.xml"/> - </fileset> - </copy> - - <!-- Copy required library JAR files --> - <mkdir dir="${build.home}/webapps/example/WEB-INF/lib"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${build.home}/lib/struts-faces.jar"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${commons-beanutils.jar}"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${commons-collections.jar}"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${commons-digester.jar}"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${commons-fileupload.jar}"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${commons-logging.jar}"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${commons-validator.jar}"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${jakarta-oro.jar}"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${struts.jar}"/> - - </target> - - - <target name="example.static.jsfri" depends="example.static" - if="jsfri.present"> - - <replace dir="${build.home}/webapps/example/WEB-INF" - token="MYFACES_BEGIN" - value="<!-- MyFaces Listener"/> - <replace dir="${build.home}/webapps/example/WEB-INF" - token="MYFACES_END" - value="-->"/> - - </target> - - - <target name="example.static.myfaces" depends="example.static.jsfri" - if="myfaces.present"> - - <replace dir="${build.home}/webapps/example/WEB-INF" - token="MYFACES_BEGIN" - value="<!-- MyFaces Listener -->"/> - <replace dir="${build.home}/webapps/example/WEB-INF" - token="MYFACES_END" - value=""/> - - </target> - - - <target name="example.libraries" depends="example.static.myfaces" - if="build.standalone"> - - <!-- Copy libraries required for standalone use only --> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${jsf-api.jar}"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${jsf-impl.jar}"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${jstl.jar}"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${standard.jar}"/> - - </target> - - - <target name="example.libraries.myfaces" depends="example.libraries" - if="myfaces.present"> - - <!-- Copy additional libraries required by MyFaces implementation --> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${jsf.home}/lib/commons-codec-1.2.jar"/> - <copy todir="${build.home}/webapps/example/WEB-INF/lib" - file="${jsf.home}/lib/commons-el.jar"/> - - </target> - - - <target name="example.compile" depends="example.libraries.myfaces"> - - <!-- Compile Java Sources --> - <mkdir dir="${build.home}/webapps/example/WEB-INF/classes"/> - <javac srcdir="src/example" - destdir="${build.home}/webapps/example/WEB-INF/classes" - debug="${compile.debug}" - deprecation="${compile.deprecation}" - optimize="${compile.optimize}"> - <classpath refid="classpath" /> - </javac> - - <!-- Copy non-Java Sources --> - <copy todir="${build.home}/webapps/example/WEB-INF/classes"> - <fileset dir="src/example"> - <exclude name="**/*.java"/> - </fileset> - </copy> - - </target> - - - <!-- ===================== EXAMPLE: Tomcat Integration ================= --> - - - <target name="example.install" depends="example.compile" - description="Install example webapp on Tomcat"> - <install url="${url}" username="${username}" password="${password}" - path="${example.path}" - war="file://${build.home}/webapps/example"/> - </target> - - - <target name="example.reload" depends="example.compile" - description="Reload example webapp on Tomcat"> - <reload url="${url}" username="${username}" password="${password}" - path="${example.path}"/> - </target> - - - <target name="example.remove" - description="Remove example webapp from Tomcat"> - <remove url="${url}" username="${username}" password="${password}" - path="${example.path}"/> - </target> - - - <!-- ==================== EXAMPLE2: Create Webapp ======================= --> - - - <target name="example2.prepare" depends="library"> - - <echo message="------------ ${project.name} Example2 Webapp ------------"/> - <mkdir dir="${build.home}/webapps"/> - <mkdir dir="${build.home}/webapps/example2"/> - - </target> - - - <target name="example2.static" depends="example2.prepare"> - - <!-- Copy static web resources --> - <copy todir="${build.home}/webapps/example2"> - <fileset dir="web/example2"/> - </copy> - - <!-- Copy required configuration files --> - <copy todir="${build.home}/webapps/example2/WEB-INF"> - <fileset dir="${build.home}/conf"> - <include name="*.tld"/> - </fileset> - </copy> - <copy todir="${build.home}/webapps/example2/WEB-INF"> - <fileset dir="${struts.home}/lib"> - <include name="*.tld"/> - <include name="valid*.xml"/> - </fileset> - </copy> - - <!-- Copy required library JAR files --> - <mkdir dir="${build.home}/webapps/example2/WEB-INF/lib"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${build.home}/lib/struts-faces.jar"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${commons-beanutils.jar}"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${commons-collections.jar}"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${commons-digester.jar}"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${commons-fileupload.jar}"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${commons-logging.jar}"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${commons-validator.jar}"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${jakarta-oro.jar}"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${struts.jar}"/> - - </target> - - - <target name="example2.static.jsfri" depends="example2.static" - if="jsfri.present"> - - <replace dir="${build.home}/webapps/example2/WEB-INF" - token="MYFACES_BEGIN" - value="<!-- MyFaces Listener"/> - <replace dir="${build.home}/webapps/example2/WEB-INF" - token="MYFACES_END" - value="-->"/> - - </target> - - - <target name="example2.static.myfaces" depends="example2.static.jsfri" - if="myfaces.present"> - - <replace dir="${build.home}/webapps/example2/WEB-INF" - token="MYFACES_BEGIN" - value="<!-- MyFaces Listener -->"/> - <replace dir="${build.home}/webapps/example2/WEB-INF" - token="MYFACES_END" - value=""/> - - </target> - - - <target name="example2.libraries" depends="example2.static.myfaces" - if="build.standalone"> - - <!-- Copy libraries required for standalone use only --> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${jsf-api.jar}"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${jsf-impl.jar}"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${jstl.jar}"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${standard.jar}"/> - - </target> - - - <target name="example2.libraries.myfaces" depends="example2.libraries" - if="myfaces.present"> - - <!-- Copy additional libraries required by MyFaces implementation --> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${jsf.home}/lib/commons-codec-1.2.jar"/> - <copy todir="${build.home}/webapps/example2/WEB-INF/lib" - file="${jsf.home}/lib/commons-el.jar"/> - - </target> - + <!-- ==================== Create Binary Distribution ==================== --> - <target name="example2.compile" depends="example2.libraries.myfaces"> - <!-- Compile Java Sources --> - <mkdir dir="${build.home}/webapps/example2/WEB-INF/classes"/> - <javac srcdir="src/example2" - destdir="${build.home}/webapps/example2/WEB-INF/classes" - debug="${compile.debug}" - deprecation="${compile.deprecation}" - optimize="${compile.optimize}"> - <classpath refid="classpath" /> - </javac> + <target name="dist" depends="library" + description="Create binary distribution"> - <!-- Copy non-Java Sources --> - <copy todir="${build.home}/webapps/example2/WEB-INF/classes"> - <fileset dir="src/example2"> - <exclude name="**/*.java"/> - </fileset> + <mkdir dir="${dist.home}"/> + <copy todir="${dist.home}"> + <fileset dir="${basedir}" includes="*.txt build.*" + excludes="build.properties"/> </copy> - </target> - - - <!-- ===================== EXAMPLE2: Tomcat Integration ================= --> - - - <target name="example2.install" depends="example2.compile" - description="Install example2 webapp on Tomcat"> - <install url="${url}" username="${username}" password="${password}" - path="${example2.path}" - war="file://${build.home}/webapps/example2"/> - </target> - - - <target name="example2.reload" depends="example2.compile" - description="Reload example2 webapp on Tomcat"> - <reload url="${url}" username="${username}" password="${password}" - path="${example2.path}"/> - </target> - - - <target name="example2.remove" - description="Remove example2 webapp from Tomcat"> - <remove url="${url}" username="${username}" password="${password}" - path="${example2.path}"/> - </target> - - - <!-- ===================== SYSTEST: Create Webapp ======================== --> - - - <target name="systest.prepare" depends="library"> - - <echo message="------------ ${project.name} Systest Webapp -------------"/> - <mkdir dir="${build.home}/webapps"/> - <mkdir dir="${build.home}/webapps/systest"/> - - </target> - - - <target name="systest.static" depends="systest.prepare"> - - <!-- Copy static web resources --> - <copy todir="${build.home}/webapps/systest" - filtering="on"> - <fileset dir="web/systest"/> + <mkdir dir="${dist.home}/conf"/> + <copy todir="${dist.home}/conf"> + <fileset dir="${build.home}/conf" includes="*.tld"/> </copy> - <!-- Copy required configuration files --> - <copy todir="${build.home}/webapps/systest/WEB-INF"> - <fileset dir="${struts.home}/lib"> - <include name="valid*.xml"/> - </fileset> + <mkdir dir="${dist.home}/lib"/> + <copy todir="${dist.home}/lib"> + <fileset dir="${build.home}/lib" includes="*.jar"/> </copy> - <!-- Copy required library JAR files --> - <mkdir dir="${build.home}/webapps/systest/WEB-INF/lib"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${build.home}/lib/struts-faces.jar"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${commons-beanutils.jar}"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${commons-collections.jar}"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${commons-digester.jar}"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${commons-fileupload.jar}"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${commons-logging.jar}"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${commons-validator.jar}"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${jakarta-oro.jar}"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${struts.jar}"/> - - </target> - - - <target name="systest.static.jsfri" depends="systest.static" - if="jsfri.present"> - - <replace dir="${build.home}/webapps/systest/WEB-INF" - token="MYFACES_BEGIN" - value="<!-- MyFaces Listener"/> - <replace dir="${build.home}/webapps/systest/WEB-INF" - token="MYFACES_END" - value="-->"/> - - </target> - - - <target name="systest.static.myfaces" depends="systest.static.jsfri" - if="myfaces.present"> - - <replace dir="${build.home}/webapps/systest/WEB-INF" - token="MYFACES_BEGIN" - value="<!-- MyFaces Listener -->"/> - <replace dir="${build.home}/webapps/systest/WEB-INF" - token="MYFACES_END" - value=""/> - - </target> - - - <target name="systest.libraries" depends="systest.static.jsfri" - if="build.standalone"> - - <!-- Copy libraries required for standalone use only --> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${jsf-api.jar}"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${jsf-impl.jar}"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${jstl.jar}"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${standard.jar}"/> - - </target> - - - <target name="systest.libraries.myfaces" depends="systest.libraries" - if="myfaces.present"> - - <!-- Copy additional libraries required by MyFaces implementation --> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${jsf.home}/lib/commons-codec-1.2.jar"/> - <copy todir="${build.home}/webapps/systest/WEB-INF/lib" - file="${jsf.home}/lib/commons-el.jar"/> - - </target> - - - <target name="systest.compile" depends="systest.libraries.myfaces"> - - <!-- Compile Java Sources --> - <mkdir dir="${build.home}/webapps/systest/WEB-INF/classes"/> - <javac srcdir="src/systest" - destdir="${build.home}/webapps/systest/WEB-INF/classes" - debug="${compile.debug}" - deprecation="${compile.deprecation}" - optimize="${compile.optimize}"> - <classpath refid="classpath" /> - </javac> - - <!-- Copy non-Java Sources --> - <copy todir="${build.home}/webapps/systest/WEB-INF/classes"> - <fileset dir="src/systest"> - <exclude name="**/*.java"/> - </fileset> + <mkdir dir="${dist.home}/src"/> + <copy todir="${dist.home}/src"> + <fileset dir="src" excludes="**/.svn/**"/> </copy> </target> - <!-- ====================== SYSTEST: Tomcat Integration ================= --> + <!-- ========================= Unit Tests ================================ --> - <target name="systest.install" depends="systest.compile" - description="Install systest webapp on Tomcat"> - <install url="${url}" username="${username}" password="${password}" - path="${systest.path}" - war="file://${build.home}/webapps/systest"/> - </target> + <target name="test:compile" depends="library" + description="Compile library unit tests"> - - <target name="systest.reload" depends="systest.compile" - description="Reload systest webapp on Tomcat"> - <reload url="${url}" username="${username}" password="${password}" - path="${systest.path}"/> - </target> - - - <target name="systest.remove" - description="Remove systest webapp from Tomcat"> - <remove url="${url}" username="${username}" password="${password}" - path="${systest.path}"/> - </target> - - - <!-- ====================== SYSTEST: Client Execution =================== --> - - - <target name="sysclient.compile" - description="Prepare system integration test client"> + <mkdir dir="${build.home}/test-classes"/> <!-- Compile Java Sources --> - <mkdir dir="${build.home}/sysclient"/> - <javac srcdir="src/sysclient" - destdir="${build.home}/sysclient" + <javac srcdir="src/test" + destdir="${build.home}/test-classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}"> - <classpath refid="sysclient.classpath"/> + <classpath refid="test.classpath" /> </javac> <!-- Copy non-Java Sources --> - <copy todir="${build.home}/sysclient"> - <fileset dir="src/sysclient"> + <copy todir="${build.home}/test-classes"> + <fileset dir="src/test"> <exclude name="**/*.java"/> </fileset> </copy> @@ -750,84 +310,23 @@ </target> - <target name="sysclient.execute" depends="sysclient.compile" - description="Execute system integration test client"> + <target name="test" depends="test:compile" + description="Execute library unit tests"> - <junit fork="yes" - printSummary="yes" - haltonerror="yes" - haltonfailure="yes"> - - <classpath refid="sysclient.classpath"/> - <formatter type="plain" - usefile="false"/> - <sysproperty key="systest" - value="${systest.url}"/> - - <batchtest> - <fileset dir="${build.home}/sysclient" - excludes="**/AbstractTestCase.class" - includes="**/*TestCase.class"/> + <junit fork="yes" + haltonerror="${test.haltonerror}" + haltonfailure="${test.haltonfailure}" + printSummary="no"> + + <classpath refid="test.classpath"/> + <formatter type="plain" + usefile="false"/> + <batchtest fork="yes"> + <fileset dir="${build.home}/test-classes" + includes="org/apache/struts/faces/*/*TestCase.class"/> </batchtest> </junit> - - </target> - - - <!-- ==================== Create Binary Distribution ==================== --> - - - <target name="dist" depends="example.compile,example2.compile, docs" - description="Create binary distribution"> - - <mkdir dir="${dist.home}"/> - <copy todir="${dist.home}"> - <fileset dir="${basedir}" includes="*.txt build.*" - excludes="build.properties"/> - </copy> - - <mkdir dir="${dist.home}/conf"/> - <copy todir="${dist.home}/conf"> - <fileset dir="${build.home}/conf" includes="*.tld"/> - </copy> - - <mkdir dir="${dist.home}/lib"/> - <copy todir="${dist.home}/lib"> - <fileset dir="${build.home}/lib" includes="*.jar"/> - </copy> - - <mkdir dir="${dist.home}/src"/> - <copy todir="${dist.home}/src"> - <fileset dir="src" excludes="**/CVS/**"/> - </copy> - - <mkdir dir="${dist.home}/web"/> - <copy todir="${dist.home}/web"> - <fileset dir="web" excludes="**/CVS/**"/> - </copy> - - <mkdir dir="${dist.home}/webapps"/> - <jar destfile="${dist.home}/webapps/struts-faces.war"> - <fileset dir="${build.home}/classes"> - <include name="META-INF/LICENSE.txt"/> - </fileset> - <fileset dir="${build.home}/webapps/example"> -<!-- Final RI license allows redistribution - <exclude name="**/jsf-*.jar"/> ---> - </fileset> - </jar> - <jar destfile="${dist.home}/webapps/struts-faces2.war"> - <fileset dir="${build.home}/classes"> - <include name="META-INF/LICENSE.txt"/> - </fileset> - <fileset dir="${build.home}/webapps/example2"> -<!-- Final RI license allows redistribution - <exclude name="**/jsf-*.jar"/> ---> - </fileset> - </jar> </target> Added: struts/trunk/struts-faces/core-library/src/test/org/apache/struts/faces/util/Bundle.properties ============================================================================== --- (empty file) +++ struts/trunk/struts-faces/core-library/src/test/org/apache/struts/faces/util/Bundle.properties Sat Oct 9 16:50:41 2004 @@ -0,0 +1,19 @@ +# $Id$ +# +# Copyright 2002,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. + +foo=This is foo +bar=And this is bar +baz=We also have baz Added: struts/trunk/struts-faces/core-library/src/test/org/apache/struts/faces/util/MessagesMapTestCase.java ============================================================================== --- (empty file) +++ struts/trunk/struts-faces/core-library/src/test/org/apache/struts/faces/util/MessagesMapTestCase.java Sat Oct 9 16:50:41 2004 @@ -0,0 +1,220 @@ +/* + * Copyright 2002,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 org.apache.struts.faces.util; + + +import java.util.Collections; +import java.util.Locale; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.apache.struts.util.MessageResources; + + +/** + * <p>Unit tests for <code>MessagesMap</code>.</p> + */ + +public class MessagesMapTestCase extends TestCase { + + + // ------------------------------------------------------ Instance Variables + + + /** + * <p>The <code>MessagesMap</code> instance to be tested.</p> + */ + protected MessagesMap map = null; + + + /** + * <p>The <code>MessageResources</code> instance containing the messages + * used for testing.</p> + */ + protected MessageResources resources = null; + + + // ------------------------------------------------------------ Constructors + + + /** + * <p>Construct a new instance of this test case.</p> + * + * @param name Name of the test case + */ + public MessagesMapTestCase(String name) { + + super(name); + + } + + + // ---------------------------------------------------- Overall Test Methods + + + /** + * <p>Set up instance variables required by this test case.</p> + */ + public void setUp() throws Exception { + + resources = + MessageResources.getMessageResources + ("org.apache.struts.faces.util.Bundle"); + map = new MessagesMap(resources, Locale.getDefault()); + + } + + + /** + * <p>Return the tests included in this test suite.</p> + */ + public static Test suite() { + + return new TestSuite(MessagesMapTestCase.class); + + } + + + /** + * <p>Tear down instance variables required by this test case.</p> + */ + public void teaDown() throws Exception { + + map = null; + resources = null; + + } + + + // -------------------------------------------------- Individal Test Methods + + + /** + * <p>Test the <code>containsKey()</code> method.</p> + */ + public void testContainsKey() throws Exception { + + // Positive tests + assertTrue(map.containsKey("foo")); + assertTrue(map.containsKey("bar")); + assertTrue(map.containsKey("baz")); + + // Negative tests + assertTrue(!map.containsKey("bop")); + + } + + + /** + * <p>Test the <code>get()</code> method.</p> + */ + public void testGet() throws Exception { + + // Positive tests + assertEquals("This is foo", (String) map.get("foo")); + assertEquals("And this is bar", (String) map.get("bar")); + assertEquals("We also have baz", (String) map.get("baz")); + + // Negative tests + assertNull((String) map.get("bop")); + + } + + + /** + * <p>Test a pristine instance, and all unsupported methods.</p> + */ + public void testPristine() throws Exception { + + // clear() + try { + map.clear(); + fail("clear() should have thrown UnsupportedOperationException"); + } catch (UnsupportedOperationException e) { + ; // Expected result + } + + // containsValue() + try { + map.containsValue("foo"); + fail("containsValue() should have thrown UnsupportedOperationException"); + } catch (UnsupportedOperationException e) { + ; // Expected result + } + + // entrySet() + try { + map.entrySet(); + fail("entrySet() should have thrown UnsupportedOperationException"); + } catch (UnsupportedOperationException e) { + ; // Expected result + } + + // keySet() + try { + map.keySet(); + fail("keySet() should have thrown UnsupportedOperationException"); + } catch (UnsupportedOperationException e) { + ; // Expected result + } + + // put() + try { + map.put("foo", "bar"); + fail("put() should have thrown UnsupportedOperationException"); + } catch (UnsupportedOperationException e) { + ; // Expected result + } + + // putAll() + try { + map.putAll(Collections.EMPTY_MAP); + fail("putAll() should have thrown UnsupportedOperationException"); + } catch (UnsupportedOperationException e) { + ; // Expected result + } + + // remove() + try { + map.remove("foo"); + fail("remove() should have thrown UnsupportedOperationException"); + } catch (UnsupportedOperationException e) { + ; // Expected result + } + + // size() + try { + map.size(); + fail("size() should have thrown UnsupportedOperationException"); + } catch (UnsupportedOperationException e) { + ; // Expected result + } + + // size() + try { + map.values(); + fail("values() should have thrown UnsupportedOperationException"); + } catch (UnsupportedOperationException e) { + ; // Expected result + } + + } + + +} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]