Author: thorsten
Date: Wed Sep 17 04:38:54 2008
New Revision: 696258
URL: http://svn.apache.org/viewvc?rev=696258&view=rev
Log:
Adding some more test files. Adding a test case to test the implemention the
dataUri resolving
Added:
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/common.fv
(with props)
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/convertor.contract.xml
(with props)
Modified:
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/TestStructurer.java
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/master.structurer.xml
Modified:
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/TestStructurer.java
URL:
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/TestStructurer.java?rev=696258&r1=696257&r2=696258&view=diff
==============================================================================
---
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/TestStructurer.java
(original)
+++
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/TestStructurer.java
Wed Sep 17 04:38:54 2008
@@ -2,6 +2,10 @@
import java.io.InputStream;
+import org.apache.forrest.dispatcher.api.Structurer;
+import org.apache.forrest.dispatcher.config.DispatcherBean;
+import org.apache.forrest.dispatcher.exception.DispatcherException;
+import org.apache.forrest.dispatcher.impl.ClassPathResolver;
import org.apache.forrest.dispatcher.impl.XMLStructurer;
import junit.framework.TestCase;
@@ -9,19 +13,31 @@
public class TestStructurer extends TestCase {
private static final String STRUCTURER_XML = "master.structurer.xml";
public void testStructurer() throws DispatcherException{
- XMLStructurer structurer = prepareStructurer();
- structurer.execute();
+ String format = "html";
+ Structurer structurer = prepareStructurer(false);
+ structurer.execute(getStream(),format);
}
public void testStructurerWithXmlProperties() throws DispatcherException{
- XMLStructurer structurer = prepareStructurer();
- structurer.setAllowXmlProperties(true);
- structurer.execute();
+ String format = "html";
+ Structurer structurer = prepareStructurer(true);
+ structurer.execute(getStream(),format);
}
- private XMLStructurer prepareStructurer() {
- InputStream
dataStream=this.getClass().getResourceAsStream(STRUCTURER_XML);
- String format="html";
- XMLStructurer structurer = new XMLStructurer(dataStream, format);
- structurer.setContractUriPrefix("/org/apache/forrest/dispatcher/");
+ public void testStructurerXmlFormat() throws DispatcherException{
+ String format = "xml";
+ Structurer structurer = prepareStructurer(false);
+ structurer.execute(getStream(), format);
+ }
+ private Structurer prepareStructurer(boolean allowXml) {
+ DispatcherBean config = new DispatcherBean();
+ config.setAllowXmlProperties(allowXml);
+ config.setResolver(new ClassPathResolver());
+ config.setContractUriPrefix("/org/apache/forrest/dispatcher/");
+ Structurer structurer = new XMLStructurer(config);
return structurer;
}
+
+ private InputStream getStream(){
+ InputStream
dataStream=this.getClass().getResourceAsStream(STRUCTURER_XML);
+ return dataStream;
+ }
}
Added:
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/common.fv
URL:
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/common.fv?rev=696258&view=auto
==============================================================================
---
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/common.fv
(added)
+++
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/common.fv
Wed Sep 17 04:38:54 2008
@@ -0,0 +1,30 @@
+<?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.
+-->
+
+<forrest:views xmlns:forrest="http://apache.org/forrest/templates/1.0"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+
+ <forrest:view type="html" hooksXpath="/html/body">
+ <forrest:contract name="genericMarkup">
+ <forrest:property name="genericMarkup">
+ placeholder
+ </forrest:property>
+ </forrest:contract>
+ </forrest:view>
+
+</forrest:views>
\ No newline at end of file
Propchange:
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/common.fv
------------------------------------------------------------------------------
svn:eol-style = native
Added:
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/convertor.contract.xml
URL:
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/convertor.contract.xml?rev=696258&view=auto
==============================================================================
---
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/convertor.contract.xml
(added)
+++
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/convertor.contract.xml
Wed Sep 17 04:38:54 2008
@@ -0,0 +1,59 @@
+<?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.
+ -->
+<forrest:contract xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+ xmlns:forrest="http://apache.org/forrest/templates/2.0" name="convertor">
+ <description>
+ <p> This is a test convertor to develop a component that allows user
+ to convert from the former version of the dispatcher to this one.</p>
+ </description>
+ <usage>
+<![CDATA[<forrest:contract name="convertor"/>]]>
+ </usage>
+ <forrest:template name="convertor" inputFormat="xsl">
+ <xsl:stylesheet version="1.0"
+ xmlns:forrest="http://apache.org/forrest/templates/1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:template match="/">
+ <forrest:content
xmlns:forrest="http://apache.org/forrest/templates/1.0">
+ <forrest:part>
+ <structurer xmlns="http://apache.org/forrest/templates/2.0"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+ <xsl:apply-templates/>
+ </structurer>
+ </forrest:part>
+ </forrest:content>
+ </xsl:template>
+ <xsl:template match="*[local-name()='view'] ">
+ <structure>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates/>
+ </structure>
+ </xsl:template>
+ <xsl:template match="*[local-name()='contract']">
+ <contract>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates/>
+ </contract>
+ </xsl:template>
+ <xsl:template match="*[local-name()='property']">
+ <property>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates/>
+ </property>
+ </xsl:template>
+ </xsl:stylesheet>
+ </forrest:template>
+</forrest:contract>
\ No newline at end of file
Propchange:
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/convertor.contract.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/master.structurer.xml
URL:
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/master.structurer.xml?rev=696258&r1=696257&r2=696258&view=diff
==============================================================================
---
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/master.structurer.xml
(original)
+++
forrest/trunk/whiteboard/dispatcher/testing/org/apache/forrest/dispatcher/master.structurer.xml
Wed Sep 17 04:38:54 2008
@@ -22,13 +22,11 @@
</property>
<property name="test-inline" value="test" />
</contract>
- <contract name="m2">
+ <contract name="m2" dataURI="">
<property name="test-inline" value="xxx" />
</contract>
</structure>
<structure type="xml" hooksXpath="/">
- <contract name="master">
- <property name="test" value="test" />
- </contract>
+ <contract name="convertor"
dataURI="/org/apache/forrest/dispatcher/common.fv"/>
</structure>
</structurer>
\ No newline at end of file