cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gkossakow...@apache.org
Subject svn commit: r591496 - in /cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src: main/java/org/apache/cocoon/forms/datatype/ test/java/org/apache/cocoon/forms/datatype/ test/resources/org/apache/cocoon/forms/datatype/
Date Fri, 02 Nov 2007 22:24:42 GMT
Author: gkossakowski
Date: Fri Nov  2 15:24:41 2007
New Revision: 591496

URL: http://svn.apache.org/viewvc?rev=591496&view=rev
Log:
Fixed FlowJXPathSelectionList test-case by:
  * moving configuration of components needed by test to Spring because Forms are now Spring-based
  * added some declarations of Avalon-based components needed by Forms
  * fixed generation of SAX stream so if it is serialized it contains namespace declaration
(I'm not sure if it's right fix)
  * clean up of test case code itself and fixing environmental data initialization

Added:
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/resources/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.spring.xml
  (with props)
Modified:
    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/test/java/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/resources/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.xtest

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=591496&r1=591495&r2=591496&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
Fri Nov  2 15:24:41 2007
@@ -18,18 +18,17 @@
 
 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.xml.AttributeTypes;
 import org.apache.cocoon.xml.AttributesImpl;
 import org.apache.cocoon.xml.XMLUtils;
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.Pointer;
 import org.apache.excalibur.xml.sax.XMLizable;
-
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
@@ -118,7 +117,11 @@
         }
 
         // Start the selection-list
