You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by ml...@apache.org on 2011/10/05 16:38:41 UTC

svn commit: r1179242 - in /tapestry/tapestry5/trunk/tapestry-core/src/test: conf/ groovy/org/apache/tapestry5/integration/symbolparam/ groovy/org/apache/tapestry5/integration/symbolparam/components/ groovy/org/apache/tapestry5/integration/symbolparam/p...

Author: mlusetti
Date: Wed Oct  5 14:38:40 2011
New Revision: 1179242

URL: http://svn.apache.org/viewvc?rev=1179242&view=rev
Log:
TAP5-1677 Integration test for Grid's default parameters Symbol value

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/
    tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy
    tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/components/
    tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/components/Layout.groovy
    tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/
    tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.groovy
    tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/Index.groovy
    tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/
    tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/AppModule.groovy
    tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/Number.groovy
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/components/
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/components/Layout.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/Index.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/
    tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/
    tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/app.properties   (with props)
    tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/web.xml   (with props)
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml?rev=1179242&r1=1179241&r2=1179242&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml Wed Oct  5 14:38:40 2011
@@ -92,6 +92,13 @@
         </packages>
     </test>
 
+    <test name="Components Param Symbols Tests" enabled="true">
+        <parameter name="tapestry.web-app-folder" value="src/test/symbolparam"/>
+        <packages>
+            <package name="org.apache.tapestry5.integration.symbolparam"/>
+        </packages>
+    </test>
+
     <test name="AppFolder Tests" enabled="true">
         <parameter name="tapestry.web-app-folder" value="src/test/appfolder"/>
         <packages>

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy?rev=1179242&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy Wed Oct  5 14:38:40 2011
@@ -0,0 +1,37 @@
+// Copyright 2011 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.integration.symbolparam
+
+import org.apache.tapestry5.integration.TapestryCoreTestCase
+import org.testng.annotations.Test
+
+/**
+ * Tests for the Grid's symbol parameter support added in 5.3.
+ */
+class GridSymbolDemoTests extends TapestryCoreTestCase
+{
+    @Test
+    void grid_default_symbol_override()
+    {
+        openLinks "GridSymbol"
+
+        clickAndWait "link=4"
+
+        assertText("//tr[1]/td[3]", "6");
+        assertText("//tr[1]/td[4]", "false");
+        assertText("//tr[2]/td[3]", "7");
+        assertText("//tr[2]/td[4]", "true");
+    }
+}

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/components/Layout.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/components/Layout.groovy?rev=1179242&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/components/Layout.groovy (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/components/Layout.groovy Wed Oct  5 14:38:40 2011
@@ -0,0 +1,39 @@
+// Copyright 2011 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.integration.symbolparam.components
+
+import org.apache.tapestry5.annotations.Property
+import org.apache.tapestry5.ioc.annotations.Inject
+import org.apache.tapestry5.services.Request
+import org.apache.tapestry5.services.Session
+
+class Layout {
+
+    @Inject
+    @Property
+    private Request request
+
+    @Property
+    private String attributeName
+
+    Session getSession() {
+        request.getSession(false)
+    }
+    
+    void onActionFromReset()
+    {
+        request.getSession(true).invalidate()
+    }
+}

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.groovy?rev=1179242&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.groovy (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.groovy Wed Oct  5 14:38:40 2011
@@ -0,0 +1,36 @@
+// Copyright 2011 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.integration.symbolparam.pages
+
+import org.apache.tapestry5.annotations.Property
+import org.apache.tapestry5.integration.symbolparam.services.Number
+
+class GridSymbol
+{
+    @Property
+    private List<Number> numbers
+    @Property
+    private Number number
+
+    void setupRender()
+    {
+        numbers = new ArrayList<Number>()
+
+        for (int i = 0; i < 10; i++)
+        {
+            numbers.add(new Number(i))
+        }
+    }
+}

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/Index.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/Index.groovy?rev=1179242&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/Index.groovy (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/Index.groovy Wed Oct  5 14:38:40 2011
@@ -0,0 +1,21 @@
+// Copyright 2011 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.integration.symbolparam.pages
+
+
+class Index
+{
+
+}

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/AppModule.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/AppModule.groovy?rev=1179242&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/AppModule.groovy (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/AppModule.groovy Wed Oct  5 14:38:40 2011
@@ -0,0 +1,28 @@
+// Copyright 2011 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.integration.symbolparam.services
+
+import org.apache.tapestry5.SymbolConstants
+import org.apache.tapestry5.ioc.MappedConfiguration
+import org.apache.tapestry5.ParameterConstants
+
+class AppModule {
+
+    void contributeApplicationDefaults(MappedConfiguration conf)
+    {
+        conf.add(SymbolConstants.PRODUCTION_MODE, false)
+        conf.add(ParameterConstants.GRID_ROWS_PER_PAGE, 2);
+    }
+}

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/Number.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/Number.groovy?rev=1179242&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/Number.groovy (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/Number.groovy Wed Oct  5 14:38:40 2011
@@ -0,0 +1,24 @@
+package org.apache.tapestry5.integration.symbolparam.services
+
+/**
+ * Just store number and if is odd or even
+ */
+class Number
+{
+    int me
+
+    Number(int number)
+    {
+        me = number
+    }
+
+    int getMe()
+    {
+        return me
+    }
+
+    boolean isOdd()
+    {
+        return me % 2 == 0 ? false : true
+    }
+}

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/components/Layout.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/components/Layout.tml?rev=1179242&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/components/Layout.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/components/Layout.tml Wed Oct  5 14:38:40 2011
@@ -0,0 +1,31 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
+  <head>
+    <title>Default Layout</title>
+  </head>
+  <body>
+    <h1>Default Layout</h1>
+
+    <t:body/>
+
+    <hr/>
+
+    <t:renderobject object="request"/>
+
+    <t:if test="session">
+      <h2>Session</h2>
+      <dl>
+        <t:loop source="session.attributeNames" value="attributeName">
+          <dt>${attributeName}</dt>
+          <dd>
+            <t:renderobject object="session.getAttribute(attributeName)"/>
+          </dd>
+        </t:loop>
+      </dl>
+    </t:if>
+    
+    <p>
+    <t:actionlink t:id="reset">reset session</t:actionlink>
+    </p>
+
+  </body>
+</html>
\ No newline at end of file

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.tml?rev=1179242&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.tml Wed Oct  5 14:38:40 2011
@@ -0,0 +1,8 @@
+<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
+
+    <h1>Grid Symbol</h1>
+
+    <table t:type="grid" t:id="grid" source="numbers" row="number">
+    </table>
+
+</t:layout>

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/Index.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/Index.tml?rev=1179242&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/Index.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/Index.tml Wed Oct  5 14:38:40 2011
@@ -0,0 +1,9 @@
+<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
+
+  <ul>
+    <li>
+      <t:pagelink page="gridsymbol">GridSymbol</t:pagelink>
+    </li>
+  </ul>
+
+</t:layout>
\ No newline at end of file

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/app.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/app.properties?rev=1179242&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/app.properties (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/app.properties Wed Oct  5 14:38:40 2011
@@ -0,0 +1 @@
+app-message=Symbol Parameter overrides demo

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/app.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/web.xml?rev=1179242&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/web.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/web.xml Wed Oct  5 14:38: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>Integration Test Symbol Param Override</display-name>
+  <context-param>
+    <param-name>tapestry.app-package</param-name>
+    <param-value>org.apache.tapestry5.integration.symbolparam</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>

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native