cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r370816 - in /cocoon/branches/BRANCH_2_1_X/src: test/htmlunit/org/apache/cocoon/ webapp/test-suite/forms/
Date Fri, 20 Jan 2006 14:34:02 GMT
Author: jbq
Date: Fri Jan 20 06:33:51 2006
New Revision: 370816

URL: http://svn.apache.org/viewcvs?rev=370816&view=rev
Log:
Adding a testcase for COCOON-1720: Form.js overwrites the CFormsInstance attribute

I dedicate this commit to Lolive who is leaving us today

Added:
    cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/FormsSharingViewDataTestCase.java
  (with props)
    cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/
    cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/flow.js   (with props)
    cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a.xml   (with props)
    cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a_template.xml   (with props)
    cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b.xml   (with props)
    cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b_template.xml   (with props)
    cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/forms-samples-styling.xsl   (with
props)
    cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/sitemap.xmap   (with props)

Added: cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/FormsSharingViewDataTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/FormsSharingViewDataTestCase.java?rev=370816&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/FormsSharingViewDataTestCase.java
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/FormsSharingViewDataTestCase.java
Fri Jan 20 06:33:51 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 1999-2004 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.cocoon;
+
+/**
+ * Test Cocoon Forms, when subsequent showForm are sharing the same viewdata and
+ * an action is invoked from within the form inbetween.
+ *
+ * @version $Id$
+ */
+public class FormsSharingViewDataTestCase extends HtmlUnitTestCase {
+    final String testPipeline = "/test-suite/forms/";
+    final String continuationPath = "/html/body/form/div/input[@name='continuation-id']/@value";
+    public void testCachingProcessingPipeline() throws Exception {
+        // Loading form "a"
+        loadXmlPage(testPipeline + "a");
+        // Get continuation id
+        String firstScreenContinuation = evalXPath(continuationPath);
+        //System.out.println("firstScreenContinuation="+firstScreenContinuation);
+
+        // Invoke the "change" action
+        loadXmlPage(testPipeline + firstScreenContinuation + ".continue?forms_submit_id=change&a=0");
+        // Get continuation id
+        String firstScreenActionContinuation = evalXPath(continuationPath);
+        //System.out.println("firstScreenActionContinuation="+firstScreenActionContinuation);
+
+        // Submit the form with "ok" button, which will load form "b"
+        loadXmlPage(testPipeline + firstScreenActionContinuation + ".continue?forms_submit_id=ok&a=1");
+
+        // Reactivating the continuation of first screen
+        loadXmlPage(testPipeline + firstScreenContinuation + ".continue?forms_submit_id=change&a=0");
+    }
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/FormsSharingViewDataTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/test/htmlunit/org/apache/cocoon/FormsSharingViewDataTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/flow.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/flow.js?rev=370816&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/flow.js (added)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/flow.js Fri Jan 20 06:33:51 2006
@@ -0,0 +1,16 @@
+cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
+
+function do_a() {
+    var data = {}
+    data.value="shared value"
+    var form = new Form("form-a.xml");
+    while (true) {
+        form.showForm("form-a", data)
+        do_b(data)
+    }
+}
+
+function do_b(data) {
+    var form = new Form("form-b.xml");
+    form.showForm("form-b", data)
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/flow.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a.xml?rev=370816&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a.xml Fri Jan 20 06:33:51
2006
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+
+<!--
+  @version $Id$
+-->
+
+<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
+  <fd:widgets>
+    <fd:field id="a">
+      <fd:initial-value locale="fr">0</fd:initial-value>
+      <fd:datatype base="integer"/>
+    </fd:field>
+    <fd:action id="change">
+      <fd:label>Change</fd:label>
+      <fd:on-action>
+        <javascript>
+          var form = event.source.form
+          var a = form.getChild("a")
+          a.setValue(new java.lang.Integer(parseInt(a.getValue()) + 1))
+        </javascript>
+      </fd:on-action>
+    </fd:action>
+    <fd:submit id="ok">
+      <fd:label>Ok</fd:label>
+    </fd:submit>
+  </fd:widgets>
+</fd:form>

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a_template.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a_template.xml?rev=370816&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a_template.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a_template.xml Fri Jan 20
06:33:51 2006
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+<!-- This file is similar to form1_template_action.xml. They differ in group layout,
+     form's action attribute (to use continuations) and, this one is a dynamic form
+     template that changes the 'contacts' repeater layout depending on its size -->
+<html xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+      xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+      xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+  <!-- Import the macros that define CForms template elements -->
+  <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
+  <head>
+    <title>Sample form A</title>
+  </head>
+  <body>
+    <ft:form-template action="#{$cocoon/continuation/id}.continue" method="GET">
+      <ft:continuation-id/>
+      ${value}
+      ${CocoonFormsInstance.getChild("a")}
+      <ft:widget id="a"/>
+      <ft:widget id="change"/>
+      <ft:widget id="ok"/>
+    </ft:form-template>
+  </body>
+</html>

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a_template.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-a_template.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b.xml?rev=370816&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b.xml Fri Jan 20 06:33:51
2006
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+
+<!--
+  @version $Id$
+-->
+
+<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
+  <fd:widgets>
+    <fd:field id="b">
+      <fd:datatype base="integer"/>
+    </fd:field>
+    <fd:submit id="ok">
+      <fd:label>Ok</fd:label>
+    </fd:submit>
+  </fd:widgets>
+</fd:form>

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b_template.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b_template.xml?rev=370816&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b_template.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b_template.xml Fri Jan 20
06:33:51 2006
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+<!-- This file is similar to form1_template_action.xml. They differ in group layout,
+     form's action attribute (to use continuations) and, this one is a dynamic form
+     template that changes the 'contacts' repeater layout depending on its size -->
+<html xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+      xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+      xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+  <!-- Import the macros that define CForms template elements -->
+  <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
+  <head>
+  <title>Sample form B</title>
+  </head>
+  <body>
+    <ft:form-template action="" method="POST" ajax="true">
+      <ft:continuation-id/>
+      ${value}
+      ${CocoonFormsInstance.getChild("b")}
+      <ft:widget id="b"/>
+      <ft:widget id="ok"/>
+    </ft:form-template>
+  </body>
+</html>

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b_template.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/form-b_template.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/forms-samples-styling.xsl
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/forms-samples-styling.xsl?rev=370816&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/forms-samples-styling.xsl (added)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/forms-samples-styling.xsl Fri
Jan 20 06:33:51 2006
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <!--+ Include styling stylesheets, one for the widgets, the other one for the
+      | page. As 'forms-advanced-field-styling.xsl' is a specialization of
+      | 'forms-field-styling.xsl' the latter one is imported there. If you don't
+      | want advanced styling of widgets, change it here!
+      | See xsl:include as composition and xsl:import as extension/inheritance.
+      +-->
+  <xsl:include href="resource://org/apache/cocoon/forms/resources/forms-page-styling.xsl"/>
+  <xsl:include href="resource://org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl"/>
+
+  <!-- Location of the resources directory, where JS libs and icons are stored -->
+  <xsl:param name="resources-uri">resources</xsl:param>
+  
+  <xsl:template match="head">
+    <head>
+      <xsl:apply-templates/>
+      <xsl:apply-templates select="." mode="forms-page"/>
+      <xsl:apply-templates select="." mode="forms-field"/>
+    </head>
+  </xsl:template>
+
+  <xsl:template match="body">
+    <body>
+      <!--+ !!! If template with mode 'forms-page' adds text or elements
+          |        template with mode 'forms-field' can no longer add attributes!!!
+          +-->
+      <xsl:apply-templates select="." mode="forms-page"/>
+      <xsl:apply-templates select="." mode="forms-field"/>
+      <xsl:apply-templates/>
+    </body>
+  </xsl:template>
+
+</xsl:stylesheet>

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/forms-samples-styling.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/sitemap.xmap?rev=370816&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/sitemap.xmap (added)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/sitemap.xmap Fri Jan 20 06:33:51
2006
@@ -0,0 +1,33 @@
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  <map:flow language="javascript">
+    <map:script src="flow.js" />
+  </map:flow>
+
+  <map:pipelines>
+    <map:pipeline>
+      <!-- Continue a scenario. The continuation id is passed in the URL
+        (typically used for GET requests) -->
+      <map:match pattern="*.continue">
+        <map:call continuation="{1}"/>
+      </map:match>
+
+      <map:match pattern="resources/*/**">
+        <map:read src="resource://org/apache/cocoon/{1}/resources/{2}"/>
+      </map:match>
+
+      <map:match pattern="form-*">
+        <map:generate type="jx" src="form-{1}_template.xml"/>
+        <map:transform src="forms-samples-styling.xsl"/>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <map:match pattern="*">
+        <map:call function="do_{1}"/>
+      </map:match>
+
+      <map:match pattern="**">
+        <map:read src="resource://org/apache/cocoon/{0}"/>
+      </map:match>
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/sitemap.xmap
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/webapp/test-suite/forms/sitemap.xmap
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message