You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2011/04/01 01:15:41 UTC

svn commit: r1087489 - in /tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test: ./ conf/ java/ java/testapp/ java/testapp/pages/ java/testapp/services/ resources/ resources/testapp/ resources/testapp/pages/ webapp/ webapp/WEB-INF/

Author: hlship
Date: Thu Mar 31 23:15:40 2011
New Revision: 1087489

URL: http://svn.apache.org/viewvc?rev=1087489&view=rev
Log:
TAP5-73: Add a test application to demonstrate minification

Added:
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/conf/
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/conf/testng.xml
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/pages/
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/pages/Index.java
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/services/
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/services/AppModule.java
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/log4j.properties
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/testapp/
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/testapp/pages/
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/testapp/pages/Index.tml
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/webapp/
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/webapp/WEB-INF/
    tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/webapp/WEB-INF/web.xml

Added: tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/conf/testng.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/conf/testng.xml?rev=1087489&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/conf/testng.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/conf/testng.xml Thu Mar 31 23:15:40 2011
@@ -0,0 +1,11 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="Tapestry YUICompressor Integration" annotations="1.5" verbose="2">
+
+  <parameter name="tapestry.web-app-folder" value="src/test/webapp"/>
+
+  <test name="Integration Tests">
+    <packages>
+      <package name="org.apache.tapestry5.yuicompressor.itest"/>
+    </packages>
+  </test>
+</suite>

Added: tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/pages/Index.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/pages/Index.java?rev=1087489&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/pages/Index.java (added)
+++ tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/pages/Index.java Thu Mar 31 23:15:40 2011
@@ -0,0 +1,46 @@
+package testapp.pages;
+
+import java.util.List;
+
+import org.apache.tapestry5.SelectModel;
+import org.apache.tapestry5.ValueEncoder;
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.ioc.Messages;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.ioc.internal.util.InternalUtils;
+import org.apache.tapestry5.services.ValueEncoderSource;
+import org.apache.tapestry5.util.EnumSelectModel;
+
+public class Index
+{
+    static enum Languages
+    {
+        JAVA, SCALA, RUBY, CLOJURE, HASKELL, C, JAVASCRIPT
+    }
+
+    @Property
+    @Persist
+    private List<Languages> languages;
+
+    @Inject
+    private Messages messages;
+
+    @Inject
+    private ValueEncoderSource vec;
+
+    public ValueEncoder<Languages> getLanguagesEncoder()
+    {
+        return vec.getValueEncoder(Languages.class);
+    }
+
+    public String getSelectedLanguages()
+    {
+        return InternalUtils.join(languages);
+    }
+
+    public SelectModel getLanguagesModel()
+    {
+        return new EnumSelectModel(Languages.class, messages);
+    }
+}

Added: tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/services/AppModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/services/AppModule.java?rev=1087489&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/services/AppModule.java (added)
+++ tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/java/testapp/services/AppModule.java Thu Mar 31 23:15:40 2011
@@ -0,0 +1,23 @@
+package testapp.services;
+
+import org.apache.tapestry5.SymbolConstants;
+import org.apache.tapestry5.ioc.MappedConfiguration;
+import org.apache.tapestry5.ioc.annotations.Contribute;
+import org.apache.tapestry5.ioc.annotations.SubModule;
+import org.apache.tapestry5.ioc.services.ApplicationDefaults;
+import org.apache.tapestry5.ioc.services.SymbolProvider;
+import org.apache.tapestry5.yuicompressor.services.YuiCompressorModule;
+
+@SubModule(YuiCompressorModule.class)
+public class AppModule
+{
+    @Contribute(SymbolProvider.class)
+    @ApplicationDefaults
+    public static void setupConfiguration(MappedConfiguration<String, Object> configuration)
+    {
+        configuration.add(SymbolConstants.BLACKBIRD_ENABLED, true);
+        configuration.add(SymbolConstants.COMBINE_SCRIPTS, true);
+        configuration.add(SymbolConstants.MINIFICATION_ENABLED, true);
+        configuration.add(SymbolConstants.PRODUCTION_MODE, false);
+    }
+}

Added: tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/log4j.properties?rev=1087489&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/log4j.properties (added)
+++ tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/log4j.properties Thu Mar 31 23:15:40 2011
@@ -0,0 +1,16 @@
+log4j.rootCategory=INFO, 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=[%p] %c{1} %m%n
+
+# log4j.category.tapestry.render=debug
+
+log4j.category.org.apache.tapestry5.services.assets.AssetsModule.ResourceMinimizer=debug
+log4j.category.org.apache.tapestry5.yuicompressor=debug
+log4j.category.org.apache.tapestry5.internal.yuicompressor=debug
+
+

Added: tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/testapp/pages/Index.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/testapp/pages/Index.tml?rev=1087489&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/testapp/pages/Index.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/resources/testapp/pages/Index.tml Thu Mar 31 23:15:40 2011
@@ -0,0 +1,25 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
+  <head>
+    <title>YUICompressor Test</title>
+  </head>
+  <body>
+
+    <t:form>
+      <t:errors/>
+      <t:palette t:id="languages" selected="languages" model="languagesModel" encoder="languagesEncoder" reorder="true"/>
+      <br/>
+      <input type="submit"/>
+    </t:form>
+
+    <hr/>
+
+    <t:if test="languages">
+      <p>
+        Selected languages:
+        <span id="selected">${selectedLanguages}</span>
+      </p>
+    </t:if>
+
+
+  </body>
+</html>
\ No newline at end of file

Added: tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/webapp/WEB-INF/web.xml?rev=1087489&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/webapp/WEB-INF/web.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-yuicompressor/src/test/webapp/WEB-INF/web.xml Thu Mar 31 23:15:40 2011
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app
+        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+        "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+  <display-name>Tapestry/YUICompressor Integration Test</display-name>
+  <context-param>
+    <param-name>tapestry.app-package</param-name>
+    <param-value>testapp</param-value>
+  </context-param>
+  <filter>
+    <filter-name>app</filter-name>
+    <filter-class>org.apache.tapestry5.TapestryFilter</filter-class>
+  </filter>
+  <filter-mapping>
+    <filter-name>app</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+</web-app>