Added: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app4/pages/Start.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app4/pages/Start.java?rev=611966&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app4/pages/Start.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app4/pages/Start.java
 Mon Jan 14 15:16:45 2008
@@ -0,0 +1,49 @@
+// Copyright 2008 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.integration.app4.pages;
+
+import org.apache.tapestry.annotations.InjectPage;
+
+public class Start
+{
+    @InjectPage
+    private Destination _destination;
+
+    private String _input;
+
+    public String getInput()
+    {
+        return _input;
+    }
+
+    public void setInput(String input)
+    {
+        _input = input;
+    }
+
+    Object onSuccess()
+    {
+        _destination.setValue(_input);
+
+        return _destination;
+    }
+
+    Object onActionFromBypass()
+    {
+        _destination.setValue("automatic value");
+
+        return _destination;
+    }
+}

Added: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app4/services/AppModule.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app4/services/AppModule.java?rev=611966&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app4/services/AppModule.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app4/services/AppModule.java
 Mon Jan 14 15:16:45 2008
@@ -0,0 +1,30 @@
+// Copyright 2008 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.integration.app4.services;
+
+import org.apache.tapestry.TapestryConstants;
+import org.apache.tapestry.ioc.MappedConfiguration;
+
+/**
+ * A module that exists for testing the immediate response mode: sending 
markup in response to action requests, rather
+ * than sending a redirect.
+ */
+public class AppModule
+{
+    public static void 
contributeApplicationDefaults(MappedConfiguration<String, String> configuration)
+    {
+        
configuration.add(TapestryConstants.SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS_SYMBOL,
 "true");
+    }
+}

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetFactoryTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetFactoryTest.java?rev=611966&r1=611965&r2=611966&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetFactoryTest.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ClasspathAssetFactoryTest.java
 Mon Jan 14 15:16:45 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 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.
@@ -39,6 +39,8 @@
 
         train_toClientURL(aliasManager, "foo/Bar.txt", expectedClientURL);
 
+        getMocksControl().times(2); // Cache of the raw path, not the final 
path which may be optimized
+
         replay();
 
         ClasspathAssetFactory factory = new ClasspathAssetFactory(cache, 
aliasManager);
@@ -81,6 +83,8 @@
 
         train_toClientURL(aliasManager, "foo/Bar.txt", expectedClientURL);
 
+        getMocksControl().times(2); // 2nd time is the toString() call
+
         replay();
 
         AssetFactory factory = new ClasspathAssetFactory(cache, aliasManager);
@@ -89,7 +93,7 @@
 
         assertSame(asset.getResource(), r);
         assertEquals(asset.toClientURL(), expectedClientURL);
-        assertEquals(asset.toString(), asset.toClientURL());
+        assertEquals(asset.toString(), expectedClientURL);
 
         verify();
     }
@@ -110,6 +114,8 @@
 
         train_toClientURL(aliasManager, "foo/Bar.ABC123.txt", 
expectedClientURL);
 
+        getMocksControl().times(2); // 2nd time is the toString() call
+
         replay();
 
         AssetFactory factory = new ClasspathAssetFactory(cache, aliasManager);
@@ -118,7 +124,7 @@
 
         assertSame(asset.getResource(), r);
         assertEquals(asset.toClientURL(), expectedClientURL);
-        assertEquals(asset.toString(), asset.toClientURL());
+        assertEquals(asset.toString(), expectedClientURL);
 
         verify();
     }

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java?rev=611966&r1=611965&r2=611966&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java
 Mon Jan 14 15:16:45 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 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.
@@ -15,12 +15,10 @@
 package org.apache.tapestry.internal.services;
 
 import org.apache.tapestry.ComponentResources;
-import org.apache.tapestry.Link;
 import org.apache.tapestry.internal.structure.Page;
 import org.apache.tapestry.internal.test.InternalBaseTestCase;
 import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.services.ComponentEventResultProcessor;
-import org.apache.tapestry.services.Response;
 import org.slf4j.Logger;
 import org.testng.annotations.Test;
 
