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 2010/04/19 16:05:17 UTC
svn commit: r935580 [2/2] - in /tapestry/tapestry5/trunk/tapestry-core/src:
main/java/org/apache/tapestry5/ main/java/org/apache/tapestry5/internal/
main/java/org/apache/tapestry5/internal/services/
main/java/org/apache/tapestry5/internal/services/ajax...
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=935580&r1=935579&r2=935580&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 Mon Apr 19 14:05:16 2010
@@ -80,7 +80,9 @@ import org.apache.tapestry5.internal.ser
import org.apache.tapestry5.internal.services.assets.AssetPathConstructorImpl;
import org.apache.tapestry5.internal.services.assets.ClasspathAssetRequestHandler;
import org.apache.tapestry5.internal.services.assets.ContextAssetRequestHandler;
-import org.apache.tapestry5.internal.services.assets.VirtualAssetRequestHandler;
+import org.apache.tapestry5.internal.services.javascript.CoreJavascriptStack;
+import org.apache.tapestry5.internal.services.javascript.JavascriptStackPathConstructor;
+import org.apache.tapestry5.internal.services.javascript.JavascriptStackSourceImpl;
import org.apache.tapestry5.internal.services.messages.PropertiesFileParserImpl;
import org.apache.tapestry5.internal.transform.*;
import org.apache.tapestry5.internal.translator.NumericTranslator;
@@ -107,6 +109,8 @@ import org.apache.tapestry5.runtime.Rend
import org.apache.tapestry5.services.ajax.MultiZoneUpdateEventResultProcessor;
import org.apache.tapestry5.services.assets.AssetPathConstructor;
import org.apache.tapestry5.services.assets.AssetRequestHandler;
+import org.apache.tapestry5.services.javascript.JavascriptStack;
+import org.apache.tapestry5.services.javascript.JavascriptStackSource;
import org.apache.tapestry5.services.javascript.JavascriptSupport;
import org.apache.tapestry5.services.messages.PropertiesFileParser;
import org.apache.tapestry5.util.StringToEnumCoercion;
@@ -118,7 +122,6 @@ import org.apache.tapestry5.validator.Mi
import org.apache.tapestry5.validator.Regexp;
import org.apache.tapestry5.validator.Required;
import org.apache.tapestry5.validator.ValidatorMacro;
-import org.apache.tools.ant.taskdefs.condition.ResourceContains;
import org.slf4j.Logger;
/**
@@ -365,6 +368,7 @@ public final class TapestryModule
binder.bind(PageActivator.class, PageActivatorImpl.class);
binder.bind(Dispatcher.class, AssetDispatcher.class).withId("AssetDispatcher");
binder.bind(AssetPathConstructor.class, AssetPathConstructorImpl.class);
+ binder.bind(JavascriptStackSource.class, JavascriptStackSourceImpl.class);
}
// ========================================================================
@@ -465,7 +469,7 @@ public final class TapestryModule
/**
* Contributes an handler for each mapped classpath alias, as well handlers for context assets
- * and virtual assets (combined Javascript files).
+ * and stack assets (combined {@link JavascriptStack} files).
*/
public static void contributeAssetDispatcher(MappedConfiguration<String, AssetRequestHandler> configuration,
@@ -486,8 +490,6 @@ public final class TapestryModule
configuration.add(RequestConstants.CONTEXT_FOLDER, new ContextAssetRequestHandler(streamer, contextAssetFactory
.getRootResource()));
-
- configuration.addInstance(RequestConstants.VIRTUAL_FOLDER, VirtualAssetRequestHandler.class);
}
private static String toPackagePath(String packageName)
@@ -1892,9 +1894,6 @@ public final class TapestryModule
*/
public void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration,
- @Symbol(SymbolConstants.PRODUCTION_MODE)
- final boolean productionMode,
-
@Path("${tapestry.spacer-image}")
final Asset spacerImage,
@@ -1905,25 +1904,22 @@ public final class TapestryModule
@Symbol(SymbolConstants.TAPESTRY_VERSION)
final String tapestryVersion,
- @Symbol(SymbolConstants.COMBINE_SCRIPTS)
- final boolean combineScripts,
-
final SymbolSource symbolSource,
final AssetSource assetSource,
- final ClientDataEncoder clientDataEncoder,
+ final JavascriptStackSource javascriptStackSource,
- final ClientInfrastructure clientInfrastructure,
+ final JavascriptStackPathConstructor javascriptStackPathConstructor,
- final AssetPathConstructor assetPathConstructor)
+ @Path("${tapestry.default-stylesheet}")
+ final Asset defaultStylesheet)
{
MarkupRendererFilter documentLinker = new MarkupRendererFilter()
{
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer)
{
- DocumentLinkerImpl linker = new DocumentLinkerImpl(productionMode, omitGeneratorMeta, tapestryVersion,
- combineScripts, request.getContextPath(), clientDataEncoder, assetPathConstructor);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(omitGeneratorMeta, tapestryVersion);
environment.push(DocumentLinker.class, linker);
@@ -1941,7 +1937,8 @@ public final class TapestryModule
{
DocumentLinker linker = environment.peekRequired(DocumentLinker.class);
- JavascriptSupportImpl support = new JavascriptSupportImpl(linker, clientInfrastructure);
+ JavascriptSupportImpl support = new JavascriptSupportImpl(linker, javascriptStackSource,
+ javascriptStackPathConstructor);
environment.push(JavascriptSupport.class, support);
@@ -1957,10 +1954,9 @@ public final class TapestryModule
{
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer)
{
- DocumentLinker linker = environment.peekRequired(DocumentLinker.class);
+ JavascriptSupport javascriptSupport = environment.peekRequired(JavascriptSupport.class);
- RenderSupportImpl support = new RenderSupportImpl(linker, symbolSource, assetSource, environment
- .peekRequired(JavascriptSupport.class));
+ RenderSupportImpl support = new RenderSupportImpl(symbolSource, assetSource, javascriptSupport);
environment.push(RenderSupport.class, support);
@@ -1976,12 +1972,9 @@ public final class TapestryModule
{
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer)
{
- RenderSupport renderSupport = environment.peek(RenderSupport.class);
+ DocumentLinker linker = environment.peekRequired(DocumentLinker.class);
- for (Asset stylesheet : clientInfrastructure.getStylesheetStack())
- {
- renderSupport.addStylesheetLink(stylesheet, null);
- }
+ linker.addStylesheetLink(defaultStylesheet.toClientURL(), null);
renderer.renderMarkup(writer);
}
@@ -2071,6 +2064,10 @@ public final class TapestryModule
@Path("${tapestry.spacer-image}")
final Asset spacerImage,
+ final JavascriptStackSource javascriptStackSource,
+
+ final JavascriptStackPathConstructor javascriptStackPathConstructor,
+
final SymbolSource symbolSource,
final AssetSource assetSource)
@@ -2103,8 +2100,8 @@ public final class TapestryModule
DocumentLinker linker = environment.peekRequired(DocumentLinker.class);
- JavascriptSupportImpl support = new JavascriptSupportImpl(linker, new EmptyClientInfrastructure(),
- idAllocator, true);
+ JavascriptSupportImpl support = new JavascriptSupportImpl(linker, javascriptStackSource,
+ javascriptStackPathConstructor, idAllocator, true);
environment.push(JavascriptSupport.class, support);
@@ -2120,10 +2117,9 @@ public final class TapestryModule
{
public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer)
{
- DocumentLinker linker = environment.peekRequired(DocumentLinker.class);
JavascriptSupport javascriptSupport = environment.peekRequired(JavascriptSupport.class);
- RenderSupportImpl support = new RenderSupportImpl(linker, symbolSource, assetSource, javascriptSupport);
+ RenderSupportImpl support = new RenderSupportImpl(symbolSource, assetSource, javascriptSupport);
environment.push(RenderSupport.class, support);
@@ -2419,8 +2415,6 @@ public final class TapestryModule
configuration.add(SymbolConstants.ENCODE_LOCALE_INTO_PATH, "true");
configuration.add(SymbolConstants.BLACKBIRD_ENABLED, "false");
-
- configuration.add(SymbolConstants.CONTEXT_ASSETS_AVAILABLE, "true");
}
/**
@@ -2633,7 +2627,7 @@ public final class TapestryModule
}
/**
- * The master Sessi`onPesistedObjectAnalyzer.
+ * The master SessionPesistedObjectAnalyzer.
*
* @since 5.1.0.0
*/
@@ -2646,7 +2640,8 @@ public final class TapestryModule
/**
* Identifies String, Number and Boolean as immutable objects, a catch-all
- * handler for Object (that understands {@link org.apache.tapestry5.annotations.ImmutableSessionPersistedObject},
+ * handler for Object (that understands
+ * the {@link org.apache.tapestry5.annotations.ImmutableSessionPersistedObject} annotation),
* and handlers for {@link org.apache.tapestry5.OptimizedSessionPersistedObject} and
* {@link org.apache.tapestry5.OptimizedApplicationStateObject}.
*
@@ -2674,7 +2669,7 @@ public final class TapestryModule
}
/**
- * Contibutions are content types that do not benefit from compression. Adds
+ * Contributions are content types that do not benefit from compression. Adds
* the following content types:
* <ul>
* <li>image/jpeg</li>
@@ -2826,7 +2821,7 @@ public final class TapestryModule
}
/**
- * Exposes the Environmental {@link Heartbeat} as an injective service.
+ * Exposes the Environmental {@link Heartbeat} as an injectable service.
*
* @since 5.2.0
*/
@@ -2834,4 +2829,14 @@ public final class TapestryModule
{
return environmentalBuilder.build(Heartbeat.class);
}
+
+ /**
+ * Contributes the "core" {@link JavascriptStack}.
+ *
+ * @since 5.2.0
+ */
+ public static void contributeJavascriptStackSource(MappedConfiguration<String, JavascriptStack> configuration)
+ {
+ configuration.addInstance(InternalConstants.CORE_STACK_NAME, CoreJavascriptStack.class);
+ }
}
Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptStack.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptStack.java?rev=935580&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptStack.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptStack.java Mon Apr 19 14:05:16 2010
@@ -0,0 +1,64 @@
+// Copyright 2010 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.tapestry5.services.javascript;
+
+import java.util.List;
+
+import org.apache.tapestry5.Asset;
+import org.apache.tapestry5.SymbolConstants;
+import org.apache.tapestry5.ioc.services.ThreadLocale;
+import org.apache.tapestry5.services.AssetSource;
+import org.apache.tapestry5.services.ClientInfrastructure;
+
+/**
+ * A high level description of a group of related JavaScript libraries and stylesheets. The built-in "core"
+ * stack is used to define the core JavaScript libraries needed by Tapestry (currently, this includes
+ * Prototype and Scriptaculous, as well as Tapestry-specific libraries). Other component libraries may
+ * define additional stacks for related sets of resources, for example, to bundle together some portion
+ * of the ExtJS or YUI libraries.
+ * <p>
+ * A JavaScriptStack can be thought of as a generalization of Tapestry 5.1's {@link ClientInfrastructure}, which exists
+ * now to define the "core" Javascript stack.
+ * <p>
+ * A Javascript assets of a stack may (when {@linkplain SymbolConstants#COMBINE_SCRIPTS enabled}) be exposed to the
+ * client as a single URL (identifying the stack by name). The individual assets are combined into a single virtual
+ * asset, which is then streamed to the client.
+ * <p>
+ * Implementations may need to inject the {@link ThreadLocale} service in order to determine the current locale (if any
+ * of the assets are localized). They will generally need to inject they {@link AssetSource} service as well.
+ * <p>
+ * A planned extension to this interface is to allow for dependencies between JavascriptStacks.
+ *
+ * @since 5.2.0
+ */
+public interface JavascriptStack
+{
+ /**
+ * Returns a list of <em>localized</em> assets for JavaScript libraries that form the stack.
+ */
+ List<Asset> getJavascriptLibraries();
+
+ /**
+ * Returns a list of <em>localized<m/e> assets for stylesheets that form the stack.
+ */
+ List<Asset> getStylesheets();
+
+ /**
+ * Returns static JavaScript initialization for the stack. This block JavaScript code will be added to the
+ * page that imports the stack. The code executes outside of any other function (i.e., the code is not deferred
+ * until the DOM is loaded).
+ */
+ String getInitialization();
+}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptStack.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptStackSource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptStackSource.java?rev=935580&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptStackSource.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptStackSource.java Mon Apr 19 14:05:16 2010
@@ -0,0 +1,36 @@
+// Copyright 2010 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.tapestry5.services.javascript;
+
+import org.apache.tapestry5.ioc.annotations.UsesMappedConfiguration;
+import org.apache.tapestry5.ioc.util.UnknownValueException;
+
+/**
+ * Manages the available {@link JavascriptStack}s, each of which has a unique name.
+ *
+ * @since 5.2.0
+ */
+@UsesMappedConfiguration(JavascriptStack.class)
+public interface JavascriptStackSource
+{
+ /**
+ * Gets a stack by name (ignoring case).
+ *
+ * @return named stack
+ * @throws UnknownValueException
+ * if no such stack
+ */
+ JavascriptStack getStack(String name);
+}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptStackSource.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptSupport.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptSupport.java?rev=935580&r1=935579&r2=935580&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptSupport.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavascriptSupport.java Mon Apr 19 14:05:16 2010
@@ -138,4 +138,28 @@ public interface JavascriptSupport
* @see IncludeJavaScriptLibrary
*/
void importJavascriptLibrary(Asset asset);
+
+ /**
+ * Imports a CSS stylesheet as part of the rendered page. CSS stylesheets are added in the
+ * order they are first imported; duplicate imports are ignored. However, CSS stylesheets
+ * added as part of a {@link JavascriptStack} are added before other stylesheets (in the order
+ * the stack is imported).
+ *
+ * @param stylesheet
+ * asset for the stylesheet
+ * @param media
+ * media value for the stylesheet, or null to not specify a specific media type
+ */
+ void importStylesheet(Asset stylesheet, String media);
+
+ /**
+ * As with {@link #importStylesheet(Asset, String)}, but the stylesheet is represented as a URL string.
+ *
+ * @param stylesheet
+ * URL for the stylesheet
+ * @param media
+ * media value for the stylesheet, or null to not specify a specific media type
+ */
+ void importStylesheet(String stylesheetURL, String media);
+
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/DocumentLinkerImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/DocumentLinkerImplTest.java?rev=935580&r1=935579&r2=935580&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/DocumentLinkerImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/DocumentLinkerImplTest.java Mon Apr 19 14:05:16 2010
@@ -50,7 +50,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("not-html").text("not an HTML document");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
// Only checked if there's something to link.
@@ -77,7 +77,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("not-html").text("not an HTML document");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
// Only checked if there's something to link.
@@ -99,7 +99,7 @@ public class DocumentLinkerImplTest exte
{
Document document = new Document();
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addScript("foo.js");
linker.addScript("doSomething();");
@@ -116,7 +116,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addScriptLink("foo.js");
linker.addScriptLink("bar/baz.js");
@@ -137,7 +137,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html").element("body").element("p").text("Ready to be marked with generator meta.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, false, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(false, "1.2.3");
linker.updateDocument(document);
@@ -154,7 +154,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("no_html").text("Generator meta only added if root is html tag.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, false, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(false, "1.2.3");
linker.updateDocument(document);
@@ -168,7 +168,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addStylesheetLink("style.css", "print");
linker.addScriptLink("foo.js");
@@ -187,7 +187,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts at top.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addScriptLink("foo.js");
linker.addScriptLink("bar/baz.js");
@@ -205,7 +205,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html").element("body").element("p").text("Ready to be updated with styles.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addStylesheetLink("foo.css", null);
linker.addStylesheetLink("bar/baz.css", "print");
@@ -222,7 +222,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html").element("body").element("p").text("Ready to be updated with styles.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addStylesheetLink("foo.css", null);
linker.addStylesheetLink("bar/baz.css", "print");
@@ -243,7 +243,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html").element("head").comment("existing head").getParent().element("body").text(
"body content");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addStylesheetLink("foo.css", null);
@@ -259,7 +259,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
for (int i = 0; i < 3; i++)
{
@@ -280,7 +280,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addScript("doSomething();");
linker.addScript("doSomethingElse();");
@@ -297,7 +297,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(false, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addScriptLink("foo.js");
@@ -316,7 +316,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html").element("notbody").element("p").text("Ready to be updated with scripts.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addScriptLink("foo.js");
@@ -332,7 +332,7 @@ public class DocumentLinkerImplTest exte
document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", false, "", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addScript("for (var i = 0; i < 5; i++) { doIt(i); }");
@@ -342,60 +342,13 @@ public class DocumentLinkerImplTest exte
}
@Test
- public void aggregated_script_link() throws Exception
- {
- final ClientDataEncoderImpl encoder = new ClientDataEncoderImpl(urlEncoder);
-
- AssetPathConstructor apc = newMock(AssetPathConstructor.class);
-
- expect(apc.constructAssetPath(EasyMock.eq(RequestConstants.VIRTUAL_FOLDER), EasyMock.isA(String.class)))
- .andAnswer(new IAnswer<String>()
- {
- public String answer() throws Throwable
- {
- String path = (String) EasyMock.getCurrentArguments()[1];
-
- String clientData = path.substring(0, path.length() - 3);
-
- ObjectInputStream stream = encoder.decodeEncodedClientData(clientData);
-
- assertEquals(stream.readInt(), 2);
- assertEquals(stream.readUTF(), "/assets/foo.js");
- assertEquals(stream.readUTF(), "/assets/xyz/bar.js");
-
- return "{virtual}";
- }
-
- });
-
- replay();
-
- Document document = new Document();
-
- document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.");
-
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", true, "/context", encoder, apc);
-
- linker.addScriptLink("/context/assets/foo.js");
- linker.addScriptLink("/context/assets/xyz/bar.js");
-
- linker.updateDocument(document);
-
- Element script = document.getRootElement().find("head/script");
-
- assertEquals(script.getAttribute("src"), "{virtual}");
-
- verify();
- }
-
- @Test
public void non_asset_script_link_disables_aggregation() throws Exception
{
Document document = new Document();
document.newRootElement("html").element("body").element("p").text("Ready to be updated with scripts.");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", true, "/context", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addScriptLink("/context/foo.js");
@@ -418,7 +371,7 @@ public class DocumentLinkerImplTest exte
head.element("meta");
head.element("script");
- DocumentLinkerImpl linker = new DocumentLinkerImpl(true, true, "1.2.3", true, "/context", null, null);
+ DocumentLinkerImpl linker = new DocumentLinkerImpl(true, "1.2.3");
linker.addScriptLink("/foo.js");
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=935580&r1=935579&r2=935580&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 Mon Apr 19 14:05:16 2010
@@ -39,7 +39,7 @@ public class RenderSupportImplTest exten
replay();
- RenderSupport support = new RenderSupportImpl(null, null, null, js);
+ RenderSupport support = new RenderSupportImpl(null, null, js);
support.addScriptLink(asset);
@@ -49,7 +49,7 @@ public class RenderSupportImplTest exten
@Test
public void add_script_link_by_url_fails()
{
- RenderSupport support = new RenderSupportImpl(null, null, null, null);
+ RenderSupport support = new RenderSupportImpl(null, null, null);
try
{
@@ -71,7 +71,7 @@ public class RenderSupportImplTest exten
replay();
- RenderSupport support = new RenderSupportImpl(null, null, null, js);
+ RenderSupport support = new RenderSupportImpl(null, null, js);
support.addScript("doSomething();");
@@ -97,7 +97,7 @@ public class RenderSupportImplTest exten
replay();
- RenderSupport support = new RenderSupportImpl(null, source, assetSource, js);
+ RenderSupport support = new RenderSupportImpl(source, assetSource, js);
support.addClasspathScriptLink(path);
@@ -116,7 +116,7 @@ public class RenderSupportImplTest exten
replay();
- RenderSupport support = new RenderSupportImpl(linker, null, null, null);
+ RenderSupport support = new RenderSupportImpl(null, null, null);
support.addStylesheetLink(asset, media);
@@ -133,7 +133,7 @@ public class RenderSupportImplTest exten
replay();
- RenderSupport support = new RenderSupportImpl(linker, null, null, null);
+ RenderSupport support = new RenderSupportImpl(null, null, null);
support.addStylesheetLink(ASSET_URL, media);
@@ -151,7 +151,7 @@ public class RenderSupportImplTest exten
replay();
- RenderSupportImpl support = new RenderSupportImpl(null, null, null, js);
+ RenderSupportImpl support = new RenderSupportImpl(null, null, js);
support.addInit("foo", "fred", "barney");
@@ -169,7 +169,7 @@ public class RenderSupportImplTest exten
replay();
- RenderSupportImpl support = new RenderSupportImpl(null, null, null, js);
+ RenderSupportImpl support = new RenderSupportImpl(null, null, js);
support.autofocus(FieldFocusPriority.OPTIONAL, "foo");
@@ -187,7 +187,7 @@ public class RenderSupportImplTest exten
replay();
- RenderSupportImpl support = new RenderSupportImpl(null, null, null, js);
+ RenderSupportImpl support = new RenderSupportImpl(null, null, js);
support.autofocus(FieldFocusPriority.OPTIONAL, "foo");
support.autofocus(FieldFocusPriority.OPTIONAL, "bar");
@@ -206,7 +206,7 @@ public class RenderSupportImplTest exten
replay();
- RenderSupportImpl support = new RenderSupportImpl(null, null, null, js);
+ RenderSupportImpl support = new RenderSupportImpl(null, null, js);
support.autofocus(FieldFocusPriority.OPTIONAL, "foo");
support.autofocus(FieldFocusPriority.REQUIRED, "bar");
@@ -227,7 +227,7 @@ public class RenderSupportImplTest exten
replay();
- RenderSupportImpl support = new RenderSupportImpl(null, null, null, js);
+ RenderSupportImpl support = new RenderSupportImpl(null, null, js);
support.addInit("setup", parameter);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImplTest.java?rev=935580&r1=935579&r2=935580&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ajax/JavaScriptSupportImplTest.java Mon Apr 19 14:05:16 2010
@@ -40,7 +40,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupport jss = new JavascriptSupportImpl(null, null);
+ JavascriptSupport jss = new JavascriptSupportImpl(null, null, null);
assertEquals(jss.allocateClientId(resources), "tracy");
assertEquals(jss.allocateClientId(resources), "tracy_0");
@@ -57,7 +57,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.commit();
@@ -74,7 +74,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra, new IdAllocator(), true);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null, new IdAllocator(), true);
jss.addScript("doSomething();");
@@ -95,7 +95,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.addScript("doSomething();");
@@ -116,7 +116,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.addScript(InitializationPriority.IMMEDIATE, "doSomething();");
@@ -138,7 +138,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.addScript(InitializationPriority.IMMEDIATE, "immediate1();");
jss.addScript("normal1();");
@@ -162,7 +162,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.addScript(InitializationPriority.EARLY, "early();");
jss.addScript(InitializationPriority.NORMAL, "normal();");
@@ -186,7 +186,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.importJavascriptLibrary(library);
@@ -209,7 +209,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.addInitializerCall(InitializationPriority.IMMEDIATE, "setup", spec);
@@ -230,7 +230,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.addInitializerCall(InitializationPriority.IMMEDIATE, "setup", "chuck");
@@ -252,7 +252,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.addInitializerCall(InitializationPriority.IMMEDIATE, "setup", "chuck");
jss.addInitializerCall(InitializationPriority.IMMEDIATE, "setup", "pat");
@@ -274,7 +274,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.addInitializerCall("setup", "chuck");
@@ -298,7 +298,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.addInitializerCall(InitializationPriority.IMMEDIATE, "setup", spec1);
jss.addInitializerCall(InitializationPriority.IMMEDIATE, "setup", spec2);
@@ -323,7 +323,7 @@ public class JavaScriptSupportImplTest e
replay();
- JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, infra);
+ JavascriptSupportImpl jss = new JavascriptSupportImpl(linker, null, null);
jss.addInitializerCall(InitializationPriority.EARLY, "early", new JSONObject("id", "foo"));
jss.addInitializerCall("normal", new JSONObject("id", "bar"));