You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by br...@apache.org on 2002/02/01 04:20:00 UTC

cvs commit: jakarta-turbine-2/src/test/org/apache/turbine/util/db CriteriaTest.java

brekke      02/01/31 19:20:00

  Modified:    .        build.xml default.properties
  Added:       .        build-test.xml
               src/rttest/cactus cactus.properties log_client.properties
                        web.xml
               src/rttest/cactus/tomcat40 server.xml
               src/rttest/org/apache/turbine/services/cache
                        TurbineCacheTest.java
               src/rttest/org/apache/turbine/services/xmlrpc/util
                        FileHandlerTest.java
               src/rttest/testapp/WEB-INF/conf TurbineCacheTest.properties
               src/test/org/apache/turbine/test BaseTestCase.java
               src/test/org/apache/turbine/util/db CriteriaTest.java
  Removed:     src/java/org/apache/turbine/services/cache
                        TurbineCacheTest.java
               src/java/org/apache/turbine/services/xmlrpc/util
                        FileHandlerTest.java
               src/java/org/apache/turbine/test BaseTestCase.java
               src/java/org/apache/turbine/util/db CriteriaTest.java
  Log:
  Added an ant build file ( build-test.xml ) to run the unit and run-time tests.
  Moved the test cases from the main source tree into src/rttest and src/test
  like other projects.  Setup cactus for the run-time tests like the t3 repo.
  Updated the build.xml file to no longer reference the test cases.
  
  To run the tests:
  
  ant -buildfile build-test.xml ( runs the unit tests )
  ant -buildfile build-test.xml test-servlet ( run-time tests via cactus )
  
  No code changes were done, only ant buildfile changes and moving of code.
  
  Revision  Changes    Path
  1.4       +4 -65     jakarta-turbine-2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/build.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- build.xml	31 Jan 2002 04:03:59 -0000	1.3
  +++ build.xml	1 Feb 2002 03:19:59 -0000	1.4
  @@ -21,7 +21,6 @@
           <pathelement location="${jdbc.jar}"/>
           <pathelement location="${jndi.jar}"/>
           <pathelement location="${jta.jar}"/>
  -        <pathelement location="${junit.jar}"/>
           <pathelement location="${log4j.jar}"/>
           <pathelement location="${javamail.jar}"/>
           <pathelement location="${oro.jar}"/>
  @@ -40,6 +39,7 @@
       <!-- Prints useful build environment values                             -->
       <!-- ================================================================== -->
       <target name="env" depends="check_for_optional_packages">
  +        <echo message="lib.repo = ${lib.repo}"/>
           <echo message="java.home = ${java.home}"/>
           <echo message="user.home = ${user.home}"/>
           <echo message="java.class.path = ${java.class.path}"/>
  @@ -61,10 +61,6 @@
                      classname="javax.servlet.jsp.PageContext">
               <classpath refid="classpath"/>
           </available>
  -        <available property="junit.present"
  -                   classname="junit.framework.TestCase">
  -            <classpath refid="classpath"/>
  -        </available>
           <available property="webmacro.present"
                      classname="org.webmacro.WebMacro">
               <classpath refid="classpath"/>
  @@ -166,18 +162,6 @@
       </target>
   
       <!-- ================================================================== -->
  -    <!-- Adds testcase files to the build directory                         -->
  -    <!-- ================================================================== -->
  -    <target name="prepare-tests" depends="prepare" if="junit.present">
  -        <copy todir="${build.src}/org" filtering="yes">
  -            <fileset dir="${src.java.dir}/org">
  -                <include name="**/*Test.java"/>
  -                <include name="**/test/**"/>
  -            </fileset>
  -        </copy>
  -    </target>
  -
  -    <!-- ================================================================== -->
       <!-- Adds log4java files to the build directory                         -->
       <!-- ================================================================== -->
       <target name="prepare-log4java" depends="prepare" if="log4java.present">
  @@ -208,7 +192,7 @@
               description="--> compiles the source code">
           <javac srcdir="${build.src}"
               destdir="${build.dest}"
  -            excludes="**/package.html"
  +            excludes="**/package.html,**/*Test.java"
               debug="${debug}"
               deprecation="${deprecation}"
               optimize="${optimize}">
  @@ -232,7 +216,7 @@
               description="--> generates the turbine.jar file (default)">
           <jar jarfile="${build.dir}/${final.name}.jar"
               basedir="${build.dest}"
  -            excludes="**/package.html"/>
  +            excludes="**/package.html,**/*Test.class"/>
       </target>
   
       <!-- ================================================================== -->
  @@ -243,7 +227,7 @@
               description="--> generates the turbine.src.jar file containing source only">
           <jar jarfile="${build.dir}/${final.name}.src.jar"
               basedir="${build.src}"
  -            excludes="**/package.html"/>
  +            excludes="**/package.html,**/*Test.java"/>
       </target>
   
       <!-- ================================================================== -->
  @@ -403,51 +387,6 @@
           </copy>
           -->
   
  -    </target>
  -
  -    <!-- ================================================================== -->
  -    <!-- Compile testcases                                                  -->
  -    <!-- ================================================================== -->
  -    <target name="compile-tests" depends="prepare-tests, compile"
  -            if="junit.present"/>
  -
  -    <!-- ================================================================== -->
  -    <!-- Run testcases                                                      -->
  -    <!-- ================================================================== -->
  -    <target name="run-tests" depends="compile-tests" if="junit.present"
  -            description="--> runs all available testcases">
  -        <junit printsummary="no" haltonfailure="yes">
  -            <classpath>
  -                <pathelement location="${build.dest}"/>
  -                <path refid="classpath"/>
  -                <pathelement path="${classpath}"/>
  -            </classpath>
  -
  -            <formatter type="plain" usefile="false"/>
  -
  -            <batchtest>
  -                <fileset dir="${build.src}">
  -                    <include name="**/*Test.java"/>
  -                </fileset>
  -            </batchtest>
  -        </junit>
  -    </target>
  -
  -    <!-- ================================================================== -->
  -    <!-- Run an single testcase                                             -->
  -    <!-- ================================================================== -->
  -    <target name="run-singletest" if="testcase" depends="compile-tests">
  -        <junit printsummary="no" haltonfailure="yes">
  -            <classpath>
  -                <pathelement location="${build.dest}"/>
  -                <path refid="classpath" />
  -                <pathelement path="${classpath}"/>
  -            </classpath>
  -
  -            <formatter type="plain" usefile="false"/>
  -
  -            <test name="${testcase}"/>
  -        </junit>
       </target>
   
       <!-- ================================================================== -->
  
  
  
  1.2       +25 -2     jakarta-turbine-2/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/default.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- default.properties	31 Jan 2002 04:03:59 -0000	1.1
  +++ default.properties	1 Feb 2002 03:19:59 -0000	1.2
  @@ -46,11 +46,10 @@
   jdbc.jar = ${lib.repo}/jdbc2_0-stdext.jar
   jndi.jar = ${lib.repo}/jndi-1.2.1.jar
   jta.jar = ${lib.repo}/jta1.0.1.jar
  -junit.jar = ${lib.repo}/junit-3.7.jar
   log4j.jar = ${lib.repo}/log4j-1.1.3.jar
   javamail.jar = ${lib.repo}/mail-1.2.jar
   oro.jar = ${lib.repo}/oro.jar
  -servlet.jar = ${lib.repo}/servlet.jar
  +servlet.jar = ${lib.repo}/servlet-2.2.jar
   velocity.jar = ${lib.repo}/velocity-1.3-dev.jar
   village.jar = ${lib.repo}/village-1.5.3-dev.jar
   xalan.jar = ${lib.repo}/xalan-2.1.0.jar
  @@ -60,3 +59,27 @@
   castor.jar = ${lib.repo}/castor.jar
   freemarker.jar = ${lib.repo}/freemarker.jar
   webmacro.jar = ${lib.repo}/webmacro-0.94.jar
  +
  +# -------------------------------------------------------------------
  +# T E S T I N G
  +# -------------------------------------------------------------------
  +test.dir = ${src.dir}/test
  +test.reportsDirectory = test-reports
  +rttest.dir = ${src.dir}/rttest
  +
  +junit.jar = ${lib.repo}/junit-3.7.jar
  +cactus.jar = ${lib.repo}/cactus.jar
  +cactus-ant.jar = ${lib.repo}/cactus-ant.jar
  +httpunit.jar = ${lib.repo}/httpunit.jar
  +httpclient.jar = ${lib.repo}/httpclient.jar
  +tidy.jar = ${lib.repo}/tidy.jar
  +
  +tomcat.home.40 = ${tdk.home}
  +webapp.dir = ${rttest.dir}/testapp
  +conf.test.dir = ${rttest.dir}/cactus
  +out.test.dir = ${build.dir}/rttest
  +
  +# Port that will be used to start the servlet engines for testing. This is
  +# optional and if omitted will default to 8080. This is used when you don't
  +# want to interfere with a running servlet engine on port 8080.
  +test.port=8182
  
  
  
  1.1                  jakarta-turbine-2/build-test.xml
  
  Index: build-test.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project name="test" default="test" basedir=".">
  
    <!-- Allow any user specific values to override the defaults -->
    <property file="${user.home}/build.properties" />
    <property file="build.properties" />
    <property file="default.properties" />
  
    <!-- Construct compile/run-time classpath -->
    <path id="test-classpath">
      <pathelement location="${junit.jar}"/>
      <pathelement location="${cactus.jar}"/>
      <pathelement location="${cactus-ant.jar}"/>
      <pathelement location="${httpunit.jar}"/>
      <pathelement location="${tidy.jar}"/>
      <pathelement location="${log4j.jar}"/>
      <pathelement location="${servlet.jar}"/>
      <pathelement location="${velocity.jar}"/>
      <pathelement location="${commons-collections.jar}"/>
      <pathelement location="${httpclient.jar}"/>
      <pathelement path="${build.dest}"/>
    </path>
  
    <!-- ================================================================== -->
    <!-- C O M P I L E  T E S T S                                           -->
    <!-- ================================================================== -->
  
    <target
      name="compile"
      description="==> compiles the test source code">
      
      <ant antfile="build.xml" target="compile"/>
  
      <copy todir="${build.src}/org">
        <fileset dir="${test.dir}/org"/>
        <fileset dir="${rttest.dir}/org"/>
      </copy>
  
      <javac srcdir="${build.src}"
        destdir="${build.dest}"
        includes="**/*Test.java"
        excludes="**/package.html"
        debug="${debug}"
        deprecation="${deprecation}"
        optimize="${optimize}">
        <classpath refid="test-classpath"/>
      </javac>
    </target>
  
    <!-- ================================================================== -->
    <!-- U N I T  T E S T S                                                 -->
    <!-- ================================================================== -->
  
    <target 
      name="test" 
      depends="compile"
      description="runs (junit) unit tests">
      
      <echo>
        Running all JUnit tests
      </echo>
      
      <delete dir="${test.reportsDirectory}"/>
      <mkdir dir="${test.reportsDirectory}"/>
      
      <junit printSummary="yes" haltonerror="yes">
        <formatter type="plain"/>
        <classpath refid="test-classpath"/>
        <batchtest todir="${test.reportsDirectory}">
          <fileset dir="${build.dest}">
            <include name="**/*Test.class"/>
            <exclude name="**/*ServletTest.class"/>
      
            <exclude name="**/FileHandlerTest.class"/>
            <exclude name="**/TurbineCacheTest.class"/>
          </fileset>
        </batchtest>
      </junit>
    </target>
  
    <!-- ================================================================== -->
    <!-- S E R V L E T  T E S T S                                           -->
    <!-- ================================================================== -->
  
    <target 
      name="test-servlet"
      depends="compile,prepare-tests-tomcat-40"
      description="--> runs turbine servlet tests">
  
      <taskdef 
        name="RunServerTests" 
        className="org.apache.cactus.ant.RunServerTestsTask">
        <classpath refid="test-classpath"/>
      </taskdef>
   
      <!--
        
        Start the servlet engine, wait for it to be started, run the
        unit tests, stop the servlet engine, wait for it to be stopped.
        The servlet engine is stopped if the tests fail for any reason 
      
      -->
   
      <RunServerTests 
        testURL="http://localhost:${test.port}/test"
        startTarget="start-tomcat-40"
        stopTarget="stop-tomcat-40"
        testTarget="turbine-servlet-tests"/>
   
    </target>
  
    <target 
      name="turbine-servlet-tests">
      
      <junit 
        printsummary="no" 
        haltonfailure="yes" 
        haltonerror="yes" 
        fork="yes" 
        dir="./">
        
        <classpath refid="test-classpath"/>
  
        <sysproperty key="java.compiler" value="NONE" />
        <sysproperty key="java.net.namelookup.cache" value="0" />
        <sysproperty key="sun.net.inetaddr.ttl" value="0" />
  
        <formatter type="plain" usefile="false"/>
        <batchtest>
          <fileset dir="${build.dest}">
            <include name="**/*ServletTest.class"/>
  	  <include name="**/TurbineCacheTest.class"/> 
            
            <!-- NEEDS TO BE FIXED -->
            <exclude name="**/FileHandlerTest.class"/>
          </fileset>
        </batchtest>
      </junit>
    </target>
  
    <!-- =================================================================== -->
    <!-- S T A R T  T O M C A T  4 . 0                                       -->
    <!-- =================================================================== -->
    <target 
      name="start-tomcat-40">
   
      <java 
        classname="org.apache.catalina.startup.Bootstrap" 
        fork="yes">
        
        <jvmarg value="-Dcatalina.home=${tomcat.home.40}"/>
        <arg value="-config"/>
        <arg value="${out.tomcat40.full.dir}/conf/server.xml"/>
        <arg value="start"/>
        <classpath>
          <pathelement location="${java.home}/../lib/tools.jar"/>
          <fileset dir="${tomcat.home.40}">
            <include name="bin/bootstrap.jar"/>                  
          </fileset>
        </classpath>
      </java>
   
    </target>
   
    <!-- =================================================================== -->
    <!-- S T O P  T O M C A T  4 . 0                                         -->
    <!-- =================================================================== -->
    <target 
      name="stop-tomcat-40">
   
      <java 
        classname="org.apache.catalina.startup.Bootstrap" 
        fork="yes">
        <jvmarg value="-Dcatalina.home=${tomcat.home.40}"/>
        <arg value="stop"/>
        <classpath>
          <fileset dir="${tomcat.home.40}">
            <include name="bin/bootstrap.jar"/>
            <include name="server/catalina.jar"/>
          </fileset>
        </classpath>
      </java>
   
    </target>
  
  
    <!-- =================================================================== -->
    <!-- Display a warning message if the needed servlet engine home         -->
    <!-- property is not set                                                 -->
    <!-- =================================================================== -->
    <target 
      name="check-tests-tomcat-40"
      depends="testwar"
      unless="tomcat.home.40">
   
      <echo>
        
        *********************************************************
        WARNING : The 'tomcat.home.40' property has not been set.
                  No test will be run on that servlet engine.
        *********************************************************
      
      </echo>
   
    </target>
  
    <!-- =================================================================== -->
    <!-- C R E A T E  T E S T  W A R  F I L E                                -->
    <!-- =================================================================== -->
    <target 
      name="testwar" 
      depends="compile">
  
      <!-- Make sure the directory for the war exist -->
      <delete dir="${out.test.dir}"/>
      <mkdir dir="${out.test.dir}"/>
  
      <!-- Create the WEB-INF/lib directory that will be used
           with the testapp -->
      
      <mkdir dir="${build.dir}/rttest/lib"/>
      <copy file="${cactus.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${httpunit.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${tidy.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${commons-collections.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${junit.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${log4j.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${velocity.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${httpclient.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${xmlrpc.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${xalan.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${xerces.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${ecs.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${activation.jar}" todir="${build.dir}/rttest/lib"/>
      <copy file="${javamail.jar}" todir="${build.dir}/rttest/lib"/>
      
      <war 
        warfile="${out.test.dir}/test.war" 
        webxml="${conf.test.dir}/web.xml">
        
        <lib dir="${build.dir}/rttest/lib"/>
        
        <!-- We want to test Turbine's core classes -->
        <classes dir="${build.dest}"/>
  
        <fileset dir="${webapp.dir}">
          <exclude name="**/CVS/*"/>
          <exclude name="**/WEB-INF/web.xml"/>
        </fileset>
      </war>
    </target>
  
    <!-- =================================================================== -->
    <!-- Prepare directories and variables for running the tests             -->
    <!-- =================================================================== -->
  
    <target 
      name="prepare-tests-tomcat-40" 
      depends="check-tests-tomcat-40" 
      if="tomcat.home.40">
      
      <echo message="tomcat.home.40 = ${tomcat.home.40}"/>
  
      <property name="out.tomcat40.dir" value="${out.test.dir}/tomcat40"/>
      <property name="conf.tomcat40.dir" value="${conf.test.dir}/tomcat40"/>
      <property name="out.tomcat40.full.dir" value="${basedir}/${out.tomcat40.dir}"/>
   
      <filter token="out.tomcat40.full.dir" value="${out.tomcat40.full.dir}"/>
      <filter token="test.port" value="${test.port}"/>
   
      <!-- Create work and conf directories and copy configuration files -->
      <mkdir dir="${out.tomcat40.dir}/conf"/>
      <mkdir dir="${out.tomcat40.dir}/work"/>
      <mkdir dir="${out.tomcat40.dir}/webapps"/>
   
      <!-- Delete some config file so that they will be copied every time -->
      <delete file="${out.tomcat40.dir}/conf/server.xml"/>
   
      <!-- Remove the auto deployed webapp so that it is redeployed every -->
      <!-- time.                                                          -->
      <delete dir="${out.tomcat40.dir}/webapps/test"/>
   
      <!-- Copy the default tomcat web.xml to our test conf/ directory. -->
      <!-- This is needed otherwise tomcat does not start.              -->
      <copy 
        file="${tomcat.home.40}/conf/web.xml"
        tofile="${out.tomcat40.dir}/conf/web.xml" 
        filtering="on"/>
   
      <copy 
        file="${conf.tomcat40.dir}/server.xml"
        tofile="${out.tomcat40.dir}/conf/server.xml" 
        filtering="on"/>
   
      <!-- Copy the war file -->
      <copy 
        file="${out.test.dir}/test.war" 
        tofile="${out.tomcat40.dir}/webapps/test.war"/>
  
      <!-- As this classes directory will be used to run the client side
           of Cactus, we need to copy the cactus.properties -->
      <copy 
        todir="${build.dest}" 
        file="${conf.test.dir}/cactus.properties" 
        filtering="on"/>
  
    </target>
  
  </project>
  
  
  
  1.1                  jakarta-turbine-2/src/rttest/cactus/cactus.properties
  
  Index: cactus.properties
  ===================================================================
  # Configuration file for Cactus.
  
  # Each project using Cactus need to have such a file put in the client side
  # CLASSPATH (Meaning the directory containgin this file should be in the client
  # side CLASSPATH, not the file itself of course ... :) )
  
  # Defines the URLs that will be used by Cactus to call it's redirectors.
  # You need to specify in these URLs the webapp context that you use for your
  # application. In the example below, the context is "test".
  
  # Servlet Redirector. Used by ServletTestCase test cases.
  cactus.servletRedirectorURL = http://localhost:@test.port@/test/ServletRedirector/
  
  # JSP Redirector. Used by JspTestCase test cases.
  cactus.jspRedirectorURL = http://localhost:@test.port@/test/JspRedirector/
  
  # Filter Redirector. Used by FilterTestCase test cases.
  
  # NOTE: Some servlet 2.3 containers need to map the filter to a valid
  # resource (Orion 1.5.2 for example). Others, like Tomcat, are happy
  # with just any mapping.
  #
  # For example, the following would work with Tomcat :
  # cactus.filterRedirectorURL = http://localhost:@test.port@/test/FilterRedirector
  
  cactus.filterRedirectorURL = http://localhost:@test.port@/test/test/filterRedirector.jsp
  
  
  
  1.1                  jakarta-turbine-2/src/rttest/cactus/log_client.properties
  
  Index: log_client.properties
  ===================================================================
  # Properties for configuring Log4j
  # This is the configuring for logging on the JUnit side (i.e. the client side)
  
  log4j.appender.cactus = org.apache.log4j.FileAppender
  log4j.appender.cactus.File = cactus_client.log
  log4j.appender.cactus.Append = false
  log4j.appender.cactus.layout = org.apache.log4j.PatternLayout
  log4j.appender.cactus.layout.ConversionPattern = %r [%t] %-5p %c{2} %x - %m %n
  
  log4j.category.org.apache.cactus = DEBUG, cactus
  
  
  
  1.1                  jakarta-turbine-2/src/rttest/cactus/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
  
  <web-app>
  
      <filter>
          <filter-name>FilterRedirector</filter-name>
          <filter-class>org.apache.cactus.server.FilterTestRedirector</filter-class>
      </filter>
  
      <filter-mapping>
          <filter-name>FilterRedirector</filter-name>
  
          <!-- Some servlet 2.3 containers need to map the filter to a valid
               resource (Orion 1.5.2 for example). Others, like Tomcat,
               are happy with just any mapping.
  
               For example, the following would work with Tomcat :
               <url-pattern>/FilterRedirector/</url-pattern> -->
          <url-pattern>/test/filterRedirector.jsp</url-pattern>
      </filter-mapping>
  
      <servlet>
          <servlet-name>ServletRedirector</servlet-name>
          <servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
          <init-param>
            <param-name>param1</param-name>
            <param-value>value1 used for testing</param-value>
          </init-param>
      </servlet>
  
      <servlet>
          <servlet-name>JspRedirector</servlet-name>
          <jsp-file>/test/jspRedirector.jsp</jsp-file>
          <init-param>
            <param-name>param1</param-name>
            <param-value>value1 used for testing</param-value>
          </init-param>
      </servlet>
      
      <servlet-mapping>
          <servlet-name>ServletRedirector</servlet-name>
          <url-pattern>/ServletRedirector/</url-pattern>
      </servlet-mapping>
  
      <servlet-mapping>
          <servlet-name>JspRedirector</servlet-name>
          <url-pattern>/JspRedirector/</url-pattern>
      </servlet-mapping>
  
  </web-app>
  
  
  
  1.1                  jakarta-turbine-2/src/rttest/cactus/tomcat40/server.xml
  
  Index: server.xml
  ===================================================================
  <Server port="8005" shutdown="SHUTDOWN" debug="0">
  
    <Service name="Tomcat-Standalone">
  
      <Connector className="org.apache.catalina.connector.http.HttpConnector"
                 port="@test.port@" minProcessors="5" maxProcessors="75"
                 acceptCount="10" debug="0"/>
  
      <Engine name="Standalone" defaultHost="localhost" debug="0">
  
        <Realm className="org.apache.catalina.realm.MemoryRealm" />
  
        <Host name="localhost" debug="0" appBase="@out.tomcat40.full.dir@/webapps">
        </Host>
  
      </Engine>
  
    </Service>
  
  </Server>
  
  
  
  1.1                  jakarta-turbine-2/src/rttest/org/apache/turbine/services/cache/TurbineCacheTest.java
  
  Index: TurbineCacheTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  
  package org.apache.turbine.services.cache;
  
  // Cactus and Junit imports
  import junit.awtui.TestRunner;
  import junit.framework.Test;
  import junit.framework.TestSuite;
  import org.apache.cactus.ServletTestCase;
  
  // Turbine imports
  import org.apache.turbine.services.TurbineServices;
  import org.apache.turbine.services.cache.GlobalCacheService;
  import org.apache.turbine.services.cache.CachedObject;
  import org.apache.turbine.services.cache.ObjectExpiredException;
  import org.apache.turbine.services.cache.Refreshable;
  import org.apache.turbine.services.cache.RefreshableCachedObject;
  import org.apache.turbine.Turbine;
  
  /**
   * TurbineCacheTest
   *
   * @author <a href="paulsp@apache.org">Paul Spencer</a>
   * @version $Id: TurbineCacheTest.java,v 1.1 2002/02/01 03:20:00 brekke Exp $
   */
  public class TurbineCacheTest extends ServletTestCase {
      
      private Turbine turbine = null;
      private static final String cacheKey = new String("CacheKey");
      private static final String cacheKey_2 = new String("CacheKey_2");
      private static final long TURBINE_CACHE_REFRESH = 5000; // in millis
      private static final long TEST_EXPIRETIME = TURBINE_CACHE_REFRESH + 1000;
      private static final long TEST_TIMETOLIVE = TEST_EXPIRETIME * 5;
      /**
       * Defines the testcase name for JUnit.
       *
       * @param name the testcase's name.
       */
      public TurbineCacheTest( String name )
      {
          super( name );
      }
      
      /**
       * Start the tests.
       *
       * @param args the arguments. Not used
       */
      public static void main(String args[])
      {
          TestRunner.main(new String[] { TurbineCacheTest.class.getName() });
      }
  
      /**
       * Creates the test suite.
       *
       * @return a test suite (<code>TestSuite</code>) that includes all methods
       *         starting with "test"
       */
      public static Test suite()
      {
          // All methods starting with "test" will be executed in the test suite.
          return new TestSuite( TurbineCacheTest.class );
      }
  
      /**
       * This setup will be running server side.  We startup Turbine and
       * get our test port from the properties.  This gets run before
       * each testXXX test.
       */
      protected void setUp()
          throws Exception
      {
          super.setUp();
          config.setInitParameter("properties",
                  "/WEB-INF/conf/TurbineCacheTest.properties");
          turbine = new Turbine();
          turbine.init(config);
      }
  
      /**
       * After each testXXX test runs, shut down the Turbine servlet.
       */
      protected void tearDown()
          throws Exception
      {
          turbine.destroy();
          super.tearDown();
      }
      
      /**
       * Simple test that verify an object can be created and deleted.
       * @throws Exception
       */
      public void testSimpleAddGetCacheObject() throws Exception
      {
          String testString = new String( "This is a test");
          Object retrievedObject = null;
          CachedObject cacheObject1 = null;
          
          GlobalCacheService globalCache = (GlobalCacheService)TurbineServices
          .getInstance()
          .getService( GlobalCacheService.SERVICE_NAME );
          
          // Create object
          cacheObject1 = new CachedObject(testString);
          assertNotNull( "Failed to create a cachable object 1", cacheObject1);
          
          // Add object to cache
          globalCache.addObject(cacheKey, cacheObject1);
          
          // Get object from cache
          retrievedObject = globalCache.getObject(cacheKey);
          assertNotNull( "Did not retrieved a cached object 1", retrievedObject);
          assertTrue( "Did not retrieved a correct, expected cached object 1", retrievedObject == cacheObject1);
          
          // Remove object from cache
          globalCache.removeObject(cacheKey);
          
          // Verify object removed from cache
          retrievedObject = null;
          cacheObject1 = null;
          try
          {
              retrievedObject = globalCache.getObject(cacheKey);
              assertNull( "Retrieved the deleted cached object 1 and did not get expected ObjectExpiredException", retrievedObject);
              assertNotNull( "Did not get expected ObjectExpiredException retrieving a deleted object", retrievedObject);
          }
          catch (ObjectExpiredException e)
          {
              assertNull( "Retrieved the deleted cached object 1, but caught expected ObjectExpiredException exception", retrievedObject);
          }
          catch (Exception e)
          {
              throw e;
          }
          
          // Remove object from cache that does NOT exist in the cache
          globalCache.removeObject(cacheKey);
      }
      
      /**
       * Simple test that adds, retrieves, and deletes 2 object.
       *
       * @throws Exception
       */
      public void test2ObjectAddGetCachedObject() throws Exception
      {
          String testString = new String( "This is a test");
          Object retrievedObject = null;
          CachedObject cacheObject1 = null;
          CachedObject cacheObject2 = null;
          
          GlobalCacheService globalCache = (GlobalCacheService)TurbineServices
          .getInstance()
          .getService( GlobalCacheService.SERVICE_NAME );
          
          // Create and add Object #1
          cacheObject1 = new CachedObject(testString);
          assertNotNull( "Failed to create a cachable object 1", cacheObject1);
          globalCache.addObject(cacheKey, cacheObject1);
          retrievedObject = globalCache.getObject(cacheKey);
          assertNotNull( "Did not retrieved a cached object 1", retrievedObject);
          assertEquals( "Did not retrieved correct cached object", cacheObject1, retrievedObject);
          
          // Create and add Object #2
          cacheObject2 = new CachedObject(testString);
          assertNotNull( "Failed to create a cachable object 2", cacheObject2);
          globalCache.addObject(cacheKey_2, cacheObject2);
          retrievedObject = globalCache.getObject(cacheKey_2);
          assertNotNull( "Did not retrieved a cached object 2", retrievedObject);
          assertEquals( "Did not retrieved correct cached object 2", cacheObject2, retrievedObject);
          
          // Get object #1
          retrievedObject = globalCache.getObject(cacheKey);
          assertNotNull( "Did not retrieved a cached object 1. Attempt #2", retrievedObject);
          assertEquals( "Did not retrieved correct cached object 1. Attempt #2", cacheObject1, retrievedObject);
          
          // Get object #1
          retrievedObject = globalCache.getObject(cacheKey);
          assertNotNull( "Did not retrieved a cached object 1. Attempt #3", retrievedObject);
          assertEquals( "Did not retrieved correct cached object 1. Attempt #3", cacheObject1, retrievedObject);
          
          // Get object #2
          retrievedObject = globalCache.getObject(cacheKey_2);
          assertNotNull( "Did not retrieved a cached object 2. Attempt #2", retrievedObject);
          assertEquals( "Did not retrieved correct cached object 2 Attempt #2", cacheObject2, retrievedObject);
          
          // Remove objects
          globalCache.removeObject(cacheKey);
          globalCache.removeObject(cacheKey_2);
      }
      
      /**
       * Verify that an object will throw the ObjectExpiredException
       * when it now longer exists in cache.
       *
       * @throws Exception
       */    
      public void testObjectExpiration() throws Exception
      {
          String testString = new String( "This is a test");
          Object retrievedObject = null;
          CachedObject cacheObject = null;
          
          GlobalCacheService globalCache = (GlobalCacheService)TurbineServices
          .getInstance()
          .getService( GlobalCacheService.SERVICE_NAME );
          
          // Create and add Object that expires in 1000 millis (1 second)
          cacheObject = new CachedObject(testString, 1000);
          assertNotNull( "Failed to create a cachable object", cacheObject);
          long addTime = System.currentTimeMillis();
          globalCache.addObject(cacheKey, cacheObject);
          
          // Try to get un-expired object
          try
          {
              retrievedObject = null;
              retrievedObject = globalCache.getObject(cacheKey);
              assertNotNull( "Did not retrieved a cached object", retrievedObject);
              assertEquals( "Did not retrieved correct cached object", cacheObject, retrievedObject);
          }
          catch (ObjectExpiredException e)
          {
              assertTrue( "Object expired early ( " + (System.currentTimeMillis() - addTime) + " millis)", false);
          }
          catch (Exception e)
          {
              throw e;
          }
          
          // Sleep 1500 Millis (1.5 seconds)
          Thread.sleep(1500);
          
          // Try to get expired object
          try
          {
              retrievedObject = null;
              retrievedObject = globalCache.getObject(cacheKey);
              assertNull( "Retrieved the expired cached object  and did not get expected ObjectExpiredException", retrievedObject);
              assertNotNull( "Did not get expected ObjectExpiredException retrieving an expired object", retrievedObject);
          }
          catch (ObjectExpiredException e)
          {
              assertNull( "Retrieved the expired cached object, but caught expected ObjectExpiredException exception", retrievedObject);
          }
          catch (Exception e)
          {
              throw e;
          }
          
          // Remove objects
          globalCache.removeObject(cacheKey);
      }
  
      /**
       * Verify the all object will be flushed from the cache.
       *
       * This test can take server minutes.
       *
       * @throws Exception
       */    
      public void testCacheFlush() throws Exception
      {
          String testString = new String( "This is a test");
          Object retrievedObject = null;
          CachedObject cacheObject = null;
          
          GlobalCacheService globalCache = (GlobalCacheService)TurbineServices
          .getInstance()
          .getService( GlobalCacheService.SERVICE_NAME );
          
          // Create and add Object that expires in 1 turbine Refresh + 1 millis 
          cacheObject = new CachedObject(testString, (TURBINE_CACHE_REFRESH*5) + 1);
          assertNotNull( "Failed to create a cachable object", cacheObject);
          long addTime = System.currentTimeMillis();
          globalCache.addObject(cacheKey, cacheObject);
                  
          // 1 Refresh
          Thread.sleep(TURBINE_CACHE_REFRESH + 1);
          assertTrue("No object in cache before flush", (0 < globalCache.getNumberOfObjects()));
          
          // Flush Cache
          globalCache.flushCache();
  
          // Wait 15 seconds, 3 Refresh
          Thread.sleep((TURBINE_CACHE_REFRESH * 2) + 1);
          assertEquals("After refresh", 0, globalCache.getNumberOfObjects());
          
          // Remove objects
          globalCache.removeObject(cacheKey);
      }
  
      /**
       * Verify the Cache count is correct.
       *
       * This test can take serveral minutes.
       *
       * @throws Exception
       */    
      public void testObjectCount() throws Exception
      {
          String testString = new String( "This is a test");
          Object retrievedObject = null;
          CachedObject cacheObject = null;
          
          GlobalCacheService globalCache = (GlobalCacheService)TurbineServices
          .getInstance()
          .getService( GlobalCacheService.SERVICE_NAME );
          
          // Wait 2 Refresh to allow for remove object to be deleted
          Thread.sleep(TURBINE_CACHE_REFRESH * 2);
          assertEquals("Initial Object Count", 0, globalCache.getNumberOfObjects());
  
          // Create and add Object that expires in 1 turbine Refresh + 1 millis 
          cacheObject = new CachedObject(testString, TURBINE_CACHE_REFRESH  + 1);
          assertNotNull( "Failed to create a cachable object", cacheObject);
          long addTime = System.currentTimeMillis();
          globalCache.addObject(cacheKey, cacheObject);
          
          assertEquals("After adding 1 Object", 1, globalCache.getNumberOfObjects());
          
          // Wait 1 Refresh
          Thread.sleep(TURBINE_CACHE_REFRESH + 1);
          assertEquals("After refresh", 1, globalCache.getNumberOfObjects());
  
          // Wait 2 additional Refresh
          Thread.sleep((TURBINE_CACHE_REFRESH * 2) + 1);
          assertEquals("After refresh", 0, globalCache.getNumberOfObjects());
          
          // Remove objects
          globalCache.removeObject(cacheKey);
      }
  
      /**
       * Verfy a refreshable object will refreshed in the following cases:
       * o The object is retrieved via getObject an it is stale.
       * o The object is determied to be stale during a cache
       *   refresh
       *
       * This test can take serveral minutes.
       *
       * @throws Exception
       */    
      public void testRefreshableObject() throws Exception
      {
          String testString = new String( "This is a test");
          Object retrievedObject = null;
          RefreshableCachedObject cacheObject = null;
          
          GlobalCacheService globalCache = (GlobalCacheService)TurbineServices
          .getInstance()
          .getService( GlobalCacheService.SERVICE_NAME );
          
          // Create and add Object that expires in TEST_EXPIRETIME millis.
          cacheObject = new RefreshableCachedObject(new RefreshableObject(), TEST_EXPIRETIME);
          assertNotNull( "Failed to create a cachable object", cacheObject);
          long addTime = System.currentTimeMillis();
          globalCache.addObject(cacheKey, cacheObject);
          
          // Try to get un-expired object
          try
          {
              retrievedObject = null;
              retrievedObject = globalCache.getObject(cacheKey);
              assertNotNull( "Did not retrieved a cached object", retrievedObject);
              assertEquals( "Did not retrieved correct cached object", cacheObject, retrievedObject);
          }
          catch (ObjectExpiredException e)
          {
              assertTrue( "Object expired early ( " + (System.currentTimeMillis() - addTime) + " millis)", false);
          }
          catch (Exception e)
          {
              throw e;
          }
          
          // Wait 1 Turbine cache refresh + 1 second.
          Thread.sleep(TEST_EXPIRETIME + 1000);
          
          // Try to get expired object
          try
          {
              retrievedObject = null;
              retrievedObject = globalCache.getObject(cacheKey);
              assertNotNull( "Did not retrieved a cached object, after sleep", retrievedObject);
              assertNotNull( "Cached object has no contents, after sleep.", ((RefreshableCachedObject)retrievedObject).getContents());
              assertTrue( "Object did not refresh.", ( ((RefreshableObject)((RefreshableCachedObject)retrievedObject).getContents()).getRefreshCount() > 0));
          }
          catch (ObjectExpiredException e)
          {
              assertTrue( "Received unexpected ObjectExpiredException exception "
              + "when retrieving refreshable object after ( "
              + (System.currentTimeMillis() - addTime) + " millis)", false);
          }
          catch (Exception e)
          {
              throw e;
          }
          
          // See if object will expires (testing every second for 100 seconds.  It sould not!
          for (int i=0; i<100; i++)
          {
              Thread.sleep(1000); // Sleep 0.5 seconds
              
              // Try to get expired object
              try
              {
                  retrievedObject = null;
                  retrievedObject = globalCache.getObject(cacheKey);
                  assertNotNull( "Did not retrieved a cached object, after sleep", retrievedObject);
                  assertNotNull( "Cached object has no contents, after sleep.", ((RefreshableCachedObject)retrievedObject).getContents());
                  assertTrue( "Object did not refresh.", ( ((RefreshableObject)((RefreshableCachedObject)retrievedObject).getContents()).getRefreshCount() > 0));
              }
              catch (ObjectExpiredException e)
              {
                  assertTrue( "Received unexpected ObjectExpiredException exception "
                  + "when retrieving refreshable object after ( "
                  + (System.currentTimeMillis() - addTime) + " millis)", false);
              }
              catch (Exception e)
              {
                  throw e;
              }
          }
          // Remove objects
          globalCache.removeObject(cacheKey);
      }
      
      /**
       * Verify a cached object will be delete after it has been
       * untouched beyond it's TimeToLive.
       *
       * This test can take serveral minutes.
       *
       * @throws Exception
       */    
      public void testRefreshableTimeToLive() throws Exception
      {
          String testString = new String( "This is a test");
          Object retrievedObject = null;
          RefreshableCachedObject cacheObject = null;
          
          GlobalCacheService globalCache = (GlobalCacheService)TurbineServices
          .getInstance()
          .getService( GlobalCacheService.SERVICE_NAME );
          
          // Create and add Object that expires in TEST_EXPIRETIME millis.
          cacheObject = new RefreshableCachedObject(new RefreshableObject(), TEST_EXPIRETIME);
          assertNotNull( "Failed to create a cachable object", cacheObject);
          cacheObject.setTTL(TEST_TIMETOLIVE);
  
          // Verify TimeToLive was set
          assertEquals( "Returned TimeToLive", TEST_TIMETOLIVE, cacheObject.getTTL());
  
          // Add object to Cache
          long addTime = System.currentTimeMillis();
          globalCache.addObject(cacheKey, cacheObject);
          
          // Try to get un-expired object
          try
          {
              retrievedObject = null;
              retrievedObject = globalCache.getObject(cacheKey);
              assertNotNull( "Did not retrieved a cached object", retrievedObject);
              assertEquals( "Did not retrieved correct cached object", cacheObject, retrievedObject);
          }
          catch (ObjectExpiredException e)
          {
              assertTrue( "Object expired early ( " + (System.currentTimeMillis() - addTime) + " millis)", false);
          }
          catch (Exception e)
          {
              throw e;
          }
          
          // Wait long enough to allow object to expire, but do not exceed TTL
          Thread.sleep(TEST_TIMETOLIVE - 2000);
          
          // Try to get expired object
          try
          {
              retrievedObject = null;
              retrievedObject = globalCache.getObject(cacheKey);
              assertNotNull( "Did not retrieved a cached object, after sleep", retrievedObject);
              assertNotNull( "Cached object has no contents, after sleep.", ((RefreshableCachedObject)retrievedObject).getContents());
              assertTrue( "Object did not refresh.", ( ((RefreshableObject)((RefreshableCachedObject)retrievedObject).getContents()).getRefreshCount() > 0));
          }
          catch (ObjectExpiredException e)
          {
              assertTrue( "Received unexpected ObjectExpiredException exception "
              + "when retrieving refreshable object after ( "
              + (System.currentTimeMillis() - addTime) + " millis)", false);
          }
          catch (Exception e)
          {
              throw e;
          }
          
          // Wait long enough to allow object to expire and exceed TTL
          Thread.sleep(TEST_TIMETOLIVE +5000);
          
          // Try to get expired object
          try
          {
              retrievedObject = null;
              retrievedObject = globalCache.getObject(cacheKey);
              assertNull( "Retrieved a cached object, after exceeding TimeToLive", retrievedObject);
          }
          catch (ObjectExpiredException e)
          {
              assertNull( "Retrieved the expired cached object, but caught expected ObjectExpiredException exception", retrievedObject);
          }
          catch (Exception e)
          {
              throw e;
          }
      }
  
      /**
       * Simple object that can be refreshed
       */
      class RefreshableObject implements Refreshable
      {
          
          private int refreshCount = 0;
          
          /**
           * Increment the refresh counter
           */
          public void refresh()
          {
              this.refreshCount++;
          }
          
          /**
           * Reutrn the number of time this object has been refreshed
           *
           * @return Number of times refresh() has been called
           */
          public int getRefreshCount()
          {
              return this.refreshCount;
          }
      }
  }
  
  
  
  1.1                  jakarta-turbine-2/src/rttest/org/apache/turbine/services/xmlrpc/util/FileHandlerTest.java
  
  Index: FileHandlerTest.java
  ===================================================================
  package org.apache.turbine.services.xmlrpc.util;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Turbine" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.util.Vector;
  
  import java.net.URL;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.turbine.test.BaseTestCase;
  import org.apache.turbine.services.xmlrpc.TurbineXmlRpc;
  
  /**
   * Test class for FileHandler.
   *
   * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
   * @version $Id: FileHandlerTest.java,v 1.1 2002/02/01 03:20:00 brekke Exp $
   */
  public class FileHandlerTest extends BaseTestCase
  {
      /**
       * Creates a new instance.
       */
      public FileHandlerTest(String name)
      {
          super(name);
      }
  
      /**
       * Creates a test suite for this class.
       *
       * @return A test suite for this class.
       */
      public static Test suite()
      {
          return new TestSuite(FileHandlerTest.class);
      }
  
      /**
       * Test to make sure that the FileHandler is working
       * correctly for files moving from the client to
       * the server.
       */
      public void testSend() throws Exception
      {
          FileTransfer.send("http://localhost:9000/RPC2",
                            "test.location",
                            "test.txt",
                            "test.location",
                            "test.send");
      }
  
      /**
       * Test to make sure that the FileHandler is working
       * correctly for files moving from the server to
       * the client.
       */
      public void testGet() throws Exception
      {
          FileTransfer.get("http://localhost:9000/RPC2",
                           "test.location",
                           "test.txt",
                           "test.location",
                           "test.get");
      }
  
      /**
       * Test to make sure that the FileHandler is working
       * correctly to remove files from the server.
       */
      public void testRemove() throws Exception
      {
          FileTransfer.remove("http://localhost:9000/RPC2",
                              "test.location",
                              "test.txt");
      }
  
  
  }
  
  
  
  1.1                  jakarta-turbine-2/src/rttest/testapp/WEB-INF/conf/TurbineCacheTest.properties
  
  Index: TurbineCacheTest.properties
  ===================================================================
  # -------------------------------------------------------------------
  # $Id: TurbineCacheTest.properties,v 1.1 2002/02/01 03:20:00 brekke Exp $
  #
  # This is the configuration file for Turbine.
  #
  # Note that strings containing "," (comma) characters must backslash 
  # escape the comma (i.e. '\,')
  #
  # -------------------------------------------------------------------
  
  # -------------------------------------------------------------------
  # 
  #  L O G S
  #
  # -------------------------------------------------------------------
  # This is the configuration for the logging system. In most cases
  # you don't need to modify anything. However, if you wish to add more
  # facilities or modify the existing settings, then you can do so.
  #
  # destination.file: A path relative to the web app root
  # -------------------------------------------------------------------
  services.LoggingService.facilities=system,debug,security
  services.LoggingService.default=debug
  services.LoggingService.loggingConfig=org.apache.turbine.services.logging.PropertiesLoggingConfig
  
  # A facility for system logging.
  services.LoggingService.system.destination.file=/logs/turbine.log
  services.LoggingService.system.className=org.apache.turbine.services.logging.FileLogger
  services.LoggingService.system.level=INFO
  
  # A facility for the scheduler service
  # To disable started/stopped messages set the level to ERROR
  services.LoggingService.scheduler.destination.file=/logs/turbine.log
  services.LoggingService.scheduler.className=org.apache.turbine.services.logging.FileLogger
  services.LoggingService.scheduler.level=INFO
  
  # A facility for debugging applications. Messages will go both
  # to the log file and the server console.
  services.LoggingService.debug.destination.file=/logs/turbine.log
  services.LoggingService.debug.destination.console=false
  services.LoggingService.debug.className=org.apache.turbine.services.logging.FileLogger
  services.LoggingService.debug.level=DEBUG
  
  # A facility for SQL query logging
  # To enable SQL query logging, set the system and sql log level to DEBUG
  services.LoggingService.sql.destination.file=/logs/turbine.log
  services.LoggingService.sql.className=org.apache.turbine.services.logging.FileLogger
  services.LoggingService.sql.level=ERROR
  
  # A facility for security audit. NOTE! As of 23 Jan 2001
  # Turbine does not have any standard security auditing
  # functionality. It's up to your application.
  services.LoggingService.security.destination.file=/logs/turbine.log
  services.LoggingService.security.className=org.apache.turbine.services.logging.FileLogger
  services.LoggingService.security.level=INFO
  
  # An example configuration for automatic log rotation using Log4Java
  # This will keep the log file size under 1MB and save up to 5 backup copies
  services.LoggingService.rotation.destination.file=/logs/turbine.log
  services.LoggingService.rotation.file.size=1048576
  services.LoggingService.rotation.file.backups=5
  services.LoggingService.rotation.className=org.apache.turbine.services.logging.Log4JavaLogger
  services.LoggingService.rotation.level=INFO
  
  # An example configuration for using *NIX syslogd with Log4Java
  services.LoggingService.syslog.destination.syslogd.host=my.syslog.server.com
  services.LoggingService.syslog.destination.syslogd.facility=LOG_DAEMON
  services.LoggingService.syslog.className=org.apache.turbine.services.logging.Log4JavaLogger
  services.LoggingService.syslog.level=INFO
  
  # An example configuration for using remote Log4Java server
  services.LoggingService.remote.destination.remote.host=my.remote.server.com
  services.LoggingService.remote.destination.remote.port=1099
  services.LoggingService.remote.className=org.apache.turbine.services.logging.Log4JavaLogger
  services.LoggingService.remote.level=INFO
  
  # An example configuration for sending error reports as email with Log4Java
  # notes: 
  # * uses 'mail.server' as SMTP server to send mail through
  # * log4j will send the email when an ERROR is logged, with
  #   'buffer.size' previous (non-ERROR) logs included in the email
  # * configured to log to a file as well otherwise stacktraces are lost
  services.LoggingService.email.destination.file=/logs/turbine.log
  services.LoggingService.email.destination.email.from=root@localhost
  services.LoggingService.email.destination.email.to=root@localhost
  services.LoggingService.email.destination.email.subject=Turbine Error Report
  services.LoggingService.email.destination.email.buffer.size=512
  services.LoggingService.email.className=org.apache.turbine.services.logging.Log4JavaLogger
  services.LoggingService.email.level=INFO
  
  # -------------------------------------------------------------------
  # 
  #  M A I L  S E R V E R 
  #
  # -------------------------------------------------------------------
  # Your mail server for outgoing email.
  #
  # Default: null
  # -------------------------------------------------------------------
  
  mail.server=
  
  # -------------------------------------------------------------------
  # SMTP-From header for your outgoing messages
  #
  # All failed delivery messages will be returned to this address.
  # If unset, these messages will be sent to the address in the 
  # From header (standard behaviour)
  #
  # Default: null
  # -------------------------------------------------------------------
  
  mail.smtp.from=
  
  # -------------------------------------------------------------------
  # 
  #  M O D U L E  C A C H I N G
  #
  # -------------------------------------------------------------------
  # This determines whether or not to cache the modules in memory.  For
  # development, turn this off.  For production, turn this on.
  #
  # Default: false
  # -------------------------------------------------------------------
  
  module.cache=false
  
  # If module.cache=true, then how large should we make the hashtables
  # by default.
  
  action.cache.size=20
  layout.cache.size=10
  navigation.cache.size=10
  page.cache.size=5
  screen.cache.size=50
  scheduledjob.cache.size=10
  
  # -------------------------------------------------------------------
  # 
  #  M O D U L E  P A C K A G E S
  #
  # -------------------------------------------------------------------
  # This is the "classpath" for Turbine.  In order to locate your own
  # modules, you should add them to this path.  For example, if you have
  # com.company.actions, com.company.screens, com.company.navigations,
  # then this setting would be "com.company,org.apache.turbine.modules".
  # This path is searched in order.  For example, Turbine comes with a
  # screen module named "Login".  If you wanted to have your own screen
  # module named "Login", then you would specify the path to your
  # modules before the others.
  #
  # Default: org.apache.turbine.modules
  # -------------------------------------------------------------------
  
  module.packages=org.apache.turbine.modules
  
  # -------------------------------------------------------------------
  # 
  #  D A T A B A S E  S E T T I N G S
  #
  # -------------------------------------------------------------------
  # These are your database settings.  Look in the
  # org.apache.turbine.util.db.pool.* packages for more information.
  # The default driver for Turbine is for MySQL.
  #
  # The parameters to connect to the default database.  You MUST
  # configure these properly.
  # -------------------------------------------------------------------
  
  database.default.driver=org.gjt.mm.mysql.Driver
  database.default.url=jdbc:mysql://localhost:3306/Turbine
  database.default.username=username
  database.default.password=password
  
  # The number of database connections to cache per ConnectionPool
  # instance (specified per database).
  
  database.default.maxConnections=3
  
  # The amount of time (in milliseconds) that database connections will be
  # cached (specified per database).
  #
  # Default: one hour = 60 * 60 * 1000
  
  database.default.expiryTime=3600000
  
  # The amount of time (in milliseconds) a connection request will have to wait
  # before a time out occurs and an error is thrown.
  #
  # Default: ten seconds = 10 * 1000
  
  database.connectionWaitTimeout=10000
  
  # The interval (in milliseconds) between which the PoolBrokerService logs 
  # the status of it's ConnectionPools.
  #
  # Default: No logging = 0 = 0 * 1000
  
  database.logInterval=0
  
  # These are the supported JDBC drivers and their associated Turbine
  # adaptor.  These properties are used by the DBFactory.  You can add
  # all the drivers you want here.
  
  database.adaptor=DBMM
  database.adaptor.DBMM=org.gjt.mm.mysql.Driver
  
  # Determines if the quantity column of the IDBroker's id_table should
  # be increased automatically if requests for ids reaches a high
  # volume.
  
  database.idbroker.cleverquantity=true
  
  # Determines if IDBroker should prefetch IDs or not.  If set to false
  # this property has the effect of shutting off the housekeeping thread
  # that attempts to prefetch the id's.  It also sets the # of id's grabbed
  # per request to 1 regardless of the settings in the database.
  # Default: true
  
  database.idbroker.prefetch=true
  
  # -------------------------------------------------------------------
  # 
  #  F R A M E W O R K  S E T T I N G S
  #
  # -------------------------------------------------------------------
  # These are settings that control the behaviour of the framework,
  # such as determining whether a template system is in use, what
  # the default templates and screens are and session handling settings.
  # -------------------------------------------------------------------
  
  # Used to set the template homepage if you are using a template
  # layout.
  #
  # Default: /Index.vm
  
  template.homepage=/Index.vm
  
  # This is the default screen to show to people when they first access
  # the system. Specify one of the template screens such as VelocityScreen
  # to use a template system. 
  #
  # Default: Login
  
  screen.homepage=
  
  # This is the template that is shown on an incorrect login attempt. 
  # Setting this property will override any value of screen.login specfied
  # below.
  #
  # Default: Login.vm
  
  template.login=/Login.vm
  
  # This is the page that is shown on an incorrect login attempt.  It is
  # referenced in the LoginUser action. Note that it will only be used if
  # a login template has not been specified (see template.login above).
  #
  # Default: Login
  
  screen.login=
  
  # This is the template that is used by the respective Template based 
  # ErrorScreen for displaying the error. If you are not using a Template based 
  # ErrorScreen, then this is ignored.
  #
  # Default: /Error.vm
  
  template.error=/Error.vm
  
  # This is the default error screen.
  #
  # Default: VelocityErrorScreen
  
  screen.error=VelocityErrorScreen
  
  # This is the screen that is displayed when the user's web page is in
  # an invalid state.
  #
  # Default: error.InvalidState
  
  screen.invalidstate=error.InvalidState
  
  # Set the default Doctype.  The default Doctype can be set by using
  # the single strings: Html40Strict, Html40Transitional, or
  # Html40Frameset.  Additionally the default can be supplied as two
  # strings separated by a comma giving the DTD and URI.
  #
  # Default: ignored if not set to some value.
  
  default.doctype=Html40Transitional
  
  # This is the default action to log a user in.
  
  action.login=LoginUser
  
  # This is the default action to log a user out.
  
  action.logout=LogoutUser
  
  # This is the default action to validate whether or not a session is
  # valid.  For example, if you want to make sure if a user has already
  # logged in or not.
  #
  # Default: SessionValidator
  
  action.sessionvalidator=sessionvalidator.TemplateSessionValidator
  
  # This is the timeout in seconds for sessions. If left commented out, the
  # servlet container's default timeout will be left as is.
  
  # session.timeout=1800
  
  # This is the default action that builds up the AccessControlList for
  # the individual users session.
  
  action.accesscontroller=AccessController
  
  # -------------------------------------------------------------------
  # 
  #  J N D I  C O N T E X T S
  #
  # -------------------------------------------------------------------
  
  # This indicates whether Turbine should try to create JNDI contexts.
  #
  # Default: false
  #
  # contexts=true
  
  # These are the JNDI context properties.  Each context's properties
  # are defined by the properties beginning with context.name.
  #
  # Default: none
  #
  # Example: The following will create a JNDI context named "name" in
  # the data.contexts Hashtable.  It will point at the RMI registry on
  # localhost running on port 1099, and will use
  # com.sun.jndi.rmi.registry.RegistryContextFactory as the initial
  # context factory:
  #
  # context.name.java.naming.provider.url=rmi://localhost:1099
  # context.name.java.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory
  
  # -------------------------------------------------------------------
  # 
  #  P E E R S
  #
  # -------------------------------------------------------------------
  # Supplies Turbine with information about the database schema, which
  # can simplify any required Peer classes.
  #
  # Default: org.apache.turbine.util.db.map.TurbineMapBuilder
  # -------------------------------------------------------------------
  
  database.maps.builder=org.apache.turbine.util.db.map.TurbineMapBuilder
  
  # -------------------------------------------------------------------
  # 
  #  M E S S A G E S
  #
  # -------------------------------------------------------------------
  # Note that strings containing "," (comma) characters must backslash 
  # escape the comma (i.e. '\,')
  
  # The message that can be displayed before a user logs in.
  
  login.message=Thank you for your visit. Please log into the system.
  
  # The message that can be displayed when no screen is defined.
  
  login.message.noscreen=There has been an error. Your session is valid but the screen variable is not defined.
  
  # The message that can be displayed when a user enters an incorrect
  # password or username.
  
  login.error=Sorry your username or password is incorrect!
  
  # The message that can be displayed when a user logs out.
  
  logout.message=Thank you for using the system. Please come back soon.
  
  # -------------------------------------------------------------------
  # 
  #  S E C U R E  S O C K E T S  L A Y E R
  #
  # -------------------------------------------------------------------
  # Whether the web server is able to use SSL.  Links in Turbine can
  # check this property to determine if SSL can be used.
  #
  # Default: true
  # -------------------------------------------------------------------
  
  use.ssl=true
  
  # -------------------------------------------------------------------
  # 
  #  S E R V I C E S
  #
  # -------------------------------------------------------------------
  # Classes for Turbine Services should be defined here.
  # Format: services.[name].classname=[implementing class]
  #
  # To specify properties of a service use the following syntax:
  # service.[name].[property]=[value]
  #
  # The order that these services is listed is important! The
  # order that is stated here is the order in which the services
  # will be initialized. Keep this is mind if you have services
  # that depend on other services during initialization.
  # -------------------------------------------------------------------
  services.ResourceService.classname=org.apache.turbine.services.resources.TurbineResourceService
  services.LoggingService.classname=org.apache.turbine.services.logging.TurbineLoggingService
  services.FactoryService.classname=org.apache.turbine.services.factory.TurbineFactoryService
  services.PoolService.classname=org.apache.turbine.services.pool.TurbinePoolService
  services.RunDataService.classname=org.apache.turbine.services.rundata.TurbineRunDataService
  services.ServletService.classname=org.apache.turbine.services.servlet.TurbineServletService
  services.AssemblerBrokerService.classname=org.apache.turbine.services.assemblerbroker.TurbineAssemblerBrokerService
  services.LocalizationService.classname=org.apache.turbine.services.localization.TurbineLocalizationService
  services.MimeTypeService.classname=org.apache.turbine.services.mimetype.TurbineMimeTypeService
  services.GlobalCacheService.classname=org.apache.turbine.services.cache.TurbineGlobalCacheService
  services.SchedulerService.classname=org.apache.turbine.services.schedule.TurbineSchedulerService
  services.XmlRpcService.classname=org.apache.turbine.services.xmlrpc.TurbineXmlRpcService
  services.UniqueIdService.classname=org.apache.turbine.services.uniqueid.TurbineUniqueIdService
  services.UploadService.classname=org.apache.turbine.services.upload.TurbineUploadService
  services.SecurityService.classname=org.apache.turbine.services.security.db.DBSecurityService
  services.PoolBrokerService.classname=org.apache.turbine.services.db.TurbinePoolBrokerService
  services.MapBrokerService.classname=org.apache.turbine.services.db.TurbineMapBrokerService
  services.PullService.classname=org.apache.turbine.services.pull.TurbinePullService
  #services.IntakeService.classname=org.apache.turbine.services.intake.TurbineIntakeService
  services.TemplateService.classname=org.apache.turbine.services.template.TurbineTemplateService
  services.XSLTService.classname=org.apache.turbine.services.xslt.TurbineXSLTService
  
  # Turn on the appropriate template service.
  services.VelocityService.classname=org.apache.turbine.services.velocity.TurbineVelocityService
  
  # -------------------------------------------------------------------
  #
  #  P O O L / M A P  B R O K E R
  #
  # -------------------------------------------------------------------
  # Default value: default
  # -------------------------------------------------------------------
  
  services.PoolBrokerService.defaultPool = default
  services.MapBrokerService.defaultMap = default
  
  # -------------------------------------------------------------------
  #
  #  R U N   D A T A   S E R V I C E
  #
  # -------------------------------------------------------------------
  # Default implementations of base interfaces for request processing.
  # Additional configurations can be defined by using other keys
  # in the place of the <default> key.  
  # -------------------------------------------------------------------
  
  services.RunDataService.default.run.data=org.apache.turbine.services.rundata.DefaultTurbineRunData
  services.RunDataService.default.parameter.parser=org.apache.turbine.util.parser.DefaultParameterParser
  services.RunDataService.default.cookie.parser=org.apache.turbine.util.parser.DefaultCookieParser
  
  # -------------------------------------------------------------------
  #
  #  C A C H E   S E R V I C E
  #
  # -------------------------------------------------------------------
  
  # Interval at which the cache will be checked. The default is
  # 5000ms or 5 seconds.
  
  services.GlobalCacheService.cache.check.frequency = 5000
  
  # -------------------------------------------------------------------
  # 
  #  A S S E M B L E R  B R O K E R  S E R V I C E
  #
  # -------------------------------------------------------------------
  # A list of AssemblerFactory classes that will be registered 
  # with TurbineAssemblerBrokerService
  # -------------------------------------------------------------------
  
  services.AssemblerBrokerService.screen=org.apache.turbine.services.assemblerbroker.util.java.JavaScreenFactory
  #services.AssemblerBrokerService.screen=org.apache.turbine.services.assemblerbroker.util.python.PythonScreenFactory
  services.AssemblerBrokerService.action=org.apache.turbine.services.assemblerbroker.util.java.JavaActionFactory
  services.AssemblerBrokerService.layout=org.apache.turbine.services.assemblerbroker.util.java.JavaLayoutFactory
  services.AssemblerBrokerService.page=org.apache.turbine.services.assemblerbroker.util.java.JavaPageFactory
  services.AssemblerBrokerService.navigation=org.apache.turbine.services.assemblerbroker.util.java.JavaNavigationFactory
  services.AssemblerBrokerService.scheduledjob=org.apache.turbine.services.assemblerbroker.util.java.JavaScheduledJobFactory
  
  # -------------------------------------------------------------------
  # 
  #  T E M P L A T E  S E R V I C E
  #
  # -------------------------------------------------------------------
  
  # Roughly, the number of templates in each category.
  #
  # Defaults: layout=2, navigation=10, screen=50
  
  services.TemplateService.layout.cache.size=2
  services.TemplateService.navigation.cache.size=10
  services.TemplateService.screen.cache.size=50
  
  # -------------------------------------------------------------------
  # 
  #  P U L L  S E R V I C E
  #
  # -------------------------------------------------------------------
  # These are the properties for the Pull Service, the service
  # that works in conjuction with the Turbine Pull Model API.
  # -------------------------------------------------------------------
  
  # This determines whether the non-request tools are refreshed 
  # on each request (request tools aren't ever, because they're
  # instantiated for the request only anyway).
  services.PullService.tools.per.request.refresh=true
  
  # These are tools that are placed in the context by the service
  # These tools will be made available to all your
  # templates. You list the tools in the following way:
  #
  # tool.<scope>.<id> = <classname>
  #
  # <scope>      is the tool scope: global, request, session
  #              or persistent (see below for more details)
  # <id>         is the name of the tool in the context
  #
  # You can configure the tools in this way:
  # tool.<id>.<parameter> = <value>
  #
  # So if you find "global", "request", "session" or "persistent" as second
  # part, it is a configuration to put a tool into the toolbox, else it is a
  # tool specific configuration.
  #
  # For example:
  #
  # tool.global.ui    = org.apache.turbine.util.pull.UIManager
  # tool.global.mm    = org.apache.turbine.util.pull.MessageManager
  # tool.request.link = org.apache.turbine.util.template.TemplateLink
  # tool.request.page = org.apache.turbine.util.template.TemplatePageAttributes
  #
  # Then:
  #
  # tool.ui.skin = default
  # 
  # configures the value of "skin" for the "ui" tool.
  #
  # Tools are accessible in all templates by the <id> given
  # to the tool. So for the above listings the UIManager would
  # be available as $ui, the MessageManager as $mm, the TemplateLink
  # as $link and the TemplatePageAttributes as $page.
  #
  # You should avoid using tool names called "global", "request",
  # "session" or "persistent" because of clashes with the possible Scopes.
  #
  # Scopes:
  #
  #   global:     tool is instantiated once and that instance is available
  #               to all templates for all requests. Tool must be threadsafe.
  #
  #   request:    tool is instantiated once for each request (although the
  #               PoolService is used to recycle instances). Tool need not
  #               be threadsafe.
  #
  #   session:    tool is instantiated once for each user session, and is
  #               stored in the user's temporary hashtable. Tool should be 
  #               threadsafe.
  #
  #   persistent: tool is instantitated once for each use session, and
  #               is stored in the user's permanent hashtable. This means
  #               for a logged in user the tool will be persisted in the
  #               user's objectdata. Tool should be threadsafe and 
  #               Serializable.
  #
  # Defaults: none
  
  tool.request.link=org.apache.turbine.util.template.TemplateLink
  tool.request.page=org.apache.turbine.util.template.TemplatePageAttributes
  tool.request.content=org.apache.turbine.util.ContentURI
  tool.request.l10n=org.apache.turbine.services.localization.LocalizationTool
  tool.request.flux=org.apache.turbine.flux.tools.FluxTool
  
  # These are intake tools.
  #tool.request.om=org.apache.turbine.om.OMTool
  #tool.request.intake=org.apache.turbine.services.intake.IntakeTool
  
  tool.global.ui=org.apache.turbine.services.pull.util.UIManager
  
  # The UI Manager will allow you to skin your Turbine
  # application using simple properties files that are
  # located in the WEBAPP/resources/ui/skins/ directory
  # hierarchy.
  
  tool.ui.skin=default
  
  # -------------------------------------------------------------------
  # 
  #  V E L O C I T Y  S E R V I C E
  #
  # -------------------------------------------------------------------
  
  # The location of Velocity configuration file, relative to webapp root
  # These properties will override the default properties set by Velocity.
  # You should specify the path to the templates directories as well as 
  # the path to the log file and they should also be relative to webapp root
  
  services.VelocityService.template.extension=vm
  services.VelocityService.default.page = VelocityPage
  services.VelocityService.default.screen=VelocityScreen
  services.VelocityService.default.layout = VelocityECSLayout
  services.VelocityService.default.navigation=VelocityNavigation
  services.VelocityService.default.error.screen = VelocityErrorScreen
  services.VelocityService.default.layout.template = /Default.vm
  
  services.VelocityService.runtime.log=/logs/velocity.log
  #services.VelocityService.input.encoding=UTF-8
  services.VelocityService.velocimacro.library = GlobalMacros.vm
  
  services.VelocityService.resource.loader = file
  services.VelocityService.file.resource.loader.description = Velocity File Resource Loader
  services.VelocityService.file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader
  services.VelocityService.file.resource.loader.path = /templates/app
  services.VelocityService.file.resource.loader.cache = false
  services.VelocityService.file.resource.loader.modificationCheckInterval = 2
  
  services.VelocityService.resource.loader = classpath
  services.VelocityService.classpath.resource.loader.description = Velocity Classpath Resource Loader
  services.VelocityService.classpath.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
  
  # -------------------------------------------------------------------
  # 
  #  J S P  S E R V I C E
  #
  # -------------------------------------------------------------------
  
  services.JspService.template.extension=jsp
  services.JspService.default.page = JspPage
  services.JspService.default.screen=BaseJspScreen
  services.JspService.default.layout = JspLayout
  services.JspService.default.navigation=BaseJspNavigation
  services.JspService.default.error.screen = JspErrorScreen
  services.JspService.default.layout.template = /Default.jsp
  
  services.JspService.templates = /templates/app
  services.JspService.buffer.size = 8192
  
  # -------------------------------------------------------------------
  # 
  #  W E B M A C R O  S E R V I C E
  #
  # the webmacro-service is deprecated. you should use velocity instead!
  # see http://jakarta.apache.org/velocity/migration.html
  #
  # -------------------------------------------------------------------
  
  services.WebMacroService.template.extension=wm
  services.WebMacroService.default.page = WebMacroSitePage
  services.WebMacroService.default.screen=WebMacroSiteScreen
  services.WebMacroService.default.layout = WebMacroSiteLayout
  services.WebMacroService.default.navigation=WebMacroSiteNavigation
  services.WebMacroService.default.error.screen = WebMacroSiteErrorScreen
  services.WebMacroService.default.layout.template = /Default.wm
  
  # The location of WebMacro configuration file, relative to webapp
  # root.
  
  services.WebMacroService.properties=/WEB-INF/conf/WebMacro.properties
  
  # The path where WebMacro will look for templates, relative to webapp
  # root.  Use your system's path separator to specify multiple paths.
  
  services.WebMacroService.templates=/templates/app
  
  # The class that will act as a template provider in webmacro.  We can
  # use default class from WebMacro (template path above is pushed into
  # WebMacro configuration mechanism, so that class can pick it up), or
  # some other custom class
  
  services.WebMacroService.templates.provider=org.apache.turbine.services.webmacro.TurbineTemplateProvider
  
  # -------------------------------------------------------------------
  # 
  #  F R E E M A R K E R  S E R V I C E
  #
  # the freemarker-service is deprecated. you should use velocity instead!
  # see http://jakarta.apache.org/velocity
  # -------------------------------------------------------------------
  
  # The path where FreeMarker will look for templates, relative to
  # webapp root, if supported by the servlet engine.
  #
  # Default: /templates
  
  services.FreeMarkerService.templates=/templates
  
  # -------------------------------------------------------------------
  # 
  #  U P L O A D  S E R V I C E
  #
  # -------------------------------------------------------------------
  
  # Whether the files should be automatically picked up by
  # ParameterParser.
  
  services.UploadService.automatic=true
  
  #
  # The directory where files will be temporarily stored.
  #
  services.UploadService.repository=.
  
  #
  # The maximum size of a request that will be processed.
  #
  services.UploadService.size.max=1048576
  
  #
  # The maximum size of a request that will have it's elements cached in
  # memory by TurbineUploadService class.
  #
  services.UploadService.size.threshold=10240
  
  # -------------------------------------------------------------------
  # 
  #  L O C A L I Z A T I O N  S E R V I C E
  #
  # -------------------------------------------------------------------
  
  # Default ResourceBundle and language/country codes used by the
  # TurbineLocalizationService.
  #
  locale.default.bundle=MyBundle
  locale.default.language=en
  locale.default.country=US
  
  #
  # This will set the charset= portion of the ContentType: header.
  # Leave commented out unless you want to return stuff as a different
  # charset.
  #
  # locale.default.charset=
  
  # -------------------------------------------------------------------
  # 
  #  M I M E T Y P E  S E R V I C E
  #
  # -------------------------------------------------------------------
  
  # This property specifies a file containing mappings between MIME 
  # content types and the corresponding file name extensions. The
  # service itself contains a hardcoded set of most common mappings. 
  # The file must use the same syntax as the mime.types file of 
  # the Apache Server, i.e. 
  # <mimetype> <ext1> <ext2>...
  #
  #services.MimeTypeService.mime.types=/WEB-INF/conf/mime.types
  
  # This property specifies a file containing mappings between locales 
  # and the corresponding character encodings. The service itself 
  # contains a hardcoded set of most common mappings. 
  # The file should use the Java property file syntax, i.e. 
  # <lang_country_variant>=<charset>
  #
  #services.MimeTypeService.charsets=/WEB-INF/conf/charset.properties
  
  # -------------------------------------------------------------------
  # 
  #  S C H E D U L E R  S E R V I C E
  #
  # -------------------------------------------------------------------
  
  #
  # Set enabled to true to start the scheduler.
  #
  # Default = false
  #
  scheduler.enabled=false
  
  
  # -------------------------------------------------------------------
  # 
  #  S E C U R I T Y  S E R V I C E
  #
  # -------------------------------------------------------------------
  
  #
  # This is the class that implements the User interface.
  # You want to override this setting only if you want your User 
  # implementation to provide application specific addtional 
  # functionality.
  #
  # Default: org.apache.turbine.om.security.TurbineUser
  #
  
  services.SecurityService.user.class=org.apache.turbine.om.security.TurbineUser
  
  #
  # This setting is DBSecurityService specific - this class is consulted for the names
  # of the columns in the users' tables for the purpose of creating join queries. 
  # If you use your own User implementation in conjunction with DBSecurityService,
  # it's peer class must implement org.apache.turbine.om.security.peer.UserPeer interface,
  # and you need to specify the name of the peer class here.
  #
  # Defalut: org.apache.turbine.om.security.peer.TurbineUserPeer
  #
  services.SecurityService.userPeer.class=org.apache.turbine.om.security.peer.TurbineUserPeer
  
  #
  # This is the class that implements UserManager interface.
  # Override this setting if you want your User information stored
  # on a different medium (LDAP directory is a good example).
  # Default implementation uses Peers and a relational database .
  #
  
  services.SecurityService.user.manager=org.apache.turbine.services.security.db.DBUserManager
  
  #
  # This is used by the SecurityService to make the password checking
  # secure. When enabled, passwords are transformed by a one-way
  # function into a sequence of bytes that is base64 encoded.
  # It is impossible to guess the plain-text form of the password
  # from the representation. When user logs in, the entered password
  # is transformed the same way and then compared with stored value.
  #
  # Default: false
  #
  
  services.SecurityService.secure.passwords=false
  
  #
  # This property lets you choose what digest algorithm will be used
  # for encrypting passwords. Check documentation of your JRE for
  # available algorithms.
  #
  # Default: SHA
  #
  
  services.SecurityService.secure.passwords.algorithm=SHA
  
  # Configuration for the LDAP Security Service implementation
  
  #services.SecurityService.ldap.security.athentication=simple
  #services.SecurityService.ldap.port=<LDAP PORT>
  #services.SecurityService.ldap.host=<LDAP HOST>
  #services.SecurityService.ldap.admin.username=<ADMIN USERNAME>
  #services.SecurityService.ldap.admin.password=<ADMIN PASSWORD>
  #services.SecurityService.ldap.user.basesearch=<SEARCH PATTERN>
  #services.SecurityService.ldap.user.search.filter=<SEARCH FILTER>
  #services.SecurityService.ldap.dn.attribute=userPrincipalName
  #services.SecurityService.ldap.provider=com.sun.jndi.ldap.LdapCtxFactory
  
  # -------------------------------------------------------------------
  # 
  #  X M L R P C  S E R V I C E
  #
  # -------------------------------------------------------------------
  # This property specifies which class should be used to parse
  # xml for XmlRpc functionality.
  #
  # Default: org.apache.xerces.parsers.SAXParser
  
  services.XmlRpcService.parser=org.apache.xerces.parsers.SAXParser
  
  # This property specifies which port the server part of the XmlRpc
  # should listen, if it is active.
  #
  # Default: 12345
  
  services.XmlRpcService.port=12345
  
  # If any classes are specified here, the Service will create an 
  # instance of them here and start up a listener on the specified 
  # port.
  #
  # Note that the handlers demonstrated are not very useful.  You
  # will have to invent your own services.  They do however
  # illustrate that any class with a default constructor can be
  # added here
  #
  # The handler parameter without further extension determines
  # the default handler for the service
  #
  # Default: no classes are specified by default
  
  #services.XmlRpcService.handler.$default=java.util.Hashtable
  #services.XmlRpcService.handler.stringhandler=java.lang.String
  
  # The following properties allow the transfer of data between
  # separate Turbine applications running on different servers.
  # This allows B2B type behavior such as sending database
  # updates in the form of XML or whatever type of data
  # that needs to be shared between Turbine applications
  # running on separate servers.
  
  services.XmlRpcService.handler.file = org.apache.turbine.services.xmlrpc.util.FileHandler
  services.XmlRpcService.paranoid = false
  services.XmlRpcService.acceptClient = 192.168.1.*
  services.XmlRpcService.denyClient = 
  
  # Do we want a secure server
  
  services.XmlRpcService.secure.server = false
  
  # Secure server options
  
  services.XmlRpcService.secure.server.option.java.protocol.handler.pkgs = \
      com.sun.net.ssl.internal.www.protocol
  
  services.XmlRpcService.secure.server.option.security.provider = \
      com.sun.net.ssl.internal.ssl.Provider
  
  services.XmlRpcService.secure.server.option.security.protocol = TLS
  
  # You probably want to keep your key stores and trust stores
  # clear out of your webapp.
  
  services.XmlRpcService.secure.server.option.javax.net.ssl.keyStore = /tmp/keystore
  services.XmlRpcService.secure.server.option.javax.net.ssl.keyStoreType = jks
  services.XmlRpcService.secure.server.option.javax.net.ssl.keyStorePassword = password 
  services.XmlRpcService.secure.server.option.javax.net.ssl.trustStore = /tmp/truststore
  services.XmlRpcService.secure.server.option.javax.net.ssl.trustStoreType = jks
  services.XmlRpcService.secure.server.option.javax.net.ssl.trustStorePassword = password 
  
  services.XmlRpcService.secure.server.option.sun.ssl.keymanager.type = SunX509
  services.XmlRpcService.secure.server.option.sun.ssl.trust.manager.type = SunX509
  
  # These values should be set to 'all' for debugging purposes.
  
  services.XmlRpcService.secure.server.option.javax.net.debug = none
  services.XmlRpcService.secure.server.option.java.security.debug = none
  
  # -------------------------------------------------------------------
  # 
  #  P O O L  S E R V I C E
  #
  # -------------------------------------------------------------------
  
  # Default capacity of pools of the Object pooling service.
  #
  # Default: 128
  services.PoolService.pool.capacity = 128
  
  # Class specific capacities used instead of the default if specified.
  #
  #services.PoolService.pool.capacity.org.apache.turbine.services.rundata.DefaultTurbineRunData=512
  
  # -------------------------------------------------------------------
  # 
  #  F A C T O R Y  S E R V I C E
  #
  # -------------------------------------------------------------------
  
  # A comma separated list of classloaders (very optional)
  #
  # Example: org.foo.bar.MyClassLoader, org.ack.joe.YourClassLoader
  #
  #services.FactoryService.class.loaders=
  
  # Customized factories to be used instead of the default factory.
  # E.g. to instantiate XML parsers, SSL sockets, etc., which require
  # specific instantiation not supported by the default factory.
  # The property name is prefixed with "factory" followed by the
  # name of the production class. The value is the class name of
  # the factory implementing the Factory interface. The factory
  # will be instantiated by using the service itself.
  #
  # Examples:
  #
  # services.FactoryService.factory.javax.xml.parsers.DocumentBuilder=org.foo.xml.DomBuilderFactory
  # services.FactoryService.factory.javax.xml.parsers.SAXParser=org.foo.xml.SaxParserFactory
  # services.FactoryService.factory.java.net.ServerSocket=org.foo.net.SslServerSocketFactory
  
  #--------------------------------------------------------------------
  #
  # X S L T  S E R V I C E
  #
  #--------------------------------------------------------------------
  
  services.XSLTService.path = /path/to/stylesheets
  services.XSLTService.cache = false
  
  # -------------------------------------------------------------------
  #
  #  I N T A K E   S E R V I C E
  #
  # -------------------------------------------------------------------
  
  # The location of the xml file specifying valid inputs
  #
  # Example: org.foo.bar.MyClassLoader, org.ack.joe.YourClassLoader
  #
  services.IntakeService.xml.path=WEB-INF/conf/intake.xml
  
  #--------------------------------------------------------------------
  #
  # P A R A M E T E R  P A R S E R
  #
  #--------------------------------------------------------------------
  #
  # This variable controls the case folding applied to URL variable
  # names.
  #
  # Allowed values: none, lower, upper
  # Default: lower
  #
  
  url.case.folding=lower
  
  # -------------------------------------------------------------------
  # 
  #  A D D I T I O N A L  P R O P E R T I E S
  #
  # -------------------------------------------------------------------
  # The full path name to an additional properties file. Properties in 
  # this file will be included in this property set. Duplicate name 
  # values will be replaced, so be careful.
  #
  # Default: none
  # -------------------------------------------------------------------
  
  
  
  
  
  1.1                  jakarta-turbine-2/src/test/org/apache/turbine/test/BaseTestCase.java
  
  Index: BaseTestCase.java
  ===================================================================
  package org.apache.turbine.test;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and 
   *    "Apache Turbine" must not be used to endorse or promote products 
   *    derived from this software without prior written permission. For 
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without 
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import junit.framework.TestCase;
  
  /**
   * Base functionality to be extended by all Apache Turbine test cases.  Test 
   * case implementations are used to automate testing via JUnit.
   *
   * @author <a href="mailto:celkins@scardini.com">Christopher Elkins</a>
   * @version $Id: BaseTestCase.java,v 1.1 2002/02/01 03:20:00 brekke Exp $
   */
  public abstract class BaseTestCase extends TestCase
  {
      /**
       * Creates a new instance.
       */
      public BaseTestCase(String name)
      {
          super(name);
      }
  }
  
  
  
  1.1                  jakarta-turbine-2/src/test/org/apache/turbine/util/db/CriteriaTest.java
  
  Index: CriteriaTest.java
  ===================================================================
  package org.apache.turbine.util.db;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and 
   *    "Apache Turbine" must not be used to endorse or promote products 
   *    derived from this software without prior written permission. For 
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without 
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.turbine.test.BaseTestCase;
  
  /**
   * Test class for Criteria.
   *
   * @author <a href="mailto:celkins@scardini.com">Christopher Elkins</a>
   * @version $Id: CriteriaTest.java,v 1.1 2002/02/01 03:20:00 brekke Exp $
   */
  public class CriteriaTest extends BaseTestCase
  {
      private Criteria c;
  
      /**
       * Creates a new instance.
       */
      public CriteriaTest(String name)
      {
          super(name);
  
          c = new Criteria();
      }
  
      /**
       * Creates a test suite for this class.
       *
       * @return A test suite for this class.
       */
      public static Test suite()
      {
          return new TestSuite(CriteriaTest.class);
      }
  
      /**
       * Test basic adding of strings.
       */
      public void testAddString()
      {
          final String table = "myTable";
          final String column = "myColumn";
          final String value = "myValue";
  
          // Add the string
          c.add(table, column, (Object)value);
  
          // Verify that the key exists
          assert(c.containsKey(table, column));
  
          // Verify that what we get out is what we put in
          assert(c.getString(table, column).equals(value));
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>