Author: hlship
Date: Thu Mar 26 17:31:51 2009
New Revision: 758764

URL: http://svn.apache.org/viewvc?rev=758764&view=rev
Log:
TAP5-605: There should be a simple way to override automatic JavaScript 
libraries and Stylesheets

Added:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientInfrastructureImpl.java
   (contents, props changed)
      - copied, changed from r758486, 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JavascriptStackImpl.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EmptyClientInfrastructure.java
   (contents, props changed)
      - copied, changed from r758400, 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EmptyJavascriptStack.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientInfrastructure.java
   (contents, props changed)
      - copied, changed from r758400, 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/JavascriptStack.java
Removed:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EmptyJavascriptStack.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JavascriptStackImpl.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/JavascriptStack.java
Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RenderSupportImpl.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
    
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
    
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RenderSupportImplTest.java

Copied: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientInfrastructureImpl.java
 (from r758486, 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JavascriptStackImpl.java)
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientInfrastructureImpl.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientInfrastructureImpl.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JavascriptStackImpl.java&r1=758486&r2=758764&rev=758764&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JavascriptStackImpl.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientInfrastructureImpl.java
 Thu Mar 26 17:31:51 2009
@@ -19,8 +19,9 @@
 import org.apache.tapestry5.ioc.services.SymbolSource;
 import org.apache.tapestry5.ioc.services.ThreadLocale;
 import org.apache.tapestry5.services.AssetSource;
-import org.apache.tapestry5.services.JavascriptStack;
+import org.apache.tapestry5.services.ClientInfrastructure;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 
@@ -29,7 +30,7 @@
  *
  * @since 5.1.0.2
  */
-public class JavascriptStackImpl implements JavascriptStack
+public class ClientInfrastructureImpl implements ClientInfrastructure
 {
     private final SymbolSource symbolSource;
 
@@ -37,9 +38,9 @@
 
     private final ThreadLocale threadLocale;
 
-    private final List<Asset> coreResources = CollectionFactory.newList();
+    private final List<Asset> javascriptStack, stylesheetStack;
 
-    private static final String[] CORE_RESOURCES = new String[]
+    private static final String[] CORE_JAVASCRIPT = new String[]
             {
                     // Core scripts added to any page that uses scripting
 
@@ -53,16 +54,32 @@
                     "${tapestry.blackbird}/blackbird.js"
             };
 
-    public JavascriptStackImpl(SymbolSource symbolSource, AssetSource 
assetSource, ThreadLocale threadLocale)
+    private static final String[] CORE_STYLESHEET = new String[]
+            {
+                    "${tapestry.default-stylesheet}",
+                    "${tapestry.blackbird}/blackbird.css"
+            };
+
+    public ClientInfrastructureImpl(SymbolSource symbolSource, AssetSource 
assetSource, ThreadLocale threadLocale)
     {
         this.symbolSource = symbolSource;
         this.assetSource = assetSource;
         this.threadLocale = threadLocale;
 
-        for (String path : CORE_RESOURCES)
+        javascriptStack = convertToAssets(CORE_JAVASCRIPT);
+        stylesheetStack = convertToAssets(CORE_STYLESHEET);
+    }
+
+    private List<Asset> convertToAssets(String[] paths)
+    {
+        List<Asset> assets = CollectionFactory.newList();
+
+        for (String path : paths)
         {
-            coreResources.add(expand(path, null));
+            assets.add(expand(path, null));
         }
+
+        return Collections.unmodifiableList(assets);
     }
 
     private Asset expand(String path, Locale locale)
@@ -72,9 +89,9 @@
         return assetSource.getAsset(null, expanded, locale);
     }
 
-    public List<Asset> getStack()
+    public List<Asset> getJavascriptStack()
     {
-        List<Asset> result = CollectionFactory.newList(coreResources);
+        List<Asset> result = CollectionFactory.newList(javascriptStack);
 
         Asset messages = assetSource.getAsset(null, 
"org/apache/tapestry5/tapestry-messages.js",
                                               threadLocale.getLocale());
@@ -83,4 +100,9 @@
 
         return result;
     }
