cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r669186 - in /cocoon/whiteboard/corona/trunk/corona-sample: ./ src/main/resources/COB-INF/ src/main/resources/COB-INF/aggregation/ src/main/resources/COB-INF/error-handling/ src/main/resources/COB-INF/read/ src/test/java/org/apache/cocoon/c...
Date Wed, 18 Jun 2008 14:27:53 GMT
Author: reinhard
Date: Wed Jun 18 07:27:53 2008
New Revision: 669186

URL: http://svn.apache.org/viewvc?rev=669186&view=rev
Log:
. more samples that use JEXL expressions and advanced matching
. fix Unit tests after introducing an explicit object model

Modified:
    cocoon/whiteboard/corona/trunk/corona-sample/pom.xml
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/aggregation/include.xml
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/error-handling/404.xml
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/overview.html
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/read/javascript-resource
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/read/javascript-resource.js
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap
    cocoon/whiteboard/corona/trunk/corona-sample/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java

Modified: cocoon/whiteboard/corona/trunk/corona-sample/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/pom.xml?rev=669186&r1=669185&r2=669186&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/pom.xml (original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/pom.xml Wed Jun 18 07:27:53 2008
@@ -51,6 +51,13 @@
       <scope>provided</scope>
     </dependency>    
 
+    <!-- Other dependencies -->
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+
     <!--  Test dependencies -->
     <dependency>
       <groupId>junit</groupId>
@@ -66,6 +73,7 @@
         <artifactId>cocoon-maven-plugin</artifactId>
         <configuration>
           <webappProfile>ssf</webappProfile>
+          <customWebappDirectory>rcl-config</customWebappDirectory>
         </configuration>
       </plugin>
       <plugin>

Modified: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/aggregation/include.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/aggregation/include.xml?rev=669186&r1=669185&r2=669186&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/aggregation/include.xml
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/aggregation/include.xml
Wed Jun 18 07:27:53 2008
@@ -16,6 +16,10 @@
   limitations under the License.
 -->
 <sample>
-  <i:include xmlns:i="http://apache.org/cocoon/include/1.0"
-    src="servlet:/aggregation/sub-request"/>
+  <sub1>
+    <i:include xmlns:i="http://apache.org/cocoon/corona/include/1.0" src="servlet:/aggregation/sub-request"/>
+  </sub1>
+  <sub2>
+    <i:include xmlns:i="http://apache.org/cocoon/corona/include/1.0" src="aggregation/sub.xml"/>
+  </sub2>
 </sample>

Modified: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/error-handling/404.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/error-handling/404.xml?rev=669186&r1=669185&r2=669186&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/error-handling/404.xml
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/error-handling/404.xml
Wed Jun 18 07:27:53 2008
@@ -6,9 +6,9 @@
   The ASF licenses this file to You 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.

Modified: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/overview.html
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/overview.html?rev=669186&r1=669185&r2=669186&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/overview.html
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/overview.html
Wed Jun 18 07:27:53 2008
@@ -17,15 +17,15 @@
 -->
 <html>
   <head>
-    <title>Micro Cocoon Integration Tests: Overview</title>
+    <title>Corona Samples and Integration Tests: Overview </title>
   <base target="_blank"/>
   </head>
   <body>
-    <h1>Micro Cocoon Integration Tests</h1>
+    <h1>Corona Samples and Integration Tests: Overview </h1>
   <h2>map:read</h2>
   <ul>
     <li><a href="read/javascript-resource-explicit">Javascript Resource</a>:
Test explicit setting of mime-type.</li>
-    <li><a href="read/javascript-resource-implicit">Javascript Resource</a>:
Test automatic setting of mime-type.</li>
+    <li><a href="read/javascript-resource-implicit.js">Javascript Resource</a>:
Test automatic setting of mime-type.</li>
   </ul>
   <h2>SAX Pipelines</h2>
   <ul>
@@ -55,11 +55,18 @@
   <h2>Redirects</h2>
   <ul>
     <li><a href="redirect/www.orf.at">Temporary (302)</a>: Temporary redirect
to orf.at.</li>
+    <li><a href="redirect/sax-pipeline/simple-xml">servlet:</a>: Redirect
to a servlet: URL.</li>
   </ul>
   <h2>Object Model</h2>
   <ul>
     <li><a href="object-model/request-parameters?a=1&b=2&c=3">All request
parameters</a>: Print all request parameters.</li>
   </ul>
+  <h2>Advanced Matching</h2>
+  <ul>
+    <li><a href="advanced-matching?myparam=11">Equals matcher (using an JEXL
expression to set a test value)</li>
+    <li><a href="advanced-matching?myparam=22">Regular expression matcher (using
an JEXL expression to set a test value)</li>
+    <li><a href="advanced-matching">Reach the otherwise section</li>
+  </ul>
   <h2>Aggregation</h2>
   <ul>
     <li><a href="aggregation/include-transformer">Include-Transformer</a>:
Aggregate XML using the IncludeTransformer.</li>

Modified: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/read/javascript-resource
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/read/javascript-resource?rev=669186&r1=669185&r2=669186&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/read/javascript-resource
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/read/javascript-resource
Wed Jun 18 07:27:53 2008
@@ -15,6 +15,6 @@
  * limitations under the License.
  */
 
-function x() {
-  alert('x');
+function x1() {
+  alert('x1');
 }
\ No newline at end of file

Modified: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/read/javascript-resource.js
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/read/javascript-resource.js?rev=669186&r1=669185&r2=669186&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/read/javascript-resource.js
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/read/javascript-resource.js
Wed Jun 18 07:27:53 2008
@@ -17,4 +17,5 @@
 
 function x() {
   alert('x');
+  
 }

Modified: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap?rev=669186&r1=669185&r2=669186&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap (original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap Wed
Jun 18 07:27:53 2008
@@ -22,12 +22,13 @@
   xmlns:servlet="http://apache.org/cocoon/corona/servlet" xmlns:controller="http://apache.org/cocoon/corona/controller">
 
   <map:pipelines>
+  
     <!-- ~~~~~~~~~~~~~~~~ exemplary image pipelines ~~~~~~~~~~~~~~~ -->
-    <map:pipeline>
+    <map:pipeline type="async-caching">
       <map:match pattern="images/simple">
         <map:generate src="images/simple.jpg" type="image" />
         <map:serialize type="image">
-          <map:parameter name="format" value="png" />
+          <map:parameter name="format" value="jpg" />
         </map:serialize>
       </map:match>
       <map:match pattern="images/simple-gray">
@@ -37,7 +38,7 @@
           <map:parameter name="gray" value="10" />
         </map:transform>
         <map:serialize type="image">
-          <map:parameter name="format" value="PNG" />
+          <map:parameter name="format" value="jpg" />
         </map:serialize>
       </map:match>
     </map:pipeline>
@@ -50,7 +51,10 @@
       <map:match pattern="read/javascript-resource-explicit">
         <map:read src="read/javascript-resource" mime-type="text/javascript" />
       </map:match>
-      <map:match pattern="read/javascript-resource-implicit">
+      <map:match pattern="read/javascript-resource-implicit.js">
+        <map:read src="read/javascript-resource.js" />
+      </map:match>
+      <map:match pattern="read/javascript-resource-implicit.abc">
         <map:read src="read/javascript-resource.js" />
       </map:match>
     </map:pipeline>
@@ -105,16 +109,15 @@
         <map:generate src="servlet:/sax-pipeline/simple-xml" />
         <map:serialize type="xml" />
       </map:match>
+      <map:match pattern="ssf/read-resource">
+        <map:read src="servlet:/read/javascript-resource-explicit" />
+      </map:match>
     </map:pipeline>
 
     <!-- ~~~~~~~~~~~~~~~~ expression language ~~~~~~~~~~~~~~~ -->
     <map:pipeline>
       <map:match pattern="expression-language/jexl">
-        <map:generate src="sax-pipeline/{jexl:cocoon.request.fileName}.xml" />
-        <map:serialize type="xml" />
-      </map:match>
-      <map:match pattern="expression-language/jxpath">
-        <map:generate src="sax-pipeline/{$cocoon/request/parameters/fileName}.xml" />
+        <map:generate src="sax-pipeline/{jexl:corona.request.fileName}.xml" />
         <map:serialize type="xml" />
       </map:match>
       <map:match pattern="expression-language/map/*">
@@ -140,6 +143,35 @@
         </map:match>
       </map:match>
     </map:pipeline>
+    
+    <!-- ~~~~~~~~~~~~~~~~ advanced matching (when/otherwise) ~~~~~~~~~~~~~~~ -->  
 
+    <map:pipeline>
+      <map:match pattern="advanced-matching">
+        <map:match value="{jexl:corona.request.myparam}">
+          <map:when equals="11">
+            <map:generate src="sax-pipeline/simple.xml" />
+            <map:transform src="sax-pipeline/simple.xslt">
+              <map:parameter name="myParam" value="{map:0}" />
+            </map:transform>
+            <map:serialize />
+          </map:when>
+          <map:when regexp="2(.)">
+            <map:generate src="sax-pipeline/simple.xml" />
+            <map:transform src="sax-pipeline/simple.xslt">
+              <map:parameter name="myParam" value="{map:1}" />
+            </map:transform>
+            <map:serialize />
+          </map:when>
+          <map:otherwise>
+            <map:generate src="sax-pipeline/simple.xml" />
+            <map:transform src="sax-pipeline/simple.xslt">
+              <map:parameter name="myParam" value="otherwise" />
+            </map:transform>
+            <map:serialize />          
+          </map:otherwise>
+        </map:match>
+      </map:match>
+    </map:pipeline>    
 
     <!-- ~~~~~~~~~~~~~~~~ aggregation ~~~~~~~~~~~~~~~ -->
     <map:pipeline>
@@ -170,7 +202,7 @@
     <!-- ~~~~~~~~~~~~~~~~ matcher: parameter passing ~~~~~~~~~~~~~~~ -->
     <map:pipeline>
       <map:match pattern="parameter-passing/failing">
-        <map:match type="parameter-passing" pattern="empty">
+        <map:match type="parameter-passing">
           <map:generate src="sax-pipeline/simple.xml" />
           <map:serialize />
         </map:match>
@@ -204,9 +236,9 @@
         <servlet:redirect-to uri="http://www.orf.at" />
       </map:match>
       <!-- Redirecting to a servlet service doesn't work -->
-      <!--map:match pattern="redirect/sax-pipeline/simple-xml">
+      <map:match pattern="redirect/sax-pipeline/simple-xml">
         <map:redirect-to uri="servlet:/sax-pipeline/simple-xml"/>
-        </map:match-->
+      </map:match>
     </map:pipeline>
 
     <!-- ~~~~~~~~~~~~~~~~ error handling ~~~~~~~~~~~~~~~ -->

Modified: cocoon/whiteboard/corona/trunk/corona-sample/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java?rev=669186&r1=669185&r2=669186&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java
Wed Jun 18 07:27:53 2008
@@ -31,6 +31,7 @@
 import org.apache.cocoon.corona.servlet.util.HttpContextHelper;
 import org.apache.cocoon.corona.sitemap.node.InvocationResult;
 import org.apache.cocoon.corona.sitemap.node.Sitemap;
+import org.apache.cocoon.corona.sitemap.objectmodel.ObjectModel;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
@@ -160,10 +161,15 @@
         assertTrue(this.sitemap.invoke(invocation).isCompleted());
         // invocation should not be marked as error-invocation
         assertFalse(invocation.isErrorInvocation());
+
+        invocation = this.buildInvocation("read/javascript-resource-explicit");
+        assertTrue(this.sitemap.invoke(invocation).isCompleted());
+        // invocation should not be marked as error-invocation
+        assertFalse(invocation.isErrorInvocation());
     }
 
     public void testReadPipelineImplicit() {
-        Invocation invocation = this.buildInvocation("read/javascript-resource-implicit");
+        Invocation invocation = this.buildInvocation("read/javascript-resource-implicit.js");
         assertTrue(this.sitemap.invoke(invocation).isCompleted());
         // invocation should not be marked as error-invocation
         assertFalse(invocation.isErrorInvocation());
@@ -207,6 +213,7 @@
         invocation.setBaseURL(this.getClass().getResource("/COB-INF/"));
         invocation.setRequestURI(request);
         invocation.setComponentProvider(this.componentProvider);
+        invocation.setObjectModel(new ObjectModel());
 
         return invocation;
     }



Mime
View raw message