@@ -39,9 +37,7 @@
         Logger logger = mockLogger();
         RequestPageCache cache = mockRequestPageCache();
         Page page = mockPage();
-        LinkFactory factory = mockLinkFactory();
-        Response response = mockResponse();
-        Link link = mockLink();
+        ActionRenderResponseGenerator generator = 
mockActionRenderResponseGenerator();
 
         train_getComponentResources(result, resources);
         train_getContainer(resources, null);
@@ -49,14 +45,12 @@
         train_getPageName(resources, PAGE_NAME);
         train_get(cache, PAGE_NAME, page);
 
-        train_createPageLink(factory, page, link);
-
-        response.sendRedirect(link);
+        generator.generateResponse(page);
 
         replay();
 
-        ComponentEventResultProcessor<Component> processor = new 
ComponentInstanceResultProcessor(logger, response,
-                                                                               
                   cache, factory);
+        ComponentEventResultProcessor<Component> processor = new 
ComponentInstanceResultProcessor(logger, cache,
+                                                                               
                   generator);
 
         processor.processComponentEvent(result, source, METHOD_DESCRIPTION);
 
@@ -74,9 +68,8 @@
         Logger logger = mockLogger();
         RequestPageCache cache = mockRequestPageCache();
         Page page = mockPage();
-        LinkFactory factory = mockLinkFactory();
-        Response response = mockResponse();
-        Link link = mockLink();
+        ActionRenderResponseGenerator generator = 
mockActionRenderResponseGenerator();
+
 
         train_getComponentResources(value, valueResources);
 
@@ -92,17 +85,16 @@
         train_getPageName(valueResources, PAGE_NAME);
         train_get(cache, PAGE_NAME, page);
 
-        train_createPageLink(factory, page, link);
-
-        response.sendRedirect(link);
+        generator.generateResponse(page);
 
         replay();
 
-        ComponentEventResultProcessor<Component> processor = new 
ComponentInstanceResultProcessor(logger, response,
-                                                                               
                   cache, factory);
+        ComponentEventResultProcessor<Component> processor = new 
ComponentInstanceResultProcessor(logger, cache,
+                                                                               
                   generator);
 
         processor.processComponentEvent(value, source, METHOD_DESCRIPTION);
 
         verify();
     }
+
 }

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageRenderDispatcherTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageRenderDispatcherTest.java?rev=611966&r1=611965&r2=611966&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageRenderDispatcherTest.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageRenderDispatcherTest.java
 Mon Jan 14 15:16:45 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 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.
@@ -99,19 +99,13 @@
         train_get(cache, "foo/Bar", page);
         train_getRootElement(page, rootElement);
 
-        train_triggerEvent(
-                rootElement,
-                TapestryConstants.ACTIVATE_EVENT,
-                new Object[0],
-                null,
-                false);
+        train_triggerEvent(rootElement, TapestryConstants.ACTIVATE_EVENT, new 
Object[0], null, false);
 
-        renderer.renderPageResponse(page, response);
+        renderer.renderPageResponse(page);
 
         replay();
 
-        PageRenderRequestHandler handler = new 
PageRenderRequestHandlerImpl(cache, processor,
-                                                                            
renderer, response);
+        PageRenderRequestHandler handler = new 
PageRenderRequestHandlerImpl(cache, processor, renderer, response);
 
         Dispatcher d = new PageRenderDispatcher(resolver, handler);
 
@@ -152,15 +146,13 @@
         train_get(cache, "foo/Bar", page);
         train_getRootElement(page, rootElement);
 
-        train_triggerEvent(rootElement, TapestryConstants.ACTIVATE_EVENT, new 
Object[]
-                {"zip", "zoom"}, null, false);
+        train_triggerEvent(rootElement, TapestryConstants.ACTIVATE_EVENT, new 
Object[]{"zip", "zoom"}, null, false);
 
-        renderer.renderPageResponse(page, response);
+        renderer.renderPageResponse(page);
 
         replay();
 
