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/23 16:53:17 UTC

cvs commit: jakarta-tapestry/config log4j.properties

hlship      2004/08/23 07:53:16

  Modified:    junit/src/org/apache/tapestry/services/impl
                        TestApplicationSpecificationInitializer.java
                        ServletFixture.java TestBasicInfrastructure.java
               junit/src/org/apache/tapestry/test TestScriptParser.java
               framework/src/org/apache/tapestry/services/impl
                        EngineManagerImpl.java ImplStrings.properties
                        ImplMessages.java
               junit/src/org/apache/tapestry/junit TapestryTestCase.java
               framework/src/org/apache/tapestry/services
                        EngineManager.java
               framework build.xml
               .        .classpath
               config   log4j.properties
  Added:       junit/src/org/apache/tapestry/services/impl
                        TestEngineManager.java
               junit/src/org/apache/tapestry/test Empty.xml
                        RequestParameters.xml AssertRegexpMatch.xml
                        Servlet.xml InitParameter.xml AssertOutput.xml
                        Request.xml EmptyUnknownAttribute.xml
                        EmptyMissingAttribute.xml ServletDuplicateName.xml
                        AssertRegexp.xml
               framework/conf log4j.properties
               framework/src/org/apache/tapestry/test
                        IntegrationTestScriptParser.java
               framework/src/org/apache/tapestry/services/impl
                        ServletInfoInitializer.java EngineFactoryImpl.java
               eclipse  Tapestry Impl Tests.launch
               framework/src/org/apache/tapestry/services
                        EngineFactory.java LocaleExtractor.java
               framework/conf/META-INF hivemodule.xml
  Removed:     junit/src/org/apache/tapestry/test Servlet.sdl
                        InitParameter.sdl ServletDuplicateName.sdl
                        AssertRegexp.sdl AssertRegexpMatch.sdl Request.sdl
                        EmptyMissingAttribute.sdl AssertOutput.sdl
                        Empty.sdl RequestParameters.sdl
                        EmptyUnknownAttribute.sdl
               framework/src/org/apache/tapestry/test ScriptParser.java
               eclipse  Tapestry-Junit.launch
               framework/conf/META-INF hivemodule.sdl
  Log:
  Upgrade to hivemind 1.0-beta-3-snapshot.
  Convert all SDL back to good ole XML.
  Continue building out the request processing pipeline.
  
  Revision  Changes    Path
  1.3       +26 -2     jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java
  
  Index: TestApplicationSpecificationInitializer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestApplicationSpecificationInitializer.java	4 Aug 2004 15:05:57 -0000	1.2
  +++ TestApplicationSpecificationInitializer.java	23 Aug 2004 14:53:15 -0000	1.3
  @@ -66,6 +66,8 @@
           MockControl configControl = newControl(ServletConfig.class);
           ServletConfig config = (ServletConfig) configControl.getMock();
   
  +        trainForServletInit(configControl, config);
  +
           config.getInitParameter(ApplicationSpecificationInitializer.APP_SPEC_PATH_PARAM);
           configControl.setReturnValue(appSpecResource.getPath());
   
  @@ -96,6 +98,20 @@
           verifyControls();
       }
   
  +    private void trainForServletInit(MockControl configControl, ServletConfig config)
  +    {
  +        MockControl contextControl = newControl(ServletContext.class);
  +        ServletContext context = (ServletContext) contextControl.getMock();
  +
  +        config.getServletContext();
  +        configControl.setReturnValue(context);
  +
  +        config.getServletName();
  +        configControl.setReturnValue("test");
  +
  +        context.log("test: init");
  +    }
  +
       public void testInAppContextFolder() throws Exception
       {
           DefaultClassResolver cr = new DefaultClassResolver();
  @@ -120,6 +136,8 @@
           MockControl configControl = newControl(ServletConfig.class);
           ServletConfig config = (ServletConfig) configControl.getMock();
   
  +        trainForServletInit(configControl, config);
  +
           config.getInitParameter(ApplicationSpecificationInitializer.APP_SPEC_PATH_PARAM);
           configControl.setReturnValue(null);
   
  @@ -192,6 +210,8 @@
           MockControl configControl = newControl(ServletConfig.class);
           ServletConfig config = (ServletConfig) configControl.getMock();
   
  +		trainForServletInit(configControl, config);
  +
           config.getInitParameter(ApplicationSpecificationInitializer.APP_SPEC_PATH_PARAM);
           configControl.setReturnValue(null);
   
  @@ -287,6 +307,8 @@
           MockControl configControl = newControl(ServletConfig.class);
           ServletConfig config = (ServletConfig) configControl.getMock();
   
  +		trainForServletInit(configControl, config);
  +
           config.getInitParameter(ApplicationSpecificationInitializer.APP_SPEC_PATH_PARAM);
           configControl.setReturnValue(null);
   
  @@ -363,10 +385,12 @@
           configControl.setReturnValue(null);
   
           config.getServletContext();
  -        configControl.setReturnValue(context, 2);
  +        configControl.setReturnValue(context, 3);
   
           config.getServletName();
  -        configControl.setReturnValue("dino");
  +        configControl.setReturnValue("dino", 2);
  +
  +		context.log("dino: init");
   
           context.getResource("/WEB-INF/dino/dino.application");
           contextControl.setReturnValue(getClass().getResource("ParseApp.application"), 2);
  
  
  
  1.3       +0 -1      jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/ServletFixture.java
  
  Index: ServletFixture.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/ServletFixture.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletFixture.java	4 Aug 2004 15:05:57 -0000	1.2
  +++ ServletFixture.java	23 Aug 2004 14:53:15 -0000	1.3
  @@ -25,5 +25,4 @@
    */
   public class ServletFixture extends HttpServlet
   {
  -
   }
  
  
  
  1.4       +25 -0     jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/TestBasicInfrastructure.java
  
  Index: TestBasicInfrastructure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/TestBasicInfrastructure.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestBasicInfrastructure.java	4 Aug 2004 15:05:57 -0000	1.3
  +++ TestBasicInfrastructure.java	23 Aug 2004 14:53:15 -0000	1.4
  @@ -151,4 +151,29 @@
   
           assertEquals(expected, f.newResource(path));
       }
  +
  +    public void testServletInfoInitializer() throws Exception
  +    {
  +        HttpServletRequest request = (HttpServletRequest) newMock(HttpServletRequest.class);
  +        HttpServletResponse response = (HttpServletResponse) newMock(HttpServletResponse.class);
  +        ServletInfo servletInfo = (ServletInfo) newMock(ServletInfo.class);
  +
  +        ServletInfoInitializer sii = new ServletInfoInitializer();
  +
  +        RequestServicer rs = (RequestServicer) newMock(RequestServicer.class);
  +
  +        sii.setServletInfo(servletInfo);
  +
  +        // Training
  +
  +        servletInfo.store(request, response);
  +
  +        rs.service(request, response);
  +
  +        replayControls();
  +
  +        sii.service(request, response, rs);
  +
  +        verifyControls();
  +    }
   }
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/TestEngineManager.java
  
  Index: TestEngineManager.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 javax.servlet.http.HttpSession;
  
  import org.apache.hivemind.test.HiveMindTestCase;
  import org.apache.tapestry.IEngine;
  import org.apache.tapestry.services.EngineFactory;
  import org.apache.tapestry.services.LocaleExtractor;
  import org.apache.tapestry.services.ObjectPool;
  import org.easymock.MockControl;
  
  /**
   * Tests for {@link org.apache.tapestry.services.impl.EngineManagerImpl}.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public class TestEngineManager extends HiveMindTestCase
  {
      public void testGetFromSession()
      {
          IEngine engine = (IEngine) newMock(IEngine.class);
  
          MockControl requestControl = newControl(HttpServletRequest.class);
          HttpServletRequest request = (HttpServletRequest) requestControl.getMock();
  
          MockControl sessionControl = newControl(HttpSession.class);
          HttpSession session = (HttpSession) sessionControl.getMock();
  
          // Training
  
          request.getSession(false);
          requestControl.setReturnValue(session);
  
          session.getAttribute(EngineManagerImpl.ENGINE_KEY_PREFIX + "george");
          sessionControl.setReturnValue(engine);
  
          replayControls();
  
          EngineManagerImpl m = new EngineManagerImpl();
  
          m.setServletName("george");
          m.setRequest(request);
  
          m.initializeService();
  
          IEngine actual = m.getEngineInstance();
  
          assertSame(engine, actual);
  
          verifyControls();
      }
  
      public void testGetFromPool()
      {
          MockControl requestControl = newControl(HttpServletRequest.class);
          HttpServletRequest request = (HttpServletRequest) requestControl.getMock();
  
          MockControl extractorControl = newControl(LocaleExtractor.class);
          LocaleExtractor extractor = (LocaleExtractor) extractorControl.getMock();
  
          MockControl poolControl = newControl(ObjectPool.class);
          ObjectPool pool = (ObjectPool) poolControl.getMock();
  
          // Training
  
          request.getSession(false);
          requestControl.setReturnValue(null);
  
          extractor.extractLocaleForCurrentRequest();
          extractorControl.setReturnValue(Locale.CHINESE);
  
          IEngine engine = (IEngine) newMock(IEngine.class);
  
          pool.get(Locale.CHINESE);
          poolControl.setReturnValue(engine);
  
          replayControls();
  
          EngineManagerImpl m = new EngineManagerImpl();
  
          m.setServletName("george");
          m.setRequest(request);
          m.setEnginePool(pool);
          m.setLocaleExtractor(extractor);
  
          m.initializeService();
  
          IEngine actual = m.getEngineInstance();
  
          assertSame(engine, actual);
  
          verifyControls();
      }
  
      public void testGetNotInPool()
      {
          MockControl requestControl = newControl(HttpServletRequest.class);
          HttpServletRequest request = (HttpServletRequest) requestControl.getMock();
  
          MockControl extractorControl = newControl(LocaleExtractor.class);
          LocaleExtractor extractor = (LocaleExtractor) extractorControl.getMock();
  
          MockControl poolControl = newControl(ObjectPool.class);
          ObjectPool pool = (ObjectPool) poolControl.getMock();
  
          // Training
  
          request.getSession(false);
          requestControl.setReturnValue(null);
  
          extractor.extractLocaleForCurrentRequest();
          extractorControl.setReturnValue(Locale.CHINESE);
  
          IEngine engine = (IEngine) newMock(IEngine.class);
  
          pool.get(Locale.CHINESE);
          poolControl.setReturnValue(null);
  
          MockControl factoryControl = newControl(EngineFactory.class);
          EngineFactory factory = (EngineFactory) factoryControl.getMock();
  
          factory.constructNewEngineInstance(Locale.CHINESE);
          factoryControl.setReturnValue(engine);
  
          replayControls();
  
          EngineManagerImpl m = new EngineManagerImpl();
  
          m.setServletName("george");
          m.setRequest(request);
          m.setEnginePool(pool);
          m.setLocaleExtractor(extractor);
          m.setEngineFactory(factory);
  
          m.initializeService();
  
          IEngine actual = m.getEngineInstance();
  
          assertSame(engine, actual);
  
          verifyControls();
      }
  
      public void testStoreNoSession()
      {
          MockControl requestControl = newControl(HttpServletRequest.class);
          HttpServletRequest request = (HttpServletRequest) requestControl.getMock();
  
          MockControl engineControl = newControl(IEngine.class);
          IEngine engine = (IEngine) engineControl.getMock();
  
          ObjectPool pool = (ObjectPool) newMock(ObjectPool.class);
  
          // Training
  
          request.getSession(false);
          requestControl.setReturnValue(null);
  
          engine.getLocale();
          engineControl.setReturnValue(Locale.KOREAN);
  
          pool.store(Locale.KOREAN, engine);
  
          replayControls();
  
          EngineManagerImpl m = new EngineManagerImpl();
  
          m.setServletName("george");
          m.setRequest(request);
          m.setEnginePool(pool);
  
          m.initializeService();
  
          m.storeEngineInstance(engine);
  
          verifyControls();
      }
  
      public void setStoreIntoSession()
      {
          MockControl requestControl = newControl(HttpServletRequest.class);
          HttpServletRequest request = (HttpServletRequest) requestControl.getMock();
  
          HttpSession session = (HttpSession) newMock(HttpSession.class);
  
          MockControl engineControl = newControl(IEngine.class);
          IEngine engine = (IEngine) engineControl.getMock();
  
          // Training
  
          request.getSession(false);
          requestControl.setReturnValue(session);
  
          engine.getLocale();
          engineControl.setReturnValue(Locale.KOREAN);
  
          session.setAttribute(EngineManagerImpl.ENGINE_KEY_PREFIX + "george", engine);
  
          replayControls();
  
          EngineManagerImpl m = new EngineManagerImpl();
  
          m.setServletName("george");
          m.setRequest(request);
  
          m.initializeService();
  
          m.storeEngineInstance(engine);
  
          verifyControls();
      }
  }
  
  
  
  1.3       +13 -13    jakarta-tapestry/junit/src/org/apache/tapestry/test/TestScriptParser.java
  
  Index: TestScriptParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/test/TestScriptParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestScriptParser.java	17 Jun 2004 18:53:42 -0000	1.2
  +++ TestScriptParser.java	23 Aug 2004 14:53:16 -0000	1.3
  @@ -29,7 +29,7 @@
   import org.apache.tapestry.util.xml.DocumentParseException;
   
   /**
  - * Tests {@link org.apache.tapestry.test.ScriptParser}.
  + * Tests {@link org.apache.tapestry.test.IntegrationTestScriptParser}.
    *
    * @author Howard Lewis Ship
    * @since 3.1
  @@ -45,7 +45,7 @@
   
           Resource fileResource = baseResource.getRelativeResource(file);
   
  -        return new ScriptParser().parse(fileResource);
  +        return new IntegrationTestScriptParser().parse(fileResource);
       }
   
       /**
  @@ -54,7 +54,7 @@
        */
       public void testEmpty() throws Exception
       {
  -        ScriptDescriptor sd = parse("Empty.sdl");
  +        ScriptDescriptor sd = parse("Empty.xml");
   
           assertNotNull(sd.getLocation());
           assertEquals("test-context", sd.getContextName());
  @@ -65,7 +65,7 @@
       {
           try
           {
  -            parse("EmptyMissingAttribute.sdl");
  +            parse("EmptyMissingAttribute.xml");
               unreachable();
           }
           catch (DocumentParseException ex)
  @@ -80,7 +80,7 @@
       {
           try
           {
  -            parse("EmptyUnknownAttribute.sdl");
  +            parse("EmptyUnknownAttribute.xml");
               unreachable();
           }
           catch (DocumentParseException ex)
  @@ -91,7 +91,7 @@
   
       public void testServlet() throws Exception
       {
  -        ScriptDescriptor sd = parse("Servlet.sdl");
  +        ScriptDescriptor sd = parse("Servlet.xml");
   
           ServletDescriptor d = sd.getServletDescriptor("default");
           assertEquals("default", d.getName());
  @@ -108,7 +108,7 @@
       {
           try
           {
  -            parse("ServletDuplicateName.sdl");
  +            parse("ServletDuplicateName.xml");
               unreachable();
           }
           catch (ApplicationRuntimeException ex)
  @@ -120,7 +120,7 @@
   
       public void testInitParameter() throws Exception
       {
  -        ScriptDescriptor sd = parse("InitParameter.sdl");
  +        ScriptDescriptor sd = parse("InitParameter.xml");
   
           ServletDescriptor s1 = sd.getServletDescriptor("default");
   
  @@ -135,7 +135,7 @@
   
       public void testRequest() throws Exception
       {
  -        ScriptDescriptor sd = parse("Request.sdl");
  +        ScriptDescriptor sd = parse("Request.xml");
   
           List l = sd.getRequestDescriptors();
   
  @@ -154,7 +154,7 @@
   
       public void testRequestParameters() throws Exception
       {
  -        ScriptDescriptor sd = parse("RequestParameters.sdl");
  +        ScriptDescriptor sd = parse("RequestParameters.xml");
   
           List l = sd.getRequestDescriptors();
   
  @@ -175,7 +175,7 @@
   
       public void testAssertOutput() throws Exception
       {
  -        ScriptDescriptor sd = parse("AssertOutput.sdl");
  +        ScriptDescriptor sd = parse("AssertOutput.xml");
   
           ScriptedTestSession ss = createSession();
   
  @@ -197,7 +197,7 @@
   
       public void testAssertRegexp() throws Exception
       {
  -        ScriptDescriptor sd = parse("AssertRegexp.sdl");
  +        ScriptDescriptor sd = parse("AssertRegexp.xml");
   
           ScriptedTestSession ss = createSession();
   
  @@ -219,7 +219,7 @@
   
       public void testAssertRegexpMatch() throws Exception
       {
  -        ScriptDescriptor sd = parse("AssertRegexpMatch.sdl");
  +        ScriptDescriptor sd = parse("AssertRegexpMatch.xml");
   
           ScriptedTestSession ss = createSession();
   
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/test/Empty.xml
  
  Index: Empty.xml
  ===================================================================
  <?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.
  -->
  
  <test-script context="test-context" directory="root"/>
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/test/RequestParameters.xml
  
  Index: RequestParameters.xml
  ===================================================================
  <?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.
  -->
  
  
  <test-script context="test-context" directory="root">
    <servlet name="default"/>
    
    <request servlet="alpha">
    	<parameter name="foo" value="manchu"/>
    	<parameter name="flintstone" value="fred"/>
    	<parameter name="flintstone" value="wilma"/>
    </request>
    
    <request>
      <parameter name="flintstone" value="pebbles"/>
    </request>
  </test-script>
  
  
  
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/test/AssertRegexpMatch.xml
  
  Index: AssertRegexpMatch.xml
  ===================================================================
  <?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.
  -->
  <test-script context="test-context">
    <request>
      <assert-regexp subgroup="1"> 
  <![CDATA[
  <(.*?)>
  ]]> 
      	<match>title</match>
        <match>/title</match>
        <match>body</match>
        <match>/body</match>
      </assert-regexp>
    </request>
  </test-script>
  
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/test/Servlet.xml
  
  Index: Servlet.xml
  ===================================================================
  <?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.
  -->
  
  <test-script context="test-context" directory="root">
    <servlet name="default" class="MyClass"/>
    <servlet name="other"/>
  </test-script>
  
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/test/InitParameter.xml
  
  Index: InitParameter.xml
  ===================================================================
  <?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.
  -->
  <test-script context="test-context" directory="root">
    <servlet name="default" class="MyClass">
      <init-parameter name="p1" value="v1"/>
      <init-parameter name="p2" value="v2"/>
    </servlet>
      
    <servlet name="other">
      <init-parameter name="p3" value="v3"/>
    </servlet>
  </test-script>
  
  
  
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/test/AssertOutput.xml
  
  Index: AssertOutput.xml
  ===================================================================
  <?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.
  -->
  
  <test-script context="test-context">
    <request>
    	<assert-output>
  <![CDATA[
  <title>Away</title>
  ]]>
      </assert-output>
    </request>
  </test-script>
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/test/Request.xml
  
  Index: Request.xml
  ===================================================================
  <?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.
  -->
  
  <test-script context="test-context" directory="root">
  	<request servlet="alpha"/>
  	
  	<request servlet="beta" servlet-path="/beta"/>
  </test-script>
  
  
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/test/EmptyUnknownAttribute.xml
  
  Index: EmptyUnknownAttribute.xml
  ===================================================================
  <?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.
  -->
  
  <!-- That should be 'context', so it will be an unknown attribute -->
  
  <test-script cntext="test-context" directory="root"/>
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/test/EmptyMissingAttribute.xml
  
  Index: EmptyMissingAttribute.xml
  ===================================================================
  <?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.
  -->
  
  <test-script directory="root"/>
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/test/ServletDuplicateName.xml
  
  Index: ServletDuplicateName.xml
  ===================================================================
  <?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.
  -->
  
  <test-script context="test-context" directory="root">
    <servlet name="default"/>
    <servlet name="default"/>
  </test-script>
  
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/test/AssertRegexp.xml
  
  Index: AssertRegexp.xml
  ===================================================================
  <?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.
  -->
  
  <test-script context="test-context">
    <request>
      <assert-regexp>
  <![CDATA[
  <body>.*</body>
  ]]>
      </assert-regexp>
    </request>
  </test-script>
  
  
  
  
  1.1                  jakarta-tapestry/framework/conf/log4j.properties
  
  Index: log4j.properties
  ===================================================================
  # Set root category priority to INFO and its only appender to A1.
  log4j.rootCategory=WARN, A1
  
  # A1 is set to be a ConsoleAppender. 
  log4j.appender.A1=org.apache.log4j.ConsoleAppender
  
  # A1 uses PatternLayout.
  log4j.appender.A1.layout=org.apache.log4j.PatternLayout
  log4j.appender.A1.layout.ConversionPattern=%c{1} [%p] %m%n
  
  log4j.category.org.apache.hivemind=ERROR
  log4j.category.hivemind=ERROR
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/test/IntegrationTestScriptParser.java
  
  Index: IntegrationTestScriptParser.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.test;
  
  import java.io.BufferedInputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.net.URL;
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.Map;
  import java.util.Properties;
  
  import javax.xml.parsers.SAXParser;
  import javax.xml.parsers.SAXParserFactory;
  
  import org.apache.hivemind.ApplicationRuntimeException;
  import org.apache.hivemind.Resource;
  import org.apache.hivemind.parse.AbstractParser;
  import org.apache.hivemind.parse.ElementParseInfo;
  import org.apache.tapestry.test.assertions.AssertOutput;
  import org.apache.tapestry.test.assertions.AssertRegexp;
  import org.apache.tapestry.test.assertions.RegexpMatch;
  import org.apache.tapestry.util.xml.DocumentParseException;
  
  /**
   * Parses Tapestry test scripts; XML files that define an execution environment and
   * a sequence of operations and assertions.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public class IntegrationTestScriptParser extends AbstractParser
  {
      private ScriptDescriptor _scriptDescriptor;
      private Map _attributes;
      private String _elementName;
  
      /**
       * Map from element name to a ElementParseInfo
       */
      private final Map _elementParseInfo = new HashMap();
  
      public IntegrationTestScriptParser()
      {
          initializeFromPropertiesFile();
      }
  
      private void initializeFromPropertiesFile()
      {
          Properties p = new Properties();
          InputStream stream = null;
  
          try
          {
  
              InputStream rawStream = getClass().getResourceAsStream("ScriptParser.properties");
              stream = new BufferedInputStream(rawStream);
  
              p.load(stream);
  
              stream.close();
              stream = null;
          }
          catch (IOException ex)
          {
              throw new ApplicationRuntimeException(ex);
          }
          finally
          {
              close(stream);
          }
  
          initializeFromProperties(p);
      }
  
      private void initializeFromProperties(Properties p)
      {
          Iterator i = p.keySet().iterator();
          while (i.hasNext())
          {
              String key = (String) i.next();
              String value = p.getProperty(key);
  
              initializeFromProperty(key, value);
          }
      }
  
      private void initializeFromProperty(String key, String value)
      {
          // Ignore keys that don't start with "required."
  
          if (!key.startsWith("required."))
              return;
  
          int lastDotx = key.lastIndexOf('.');
  
          String elementName = key.substring(9, lastDotx);
          String attributeName = key.substring(lastDotx + 1);
  
          boolean required = value.equalsIgnoreCase("true");
  
          ElementParseInfo epi = getElementParseInfo(elementName);
  
          epi.addAttribute(attributeName, required);
      }
  
      private void close(InputStream stream)
      {
          try
          {
              if (stream != null)
                  stream.close();
          }
          catch (IOException ex)
          {
              // Ingore.
          }
      }
  
      public ScriptDescriptor parse(Resource script)
      {
          initializeParser(script, STATE_INITIAL);
  
          try
          {
              startParse();
  
              return _scriptDescriptor;
          }
          finally
          {
              resetParser();
          }
      }
  
      private void startParse()
      {
          try
          {
              SAXParserFactory factory = SAXParserFactory.newInstance();
  
              SAXParser parser = factory.newSAXParser();
  
              Resource resource = getResource();
  
              URL url = resource.getResourceURL();
  
              InputStream is = url.openStream();
  
              parser.parse(is, this);
          }
          catch (Exception ex)
          {
              throw new DocumentParseException(ex.getMessage(), getResource(), ex);
          }
      }
  
      protected void initializeParser(Resource resource, int startState)
      {
          super.initializeParser(resource, startState);
  
          _attributes = new HashMap();
      }
  
      protected void resetParser()
      {
          _attributes = null;
          _elementName = null;
          _scriptDescriptor = null;
  
          super.resetParser();
      }
  
      private static final int STATE_INITIAL = 0;
      private static final int STATE_TEST_SCRIPT = 1;
      private static final int STATE_SERVLET = 2;
      private static final int STATE_INIT_PARAMETER = 3;
      private static final int STATE_REQUEST = 4;
      private static final int STATE_ASSERT_OUTPUT = 5;
      private static final int STATE_ASSERT_REGEXP = 6;
      private static final int STATE_MATCH = 7;
  
      private static final int STATE_NO_CONTENT = 1000;
  
      protected void begin(String elementName, Map attributes)
      {
          _elementName = elementName;
          _attributes = attributes;
  
          switch (getState())
          {
              case STATE_INITIAL :
                  beginInitial();
                  break;
  
              case STATE_TEST_SCRIPT :
                  beginTestScript();
                  break;
  
              case STATE_SERVLET :
                  beginServlet();
                  break;
  
              case STATE_REQUEST :
                  beginRequest();
                  break;
  
              case STATE_ASSERT_REGEXP :
                  beginAssertRegexp();
                  break;
  
              default :
                  unexpectedElement(_elementName);
          }
      }
  
      protected void end(String elementName)
      {
          _elementName = elementName;
  
          switch (getState())
          {
              case STATE_ASSERT_OUTPUT :
  
                  endAssertOutput();
                  break;
  
              case STATE_ASSERT_REGEXP :
                  endAssertRegexp();
                  break;
  
              case STATE_MATCH :
                  endMatch();
                  break;
  
              default :
                  break;
          }
  
          pop();
  
      }
  
      private void beginInitial()
      {
          if (_elementName.equals("test-script"))
          {
              enterTestScript();
              return;
          }
  
          unexpectedElement(_elementName);
      }
  
      private void beginTestScript()
      {
          if (_elementName.equals("servlet"))
          {
              enterServlet();
              return;
          }
  
          if (_elementName.equals("request"))
          {
              enterRequest();
              return;
          }
  
          unexpectedElement(_elementName);
      }
  
      private void beginServlet()
      {
          if (_elementName.equals("init-parameter"))
          {
              enterInitParameter();
              return;
          }
  
          unexpectedElement(_elementName);
      }
  
      private void enterRequest()
      {
          validateAttributes();
  
          String servletName = getAttribute("servlet");
          String servletPath = getAttribute("servlet-path", "/app");
  
          RequestDescriptor rd = new RequestDescriptor();
          rd.setServletName(servletName);
          rd.setServletPath(servletPath);
  
          ScriptDescriptor sd = (ScriptDescriptor) peekObject();
  
          sd.addRequestDescriptor(rd);
  
          push(_elementName, rd, STATE_REQUEST);
      }
  
      public void beginRequest()
      {
          if (_elementName.equals("parameter"))
          {
              enterParameter();
              return;
          }
  
          if (_elementName.equals("assert-output"))
          {
              enterAssertOutput();
              return;
          }
  
          if (_elementName.equals("assert-regexp"))
          {
              enterAssertRegexp();
              return;
          }
  
          unexpectedElement(_elementName);
      }
  
      private void enterAssertOutput()
      {
          validateAttributes();
  
          AssertOutput ao = new AssertOutput();
          RequestDescriptor rd = (RequestDescriptor) peekObject();
  
          rd.addAssertion(ao);
  
          push(_elementName, ao, STATE_ASSERT_OUTPUT, false);
      }
  
      private void enterAssertRegexp()
      {
          validateAttributes();
  
          int subgroup = getIntAttribute("subgroup", 0);
  
          AssertRegexp ar = new AssertRegexp();
          ar.setSubgroup(subgroup);
  
          RequestDescriptor rd = (RequestDescriptor) peekObject();
  
          rd.addAssertion(ar);
  
          push(_elementName, ar, STATE_ASSERT_REGEXP, false);
      }
  
      private void beginAssertRegexp()
      {
          if (_elementName.equals("match"))
          {
              enterMatch();
              return;
          }
  
          unexpectedElement(_elementName);
      }
  
      private void enterMatch()
      {
          validateAttributes();
  
          RegexpMatch m = new RegexpMatch();
          AssertRegexp ar = (AssertRegexp) peekObject();
  
          ar.addMatch(m);
  
          push(_elementName, m, STATE_MATCH, false);
      }
  
      private void endAssertOutput()
      {
          String content = peekContent();
          AssertOutput ao = (AssertOutput) peekObject();
  
          ao.setExpectedSubstring(content);
      }
  
      private void endAssertRegexp()
      {
          String content = peekContent();
  
          AssertRegexp ar = (AssertRegexp) peekObject();
  
          ar.setRegexp(content);
      }
  
      private void endMatch()
      {
          String content = peekContent();
  
          RegexpMatch m = (RegexpMatch) peekObject();
  
          m.setExpectedString(content);
      }
  
      protected String peekContent()
      {
          String rawContent = super.peekContent();
  
          if (rawContent == null)
              return null;
  
          return rawContent.trim();
      }
  
      private void enterParameter()
      {
          validateAttributes();
  
          String name = getAttribute("name");
          String value = getAttribute("value");
  
          RequestDescriptor rd = (RequestDescriptor) peekObject();
  
          rd.addParameter(name, value);
  
          push(_elementName, null, STATE_NO_CONTENT);
      }
  
      private void enterInitParameter()
      {
          validateAttributes();
  
          String name = getAttribute("name");
          String value = getAttribute("value");
  
          ServletDescriptor sd = (ServletDescriptor) peekObject();
  
          sd.addInitParameter(name, value);
  
          push(_elementName, null, STATE_NO_CONTENT);
      }
  
      private void enterTestScript()
      {
          validateAttributes();
  
          String contextName = getAttribute("context");
          String directory = getAttribute("directory");
  
          ScriptDescriptor sd = new ScriptDescriptor();
          sd.setContextName(contextName);
          sd.setRootDirectory(directory);
  
          _scriptDescriptor = sd;
  
          push(_elementName, sd, STATE_TEST_SCRIPT);
      }
  
      private void enterServlet()
      {
          validateAttributes();
  
          String name = getAttribute("name");
          String className = getAttribute("class", "org.apache.tapestry.ApplicationServlet");
  
          ServletDescriptor sd = new ServletDescriptor();
          sd.setName(name);
          sd.setClassName(className);
  
          // Can't wait for push() to do this, because of checks inside
          // addServletDescriptor(). 
          sd.setLocation(getLocation());
  
          ScriptDescriptor scriptDescriptor = (ScriptDescriptor) peekObject();
  
          scriptDescriptor.addServletDescriptor(sd);
  
          push(_elementName, sd, STATE_SERVLET);
      }
  
      private String getAttribute(String name)
      {
          return (String) _attributes.get(name);
      }
  
      private String getAttribute(String name, String defaultValue)
      {
          if (!_attributes.containsKey(name))
              return defaultValue;
  
          return (String) _attributes.get(name);
      }
  
      private void validateAttributes()
      {
          Iterator i = _attributes.keySet().iterator();
  
          ElementParseInfo epi = getElementParseInfo(_elementName);
  
          // First, check that each attribute is in the set of expected attributes.
  
          while (i.hasNext())
          {
              String name = (String) i.next();
  
              if (!epi.isKnown(name))
                  throw new DocumentParseException(
                      ScriptMessages.unexpectedAttributeInElement(name, _elementName),
                      getLocation(),
                      null);
          }
  
          // Now check that all required attributes have been specified.
  
          i = epi.getRequiredNames();
          while (i.hasNext())
          {
              String name = (String) i.next();
  
              if (!_attributes.containsKey(name))
                  throw new DocumentParseException(
                      ScriptMessages.missingRequiredAttribute(name, _elementName),
                      getLocation(),
                      null);
          }
  
      }
  
      private ElementParseInfo getElementParseInfo(String elementName)
      {
          ElementParseInfo result = (ElementParseInfo) _elementParseInfo.get(elementName);
  
          if (result == null)
          {
              result = new ElementParseInfo();
              _elementParseInfo.put(elementName, result);
          }
  
          return result;
      }
  
      private int getIntAttribute(String name, int defaultValue)
      {
          String attributeValue = getAttribute(name);
  
          if (attributeValue == null)
              return defaultValue;
  
          try
          {
              return Integer.parseInt(attributeValue);
          }
          catch (NumberFormatException ex)
          {
              throw new ApplicationRuntimeException(
                  ScriptMessages.invalidIntAttribute(
                      name,
                      _elementName,
                      getLocation(),
                      attributeValue),
                  getLocation(),
                  ex);
          }
      }
  }
  
  
  
  1.3       +91 -2     jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/EngineManagerImpl.java
  
  Index: EngineManagerImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/EngineManagerImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EngineManagerImpl.java	4 Aug 2004 15:06:00 -0000	1.2
  +++ EngineManagerImpl.java	23 Aug 2004 14:53:16 -0000	1.3
  @@ -14,21 +14,110 @@
   
   package org.apache.tapestry.services.impl;
   
  +import java.util.Locale;
  +
  +import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.http.HttpSession;
  +
   import org.apache.tapestry.IEngine;
  +import org.apache.tapestry.services.EngineFactory;
   import org.apache.tapestry.services.EngineManager;
  +import org.apache.tapestry.services.LocaleExtractor;
  +import org.apache.tapestry.services.ObjectPool;
   
  -
  +/**
  + * Implementation of service {@link org.apache.tapestry.services.EngineManager}.
  + *
  + * @author Howard Lewis Ship
  + * @since 3.1
  + */
   public class EngineManagerImpl implements EngineManager
   {
  +    private ObjectPool _enginePool;
  +    private HttpServletRequest _request;
  +    private String _servletName;
  +    private String _engineKey;
  +    private EngineFactory _engineFactory;
  +    private LocaleExtractor _localeExtractor;
  +
  +    static final String ENGINE_KEY_PREFIX = "org.apache.tapestry.engine:";
  +
  +    public void initializeService()
  +    {
  +        _engineKey = ENGINE_KEY_PREFIX + _servletName;
  +    }
   
       public IEngine getEngineInstance()
       {
  -        return null;
  +        HttpSession session = getSession();
  +        IEngine result = null;
  +
  +        if (session != null)
  +        {
  +            result = (IEngine) session.getAttribute(_engineKey);
  +
  +            if (result != null)
  +                return result;
  +        }
  +
  +        Locale locale = _localeExtractor.extractLocaleForCurrentRequest();
  +
  +        result = (IEngine) _enginePool.get(locale);
  +
  +        // This happens when either the pool is empty, or when a session exists
  +        // but the engine has not been stored into it (which should never happen, and
  +        // probably indicates an error in the framework or the application).
  +
  +        if (result == null)
  +            result = _engineFactory.constructNewEngineInstance(locale);
  +
  +        return result;
  +    }
  +
  +    private HttpSession getSession()
  +    {
  +        return _request.getSession(false);
       }
   
       public void storeEngineInstance(IEngine engine)
       {
  +        HttpSession session = getSession();
  +
  +        if (session == null)
  +        {
  +            _enginePool.store(engine.getLocale(), engine);
  +            return;
  +        }
  +
  +        // TODO: We've lost the optimizations for only storing the engine when dirty.
  +        // However, since (I believe) in 3.1, the engine will no longer be session persistent,
  +        // this is OK.
  +
  +        session.setAttribute(_engineKey, engine);
  +    }
  +
  +    public void setEngineFactory(EngineFactory factory)
  +    {
  +        _engineFactory = factory;
  +    }
  +
  +    public void setEnginePool(ObjectPool pool)
  +    {
  +        _enginePool = pool;
  +    }
  +
  +    public void setLocaleExtractor(LocaleExtractor extractor)
  +    {
  +        _localeExtractor = extractor;
  +    }
   
  +    public void setRequest(HttpServletRequest request)
  +    {
  +        _request = request;
       }
   
  +    public void setServletName(String string)
  +    {
  +        _servletName = string;
  +    }
   }
  
  
  
  1.2       +2 -0      jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ImplStrings.properties
  
  Index: ImplStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ImplStrings.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ImplStrings.properties	21 Jun 2004 19:11:52 -0000	1.1
  +++ ImplStrings.properties	23 Aug 2004 14:53:16 -0000	1.2
  @@ -14,4 +14,6 @@
   
   initializer-contribution=application initializer
   no-application-specification=Could not find an application specification for application servlet {0}.
  +error-instantiating-engine=Unable to instantiate engine as instance of class {0}: {1}
  +
   
  
  
  
  1.3       +5 -0      jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ImplMessages.java
  
  Index: ImplMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ImplMessages.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ImplMessages.java	4 Aug 2004 15:06:00 -0000	1.2
  +++ ImplMessages.java	23 Aug 2004 14:53:16 -0000	1.3
  @@ -38,4 +38,9 @@
       {
           return _formatter.format("no-application-specification", servlet.getServletName());
       }
  +
  +    public static String errorInstantiatingEngine(Class engineClass, Throwable cause)
  +    {
  +        return _formatter.format("error-instantiating-engine", engineClass.getName(), cause);
  +    }
   }
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ServletInfoInitializer.java
  
  Index: ServletInfoInitializer.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.io.IOException;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.tapestry.services.RequestServicer;
  import org.apache.tapestry.services.RequestServicerFilter;
  import org.apache.tapestry.services.ServletInfo;
  
  /**
   * A {@link org.apache.tapestry.services.RequestServicerFilter} threaded early onto the pipeline,
   * which invokes {@link org.apache.tapestry.services.ServletInfo#store(HttpServletRequest, HttpServletResponse)}
   * so that other services can obtain the current thread's request and response.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public class ServletInfoInitializer implements RequestServicerFilter
  {
      private ServletInfo _servletInfo;
  
      public void setServletInfo(ServletInfo info)
      {
          _servletInfo = info;
      }
  
      public void service(
          HttpServletRequest request,
          HttpServletResponse response,
          RequestServicer servicer)
          throws IOException, ServletException
      {
          _servletInfo.store(request, response);
  
          servicer.service(request, response);
      }
  
  }
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/EngineFactoryImpl.java
  
  Index: EngineFactoryImpl.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 org.apache.hivemind.ApplicationRuntimeException;
  import org.apache.tapestry.IEngine;
  import org.apache.tapestry.engine.BaseEngine;
  import org.apache.tapestry.services.EngineFactory;
  
  /**
   * Standard implementation of {@link org.apache.tapestry.services.EngineFactory} service.
   * This should do for most purposes, since a major focus of Tapestry 3.1 is to no longer
   * require subclassing of {@link org.apache.tapestry.engine.BaseEngine}.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public class EngineFactoryImpl implements EngineFactory
  {
      interface EngineConstructor
      {
          IEngine construct();
      }
  
      static class BaseEngineConstructor implements EngineConstructor
      {
          public IEngine construct()
          {
              return new BaseEngine();
          }
      }
  
      static class ReflectiveEngineConstructor implements EngineConstructor
      {
          private Class _engineClass;
  
          ReflectiveEngineConstructor(Class engineClass)
          {
              _engineClass = engineClass;
          }
  
          public IEngine construct()
          {
              try
              {
                  return (IEngine) _engineClass.newInstance();
              }
              catch (Exception ex)
              {
                  throw new ApplicationRuntimeException(
                      ImplMessages.errorInstantiatingEngine(_engineClass, ex),
                      ex);
              }
          }
      }
  
      public IEngine constructNewEngineInstance(Locale locale)
      {
          return null;
      }
  
  }
  
  
  
  No                   revision
  No                   revision
  No                   revision
  1.12      +0 -22     jakarta-tapestry/junit/src/org/apache/tapestry/junit/TapestryTestCase.java
  
  Index: TapestryTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/TapestryTestCase.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TapestryTestCase.java	21 Jun 2004 19:11:53 -0000	1.11
  +++ TapestryTestCase.java	23 Aug 2004 14:53:16 -0000	1.12
  @@ -149,26 +149,4 @@
               "Exception " + ex + " does not contain sub-string '" + string + "'.");
       }
   
  -	/**
  -	 * Tests to see if the provided value matches the regular expression.
  -	 * 
  -	 * @throws AssertionFailedError if the input does not match
  -	 * 
  -	 * @since 3.1
  -	 */
  -    public static void assertRegexp(String regexpPattern, String value)
  -    {
  -        if (_matcher == null)
  -            _matcher = new RegexpMatcher();
  -
  -        if (_matcher.matches(regexpPattern, value))
  -            return;
  -
  -        throw new AssertionFailedError(
  -            "Text \""
  -                + value
  -                + "\" does not contain regular expression \""
  -                + regexpPattern
  -                + "\".");
  -    }
   }
  
  
  
  1.3       +1 -1      jakarta-tapestry/framework/src/org/apache/tapestry/services/EngineManager.java
  
  Index: EngineManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/services/EngineManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EngineManager.java	4 Aug 2004 15:05:56 -0000	1.2
  +++ EngineManager.java	23 Aug 2004 14:53:16 -0000	1.3
  @@ -17,7 +17,7 @@
   import org.apache.tapestry.IEngine;
   
   /**
  - * Service responsible for obtaining instances of of {@link org.apache.tapestry.IEngine}
  + * Service responsible for obtaining instances of {@link org.apache.tapestry.IEngine}
    * to service the current request.  An engine service may be retrieved from a pool, or extracted
    * from the HttpSession. After the request is processed, the engine is re-stored into the
    * HttpSession (if stateful) or back into the pool (if not stateful).
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/EngineFactory.java
  
  Index: EngineFactory.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;
  
  import java.util.Locale;
  
  import org.apache.tapestry.IEngine;
  
  /**
   * Responsible for creating new instance of {@link org.apache.tapestry.IEngine}.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public interface EngineFactory
  {
  	/**
  	 * Creates and initializes a new engine instance for the specified locale.
  	 */
  	public IEngine constructNewEngineInstance(Locale locale);
  }
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/LocaleExtractor.java
  
  Index: LocaleExtractor.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;
  
  import java.util.Locale;
  
  /**
   * Used to determine what is the client-specified locale, if any, for the current request.
   * This may be stored in the request as an HTTP Cookie, or may be interpolated from
   * request headers.  Additionally, the "raw" value provided by the client may be
   * filtered down.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public interface LocaleExtractor
  {
  	public Locale extractLocaleForCurrentRequest();
  }
  
  
  
  1.32      +16 -14    jakarta-tapestry/framework/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/build.xml,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- build.xml	4 Aug 2004 15:04:26 -0000	1.31
  +++ build.xml	23 Aug 2004 14:53:16 -0000	1.32
  @@ -6,6 +6,8 @@
     
     <property name="java.src.dir" value="src"/>
     <property name="test.src.dir" value="../junit/src"/>
  +  <property name="conf.src.dir" value="conf"/>
  +  
     <property name="descriptor.src.dir" value="conf"/>
     <property name="module.javac.deprecation" value="off"/>
       
  @@ -17,21 +19,21 @@
   	<import file="${hivebuild.dir}/clover-report.xml"/>  
     
   	<target name="compile">
  -    <ibiblio-dependency jar="bsf-2.3.0.jar" group-id="bsf"/>
  -    <ibiblio-dependency jar="commons-codec-1.2.jar" group-id="commons-codec"/>
  -		<ibiblio-dependency jar="commons-fileupload-1.0.jar" group-id="commons-fileupload"/>    
  -    <ibiblio-dependency jar="commons-lang-2.0.jar" group-id="commons-lang"/>
  -    <ibiblio-dependency jar="commons-logging-1.0.4.jar" group-id="commons-logging"/>
  -    <ibiblio-dependency jar="hivemind-1.0-beta-2.jar" group-id="hivemind"/>
  -    <ibiblio-dependency jar="hivemind-lib-1.0-beta-2.jar" group-id="hivemind"/>
  -    <ibiblio-dependency jar="oro-2.0.6.jar" group-id="oro"/>
  -		<ibiblio-dependency jar="javassist-2.6.jar" group-id="jboss"/>
  -		<ibiblio-dependency jar="servletapi-2.3.jar" group-id="servletapi"/>
  -    <ibiblio-dependency jar="ognl-2.6.3.jar" group-id="ognl"/>
  +    <ibiblio-dependency artifact="bsf"                version="2.3.0"               group="bsf"/>
  +    <ibiblio-dependency artifact="commons-codec"      version="1.2"                 group="commons-codec"/>
  +		<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="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 jar="log4j-1.2.7.jar" group-id="log4j" use="test"/>
  -		<ibiblio-dependency jar="easymock-1.1.jar" group-id="easymock" use="test"/>
  -    <ibiblio-dependency jar="jdom-b8.jar" group-id="jdom" 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"/>
   		
   		<default-compile/>
       
  
  
  
  1.48      +2 -2      jakarta-tapestry/.classpath
  
  Index: .classpath
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/.classpath,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- .classpath	4 Aug 2004 15:04:24 -0000	1.47
  +++ .classpath	23 Aug 2004 14:53:16 -0000	1.48
  @@ -12,8 +12,6 @@
       <classpathentry kind="lib" path="ext-package/lib/commons-lang-2.0.jar"/>
       <classpathentry kind="lib" path="ext-package/lib/commons-logging-1.0.3.jar"/>
       <classpathentry kind="lib" path="ext-package/lib/easymock-1.1.jar"/>
  -    <classpathentry kind="lib" path="ext-package/lib/hivemind-1.0-beta-2.jar"/>
  -    <classpathentry kind="lib" path="ext-package/lib/hivemind-lib-1.0-beta-2.jar"/>
       <classpathentry kind="lib" path="ext-package/lib/javassist-2.6.jar"/>
       <classpathentry kind="lib" path="ext-package/lib/jdom-b8.jar"/>
       <classpathentry kind="lib" path="ext-package/lib/junit-3.8.1.jar"/>
  @@ -21,5 +19,7 @@
       <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="output" path="bin"/>
   </classpath>
  
  
  
  1.1                  jakarta-tapestry/framework/conf/META-INF/hivemodule.xml
  
  Index: hivemodule.xml
  ===================================================================
  <?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.
  -->
  
  <module id="tapestry" version="3.1.0">
  
    The master module for the Tapestry web application framework.
    
    <service-point id="MasterInitializer" interface="org.apache.tapestry.services.ApplicationInitializer">
      
      Master startup for the application; invokes an ordered series of other ApplicationInitializer instances contributed to
      the ApplicationInitializers configuration point.
      
      <invoke-factory>
        <construct class="org.apache.tapestry.services.impl.MasterInitializer">
          <set-configuration property="initializers" configuration-id="ApplicationInitializers"/>
        </construct>
      </invoke-factory>
    </service-point>
  
    <configuration-point id="ApplicationInitializers">
    
      An orderable list of ApplicationInitializer services.
      
      <schema>
        <element name="initializer">
          <attribute name="name" required="true">
            A unique id used when ordering the initializers.
          </attribute>
        
          <attribute name="before" translator="id-list">
            A comma-seperated list of the names of initializers that should execute after this initializer.
          </attribute>
        
          <attribute name="after" translator="id-list">
            A comma-seperated list of the names of initializers that should execute before this initializer.
          </attribute>
          
          <attribute name="object" required="true" translator="object">
            The object which implements the ApplicationInitializer interface.
          </attribute>
          
          <conversion class="org.apache.tapestry.services.impl.InitializerContribution">
            <map attribute="object" property="initializer"/>
          </conversion>
        </element>
      </schema>
    </configuration-point>
  
    <service-point id="ApplicationSpecificationInitializer" interface="org.apache.tapestry.services.ApplicationInitializer">
      
      Locates and parses the application specification and informs the ApplicationGlobals service about it.
      
      <invoke-factory>
        <construct class="org.apache.tapestry.services.impl.ApplicationSpecificationInitializer">
          <set-service property="classpathResourceFactory" service-id="ClasspathResourceFactory"/>
          <set-service property="globals" service-id="ApplicationGlobals"/>
          <set-service property="parser" service-id="SpecificationParser"/>
        </construct>
      </invoke-factory>
    </service-point>
    
    <service-point id="ClasspathResourceFactory" interface="org.apache.tapestry.services.ClasspathResourceFactory">
    
      Constructs new instances of ClasspathResource.
      
      <invoke-factory>
        <construct class="org.apache.tapestry.services.impl.ClasspathResourceFactoryImpl"/>
      </invoke-factory>
    </service-point>
    
    <service-point id="SpecificationParser" interface="org.apache.tapestry.services.SpecificationParser">
      <invoke-factory model="pooled">
        <construct class="org.apache.tapestry.services.impl.SpecificationParserImpl"/>
      </invoke-factory>
      
      <interceptor service-id="hivemind.LoggingInterceptor"/>
    </service-point>
    
    <service-point id="ApplicationGlobals" interface="org.apache.tapestry.services.ApplicationGlobals">
      <create-instance class="org.apache.tapestry.services.impl.ApplicationGlobalsImpl"/>
    </service-point>
    
    <contribution configuration-id="ApplicationInitializers">
      <initializer name="ApplicationSpecificationInitializer" object="service:ApplicationSpecificationInitializer"/>
    </contribution>
    
    <service-point id="EnginePool" interface="org.apache.tapestry.services.ObjectPool">
      <create-instance class="org.apache.tapestry.services.impl.ObjectPool"/>
    </service-point>
    
    <service-point id="ServletInfo" interface="org.apache.tapestry.services.ServletInfo">
      Stores the request and response for the current thread.
      
      <create-instance class="org.apache.tapestry.services.impl.ServletInfoImpl" model="threaded"/>
    </service-point>
    
    <service-point id="ServletInfoInitializer" interface="org.apache.tapestry.services.RequestServicerFilter">
      <invoke-factory>
        <construct class="org.apache.tapestry.services.impl.ServletInfoInitializer">
          <set-service property="servletInfo" service-id="ServletInfo"/>
        </construct>
      </invoke-factory>
    </service-point>
    
    
    <service-point id="RequestServicerPipeline" interface="org.apache.tapestry.services.RequestServicer">
      
      A pipeline for handling each request.
      
      <invoke-factory service-id="hivemind.lib.PipelineFactory">
        <create-pipeline filter-interface="org.apache.tapestry.services.RequestServicerFilter"
          configuration-id="RequestServicerPipeline"/>
      </invoke-factory>    
    </service-point>
    
    <configuration-point id="RequestServicerPipeline" schema-id="hivemind.lib.Pipeline">
      
      A pipeline for processing an incoming request.
    </configuration-point>
    
    <contribution configuration-id="RequestServicerPipeline">
      <filter name="ServletInfoInitializer" before="*" object="service:ServletInfoInitializer"/>
    </contribution>
  </module>
  
  
  1.8       +3 -1      jakarta-tapestry/config/log4j.properties
  
  Index: log4j.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/config/log4j.properties,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- log4j.properties	4 Jul 2004 16:59:28 -0000	1.7
  +++ log4j.properties	23 Aug 2004 14:53:16 -0000	1.8
  @@ -8,4 +8,6 @@
   log4j.appender.A1.layout=org.apache.log4j.PatternLayout
   log4j.appender.A1.layout.ConversionPattern=%c{1} [%p] %m%n
   
  -log4j.category.org.apache.commons.digester.Digester=FATAL
  \ No newline at end of file
  +log4j.category.org.apache.commons.digester.Digester=FATAL
  +log4j.categiry.org.apache.hivemind=ERROR
  +log4j.cateogry.hivemind=ERROR
  
  
  

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