-        contentHandler.startElement(FormsConstants.INSTANCE_NS, SELECTION_LIST_EL, FormsConstants.INSTANCE_PREFIX_COLON
+ SELECTION_LIST_EL, XMLUtils.EMPTY_ATTRIBUTES);
+        //FIXME: I added attribute for namespace declaration because it would not be serialized
otherwise
+        //why it's not printed even if we specify necessary information in startElement()
method? (GK)
+        AttributesImpl attrs = new AttributesImpl();
+        attrs.addAttribute("", FormsConstants.INSTANCE_PREFIX, "xmlns:" + FormsConstants.INSTANCE_PREFIX,
AttributeTypes.CDATA, FormsConstants.INSTANCE_NS);
+        contentHandler.startElement(FormsConstants.INSTANCE_NS, SELECTION_LIST_EL, FormsConstants.INSTANCE_PREFIX_COLON
+ SELECTION_LIST_EL, attrs);
         if( this.nullable ) {
             final AttributesImpl voidAttrs = new AttributesImpl(  );
             voidAttrs.addCDATAAttribute( "value", "" );

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=591496&r1=591495&r2=591496&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
Fri Nov  2 15:24:41 2007
@@ -23,16 +23,11 @@
 import java.util.Locale;
 import java.util.Map;
 
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.DefaultContext;
-import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.components.flow.FlowHelper;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.mock.MockRequest;
-import org.apache.cocoon.forms.FormsConstants;
-import org.apache.cocoon.el.objectmodel.ObjectModel;
 import org.apache.cocoon.el.impl.objectmodel.ObjectModelImpl;
+import org.apache.cocoon.el.objectmodel.ObjectModel;
+import org.apache.cocoon.forms.FormsConstants;
+import org.apache.cocoon.processing.ProcessInfoProvider;
 import org.apache.cocoon.xml.dom.DOMBuilder;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.impl.ResourceSource;
@@ -44,6 +39,13 @@
  * @version $Id$
  */
 public class FlowJXPathSelectionListTestCase extends AbstractSelectionListTestCase {
+	
+	private ProcessInfoProvider processInfoProvider;
+	
+	protected void setUp() throws Exception {
+		super.setUp();
+		processInfoProvider = (ProcessInfoProvider)this.getBeanFactory().getBean(ProcessInfoProvider.class.getName());
+	}
 
     /**
      * Test the generateSaxFragment method.
@@ -54,20 +56,13 @@
         beans.add(new TestBean("2", "Two"));
         Map flowContextObject = new HashMap();
         flowContextObject.put("beans", beans);
-        Request request = new MockRequest();
-        Map objectModel = new HashMap();
         ObjectModel newObjectModel = new ObjectModelImpl();
-        FlowHelper.setContextObject(objectModel, newObjectModel, flowContextObject);
-        objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
-        Map contextObjectModel = new HashMap();
-        contextObjectModel.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectModel);
-        Context context = new DefaultContext(contextObjectModel);
+        FlowHelper.setContextObject(getObjectModel(), newObjectModel, flowContextObject);
         Source sampleSource = new ResourceSource("resource://org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.source.xml");
         Document sample = this.parser.parse(sampleSource.getInputStream());
         Element datatypeElement = (Element) sample.getElementsByTagNameNS(FormsConstants.DEFINITION_NS,
"datatype").item(0);
         Datatype datatype = this.datatypeManager.createDatatype(datatypeElement, false);
-        FlowJXPathSelectionList list = new FlowJXPathSelectionList
-            (objectModel, "beans", "key", "value", datatype,null,false,null,false);
+        FlowJXPathSelectionList list = new FlowJXPathSelectionList(processInfoProvider, "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");
@@ -87,20 +82,13 @@
         beans.add(new TestBean("2", "Two"));
         Map flowContextObject = new HashMap();
         flowContextObject.put("beans", beans);
-        Request request = new MockRequest();
-        Map objectModel = new HashMap();
         ObjectModel newObjectModel = new ObjectModelImpl();
-        FlowHelper.setContextObject(objectModel, newObjectModel, flowContextObject);
-        objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
-        Map contextObjectModel = new HashMap();
-        contextObjectModel.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectModel);
-        Context context = new DefaultContext(contextObjectModel);
+        FlowHelper.setContextObject(getObjectModel(), newObjectModel, flowContextObject);
         Source sampleSource = new ResourceSource("resource://org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.source.xml");
         Document sample = this.parser.parse(sampleSource.getInputStream());
         Element datatypeElement = (Element) sample.getElementsByTagNameNS(FormsConstants.DEFINITION_NS,
"datatype").item(0);
         Datatype datatype = this.datatypeManager.createDatatype(datatypeElement, false);
-        FlowJXPathSelectionList list = new FlowJXPathSelectionList
-            (objectModel, "beans", "key", "value", datatype,null,false,null,false);
+        FlowJXPathSelectionList list = new FlowJXPathSelectionList(processInfoProvider, "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");

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/resources/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.spring.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/resources/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.spring.xml?rev=591496&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/resources/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.spring.xml
(added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/resources/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.spring.xml
Fri Nov  2 15:24:41 2007
@@ -0,0 +1,26 @@
+<?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/cocoon-forms.xml"/>
+  <import resource="classpath:META-INF/cocoon/spring/cocoon-xml-impl.xml"/>       

+  
+</beans>
\ No newline at end of file

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/resources/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.spring.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/resources/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.xtest
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/resources/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.xtest?rev=591496&r1=591495&r2=591496&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/resources/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.xtest
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/test/resources/org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.xtest
Fri Nov  2 15:24:41 2007
@@ -16,68 +16,34 @@
   limitations under the License.
 -->
 <testcase>
+
+  <!-- Here we are redefining lots of roles and components, is there any way to include
these declarations instead? (GK) -->
+
  <roles>
 
-  <role name="org.apache.cocoon.forms.datatype.DatatypeManager"
-    shorthand="forms-datatype"
-    default-class="org.apache.cocoon.forms.datatype.DefaultDatatypeManager"/>
-
-  <role name="org.apache.cocoon.forms.expression.ExpressionManager"
-    shorthand="forms-expression"
-    default-class="org.apache.cocoon.forms.expression.DefaultExpressionManager"/>
+  <role name="org.apache.excalibur.source.SourceFactorySelector"
+        shorthand="source-factories"
+        default-class="org.apache.cocoon.core.container.DefaultServiceSelector">
+  </role>
 
+  <role name="org.apache.excalibur.source.SourceResolver"
+        shorthand="source-resolver"
+        default-class="org.apache.cocoon.components.source.CocoonSourceResolver"/>
+
+  <role name="org.apache.excalibur.xml.xpath.XPathProcessor"
+        shorthand="xpath-processor"
+        default-class="org.apache.excalibur.xml.xpath.XPathProcessorImpl"/>
+        
+  <role name="org.apache.excalibur.xmlizer.XMLizer"
+        shorthand="xmlizer"
+        default-class="org.apache.excalibur.xmlizer.DefaultXMLizer"/>
  </roles>
 
  <components>
-  <forms-datatype logger="forms">
-    <datatypes>
-      <datatype name="string" src="org.apache.cocoon.forms.datatype.typeimpl.StringTypeBuilder">
-        <convertors default="dummy" plain="dummy">
-          <convertor name="dummy" src="org.apache.cocoon.forms.datatype.convertor.DummyStringConvertorBuilder"/>
-        </convertors>
-      </datatype>
-      <datatype name="long" src="org.apache.cocoon.forms.datatype.typeimpl.LongTypeBuilder">
-        <convertors default="formatting" plain="plain">
-          <convertor name="plain" src="org.apache.cocoon.forms.datatype.convertor.PlainLongConvertorBuilder"/>
-          <convertor name="formatting" src="org.apache.cocoon.forms.datatype.convertor.FormattingLongConvertorBuilder"/>
-        </convertors>
-      </datatype>
-      <datatype name="decimal" src="org.apache.cocoon.forms.datatype.typeimpl.DecimalTypeBuilder">
-        <convertors default="formatting" plain="plain">
-          <convertor name="plain" src="org.apache.cocoon.forms.datatype.convertor.PlainDecimalConvertorBuilder"/>
-          <convertor name="formatting" src="org.apache.cocoon.forms.datatype.convertor.FormattingDecimalConvertorBuilder"/>
-        </convertors>
-      </datatype>
-      <datatype name="date" src="org.apache.cocoon.forms.datatype.typeimpl.DateTypeBuilder">
-        <convertors default="formatting" plain="millis">
-          <convertor name="formatting" src="org.apache.cocoon.forms.datatype.convertor.FormattingDateConvertorBuilder"/>
-          <convertor name="millis" src="org.apache.cocoon.forms.datatype.convertor.MillisDateConvertorBuilder"/>
-        </convertors>
-      </datatype>
-      <datatype name="boolean" src="org.apache.cocoon.forms.datatype.typeimpl.BooleanTypeBuilder">
-        <convertors default="plain" plain="plain">
-          <convertor name="plain" src="org.apache.cocoon.forms.datatype.convertor.PlainBooleanConvertorBuilder"/>
-        </convertors>
-      </datatype>  
-      <datatype name="integer" src="org.apache.cocoon.forms.datatype.typeimpl.IntegerTypeBuilder">
-        <convertors default="formatting" plain="plain">
-          <convertor name="plain" src="org.apache.cocoon.forms.datatype.convertor.PlainIntegerConvertorBuilder"/>
-          <convertor name="formatting" src="org.apache.cocoon.forms.datatype.convertor.FormattingIntegerConvertorBuilder"/>
-        </convertors>
-      </datatype>  
-    </datatypes>
-    <validation-rules>
-      <validation-rule name="length" src="org.apache.cocoon.forms.datatype.validationruleimpl.LengthValidationRuleBuilder"/>
-      <validation-rule name="email" src="org.apache.cocoon.forms.datatype.validationruleimpl.EmailValidationRuleBuilder"/>
-      <validation-rule name="value-count" src="org.apache.cocoon.forms.datatype.validationruleimpl.ValueCountValidationRuleBuilder"/>
-      <validation-rule name="range" src="org.apache.cocoon.forms.datatype.validationruleimpl.RangeValidationRuleBuilder"/>
-      <validation-rule name="assert" src="org.apache.cocoon.forms.datatype.validationruleimpl.AssertValidationRuleBuilder"/>
-      <validation-rule name="mod10" src="org.apache.cocoon.forms.datatype.validationruleimpl.Mod10ValidationRuleBuilder"/>
-      <validation-rule name="regexp" src="org.apache.cocoon.forms.datatype.validationruleimpl.RegExpValidationRuleBuilder"/>
-    </validation-rules>
-  </forms-datatype>
-
-  <forms-expression logger="forms.expression"/>
+ 
+  <source-resolver/>
+  
+  <xpath-processor class="org.apache.excalibur.xml.xpath.XPathProcessorImpl" logger="core.xpath"/>
 
  </components>
 



Mime
View raw message