-        PageRenderRequestHandler handler = new 
PageRenderRequestHandlerImpl(cache, processor,
-                                                                            
renderer, response);
+        PageRenderRequestHandler handler = new 
PageRenderRequestHandlerImpl(cache, processor, renderer, response);
 
         Dispatcher d = new PageRenderDispatcher(resolver, handler);
 
@@ -174,13 +166,10 @@
         return newMock(ComponentEventResultProcessor.class);
     }
 
-    private void train_triggerEvent(ComponentPageElement element, String 
eventType,
-                                    Object[] context, ComponentEventHandler 
handler, boolean handled)
+    private void train_triggerEvent(ComponentPageElement element, String 
eventType, Object[] context,
+                                    ComponentEventHandler handler, boolean 
handled)
     {
-        expect(
-                element.triggerEvent(
-                        eq(eventType),
-                        aryEq(context),
-                        isA(ComponentEventHandler.class))).andReturn(handled);
+        expect(element.triggerEvent(eq(eventType), aryEq(context), 
isA(ComponentEventHandler.class))).andReturn(
+                handled);
     }
 }

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/RequestPathOptimizerImplTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/RequestPathOptimizerImplTest.java?rev=611966&r1=611965&r2=611966&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/RequestPathOptimizerImplTest.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/RequestPathOptimizerImplTest.java
 Mon Jan 14 15:16:45 2008
@@ -53,6 +53,8 @@
 
                               {"", "", "/asset/foo.gif", "asset/foo.gif"},
 