+
+    public List<Asset> getStylesheetStack()
+    {
+        return stylesheetStack;
+    }
 }

Propchange: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ClientInfrastructureImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EmptyClientInfrastructure.java
 (from r758400, 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EmptyJavascriptStack.java)
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EmptyClientInfrastructure.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EmptyClientInfrastructure.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EmptyJavascriptStack.java&r1=758400&r2=758764&rev=758764&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EmptyJavascriptStack.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EmptyClientInfrastructure.java
 Thu Mar 26 17:31:51 2009
@@ -15,7 +15,7 @@
 package org.apache.tapestry5.internal.services;
 
 import org.apache.tapestry5.Asset;
-import org.apache.tapestry5.services.JavascriptStack;
+import org.apache.tapestry5.services.ClientInfrastructure;
 
 import java.util.Collections;
 import java.util.List;
@@ -26,9 +26,14 @@
  *
  * @since 5.1.0.2
  */
-public class EmptyJavascriptStack implements JavascriptStack
+public class EmptyClientInfrastructure implements ClientInfrastructure
 {
-    public List<Asset> getStack()
+    public List<Asset> getJavascriptStack()
+    {
+        return Collections.emptyList();
+    }
+
+    public List<Asset> getStylesheetStack()
     {
         return Collections.emptyList();
     }

Propchange: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EmptyClientInfrastructure.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RenderSupportImpl.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RenderSupportImpl.java?rev=758764&r1=758763&r2=758764&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RenderSupportImpl.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RenderSupportImpl.java
 Thu Mar 26 17:31:51 2009
@@ -24,7 +24,7 @@
 import org.apache.tapestry5.json.JSONArray;
 import org.apache.tapestry5.json.JSONObject;
 import org.apache.tapestry5.services.AssetSource;
-import org.apache.tapestry5.services.JavascriptStack;
+import org.apache.tapestry5.services.ClientInfrastructure;
 
 public class RenderSupportImpl implements RenderSupport
 {
@@ -36,7 +36,7 @@
 
     private final AssetSource assetSource;
 
-    private final JavascriptStack javascriptStack;
+    private final ClientInfrastructure clientInfrastructure;
 
     private boolean stackAssetsAdded;
 
@@ -56,9 +56,9 @@
      * @param javascriptStack
      */
     public RenderSupportImpl(DocumentLinker linker, SymbolSource symbolSource,
-                             AssetSource assetSource, JavascriptStack 
javascriptStack)
+                             AssetSource assetSource, ClientInfrastructure 
clientInfrastructure)
     {
-        this(linker, symbolSource, assetSource, new IdAllocator(), 
javascriptStack);
+        this(linker, symbolSource, assetSource, new IdAllocator(), 
clientInfrastructure);
     }
 
     /**
@@ -73,14 +73,15 @@
      */
 
     public RenderSupportImpl(DocumentLinker linker, SymbolSource symbolSource,
-                             AssetSource assetSource, IdAllocator idAllocator, 
JavascriptStack javascriptStack)
+                             AssetSource assetSource, IdAllocator idAllocator,
+                             ClientInfrastructure clientInfrastructure)
 
     {
         this.linker = linker;
         this.symbolSource = symbolSource;
         this.assetSource = assetSource;
         this.idAllocator = idAllocator;
-        this.javascriptStack = javascriptStack;
+        this.clientInfrastructure = clientInfrastructure;
     }
 
     public String allocateClientId(String id)
