cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gkossakow...@apache.org
Subject svn commit: r565656 - in /cocoon/trunk/core/cocoon-core: ./ src/test/java/org/apache/cocoon/components/treeprocessor/variables/ src/test/resources/org/apache/cocoon/components/treeprocessor/variables/
Date Tue, 14 Aug 2007 08:24:28 GMT
Author: gkossakowski
Date: Tue Aug 14 01:24:27 2007
New Revision: 565656

URL: http://svn.apache.org/viewvc?view=rev&rev=565656
Log:
COCOON-2110: First attempt to evaluate new expressions in sitemap. Expressions like ${...}
will be evaluated as expressions from cocoon-expression-language-impl module.

Added:
    cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.spring.xml
  (with props)
Modified:
    cocoon/trunk/core/cocoon-core/pom.xml
    cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.java

Modified: cocoon/trunk/core/cocoon-core/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/pom.xml?view=diff&rev=565656&r1=565655&r2=565656
==============================================================================
--- cocoon/trunk/core/cocoon-core/pom.xml (original)
+++ cocoon/trunk/core/cocoon-core/pom.xml Tue Aug 14 01:24:27 2007
@@ -149,6 +149,11 @@
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-thread-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-expression-language-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
     <!--  excalibur -->
     <dependency>
       <groupId>org.apache.excalibur.components</groupId>

Modified: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.java?view=diff&rev=565656&r1=565655&r2=565656
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.java
Tue Aug 14 01:24:27 2007
@@ -220,6 +220,20 @@
         assertEquals("", resolver.resolve(context, getObjectModel()));
     }
     
+    public void testNewExpression() throws PatternException {
+        String expr = "${$cocoon/request/parameters/foo}";
+        InvokeContext context = new InvokeContext(true);
+        context.enableLogging(getLogger());
+        MockRequest request = getRequest();
+        request.addParameter("foo", "bar");
+        
+        Map sitemapElements = new HashMap();
+        context.pushMap("sitemap", sitemapElements);
+        
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
+        assertEquals("bar", resolver.resolve(context, getObjectModel()));
+    }
+    
     /* (non-Javadoc)
      * @see org.apache.cocoon.CocoonTestCase#addSourceFactories()
      */

Added: cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.spring.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.spring.xml?view=auto&rev=565656
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.spring.xml
(added)
+++ cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.spring.xml
Tue Aug 14 01:24:27 2007
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  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.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:p="http://www.springframework.org/schema/p"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+  
+  <import resource="classpath:META-INF/cocoon/spring/DefaultExpressionFactory.xml"/>
+  <import resource="classpath:META-INF/cocoon/spring/JexlCompiler.xml"/>
+  <import resource="classpath:META-INF/cocoon/spring/JXPathCompiler.xml"/>
+  <import resource="classpath:META-INF/cocoon/spring/ObjectModelProviders.xml"/>
+  <import resource="classpath:META-INF/cocoon/spring/CocoonEntryObjectModelProvider.xml"/>
+  <import resource="classpath:META-INF/cocoon/spring/RhinoScope.xml"/>
+  
+  <!-- Redefining this bean instead of importing because originally it is in "call" scope
-->
+  <bean name="org.apache.cocoon.objectmodel.ObjectModel" class="org.apache.cocoon.objectmodel.ObjectModelImpl">
+    <property name="initialEntries">
+      <map>
+        <entry key="cocoon" value-ref="org.apache.cocoon.objectmodel.provider.CocoonEntryObjectModelProvider"/>
+        <entry key="Packages" value-ref="org.apache.cocoon.objectmodel.provider.PackagesEntryObjectModelProvider"/>
+        <entry key="java" value-ref="org.apache.cocoon.objectmodel.provider.JavaEntryObjectModelProvider"/>
+      </map>
+    </property>        
+  </bean>
+  
+</beans>
\ No newline at end of file

Propchange: cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.spring.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.spring.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message