You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2004/08/25 21:53:57 UTC

cvs commit: jakarta-tapestry/framework/conf/META-INF hivemodule.xml

hlship      2004/08/25 12:53:57

  Modified:    eclipse  Tapestry-Mock.launch
               .        build.xml .cvsignore .classpath
               framework/src/org/apache/tapestry/services/impl
                        ApplicationGlobalsImpl.java EngineFactoryImpl.java
               junit/src/org/apache/tapestry/junit/mock TestMocks.java
                        MockTester.java
               framework/src/org/apache/tapestry/test/mock MockContext.java
               contrib  build.xml
               junit/src/org/apache/tapestry/junit/mock/c19 Two.java
               framework build.xml
               framework/src/org/apache/tapestry/test
                        ScriptedTestSession.java
               junit/src/org/apache/tapestry/junit/utils
                        TestDataSqueezer.java
               junit/mock-scripts TestValidField.xml
               framework/src/org/apache/tapestry/services
                        ApplicationGlobals.java
               framework/src/org/apache/tapestry ApplicationServlet.java
                        Tapestry.java
               framework/conf/META-INF hivemodule.xml
  Added:       framework/src/org/apache/tapestry/services/impl
                        LocaleExtractorImpl.java
               junit/src/org/apache/tapestry/services/impl
                        TestLocaleExtractor.java
               framework/src/org/apache/tapestry/services CookieSource.java
  Removed:     junit/context29/WEB-INF app.application Three.page
               config   Version.properties
               junit    build.xml
               junit/context29 Three.html
  Log:
  Fix the mock unit tests to work within the new build environment.
  Fill in more of the request processing pipeline.
  Build contrib as well as framework.
  Update to HiveMind 1.0-rc-1.
  
  Revision  Changes    Path
  1.26      +0 -1      jakarta-tapestry/eclipse/Tapestry-Mock.launch
  
  Index: Tapestry-Mock.launch
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/eclipse/Tapestry-Mock.launch,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Tapestry-Mock.launch	3 May 2004 16:04:40 -0000	1.25
  +++ Tapestry-Mock.launch	25 Aug 2004 19:53:44 -0000	1.26
  @@ -9,6 +9,5 @@
       </listAttribute>
       <stringAttribute key="org.eclipse.debug.ui.target_debug_perspective" value="perspective_none"/>
       <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
  -    <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="jakarta-tapestry/junit"/>
       <stringAttribute key="org.eclipse.debug.ui.target_run_perspective" value="perspective_none"/>
   </launchConfiguration>
  
  
  
  1.99      +1 -1      jakarta-tapestry/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/build.xml,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- build.xml	4 Aug 2004 15:04:24 -0000	1.98
  +++ build.xml	25 Aug 2004 19:53:45 -0000	1.99
  @@ -7,7 +7,7 @@
   
   	<filelist id="project.modules" 
   		dir="."
  -		files="framework/build.xml"/>
  +		files="framework/build.xml contrib/build.xml"/>
       
   	<import file="${hivebuild.dir}/project.xml"/>
   	<import file="${hivebuild.dir}/license-report.xml"/>    
  
  
  
  1.12      +1 -0      jakarta-tapestry/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/.cvsignore,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- .cvsignore	4 Aug 2004 15:04:24 -0000	1.11
  +++ .cvsignore	25 Aug 2004 19:53:45 -0000	1.12
  @@ -9,3 +9,4 @@
   build
   ${destdir}
   ext-package
  +cachedir
  
  
  
  1.49      +4 -2      jakarta-tapestry/.classpath
  
  Index: .classpath
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/.classpath,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- .classpath	23 Aug 2004 14:53:16 -0000	1.48
  +++ .classpath	25 Aug 2004 19:53:45 -0000	1.49
  @@ -4,6 +4,7 @@
       <classpathentry kind="lib" path="config"/>
       <classpathentry kind="src" path="framework/src"/>
       <classpathentry kind="src" path="junit/src"/>
  +    <classpathentry kind="src" path="contrib/src/java"/>
       <classpathentry kind="var" path="JYTHON_DIR/jython.jar"/>
       <classpathentry kind="lib" path="framework/conf"/>
       <classpathentry kind="lib" path="ext-package/lib/bsf-2.3.0.jar"/>
  @@ -19,7 +20,8 @@
       <classpathentry kind="lib" path="ext-package/lib/ognl-2.6.3.jar"/>
       <classpathentry kind="lib" path="ext-package/lib/oro-2.0.6.jar"/>
       <classpathentry kind="lib" path="ext-package/lib/servletapi-2.3.jar"/>
  -    <classpathentry kind="lib" path="ext-package/lib/hivemind-1.0-beta-3-snapshot.jar"/>
  -    <classpathentry kind="lib" path="ext-package/lib/hivemind-lib-1.0-beta-3-snapshot.jar"/>
  +    <classpathentry kind="lib" path="ext-package/lib/hivemind-1.0-rc-1.jar"/>
  +    <classpathentry kind="lib" path="ext-package/lib/hivemind-lib-1.0-rc-1.jar"/>
  +    <classpathentry kind="lib" path="ext-package/lib/jboss-j2ee-3.2.1.jar"/>
       <classpathentry kind="output" path="bin"/>
   </classpath>
  
  
  
  1.3       +4 -0      jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ApplicationGlobalsImpl.java
  
  Index: ApplicationGlobalsImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ApplicationGlobalsImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ApplicationGlobalsImpl.java	4 Aug 2004 15:05:59 -0000	1.2
  +++ ApplicationGlobalsImpl.java	25 Aug 2004 19:53:45 -0000	1.3
  @@ -54,4 +54,8 @@
           return _context;
       }
   
  +	public String getServletName()
  +	{
  +		return _servlet.getServletName();
  +	}
   }
  
  
  
  1.2       +45 -9     jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/EngineFactoryImpl.java
  
  Index: EngineFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/EngineFactoryImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EngineFactoryImpl.java	23 Aug 2004 14:53:16 -0000	1.1
  +++ EngineFactoryImpl.java	25 Aug 2004 19:53:45 -0000	1.2
  @@ -17,9 +17,10 @@
   import java.util.Locale;
   
   import org.apache.hivemind.ApplicationRuntimeException;
  +import org.apache.hivemind.ClassResolver;
   import org.apache.tapestry.IEngine;
  -import org.apache.tapestry.engine.BaseEngine;
   import org.apache.tapestry.services.EngineFactory;
  +import org.apache.tapestry.spec.IApplicationSpecification;
   
   /**
    * Standard implementation of {@link org.apache.tapestry.services.EngineFactory} service.
  @@ -31,18 +32,20 @@
    */
   public class EngineFactoryImpl implements EngineFactory
   {
  +    private IApplicationSpecification _applicationSpecification;
  +    private String _defaultEngineClassName;
  +    private EngineConstructor _constructor;
  +    private ClassResolver _classResolver;
  +
       interface EngineConstructor
       {
           IEngine construct();
       }
   
  -    static class BaseEngineConstructor implements EngineConstructor
  -    {
  -        public IEngine construct()
  -        {
  -            return new BaseEngine();
  -        }
  -    }
  +
  +	// TODO: Create a BaseEngineConstructor that is hardcoded to
  +	// instantiate a BaseEngine instance, without using reflection
  +	// (for efficiency). 
   
       static class ReflectiveEngineConstructor implements EngineConstructor
       {
  @@ -68,9 +71,42 @@
           }
       }
   
  +    public void initializeService()
  +    {
  +        String engineClassName = _applicationSpecification.getEngineClassName();
  +
  +		// TODO: Check in web.xml first.
  +
  +        if (engineClassName == null)
  +            engineClassName = _defaultEngineClassName;
  +
  +        Class engineClass = _classResolver.findClass(engineClassName);
  +
  +        _constructor = new ReflectiveEngineConstructor(engineClass);
  +    }
  +
       public IEngine constructNewEngineInstance(Locale locale)
       {
  -        return null;
  +        IEngine result = _constructor.construct();
  +
  +        result.setLocale(locale);
  +
  +        return result;
  +    }
  +
  +    public void setApplicationSpecification(IApplicationSpecification specification)
  +    {
  +        _applicationSpecification = specification;
  +    }
  +
  +    public void setClassResolver(ClassResolver resolver)
  +    {
  +        _classResolver = resolver;
  +    }
  +
  +    public void setDefaultEngineClassName(String string)
  +    {
  +        _defaultEngineClassName = string;
       }
   
   }
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/LocaleExtractorImpl.java
  
  Index: LocaleExtractorImpl.java
  ===================================================================
  //  Copyright 2004 The Apache Software Foundation
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  
  package org.apache.tapestry.services.impl;
  
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.Locale;
  import java.util.Map;
  
  import javax.servlet.http.HttpServletRequest;
  
  import org.apache.tapestry.ApplicationServlet;
  import org.apache.tapestry.services.CookieSource;
  import org.apache.tapestry.services.LocaleExtractor;
  import org.apache.tapestry.util.StringSplitter;
  
  /**
   * Identifies the Locale provided by the client (either in a Tapestry-specific
   * cookie, or interpolated from the HTTP header.
   * 
   * TODO: Add the ability to "filter down" Locales down to a predifined set
   * (specified using some form of HiveMInd configuration).
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public class LocaleExtractorImpl implements LocaleExtractor
  {
      private HttpServletRequest _request;
      private CookieSource _cookieSource;
      private Map _localeMap = Collections.synchronizedMap(new HashMap());
  
      public Locale extractLocaleForCurrentRequest()
      {
          String localeName = _cookieSource.getCookieValue(ApplicationServlet.LOCALE_COOKIE_NAME);
  
          if (localeName != null)
              return getLocale(localeName);
  
          return _request.getLocale();
      }
  
      private Locale getLocale(String name)
      {
          Locale result = (Locale) _localeMap.get(name);
  
          if (result == null)
          {
              result = constructLocale(name);
              _localeMap.put(name, result);
          }
  
          return result;
      }
  
      private Locale constructLocale(String name)
      {
          StringSplitter splitter = new StringSplitter('_');
          String[] terms = splitter.splitToArray(name);
  
          switch (terms.length)
          {
              case 1 :
                  return new Locale(terms[0], "");
  
              case 2 :
                  return new Locale(terms[0], terms[1]);
  
              case 3 :
  
                  return new Locale(terms[0], terms[1], terms[2]);
  
              default :
  
                  throw new IllegalArgumentException();
          }
      }
      
      public void setCookieSource(CookieSource source)
      {
          _cookieSource = source;
      }
  
      public void setRequest(HttpServletRequest request)
      {
          _request = request;
      }
  
  }
  
  
  
  1.7       +20 -11    jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/TestMocks.java
  
  Index: TestMocks.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/TestMocks.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestMocks.java	19 Feb 2004 17:37:58 -0000	1.6
  +++ TestMocks.java	25 Aug 2004 19:53:46 -0000	1.7
  @@ -29,25 +29,35 @@
    *
    *
    *  @author Howard Lewis Ship
  - *  @version $Id$
    *  @since 2.2
  - * 
  - **/
  + */
   
   public class TestMocks extends TapestryTestCase
   {
  -    public static final String LOGS_DIR = "logs";
  +    public static final String LOGS_DIR = "/junit/logs";
   
  -    public static final String SCRIPTS_DIR = "mock-scripts";
  +    public static final String DEFAULT_PROJECT_DIR = ".";
  +
  +    public static final String SCRIPTS_DIR = "/junit/mock-scripts";
   
       private PrintStream _savedOut;
       private PrintStream _savedErr;
   
  +    private static String _projectDir;
  +
  +    private static String getProjectDir()
  +    {
  +        if (_projectDir == null)
  +            _projectDir = System.getProperty("PROJECT_ROOT", DEFAULT_PROJECT_DIR);
  +
  +        return _projectDir;
  +    }
  +
       protected void runTest() throws Throwable
       {
  -        String path = SCRIPTS_DIR + "/" + getName();
  +        String path = getProjectDir() + SCRIPTS_DIR + "/" + getName();
   
  -        MockTester tester = new MockTester(path);
  +        MockTester tester = new MockTester(getProjectDir() + "/junit/", path);
   
           tester.execute();
       }
  @@ -59,14 +69,14 @@
           addScripts(suite);
   
           // Handy place to perform one-time 
  -        deleteDir(".private");
  +        deleteDir(getProjectDir() + "/junit/.private");
   
           return suite;
       }
   
       private static void addScripts(TestSuite suite)
       {
  -        File scriptsDir = new File(SCRIPTS_DIR);
  +        File scriptsDir = new File(getProjectDir() + SCRIPTS_DIR);
   
           String[] names = scriptsDir.list();
   
  @@ -120,7 +130,7 @@
        */
       protected void setUp() throws Exception
       {
  -        File outDir = new File(LOGS_DIR);
  +        File outDir = new File(getProjectDir() + LOGS_DIR);
   
           if (!outDir.isDirectory())
               outDir.mkdirs();
  @@ -157,6 +167,5 @@
   
           System.out.close();
           System.setOut(_savedOut);
  -
       }
   }
  
  
  
  1.12      +8 -8      jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/MockTester.java
  
  Index: MockTester.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/MockTester.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MockTester.java	5 May 2004 02:41:19 -0000	1.11
  +++ MockTester.java	25 Aug 2004 19:53:47 -0000	1.12
  @@ -66,13 +66,12 @@
    *
    *
    *  @author Howard Lewis Ship
  - *  @version $Id$
    *  @since 2.2
  - * 
  - **/
  + */
   
   public class MockTester
   {
  +	private String _testRootDirectory;
       private String _path;
       private Document _document;
       private MockContext _context;
  @@ -100,9 +99,10 @@
        * 
        **/
   
  -    public MockTester(String path)
  +    public MockTester(String testRootDirectory, String path)
           throws JDOMException, ServletException, DocumentParseException, IOException
       {
  +    	_testRootDirectory = testRootDirectory;
           _path = path;
   
           parse();
  @@ -157,7 +157,7 @@
   
           String contentPath = request.getAttributeValue("content-path");
           if (contentPath != null)
  -            _request.setContentPath(contentPath);
  +            _request.setContentPath(_testRootDirectory + contentPath);
   
           _request.addCookies(oldRequestCookies);
   
  @@ -208,7 +208,7 @@
   
       private void setupContext(Element parent)
       {
  -        _context = new MockContext();
  +        _context = new MockContext(_testRootDirectory);
   
           Element context = parent.getChild("context");
   
  @@ -223,7 +223,7 @@
           String root = context.getAttributeValue("root");
   
           if (root != null)
  -            _context.setRootDirectory(root);
  +            _context.setRootDirectory(_testRootDirectory + root);
   
           setInitParameters(context, _context);
       }
  @@ -835,7 +835,7 @@
                       + "'.");
   
           byte[] actualContent = _response.getResponseBytes();
  -        byte[] expectedContent = getFileContent(path);
  +        byte[] expectedContent = getFileContent(_testRootDirectory + path);
   
           if (actualContent.length != expectedContent.length)
               throw new AssertionFailedError(
  
  
  
  1.3       +13 -18    jakarta-tapestry/framework/src/org/apache/tapestry/test/mock/MockContext.java
  
  Index: MockContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/test/mock/MockContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MockContext.java	17 Jun 2004 21:32:01 -0000	1.2
  +++ MockContext.java	25 Aug 2004 19:53:47 -0000	1.3
  @@ -49,16 +49,19 @@
           _suffixToContentType.put("png", "image/png");
       }
   
  -    /**
  -     *  Directory, relative to the current directory (i.e., System property user.dir)
  -     *  that is the context root.
  -     * 
  -     **/
  -
  -    private String _rootDirectory = "context";
  +    private String _rootDirectory;
       private String _servletContextName = "test";
       private Map _initParameters = new HashMap();
   
  +    public MockContext()
  +    {
  +    }
  +
  +    public MockContext(String testDirectory)
  +    {
  +        _rootDirectory = testDirectory + "/context";
  +    }
  +
       public ServletContext getContext(String name)
       {
           return null;
  @@ -79,7 +82,7 @@
           int lastx = path.lastIndexOf('.');
           String suffix = path.substring(lastx + 1);
   
  -        return(String) _suffixToContentType.get(suffix);
  +        return (String) _suffixToContentType.get(suffix);
       }
   
       public Set getResourcePaths(String arg0)
  @@ -92,17 +95,9 @@
           if (path == null || !path.startsWith("/"))
               throw new MalformedURLException("Not a valid context path.");
   
  -        StringBuffer buffer = new StringBuffer();
  -
  -        buffer.append(System.getProperty("user.dir"));
  -        buffer.append("/");
  -        buffer.append(_rootDirectory);
  -
  -        // Path has a leading slash
  -
  -        buffer.append(path);
  +        String fullPath = _rootDirectory + path;
   
  -        File file = new File(buffer.toString());
  +        File file = new File(fullPath);
   
           if (file.exists())
               return file.toURL();
  
  
  
  1.22      +46 -41    jakarta-tapestry/contrib/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/contrib/build.xml,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- build.xml	10 Mar 2004 19:24:38 -0000	1.21
  +++ build.xml	25 Aug 2004 19:53:48 -0000	1.22
  @@ -1,46 +1,51 @@
   <?xml version="1.0"?>
  -<!-- $Id$ -->
  -<project name="Tapestry Contrib Framework" default="install">
  -	<property name="root.dir" value=".."/>
  -	<property file="${root.dir}/config/Version.properties"/>
  +<!-- 
  +   Copyright 2004 The Apache Software Foundation
  +
  +   Licensed under the Apache License, Version 2.0 (the "License");
  +   you may not use this file except in compliance with the License.
  +   You may obtain a copy of the License at
  +
  +       http://www.apache.org/licenses/LICENSE-2.0
  +
  +   Unless required by applicable law or agreed to in writing, software
  +   distributed under the License is distributed on an "AS IS" BASIS,
  +   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  +   See the License for the specific language governing permissions and
  +   limitations under the License.
  +-->
  +<project name="Tapestry Contrib Library" default="jar">
  +  
  +  <property name="module.name" value="tapestry-contrib"/>
  +  <property name="javadoc.package" value="org.apache.tapestry.contrib.*"/>
  +    
  +  <property name="root.dir" value=".."/>
   	<property file="${root.dir}/config/build.properties"/>
  -	<property file="${root.dir}/config/common.properties"/>
  -	<path id="jetty.classpath">
  -		<fileset dir="${jetty.dir}">
  -			<include name="**/javax.*.jar"/>
  -		</fileset>
  -	</path>
  -	<path id="project.classpath">
  -		<fileset dir="${root.lib.dir}">
  -			<include name="${framework.jar}"/>
  -			<include name="${ext.dir}/*.jar"/>
  -			<include name="${j2ee.dir}/*.jar"/>
  -		</fileset>
  -	</path>
  -	<target name="init">
  -		<mkdir dir="${classes.dir}"/>
  -	</target>
  -	<target name="clean">
  -		<delete dir="${classes.dir}"/>
  -	</target>
   
  -	<target name="compile" depends="init"
  -		description="Compile all classes in the framework.">
  -		<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="on"
  -			target="1.1">
  -			<classpath refid="project.classpath"/>
  -		</javac>
  -	</target>
  +	<import file="${hivebuild.dir}/jar-module.xml"/>
  +	<import file="${hivebuild.dir}/javadoc-report.xml"/>
  +	<import file="${hivebuild.dir}/clover-report.xml"/>  
  +  
  +	<target name="compile">
  +    <project-dependency artifact="tapestry"/>
   
  -	<target name="install" depends="compile"
  -		description="Compile all classes and build the installed JAR including all package resources."
  -		>
  -		<jar jarfile="${root.lib.dir}/${contrib.jar}">
  -			<fileset dir="${classes.dir}"/>
  -			<fileset dir="${src.dir}">
  -				<exclude name="**/*.java"/>
  -				<exclude name="**/package.html"/>
  -			</fileset>
  -		</jar>
  -	</target>
  +    <ibiblio-dependency artifact="commons-logging"    version="1.0.4"               group="commons-logging"/>
  +    <ibiblio-dependency artifact="hivemind"           version="1.0-rc-1"            group="hivemind"/>
  +    <ibiblio-dependency artifact="commons-lang"       version="2.0"                 group="commons-lang"/>
  +    <ibiblio-dependency artifact="commons-codec"      version="1.2"                 group="commons-codec"/>
  +    <ibiblio-dependency artifact="ognl"               version="2.6.3"               group="ognl"/>
  +    <ibiblio-dependency artifact="jboss-j2ee"         version="3.2.1"               group="jboss"/>
  +    
  +    <!--
  +    <ibiblio-dependency artifact="bsf"                version="2.3.0"               group="bsf"/>
  +		<ibiblio-dependency artifact="commons-fileupload" version="1.0"                 group="commons-fileupload"/>    
  +    <ibiblio-dependency artifact="hivemind-lib"       version="1.0-rc-1"            group="hivemind"/>
  +    <ibiblio-dependency artifact="oro"                version="2.0.6"               group="oro"/>
  +		<ibiblio-dependency artifact="javassist"          version="2.6"                 group="jboss"/>
  +		<ibiblio-dependency artifact="servletapi"         version="2.3"                 group="servletapi"/>
  +    -->
  +     
  +		<default-compile/> 
  +	</target>	
  +  
   </project>
  
  
  
  1.6       +4 -2      jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c19/Two.java
  
  Index: Two.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c19/Two.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Two.java	30 Apr 2004 15:17:57 -0000	1.5
  +++ Two.java	25 Aug 2004 19:53:49 -0000	1.6
  @@ -46,9 +46,11 @@
           InputStream expected = null;
           InputStream actual = null;
   
  +        String baseDir = System.getProperty("ROOT_DIR", ".") + "/junit/";
  +
           try
           {
  -            expected = new FileInputStream(path);
  +            expected = new FileInputStream(baseDir + path);
               actual = file.getStream();
   
               int i = 0;
  
  
  
  1.33      +21 -6     jakarta-tapestry/framework/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/build.xml,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- build.xml	23 Aug 2004 14:53:16 -0000	1.32
  +++ build.xml	25 Aug 2004 19:53:50 -0000	1.33
  @@ -1,4 +1,19 @@
   <?xml version="1.0"?>
  +<!-- 
  +   Copyright 2004 The Apache Software Foundation
  +
  +   Licensed under the Apache License, Version 2.0 (the "License");
  +   you may not use this file except in compliance with the License.
  +   You may obtain a copy of the License at
  +
  +       http://www.apache.org/licenses/LICENSE-2.0
  +
  +   Unless required by applicable law or agreed to in writing, software
  +   distributed under the License is distributed on an "AS IS" BASIS,
  +   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  +   See the License for the specific language governing permissions and
  +   limitations under the License.
  +-->
   <project name="Tapestry Framework" default="jar">
     
     <property name="module.name" value="tapestry"/>
  @@ -24,21 +39,21 @@
   		<ibiblio-dependency artifact="commons-fileupload" version="1.0"                 group="commons-fileupload"/>    
       <ibiblio-dependency artifact="commons-lang"       version="2.0"                 group="commons-lang"/>
       <ibiblio-dependency artifact="commons-logging"    version="1.0.4"               group="commons-logging"/>
  -    <ibiblio-dependency artifact="hivemind"           version="1.0-beta-3-snapshot" group="hivemind"/>
  -    <ibiblio-dependency artifact="hivemind-lib"       version="1.0-beta-3-snapshot" group="hivemind"/>
  +    <ibiblio-dependency artifact="hivemind"           version="1.0-rc-1"            group="hivemind"/>
  +    <ibiblio-dependency artifact="hivemind-lib"       version="1.0-rc-1"            group="hivemind"/>
       <ibiblio-dependency artifact="oro"                version="2.0.6"               group="oro"/>
   		<ibiblio-dependency artifact="javassist"          version="2.6"                 group="jboss"/>
   		<ibiblio-dependency artifact="servletapi"         version="2.3"                 group="servletapi"/>
       <ibiblio-dependency artifact="ognl"               version="2.6.3"               group="ognl"/>
       
  -		<ibiblio-dependency artifact="log4j"              version="1.2.7"               group="log4j" use="test"/>
  +		<ibiblio-dependency artifact="log4j"              version="1.2.7"               group="log4j"    use="test"/>
   		<ibiblio-dependency artifact="easymock"           version="1.1"                 group="easymock" use="test"/>
  -    <ibiblio-dependency artifact="jdom"               version="b8"                  group="jdom" use="test"/>
  +    <ibiblio-dependency artifact="jdom"               version="b8"                  group="jdom"     use="test"/>
  +    <ibiblio-dependency artifact="jython"             version="2.1"                 group="jython"   use="test"/>
   		
   		<default-compile/>
       
  -		<copy file="${root.dir}/config/Version.properties"
  -			todir="${java.classes.dir}/org/apache/tapestry"/>    
  +		<copy file="${root.dir}/version.properties" todir="${java.classes.dir}/org/apache/tapestry"/>    
   	</target>	
     
   </project>
  
  
  
  1.4       +7 -9      jakarta-tapestry/framework/src/org/apache/tapestry/test/ScriptedTestSession.java
  
  Index: ScriptedTestSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/test/ScriptedTestSession.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ScriptedTestSession.java	17 Jun 2004 21:32:01 -0000	1.3
  +++ ScriptedTestSession.java	25 Aug 2004 19:53:51 -0000	1.4
  @@ -41,8 +41,8 @@
       private MockContext _context;
       private MockRequest _request;
       private MockResponse _response;
  -	private RegexpMatcher _matcher = new RegexpMatcher();
  -	
  +    private RegexpMatcher _matcher = new RegexpMatcher();
  +
       public ScriptedTestSession(ScriptDescriptor descriptor)
       {
           _scriptDescriptor = descriptor;
  @@ -64,11 +64,10 @@
   
       private void setupForExecute()
       {
  -        _context = new MockContext();
  +        _context = new MockContext(_scriptDescriptor.getRootDirectory());
           _context.setServletContextName(_scriptDescriptor.getContextName());
  -        _context.setRootDirectory(_scriptDescriptor.getRootDirectory());
  -
       }
  +
       private void executeRequest(RequestDescriptor rd)
       {
           HttpServlet s = getServlet(rd.getServletName());
  @@ -182,10 +181,9 @@
                   ex);
           }
       }
  -    
  -   
  -   /** Inteaded only for use by the test suite. */
  -    
  +
  +    /** Inteaded only for use by the test suite. */
  +
       void setResponse(MockResponse response)
       {
           _response = response;
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/TestLocaleExtractor.java
  
  Index: TestLocaleExtractor.java
  ===================================================================
  //  Copyright 2004 The Apache Software Foundation
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  
  package org.apache.tapestry.services.impl;
  
  import java.util.Locale;
  
  import javax.servlet.http.HttpServletRequest;
  
  import org.apache.hivemind.test.HiveMindTestCase;
  import org.apache.tapestry.ApplicationServlet;
  import org.apache.tapestry.services.CookieSource;
  import org.easymock.MockControl;
  
  /**
   * Tests for {@link org.apache.tapestry.services.impl.LocaleExtractorImpl}.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public class TestLocaleExtractor extends HiveMindTestCase
  {
      public void testSuppliedByRequest()
      {
          MockControl sourceControl = newControl(CookieSource.class);
          CookieSource source = (CookieSource) sourceControl.getMock();
  
          MockControl requestControl = newControl(HttpServletRequest.class);
          HttpServletRequest request = (HttpServletRequest) requestControl.getMock();
  
          // Training
  
          source.getCookieValue(ApplicationServlet.LOCALE_COOKIE_NAME);
          sourceControl.setReturnValue(null);
  
          request.getLocale();
          requestControl.setReturnValue(Locale.JAPANESE);
  
          replayControls();
  
          LocaleExtractorImpl le = new LocaleExtractorImpl();
          le.setCookieSource(source);
          le.setRequest(request);
  
          Locale actual = le.extractLocaleForCurrentRequest();
  
          assertSame(Locale.JAPANESE, actual);
  
          verifyControls();
      }
  
      private void attempt(String localeName, Locale expectedLocale)
      {
          MockControl sourceControl = newControl(CookieSource.class);
          CookieSource source = (CookieSource) sourceControl.getMock();
  
          // Training
      
          source.getCookieValue(ApplicationServlet.LOCALE_COOKIE_NAME);
          sourceControl.setReturnValue(localeName);
  
  		replayControls();
  		
  		LocaleExtractorImpl le = new LocaleExtractorImpl();
  		le.setCookieSource(source);
  
  		Locale actual = le.extractLocaleForCurrentRequest();
  		
  		assertEquals(expectedLocale, actual);
  		
  		verifyControls();		
      }
      
      public void testJustLanguage()
      {
      	attempt("en", Locale.ENGLISH);
      }
      
      public void testLanguageAndCountry()
      {
      	attempt("fr_FR", Locale.FRANCE);
      }
      
      public void testWithVariant()
      {
      	attempt("en_US_Bahstohn", new Locale("en", "US", "Bahstohn"));
      }
  }
  
  
  
  1.9       +4 -5      jakarta-tapestry/junit/src/org/apache/tapestry/junit/utils/TestDataSqueezer.java
  
  Index: TestDataSqueezer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/utils/TestDataSqueezer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestDataSqueezer.java	30 Apr 2004 15:17:57 -0000	1.8
  +++ TestDataSqueezer.java	25 Aug 2004 19:53:53 -0000	1.9
  @@ -374,9 +374,8 @@
   
       public void testClassLoader() throws Exception
       {
  -
  -        File cd = new File(System.getProperty("user.dir"));
  -        File dir = new File(cd.getParentFile(), "examples/Workbench/classes");
  +        File dir =
  +            new File(System.getProperty("PROJECT_ROOT", ".") + "/examples/Workbench/classes");
   
           if (!dir.exists())
           {
  @@ -393,7 +392,7 @@
           Object visit = visitClass.newInstance();
   
           ClassLoader visitClassLoader = visit.getClass().getClassLoader();
  -        
  +
           if (getClass().getClassLoader() == visitClassLoader)
           {
               unable("Unable to setup necessary ClassLoaders for test.");
  
  
  
  1.4       +0 -68     jakarta-tapestry/junit/mock-scripts/TestValidField.xml
  
  Index: TestValidField.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/mock-scripts/TestValidField.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestValidField.xml	30 Apr 2004 15:17:55 -0000	1.3
  +++ TestValidField.xml	25 Aug 2004 19:53:54 -0000	1.4
  @@ -1,6 +1,4 @@
   <?xml version="1.0" encoding="UTF-8"?>
  -
  -<!-- $Id$ -->
   <!--
      Copyright 2004 The Apache Software Foundation
     
  @@ -40,71 +38,5 @@
   	
   	</request>
   	
  -	<!-- Simple contrib.valid component tests -->
  -	<!-- test the NumericField field -->
  -    <request>
  -    	<parameter name="service" value="page/Three"/>
  -    	
  -		<assert-output>intValue=0|</assert-output>
  -		<assert-output>floatValue=0.0|</assert-output>
  -		<assert-output>bigIntegerValue=|</assert-output>
  -		<assert-output>bigDecimalValue=|</assert-output>
  -		<assert-output>stringValue=|</assert-output>
  -		<assert-output>dateValue=|</assert-output>
  -	</request>
  -	
  -    <request>
  -    	<parameter name="service" value="direct/0/Three/intForm"/>
  -    	<parameter name="sp" value="S0"/>
  -    	<parameter name="Form0" value="intField"/>
  -    	<parameter name="intField" value="1"/>
  -
  -		<assert-output>intValue=1|</assert-output>
  -	</request>
  -	
  -    <request>
  -    	<parameter name="service" value="direct/0/Three/floatForm"/>
  -    	<parameter name="sp" value="S0"/>
  -    	<parameter name="Form0" value="floatField"/>
  -    	<parameter name="floatField" value="1.23"/>
  -
  -		<assert-output>floatValue=1.23|</assert-output>
  -	</request>
  -	
  -    <request>
  -    	<parameter name="service" value="direct/0/Three/bigIntegerForm"/>
  -    	<parameter name="sp" value="S0"/>
  -    	<parameter name="Form0" value="bigIntegerField"/>
  -    	<parameter name="bigIntegerField" value="12345678901234567890"/>
  -
  -		<assert-output>bigIntegerValue=12345678901234567890|</assert-output>
  -	</request>
  -	
  -    <request>
  -    	<parameter name="service" value="direct/0/Three/bigDecimalForm"/>
  -    	<parameter name="sp" value="S0"/>
  -    	<parameter name="Form0" value="bigDecimalField"/>
  -    	<parameter name="bigDecimalField" value="1234567890.1234567890"/>
  -
  -		<assert-output>bigDecimalValue=1234567890.1234567890|</assert-output>
  -	</request>
  -	
  -    <request>
  -    	<parameter name="service" value="direct/0/Three/stringForm"/>
  -    	<parameter name="sp" value="S0"/>
  -    	<parameter name="Form0" value="stringField"/>
  -    	<parameter name="stringField" value="Tapestry Rocks"/>
  -
  -		<assert-output>stringValue=Tapestry Rocks|</assert-output>
  -	</request>
  -	
  -    <request>
  -    	<parameter name="service" value="direct/0/Three/dateForm"/>
  -    	<parameter name="sp" value="S0"/>
  -    	<parameter name="Form0" value="dateField"/>
  -    	<parameter name="dateField" value="3/20/1974"/>
  -
  -		<assert-output>dateValue=1974-03-20|</assert-output>
  -	</request>
   	
   </mock-test>
  
  
  
  1.4       +2 -0      jakarta-tapestry/framework/src/org/apache/tapestry/services/ApplicationGlobals.java
  
  Index: ApplicationGlobals.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/services/ApplicationGlobals.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ApplicationGlobals.java	4 Aug 2004 15:05:57 -0000	1.3
  +++ ApplicationGlobals.java	25 Aug 2004 19:53:54 -0000	1.4
  @@ -37,4 +37,6 @@
       IApplicationSpecification getSpecification();
   
       ServletContext getContext();
  +    
  +    String getServletName();
   }
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/CookieSource.java
  
  Index: CookieSource.java
  ===================================================================
  //  Copyright 2004 The Apache Software Foundation
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  
  package org.apache.tapestry.services;
  
  /**
   * Used by other services to obtain cookie values for the current request.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public interface CookieSource
  {
  	/**
  	 * Returns the value of the first cookie whose name matches. Returns null
  	 * if no such cookie exists.
  	 */
  	public String getCookieValue(String name);
  }
  
  
  
  1.12      +1 -1      jakarta-tapestry/framework/src/org/apache/tapestry/ApplicationServlet.java
  
  Index: ApplicationServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/ApplicationServlet.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ApplicationServlet.java	22 Jun 2004 13:26:01 -0000	1.11
  +++ ApplicationServlet.java	25 Aug 2004 19:53:55 -0000	1.12
  @@ -96,7 +96,7 @@
        *
        */
   
  -    private static final String LOCALE_COOKIE_NAME = "org.apache.tapestry.locale";
  +    public static final String LOCALE_COOKIE_NAME = "org.apache.tapestry.locale";
   
       /**
        *  A {@link Pool} used to store {@link IEngine engine}s that are not currently
  
  
  
  1.28      +2 -2      jakarta-tapestry/framework/src/org/apache/tapestry/Tapestry.java
  
  Index: Tapestry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/Tapestry.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Tapestry.java	4 Jul 2004 20:59:58 -0000	1.27
  +++ Tapestry.java	25 Aug 2004 19:53:55 -0000	1.28
  @@ -988,7 +988,7 @@
   
           try
           {
  -            InputStream in = Tapestry.class.getResourceAsStream("Version.properties");
  +            InputStream in = Tapestry.class.getResourceAsStream("version.properties");
   
               if (in == null)
                   return UNKNOWN_VERSION;
  @@ -997,7 +997,7 @@
   
               in.close();
   
  -            return props.getProperty("framework.version", UNKNOWN_VERSION);
  +            return props.getProperty("project.version", UNKNOWN_VERSION);
           }
           catch (IOException ex)
           {
  
  
  
  1.2       +60 -0     jakarta-tapestry/framework/conf/META-INF/hivemodule.xml
  
  Index: hivemodule.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/conf/META-INF/hivemodule.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- hivemodule.xml	23 Aug 2004 14:53:16 -0000	1.1
  +++ hivemodule.xml	25 Aug 2004 19:53:56 -0000	1.2
  @@ -94,6 +94,16 @@
       <create-instance class="org.apache.tapestry.services.impl.ApplicationGlobalsImpl"/>
     </service-point>
     
  +  <service-point id="ApplicationSpecification" interface="org.apache.tapestry.spec.IApplicationSpecification">
  +    
  +    The specification property of ApplicationGlobals as its own service.
  +    
  +    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory">
  +      <construct service-id="ApplicationGlobals" property="specification"/>
  +    </invoke-factory>
  +    
  +  </service-point>
  +  
     <contribution configuration-id="ApplicationInitializers">
       <initializer name="ApplicationSpecificationInitializer" object="service:ApplicationSpecificationInitializer"/>
     </contribution>
  @@ -116,6 +126,56 @@
       </invoke-factory>
     </service-point>
     
  +  <service-point id="HttpServletRequest" interface="javax.servlet.http.HttpServletRequest">
  +    
  +    Exposes the current thread's HttpServletRequest as a service. The request is actually
  +    stored in the ServletInfo service.
  +    
  +    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory">
  +      <constuct service-id="ServletInfo" property="request"/>
  +    </invoke-factory>
  +  </service-point>
  +  
  +  <service-point id="LocaleExtractor" interface="org.apache.tapestry.services.LocaleExtractor">
  +    
  +    Encapsulates the logic for extracting the locale for the current request.
  +    
  +    <invoke-factory>
  +      <construct class="org.apache.tapestry.services.impl.LocaleExtractorImpl">
  +        <set-service property="request" service-id="HttpServletRequest"/>
  +        <set-service property="cookieSource" service-id="XXXX"/>
  +      </construct>
  +    </invoke-factory>
  +  </service-point>
  +  
  +  <service-point id="EngineManager" interface="org.apache.tapestry.services.EngineManager">
  +    Obtains an IEngine implementation for the current request, either from a pool of
  +    such engine instance, from a factory, or from the HttpSession.
  +    
  +    <invoke-factory>
  +      <construct class="org.apache.tapestry.services.impl.EngineManagerImpl">
  +        <set-service property="enginePool" service-id="EnginePool"/>
  +        <set-service property="request" service-id="HttpServletRequest"/>
  +        <set-object property="servletName" object="service-property:ApplicationGlobals:servletName"/>
  +        <set-service property="engineFactory" service-id="EngineFactory"/>
  +        <set-service property="localeExtractor" service-id="LocaleExtractor"/>
  +      </construct>
  +    </invoke-factory>
  +  </service-point>
  +  
  +  <service-point id="EngineFactory" interface="org.apache.tapestry.services.EngineFactory">
  +    
  +    Responsible for creating new instances of IEngine as needed.
  +    
  +    <invoke-factory>
  +      <construct class="org.apache.tapestry.services.impl.EngineFactoryImpl">
  +        <set-service property="applicationSpecification" service-id="ApplicationSpecification"/>
  +        <set property="defaultEngineClassName"
  +            value="${org.apache.tapestry.engine-class}"/>
  +      </construct>
  +    </invoke-factory>
  +    
  +  </service-point>
     
     <service-point id="RequestServicerPipeline" interface="org.apache.tapestry.services.RequestServicer">
       
  
  
  

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