@@ -237,7 +238,7 @@
     {
         if (!stackAssetsAdded)
         {
-            for (Asset script : javascriptStack.getStack())
+            for (Asset script : clientInfrastructure.getJavascriptStack())
             {
                 linker.addScriptLink(script.toClientURL());
             }

Copied: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientInfrastructure.java
 (from r758400, 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/JavascriptStack.java)
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientInfrastructure.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientInfrastructure.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/JavascriptStack.java&r1=758400&r2=758764&rev=758764&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/JavascriptStack.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientInfrastructure.java
 Thu Mar 26 17:31:51 2009
@@ -19,21 +19,39 @@
 import java.util.List;
 
 /**
- * A Javascript Stack is a base set of JavaScript files that are used by any 
page that {...@linkplain
- * org.apache.tapestry5.RenderSupport#addScript(String, Object[]) adds 
JavaScript to the page}. Tapestry's default stack
- * includes Prototype, Scriptaculous, and a Tapestry-specific library.  Note 
that these individual library files will
- * {...@linkplain org.apache.tapestry5.SymbolConstants#COMBINE_SCRIPTS be 
combined into a single virtual resource} (from
- * the client's point of view).
+ * Client infrastructure is a base set of JavaScript libraries and CSS 
stylesheet files, The core JavaScript libraries
+ * are added to any page that {...@linkplain 
org.apache.tapestry5.RenderSupport#addScript(String, Object[]) adds JavaScript
+ * to the page}. The CSS stylesheet files are added to any page with a root 
&lt;html&gt; element.
+ * <p/>
+ * Tapestry's default JavaScript stack includes Prototype, Scriptaculous, and 
a Tapestry-specific library.  Note that
+ * these individual library files will {...@linkplain 
org.apache.tapestry5.SymbolConstants#COMBINE_SCRIPTS be combined into
+ * a single virtual resource} (from the client's point of view).
+ * <p/>
+ * Tapestry's default CSS stack contains the Tapestry default stylesheet, and 
the stylesheet used by Tapestry's
+ * Blackbird console.
+ * <p/>
+ * Overriding the default ClientInfrastructure service gives an application 
complete freedom to replace any part of
+ * Tapestry's default client-side resources.
  *
  * @since 5.1.0.2
  */
-public interface JavascriptStack
+public interface ClientInfrastructure
 {
     /**
      * Returns the (localized) assets for the scripts to be included as core 
JavaScript stack. The assets for the stack
-     * will be added before any other JavaScript libraries included in the 
render of the page.
+     * will be added before any other JavaScript libraries included in the 
render of the page. Adding a library or any
+     * initialization JavaScript triggers the inclusion of the JavaScript 
stack.
      *
      * @return list of assets
      */
-    List<Asset> getStack();
+    List<Asset> getJavascriptStack();
+
+    /**
+     * Returns the (localized) assets for CSS stylesheet files to be included 
on any page. These are ordered before any
+     * stylesheets specifically included (to allow default rules to be easily 
overridden). The default core stack
+     * includes the Tapestry default stylesheet, and an additional stylesheet 
for the Blackbird JavaScript console.
+     *
+     * @return list of assets
+     */
+    List<Asset> getStylesheetStack();
 }

Propchange: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClientInfrastructure.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=758764&r1=758763&r2=758764&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
 Thu Mar 26 17:31:51 2009
@@ -306,7 +306,7 @@
         binder.bind(ClientDataEncoder.class, ClientDataEncoderImpl.class);
         binder.bind(ComponentEventLinkEncoder.class, 
ComponentEventLinkEncoderImpl.class);
         binder.bind(PageRenderLinkSource.class, 
PageRenderLinkSourceImpl.class);
-        binder.bind(JavascriptStack.class, JavascriptStackImpl.class);
+        binder.bind(ClientInfrastructure.class, 
ClientInfrastructureImpl.class);
     }
 
     // ========================================================================
@@ -1625,15 +1625,9 @@
                                          
@Symbol(SymbolConstants.PRODUCTION_MODE)
                                          final boolean productionMode,
 
-                                         
@Path("${tapestry.default-stylesheet}")
-                                         final Asset stylesheetAsset,
-
                                          @Path("${tapestry.spacer-image}")
                                          final Asset spacerImage,
 
-                                         
@Path("${tapestry.blackbird.path}/blackbird.css")
-                                         final Asset blackbirdStylesheetAsset,
-
                                          
@Symbol(SymbolConstants.OMIT_GENERATOR_META)
                                          final boolean omitGeneratorMeta,
 
@@ -1651,7 +1645,7 @@
 
                                          final ClientDataEncoder 
clientDataEncoder,
 
-                                         final JavascriptStack javascriptStack)
+                                         final ClientInfrastructure 
clientInfrastructure)
     {
         MarkupRendererFilter documentLinker = new MarkupRendererFilter()
         {
@@ -1680,7 +1674,8 @@
             {
                 DocumentLinker linker = 
environment.peekRequired(DocumentLinker.class);
 
-                RenderSupportImpl support = new RenderSupportImpl(linker, 
symbolSource, assetSource, javascriptStack);
+                RenderSupportImpl support = new RenderSupportImpl(linker, 
symbolSource, assetSource,
+                                                                  
clientInfrastructure);
 
                 environment.push(RenderSupport.class, support);
 
@@ -1698,8 +1693,10 @@
             {
                 RenderSupport renderSupport = 
environment.peek(RenderSupport.class);
 
-                renderSupport.addStylesheetLink(stylesheetAsset, null);
-                renderSupport.addStylesheetLink(blackbirdStylesheetAsset, 
null);
+                for (Asset stylesheet : 
clientInfrastructure.getStylesheetStack())
+                {
+                    renderSupport.addStylesheetLink(stylesheet, null);
+                }
 
                 renderer.renderMarkup(writer);
             }
@@ -1818,7 +1815,7 @@
                 DocumentLinker linker = 
environment.peekRequired(DocumentLinker.class);
 
                 RenderSupportImpl support = new RenderSupportImpl(linker, 
symbolSource, assetSource,
-                                                                  idAllocator, 
new EmptyJavascriptStack());
+                                                                  idAllocator, 
new EmptyClientInfrastructure());
 
                 environment.push(RenderSupport.class, support);
 
@@ -2002,9 +1999,6 @@
 
     /**
      * Contributes factory defaults that may be overridden.
-     *
-     * @see 
TapestryModule#contributeClasspathAssetAliasManager(org.apache.tapestry5.ioc.MappedConfiguration,
 String,
-     *      String, String)
      */
     public static void contributeFactoryDefaults(MappedConfiguration<String, 
String> configuration)
     {

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java?rev=758764&r1=758763&r2=758764&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
 Thu Mar 26 17:31:51 2009
@@ -2286,12 +2286,21 @@
     private void waitForElementToAppear(String elementId)
     {
 
-        String condition = 
String.format("selenium.browserbot.getCurrentWindow().document.getElementById('%s')",
+        String condition = 
String.format("selenium.browserbot.getCurrentWindow().$(\"%s\")",
                                          elementId);
 
         waitForCondition(condition, PAGE_LOAD_TIMEOUT);
     }
 
+    private void waitForCSSSelectedElementToAppear(String cssRule)
+    {
+        String condition = 
String.format("selenium.browserbot.getCurrentWindow().$$(\"%s\").size() > 0",
+                                         cssRule);
+
+        waitForCondition(condition, PAGE_LOAD_TIMEOUT);
+
+    }
+
     /**
      * TAPESTRY-2610
      */
@@ -2364,10 +2373,10 @@
 
         click("link=Failure on the server side");
 
-        waitForElementToAppear("blackbird");
-
         // Wait for the console to appear
 
+        waitForCSSSelectedElementToAppear("#t-console li");
+
         assertTextPresent("Communication with the server failed: Server-side 
exception.");
     }
 
@@ -2405,9 +2414,7 @@
 
         click("link=ajax");
 
-        // Concerned about a timing issue here.
-
-        waitForElementToAppear("blackbird");
+        waitForCSSSelectedElementToAppear("#t-console li");
 
         assertTextPresent(
                 "Communication with the server failed: Request event 'action' 
(on component UnhandledEventDemo:ajax) was not handled; you must provide a 
matching event handler method in the component or in one of its containers.");

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RenderSupportImplTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RenderSupportImplTest.java?rev=758764&r1=758763&r2=758764&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RenderSupportImplTest.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RenderSupportImplTest.java
 Thu Mar 26 17:31:51 2009
@@ -20,7 +20,7 @@
 import org.apache.tapestry5.internal.test.InternalBaseTestCase;
 import org.apache.tapestry5.ioc.services.SymbolSource;
 import org.apache.tapestry5.services.AssetSource;
-import org.apache.tapestry5.services.JavascriptStack;
+import org.apache.tapestry5.services.ClientInfrastructure;
 import org.testng.annotations.Test;
 
 import java.util.Arrays;
@@ -29,6 +29,8 @@
 {
     private static final String ASSET_URL = "/assets/foo/bar.pdf";
 
+    private static final EmptyClientInfrastructure EMPTY_CLIENT_INFRASTRUCTURE 
= new EmptyClientInfrastructure();
+
     @Test
     public void add_script_link_by_asset()
     {
@@ -40,7 +42,7 @@
 
         replay();
 
-        RenderSupport support = new RenderSupportImpl(linker, null, null, new 
EmptyJavascriptStack());
+        RenderSupport support = new RenderSupportImpl(linker, null, null, 
EMPTY_CLIENT_INFRASTRUCTURE);
 
         support.addScriptLink(asset);
 
@@ -56,7 +58,7 @@
 
         replay();
 
-        RenderSupport support = new RenderSupportImpl(linker, null, null, new 
EmptyJavascriptStack());
+        RenderSupport support = new RenderSupportImpl(linker, null, null, 
EMPTY_CLIENT_INFRASTRUCTURE);
 
         support.addScriptLink(ASSET_URL);
 
@@ -81,7 +83,7 @@
         AssetSource assetSource = mockAssetSource();
         SymbolSource symbolSource = mockSymbolSource();
 
-        JavascriptStack stack = mockJavascriptStack(coreAsset1, coreAsset2);
+        ClientInfrastructure infrastructure = mockJavascriptStack(coreAsset1, 
coreAsset2);
 
         train_toClientURL(coreAsset1, coreURL1);
         linker.addScriptLink(coreURL1);
@@ -94,7 +96,7 @@
 
         replay();
 
-        RenderSupport support = new RenderSupportImpl(linker, symbolSource, 
assetSource, stack);
+        RenderSupport support = new RenderSupportImpl(linker, symbolSource, 
assetSource, infrastructure);
 
         support.addScriptLink(asset);
 
@@ -110,14 +112,14 @@
         SymbolSource symbolSource = mockSymbolSource();
         AssetSource assetSource = mockAssetSource();
         Asset coreAsset = mockAsset(coreScript);
-        JavascriptStack stack = mockJavascriptStack(coreAsset);
+        ClientInfrastructure infrastructure = mockJavascriptStack(coreAsset);
 
         linker.addScriptLink(coreScript);
         linker.addScript("Tapestry.Foo(\"bar\");");
 
         replay();
 
-        RenderSupport support = new RenderSupportImpl(linker, symbolSource, 
assetSource, stack);
+        RenderSupport support = new RenderSupportImpl(linker, symbolSource, 
assetSource, infrastructure);
 
         support.addScript("Tapestry.Foo(\"%s\");", "bar");
 
@@ -135,7 +137,7 @@
         AssetSource assetSource = mockAssetSource();
         Asset coreAsset = mockAsset(coreScript);
 
-        JavascriptStack stack = mockJavascriptStack(coreAsset);
+        ClientInfrastructure infrastructure = mockJavascriptStack(coreAsset);
 
         linker.addScriptLink(coreScript);
 
@@ -145,20 +147,20 @@
 
         replay();
 
-        RenderSupport support = new RenderSupportImpl(linker, symbolSource, 
assetSource, stack);
+        RenderSupport support = new RenderSupportImpl(linker, symbolSource, 
assetSource, infrastructure);
 
         support.addScript(script);
 
         verify();
     }
 
-    protected final JavascriptStack mockJavascriptStack(Asset... asset)
+    protected final ClientInfrastructure mockJavascriptStack(Asset... asset)
     {
-        JavascriptStack stack = newMock(JavascriptStack.class);
+        ClientInfrastructure infrastructure = 
newMock(ClientInfrastructure.class);
 
-        expect(stack.getStack()).andReturn(Arrays.asList(asset)).atLeastOnce();
+        
expect(infrastructure.getJavascriptStack()).andReturn(Arrays.asList(asset)).atLeastOnce();
 
-        return stack;
+        return infrastructure;
     }
 
     protected final Asset mockAsset(String assetURL)
@@ -190,7 +192,7 @@
 
         replay();
 
-        RenderSupport support = new RenderSupportImpl(linker, source, 
assetSource, new EmptyJavascriptStack());
+        RenderSupport support = new RenderSupportImpl(linker, source, 
assetSource, EMPTY_CLIENT_INFRASTRUCTURE);
 
         support.addClasspathScriptLink(path);
 
@@ -209,7 +211,7 @@
 
         replay();
 
-        RenderSupport support = new RenderSupportImpl(linker, null, null, new 
EmptyJavascriptStack());
+        RenderSupport support = new RenderSupportImpl(linker, null, null, 
EMPTY_CLIENT_INFRASTRUCTURE);
 
         support.addStylesheetLink(asset, media);
 
@@ -226,7 +228,7 @@
 
         replay();
 
-        RenderSupport support = new RenderSupportImpl(linker, null, null, new 
EmptyJavascriptStack());
+        RenderSupport support = new RenderSupportImpl(linker, null, null, 
EMPTY_CLIENT_INFRASTRUCTURE);
 
         support.addStylesheetLink(ASSET_URL, media);
 
@@ -242,7 +244,7 @@
 
         replay();
 
-        RenderSupportImpl support = new RenderSupportImpl(linker, null, null, 
new EmptyJavascriptStack());
+        RenderSupportImpl support = new RenderSupportImpl(linker, null, null, 
EMPTY_CLIENT_INFRASTRUCTURE);
 
         support.addInit("foo", "fred");
         support.addInit("foo", "barney");
@@ -261,7 +263,7 @@
 
         replay();
 
-        RenderSupportImpl support = new RenderSupportImpl(linker, null, null, 
new EmptyJavascriptStack());
+        RenderSupportImpl support = new RenderSupportImpl(linker, null, null, 
EMPTY_CLIENT_INFRASTRUCTURE);
 
         support.addInit("foo", "fred", "barney");
 
@@ -279,7 +281,7 @@
 
         replay();
 
-        RenderSupportImpl support = new RenderSupportImpl(linker, null, null, 
new EmptyJavascriptStack());
+        RenderSupportImpl support = new RenderSupportImpl(linker, null, null, 
EMPTY_CLIENT_INFRASTRUCTURE);
 
         support.autofocus(FieldFocusPriority.OPTIONAL, "foo");
 
@@ -297,7 +299,7 @@
 
         replay();
 
-        RenderSupportImpl support = new RenderSupportImpl(linker, null, null, 
new EmptyJavascriptStack());
+        RenderSupportImpl support = new RenderSupportImpl(linker, null, null, 
EMPTY_CLIENT_INFRASTRUCTURE);
 
         support.autofocus(FieldFocusPriority.OPTIONAL, "foo");
         support.autofocus(FieldFocusPriority.OPTIONAL, "bar");
@@ -316,7 +318,7 @@
 
         replay();
 
-        RenderSupportImpl support = new RenderSupportImpl(linker, null, null, 
new EmptyJavascriptStack());
+        RenderSupportImpl support = new RenderSupportImpl(linker, null, null, 
EMPTY_CLIENT_INFRASTRUCTURE);
 
         support.autofocus(FieldFocusPriority.OPTIONAL, "foo");
         support.autofocus(FieldFocusPriority.REQUIRED, "bar");


Reply via email to