cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@apache.org
Subject svn commit: r581157 - in /cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src: main/java/org/apache/cocoon/forms/datatype/ main/java/org/apache/cocoon/forms/formmodel/ test/java/org/apache/cocoon/forms/datatype/
Date Tue, 02 Oct 2007 08:36:36 GMT
Author: giacomo
Date: Tue Oct  2 01:36:35 2007
New Revision: 581157

URL: http://svn.apache.org/viewvc?rev=581157&view=rev
Log:
fixed testcases after springification

Modified:
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/DynamicSelectionList.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionList.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListBuilder.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinition.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.java

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java?rev=581157&r1=581156&r2=581157&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java
Tue Oct  2 01:36:35 2007
@@ -81,7 +81,7 @@
             }
             // Create SelectionList
             if (dynamic) {
-                selectionList = new DynamicSelectionList(datatype, src, usePerRequestCache,
xmlizer, sourceResolver, processInfoProvider);
+                selectionList = new DynamicSelectionList(datatype, src, usePerRequestCache,
xmlizer, sourceResolver, processInfoProvider.getRequest());
             } else {
                 selectionListElement = readSelectionList(src);
                 selectionList = buildStaticList(selectionListElement, datatype);        
       

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/DynamicSelectionList.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/DynamicSelectionList.java?rev=581157&r1=581156&r2=581157&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/DynamicSelectionList.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/DynamicSelectionList.java
Tue Oct  2 01:36:35 2007
@@ -63,7 +63,7 @@
     private Datatype datatype;
     private XMLizer xmlizer;
     private SourceResolver sourceResolver;
-    private ProcessInfoProvider processInfoProvider;
+    private HttpServletRequest request;
 
     /**
      * @param datatype
@@ -72,13 +72,13 @@
      * @param serviceManager
      * @param context
      */
-    public DynamicSelectionList(Datatype datatype, String src, boolean usePerRequestCache,
XMLizer xmlizer, SourceResolver sourceResolver, ProcessInfoProvider processInfoProvider) {
+    public DynamicSelectionList(Datatype datatype, String src, boolean usePerRequestCache,
XMLizer xmlizer, SourceResolver sourceResolver, HttpServletRequest request) {
         this.datatype = datatype;
         this.src = src;
         this.usePerRequestCache = usePerRequestCache;
         this.xmlizer = xmlizer;
         this.sourceResolver = sourceResolver;
-        this.processInfoProvider = processInfoProvider;
+        this.request = request;
     }
 
     /**
@@ -87,8 +87,8 @@
      * @param src - 
      * @param serviceManager -
      */
-    public DynamicSelectionList(Datatype datatype, String src, XMLizer xmlizer, SourceResolver
sourceResolver, ProcessInfoProvider processInfoProvider) {
-        this(datatype, src, false, xmlizer, sourceResolver, processInfoProvider);
+    public DynamicSelectionList(Datatype datatype, String src, XMLizer xmlizer, SourceResolver
sourceResolver, HttpServletRequest request) {
+        this(datatype, src, false, xmlizer, sourceResolver, request);
     }
 
     public Datatype getDatatype() {
@@ -148,15 +148,16 @@
 
         if (usePerRequestCache) {
             // Search the sax buffer in request attributes
-            HttpServletRequest request = processInfoProvider.getRequest();
             String attributeName = "DynamicSelectionListCache/" + url;
-            SaxBuffer saxBuffer = (SaxBuffer)request.getAttribute(attributeName);
+            SaxBuffer saxBuffer = (request != null ? (SaxBuffer)request.getAttribute(attributeName)
: null);
             
             if (saxBuffer == null) {
                 // Not found: generate the list and store it
                 saxBuffer = new SaxBuffer();
                 generateSaxFragmentFromSrc(url, saxBuffer, locale);
-                request.setAttribute(attributeName, saxBuffer);
+                if (request != null) {
+                    request.setAttribute(attributeName, saxBuffer);
+                }
             }
             
             // Output the stored saxBuffer to the contentHandler

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionList.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionList.java?rev=581157&r1=581156&r2=581157&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionList.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionList.java
Tue Oct  2 01:36:35 2007
@@ -18,11 +18,12 @@
 
 import java.util.Iterator;
 import java.util.Locale;
+import java.util.Map;
 
 import org.apache.cocoon.components.flow.FlowHelper;
 import org.apache.cocoon.forms.FormsConstants;
 import org.apache.cocoon.forms.util.I18nMessage;
-import org.apache.cocoon.processing.ProcessInfoProvider;
+import org.apache.cocoon.el.objectmodel.ObjectModel;
 import org.apache.cocoon.xml.AttributesImpl;
 import org.apache.cocoon.xml.XMLUtils;
 import org.apache.commons.jxpath.JXPathContext;
@@ -40,7 +41,7 @@
  */
 public class FlowJXPathSelectionList implements SelectionList {
 
-    private ProcessInfoProvider processInfoProvider;
+    private Map objectModel;
     private String listPath;
     private String valuePath;
     private String labelPath;
@@ -52,7 +53,7 @@
     private String i18nCatalog;
     private boolean labelIsI18nKey = false;
 
-    public FlowJXPathSelectionList(ProcessInfoProvider processInfoProvider, 
+    public FlowJXPathSelectionList(Map objectModel, 
                                    String listPath, 
                                    String valuePath, 
                                    String labelPath, 
@@ -61,7 +62,7 @@
                                    boolean nullTextIsI18nKey, 
                                    String i18nCatalog, 
                                    boolean labelIsI18nKey) {
-        this.processInfoProvider = processInfoProvider;
+        this.objectModel = objectModel;
         this.listPath = listPath;
         this.valuePath = valuePath;
         this.labelPath = labelPath;
@@ -98,7 +99,7 @@
         JXPathContext ctx = null;
         Iterator iter = null;
         if (model == null) {
-            Object flowData = FlowHelper.getContextObject(processInfoProvider.getObjectModel());
+            Object flowData = FlowHelper.getContextObject(objectModel);
             if (flowData == null) {
                 throw new SAXException("No flow data to produce selection list");
             }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListBuilder.java?rev=581157&r1=581156&r2=581157&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListBuilder.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListBuilder.java
Tue Oct  2 01:36:35 2007
@@ -82,7 +82,7 @@
 
         String i18nCatalog = DomHelper.getAttribute(selectionListElement, "catalogue", null);
 
-        return new FlowJXPathSelectionList(processInfoProvider,
+        return new FlowJXPathSelectionList(processInfoProvider.getObjectModel(),
                                            listPath,
                                            valuePath,
                                            labelPath,

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinition.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinition.java?rev=581157&r1=581156&r2=581157&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinition.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinition.java
Tue Oct  2 01:36:35 2007
@@ -111,7 +111,7 @@
      * @param uri The URI of the source.
      */
     public SelectionList buildSelectionList(String uri) {
-        return new DynamicSelectionList(datatype, uri, this.xmlizer, this.sourceResolver,
this.processInfoProvider);
+        return new DynamicSelectionList(datatype, uri, this.xmlizer, this.sourceResolver,
this.processInfoProvider.getRequest());
     }
 
     /**

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.java?rev=581157&r1=581156&r2=581157&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/java/org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.java
Tue Oct  2 01:36:35 2007
@@ -22,7 +22,9 @@
 import org.apache.cocoon.forms.FormsConstants;
 import org.apache.cocoon.xml.dom.DOMBuilder;
 
+import org.apache.excalibur.source.SourceResolver;
 import org.apache.excalibur.source.impl.ResourceSource;
+import org.apache.excalibur.xmlizer.XMLizer;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -45,8 +47,10 @@
         Document sourceDoc = this.parser.parse(source.getInputStream());
         Element datatypeElement = (Element) sourceDoc.getElementsByTagNameNS(FormsConstants.DEFINITION_NS,
"convertor").item(0);
         Datatype datatype = this.datatypeManager.createDatatype(datatypeElement, false);
+        final XMLizer xmlizer = (XMLizer)getManager().lookup( XMLizer.ROLE );
+        final SourceResolver sourceResolver = (SourceResolver)getManager().lookup( SourceResolver.ROLE
);
         DynamicSelectionList list = 
-            new DynamicSelectionList(datatype, null, this.getManager());
+            new DynamicSelectionList(datatype, null, xmlizer, sourceResolver, null);
         list.generateSaxFragment(dest, Locale.ENGLISH, source);
         ResourceSource expectedSource =
             new ResourceSource("resource://org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.dest.xml");

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.java?rev=581157&r1=581156&r2=581157&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.java
Tue Oct  2 01:36:35 2007
@@ -67,7 +67,7 @@
         Element datatypeElement = (Element) sample.getElementsByTagNameNS(FormsConstants.DEFINITION_NS,
"datatype").item(0);
         Datatype datatype = this.datatypeManager.createDatatype(datatypeElement, false);
         FlowJXPathSelectionList list = new FlowJXPathSelectionList
-            (context, "beans", "key", "value", datatype,null,false,null,false);
+            (objectModel, "beans", "key", "value", datatype,null,false,null,false);
         DOMBuilder dest = new DOMBuilder();
         list.generateSaxFragment(dest, Locale.ENGLISH);
         Source expectedSource = new ResourceSource("resource://org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.dest.xml");
@@ -100,7 +100,7 @@
         Element datatypeElement = (Element) sample.getElementsByTagNameNS(FormsConstants.DEFINITION_NS,
"datatype").item(0);
         Datatype datatype = this.datatypeManager.createDatatype(datatypeElement, false);
         FlowJXPathSelectionList list = new FlowJXPathSelectionList
-            (context, "beans", "key", "value", datatype,null,false,null,false);
+            (objectModel, "beans", "key", "value", datatype,null,false,null,false);
         DOMBuilder dest = new DOMBuilder();
         list.generateSaxFragment(dest, Locale.ENGLISH);
         Source expectedSource = new ResourceSource("resource://org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCaseWithNull.dest.xml");



Mime
View raw message