+                              {"", "/griddemo.grid.columns.sort/title", 
"/assets/default.css", "/assets/default.css"},
+
                               {"/example", "/", 
"/example/assets/tapestry/default.css", "assets/tapestry/default.css"},
 
                               {"/example", "/newaccount", 
"/example/assets/tapestry/default.css",

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ResponseRendererImplTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ResponseRendererImplTest.java?rev=611966&r1=611965&r2=611966&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ResponseRendererImplTest.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ResponseRendererImplTest.java
 Mon Jan 14 15:16:45 2008
@@ -62,7 +62,7 @@
 
         train_get(cache, pageName, page);
 
-        pageResponseRenderer.renderPageResponse(page, response);
+        pageResponseRenderer.renderPageResponse(page);
 
         replay();
 

Modified: 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java?rev=611966&r1=611965&r2=611966&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java
 Mon Jan 14 15:16:45 2008
@@ -26,16 +26,15 @@
 import java.lang.annotation.Target;
 
 /**
- * An optional annotation that may be placed on a service building method of a 
module. The
- * annotation overrides the default scope for services (the default being a 
global singleton that is
- * instantiated on demand) for an alternate lifecycle. Alternate lifecycles 
are typically used to
- * bind a service implementation to a single thread or request. Modules may 
define new scopes. Each
- * scope should have a corresponding [EMAIL PROTECTED] ServiceLifecycle} 
implementation. The linkage from scope
- * name to service lifecycle occurs via a contribution to the [EMAIL 
PROTECTED] ServiceLifecycleSource} service
- * configuration.
+ * An optional annotation that may be placed on a service building method of a 
module, or on the implementation class
+ * (when using service binding). The annotation overrides the default scope 
for services (the default being a global
+ * singleton that is instantiated on demand) for an alternate lifecycle. 
Alternate lifecycles are typically used to bind
+ * a service implementation to a single thread or request. Modules may define 
new scopes. Each scope should have a
+ * corresponding [EMAIL PROTECTED] ServiceLifecycle} implementation. The 
linkage from scope name to service lifecycle occurs via a
+ * contribution to the [EMAIL PROTECTED] ServiceLifecycleSource} service 
configuration.
  * <p/>
- * The annotation may also be placed directly on a service implementation 
class, when using service
- * autobuilding (via the [EMAIL PROTECTED] ServiceBinder}.
+ * The annotation may also be placed directly on a service implementation 
class, when using service autobuilding (via
+ * the [EMAIL PROTECTED] ServiceBinder}.
  */
 @Target(
         {TYPE, METHOD})

Modified: 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java?rev=611966&r1=611965&r2=611966&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java
 Mon Jan 14 15:16:45 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 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.
@@ -15,6 +15,7 @@
 package org.apache.tapestry.ioc.internal;
 
 import org.apache.tapestry.ioc.ObjectCreator;
+import org.apache.tapestry.ioc.ObjectLocator;
 import org.apache.tapestry.ioc.ServiceBuilderResources;
 import org.apache.tapestry.ioc.ServiceResources;
 import static org.apache.tapestry.ioc.internal.ConfigurationType.*;
@@ -28,9 +29,8 @@
 import java.util.Map;
 
 /**
- * Abstract implementation of [EMAIL PROTECTED] ObjectCreator} geared towards 
the creation of the core service
- * implementation, either by invoking a service builder method on a module, or 
by invoking a
- * constructor.
+ * Abstract implementation of [EMAIL PROTECTED] ObjectCreator} geared towards 
the creation of the core service implementation,
+ * either by invoking a service builder method on a module, or by invoking a 
constructor.
  */
 public abstract class AbstractServiceCreator implements ObjectCreator
 {
@@ -61,15 +61,15 @@
         _logger = resources.getLogger();
 
         _parameterDefaults.put(String.class, _serviceId);
+        _parameterDefaults.put(ObjectLocator.class, resources);
         _parameterDefaults.put(ServiceResources.class, resources);
         _parameterDefaults.put(Logger.class, _logger);
         _parameterDefaults.put(Class.class, resources.getServiceInterface());
     }
 
     /**
-     * Returns a map (based on _parameterDefaults) that includes (possibly) an 
additional mapping
-     * containing the collected configuration data. This involves scanning the 
parameters and
-     * generic types.
+     * Returns a map (based on _parameterDefaults) that includes (possibly) an 
additional mapping containing the
+     * collected configuration data. This involves scanning the parameters and 
generic types.
      */
     protected final Map<Class, Object> 
getParameterDefaultsWithConfiguration(Class[] parameterTypes,
                                                                              
Type[] genericParameterTypes)
@@ -157,9 +157,9 @@
     }
 
     /**
-     * Extracts from a generic type the underlying parameterized type. I.e., 
for List<Runnable>,
-     * will return Runnable. This is limited to simple parameterized types, 
not the more complex
-     * cases involving wildcards and upper/lower boundaries.
+     * Extracts from a generic type the underlying parameterized type. I.e., 
for List<Runnable>, will return Runnable.
+     * This is limited to simple parameterized types, not the more complex 
cases involving wildcards and upper/lower
+     * boundaries.
      *
      * @param type the genetic type of the parameter, i.e., List<Runnable>
      * @return the parameterize type (i.e. Runnable.class if type represents 
List<Runnable>).
@@ -176,15 +176,15 @@
     }
 
     /**
-     * "Sniffs" a generic type to find the underlying parameterized type. If 
the Type is a class,
-     * then Object.class is returned. Otherwise, the type must be a 
ParameterizedType. We check to
-     * make sure it has the correct number of a actual types (1 for a 
Collection or List, 2 for a
-     * Map). The actual types must be classes (wildcards just aren't supported)
+     * "Sniffs" a generic type to find the underlying parameterized type. If 
the Type is a class, then Object.class is
+     * returned. Otherwise, the type must be a ParameterizedType. We check to 
make sure it has the correct number of a
+     * actual types (1 for a Collection or List, 2 for a Map). The actual 
types must be classes (wildcards just aren't
+     * supported)
      *
      * @param type      a Class or ParameterizedType to inspect
      * @param typeIndex the index within the ParameterizedType to extract
-     * @return the actual type, or Object.class if the input type is not 
generic, or null if any
-     *         other pre-condition is not met
+     * @return the actual type, or Object.class if the input type is not 
generic, or null if any other pre-condition is
+     *         not met
      */
     private static Class findParameterizedTypeFromGenericType(Type type, int 
typeIndex)
     {


Reply via email to