cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hu...@apache.org
Subject cvs commit: cocoon-2.1/src/test/org/apache/cocoon/transformation cinclude-incl.xml cinclude-input-1.xml cinclude-input-2.xml cinclude-input-3.xml cinclude-result-1.xml cinclude-result-2.xml cinclude-result-3.xml CIncludeTransformerTestCase.java CIncludeTransformerTestCase.xtest filter-input.xml filter-result-1-1.xml filter-result-1-3.xml filter-result-3-1.xml FilterTransformerTestCase.java FilterTransformerTestCase.xtest i18n-input-1.xml i18n-input-2.xml i18n-menu.xml i18n-messages.xml i18n-result-1.xml i18n-result-2.xml I18NTransformerTestCase.java I18NTransformerTestCase.xtest xinclude-incl.txt xinclude-incl.xml xinclude-input-1.xml xinclude-input-2.xml xinclude-result-1.xml xinclude-result-2.xml XIncludeTransformerTestCase.java XIncludeTransformerTestCase.xtest
Date Wed, 10 Dec 2003 18:52:40 GMT
huber       2003/12/10 10:52:40

  Added:       src/test/org/apache/cocoon/transformation cinclude-incl.xml
                        cinclude-input-1.xml cinclude-input-2.xml
                        cinclude-input-3.xml cinclude-result-1.xml
                        cinclude-result-2.xml cinclude-result-3.xml
                        CIncludeTransformerTestCase.java
                        CIncludeTransformerTestCase.xtest filter-input.xml
                        filter-result-1-1.xml filter-result-1-3.xml
                        filter-result-3-1.xml
                        FilterTransformerTestCase.java
                        FilterTransformerTestCase.xtest i18n-input-1.xml
                        i18n-input-2.xml i18n-menu.xml i18n-messages.xml
                        i18n-result-1.xml i18n-result-2.xml
                        I18NTransformerTestCase.java
                        I18NTransformerTestCase.xtest xinclude-incl.txt
                        xinclude-incl.xml xinclude-input-1.xml
                        xinclude-input-2.xml xinclude-result-1.xml
                        xinclude-result-2.xml
                        XIncludeTransformerTestCase.java
                        XIncludeTransformerTestCase.xtest
  Log:
  initial import
  
  Revision  Changes    Path
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/cinclude-incl.xml
  
  Index: cinclude-incl.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root-include>
    <p>include 1</p>
    <p>include 2</p>
    <p>include 3</p>
    <p>include 4</p>
  </root-include>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/cinclude-input-1.xml
  
  Index: cinclude-input-1.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
    xmlns:ci="http://apache.org/cocoon/include/1.0">
    <p>P1</p>
    <p>P2</p>
  
  <ci:include src="resource://org/apache/cocoon/transformation/cinclude-incl.xml"
  />
  
    <p>P3</p>
    <p>P4</p>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/cinclude-input-2.xml
  
  Index: cinclude-input-2.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
    xmlns:ci="http://apache.org/cocoon/include/1.0">
    <p>P1</p>
    <p>P2</p>
  
  <ci:include src="resource://org/apache/cocoon/transformation/cinclude-incl.xml"
  element="inc-root"
  />
  
    <p>P3</p>
    <p>P4</p>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/cinclude-input-3.xml
  
  Index: cinclude-input-3.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
    xmlns:ci="http://apache.org/cocoon/include/1.0">
    <p>P1</p>
    <p>P2</p>
  
  <ci:include src="resource://org/apache/cocoon/transformation/cinclude-incl.xml"
  element="inc-root"
  select="root-include/p[3]"
  />
    <p>P3</p>
    <p>P4</p>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/cinclude-result-1.xml
  
  Index: cinclude-result-1.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
    xmlns:ci="http://apache.org/cocoon/include/1.0">
    <p>P1</p>
    <p>P2</p>
  
  <root-include>
    <p>include 1</p>
    <p>include 2</p>
    <p>include 3</p>
    <p>include 4</p>
  </root-include>
  
    <p>P3</p>
    <p>P4</p>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/cinclude-result-2.xml
  
  Index: cinclude-result-2.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
    xmlns:inc="incl-ns"
  >
    <p>P1</p>
    <p>P2</p>
  
  <inc-root>
  <root-include>
    <p>include 1</p>
    <p>include 2</p>
    <p>include 3</p>
    <p>include 4</p>
  </root-include>
  </inc-root>
  
    <p>P3</p>
    <p>P4</p>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/cinclude-result-3.xml
  
  Index: cinclude-result-3.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
    xmlns:inc="incl-ns"
  >
    <p>P1</p>
    <p>P2</p>
  
  <inc-root>
    <p>include 3</p>
  </inc-root>
  
    <p>P3</p>
    <p>P4</p>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/CIncludeTransformerTestCase.java
  
  Index: CIncludeTransformerTestCase.java
  ===================================================================
  /*
   
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
   
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
   
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
   
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
   
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
   
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
   
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
   
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
   
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
   
   */
  
  package org.apache.cocoon.transformation;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  import junit.textui.TestRunner;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.cocoon.Processor;
  import org.apache.cocoon.SitemapComponentTestCase;
  import org.apache.cocoon.components.CocoonComponentManager;
  import org.apache.cocoon.environment.mock.MockEnvironment;
  
  /**
   * A simple testcase for FilterTransformer.
   *
   * @author <a href="mailto:stephan@apache.org">Stephan Michels </a>
   * @version CVS $Id: CIncludeTransformerTestCase.java,v 1.1 2003/12/10 18:52:39 huber Exp $
   */
  public class CIncludeTransformerTestCase extends SitemapComponentTestCase {
      
      /** Create new testcase
       * @param name of testase
       */
      public CIncludeTransformerTestCase(String name) {
          super(name);
      }
      
      /**
       * Run this test suite from commandline
       *
       * @param args commandline arguments (ignored)
       */
      public static void main( String[] args ) {
          TestRunner.run(suite());
      }
      
      /** Create a test suite.
       * This test suite contains all test cases of this class.
       * @return the Test object containing all test cases.
       */
      public static Test suite() {
          TestSuite suite = new TestSuite(CIncludeTransformerTestCase.class);
          return suite;
      }
      
      /** Testcase for cinclude simple include
       *
       * @throws Exception iff ComponentManager enterEnvironment fails
       */
      public void testCInclude1() throws Exception {
          getLogger().debug("testCInclude1");
          
          Parameters parameters = new Parameters();
          parameters.setParameter( "support-caching", "false" );
          
          String input = "resource://org/apache/cocoon/transformation/cinclude-input-1.xml";
          String result = "resource://org/apache/cocoon/transformation/cinclude-result-1.xml";
          String src =  null;
          
          // enter & leave environment, as a manager is looked up using
          // the processing context stack
          MockEnvironment env = new
          MockEnvironment(null);
          Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
          
          CocoonComponentManager.enterEnvironment(
          env, this.manager, processor);
          
          assertEqual( load(result),
          transform("cinclude", src, parameters, load(input)));
          
          CocoonComponentManager.leaveEnvironment();
      }
      
      /**
       * Testcase for cinclude specifying element for wrapping included content
       *
       * @throws Exception iff ComponentManager enterEnvironment fails
       */
      public void testCInclude2() throws Exception {
          getLogger().debug("testCInclude2");
          
          Parameters parameters = new Parameters();
          parameters.setParameter( "support-caching", "false" );
          
          String input = "resource://org/apache/cocoon/transformation/cinclude-input-2.xml";
          String result = "resource://org/apache/cocoon/transformation/cinclude-result-2.xml";
          String src =  null;
          
          // enter & leave environment, as a manager is looked up using
          // the processing context stack
          MockEnvironment env = new
          MockEnvironment(null);
          Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
          
          CocoonComponentManager.enterEnvironment(
          env, this.manager, processor);
          
          assertEqual( load(result),
          transform("cinclude", src, parameters, load(input)));
          
          CocoonComponentManager.leaveEnvironment();
      }
      
      /**
       * Testcase for cinclude specifying select attribute, selection elements from the included document
       *
       * @throws Exception iff ComponentManager enterEnvironment fails
       */
      public void testCInclude3() throws Exception {
          getLogger().debug("testCInclude3");
          
          Parameters parameters = new Parameters();
          parameters.setParameter( "support-caching", "false" );
          
          String input = "resource://org/apache/cocoon/transformation/cinclude-input-3.xml";
          String result = "resource://org/apache/cocoon/transformation/cinclude-result-3.xml";
          String src =  null;
          
          // enter & leave environment, as a manager is looked up using
          // the processing context stack
          MockEnvironment env = new
          MockEnvironment(null);
          Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
          
          CocoonComponentManager.enterEnvironment(
          env, this.manager, processor);
          
          assertEqual( load(result),
          transform("cinclude", src, parameters, load(input)));
          
          CocoonComponentManager.leaveEnvironment();
      }
  }
  
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/CIncludeTransformerTestCase.xtest
  
  Index: CIncludeTransformerTestCase.xtest
  ===================================================================
  <?xml version="1.0" ?>
  <testcase>
   <annotation>
    Test Cases: CIncludeTransformer
   </annotation>
  
   <logkit>
    <factories>
     <factory type="stream" class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/>
    </factories>
    <targets>
     <stream id="root">
      <stream>System.out</stream>
      <format type="extended">
       %7.7{priority} %5.5{time}   [%9.9{category}] (%{context}): %{message}\n%{throwable}
      </format>
     </stream>
    </targets>
    <categories>
     <category name="test" log-level="DEBUG">
      <log-target id-ref="root"/>
     </category>
    </categories>
   </logkit>
  
   <context/>
  
   <roles>
    <role name="org.apache.cocoon.Processor"
          shorthand="sitemap"
          default-class="org.apache.cocoon.components.treeprocessor.TreeProcessor"/>
    <role name="org.apache.excalibur.xml.dom.DOMParser"
          shorthand="dom-parser"
          default-class="org.apache.excalibur.xml.impl.JaxpParser"/>
    <role name="org.apache.excalibur.xml.sax.SAXParser"
          shorthand="xml-parser"
          default-class="org.apache.excalibur.xml.impl.JaxpParser"/>
  
    <role name="org.apache.excalibur.xmlizer.XMLizer"
          shorthand="xmlizer"
          default-class="org.apache.excalibur.xmlizer.DefaultXMLizer"/>
  
    <role name="org.apache.excalibur.xml.xslt.XSLTProcessor"
          shorthand="xslt-processor"
          default-class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl"/>
          
    <role name="org.apache.excalibur.xml.xpath.XPathProcessor"
          shorthand="xpath-processor"
          default-class="org.apache.excalibur.xml.xpath.XPathProcessorImpl"/>
  
    <role name="org.apache.excalibur.source.SourceFactorySelector"
          shorthand="source-factories"
          default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>
  
    <role name="org.apache.excalibur.source.SourceResolver"
          shorthand="source-resolver"
          default-class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
  
    <role name="org.apache.cocoon.transformation.TransformerSelector"
          shorthand="transformers"
          default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
  
    <role name="org.apache.excalibur.store.Store/TransientStore"
          shorthand="transient-store"
          default-class="org.apache.excalibur.store.impl.MemoryStore"/>
  
    <role name="org.apache.excalibur.store.Store"
         shorthand="persistent-store"
         default-class="org.apache.excalibur.store.impl.MemoryStore"/>
   </roles>
  
   <components>
    <sitemap check-reload="yes" 
      config="resource://org/apache/cocoon/components/treeprocessor/treeprocessor-builtins.xml" 
      file="context://sitemap.xmap" 
      logger="sitemap"/>
  
    <xml-parser class="org.apache.excalibur.xml.impl.JaxpParser">
     <parameter name="validate" value="false"/>
     <parameter name="namespace-prefixes" value="false"/>
     <parameter name="stop-on-warning" value="true"/>
     <parameter name="stop-on-recoverable-error" value="true"/>
     <parameter name="reuse-parsers" value="false"/>
    </xml-parser>
  
    <xmlizer/>
  
    <transient-store/>
  
    <persistent-store/>
  
    <source-factories>
     <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory" name="resource"/>
     <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
    </source-factories>
  
    <source-resolver class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
  
    <xslt-processor logger="core.xslt-processor">
     <parameter name="use-store" value="true"/>
     <parameter name="incremental-processing" value="true"/>
    </xslt-processor>
  
    <transformers logger="test">
     <component-instance class="org.apache.cocoon.transformation.CIncludeTransformer" 
                         name="cinclude">
     </component-instance>
  
    </transformers>
   </components>
  
  </testcase>
  
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/filter-input.xml
  
  Index: filter-input.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <root>
    <leaf>1 Hi</leaf>
    <leaf>2 Hello</leaf>
    <leaf>3 Goodbye</leaf>
    <leaf>4 So long</leaf>
  </root>
  
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/filter-result-1-1.xml
  
  Index: filter-result-1-1.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <root>
  	<block id="1">
       <leaf>1 Hi</leaf>
     </block>
     <block id="2"/>
     <block id="3"/>
     <block id="4"/>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/filter-result-1-3.xml
  
  Index: filter-result-1-3.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <root>
  	<block id="1"/>
     <block id="2"/>
     <block id="3">
       <leaf>3 Goodbye</leaf>
     </block>
     <block id="4"/>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/filter-result-3-1.xml
  
  Index: filter-result-3-1.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <root>
  	<block id="1">
       <leaf>1 Hi</leaf>
       <leaf>2 Hello</leaf>
       <leaf>3 Goodbye</leaf>
     </block>
     <block id="2"/>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/FilterTransformerTestCase.java
  
  Index: FilterTransformerTestCase.java
  ===================================================================
  /*
   
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
   
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
   
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
   
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
   
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
   
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
   
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
   
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
   
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
   
   */
  
  package org.apache.cocoon.transformation;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  import junit.textui.TestRunner;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.cocoon.SitemapComponentTestCase;
  
  /**
   * A simple testcase for FilterTransformer.
   *
   * @author <a href="mailto:stephan@apache.org">Stephan Michels </a>
   * @version CVS $Id: FilterTransformerTestCase.java,v 1.1 2003/12/10 18:52:39 huber Exp $
   */
  public class FilterTransformerTestCase extends SitemapComponentTestCase {
  
      public FilterTransformerTestCase(String name) {
          super(name);
      }
      
      /**
       * Run this test suite from commandline
       *
       * @param args commandline arguments (ignored) 
       */
      public static void main( String[] args ) {
          TestRunner.run(suite());
      }
      
      /** Create a test suite.
       * This test suite contains all test cases of this class.
       * @return the Test object containing all test cases.
       */
      public static Test suite() {
          TestSuite suite = new TestSuite(FilterTransformerTestCase.class);
          return suite;
      }
  
      /**
       * Testcase for count=1, blocknr=1
       */
      public void testFilter_1_1() {
          getLogger().debug("testFilter_1_1");
  
          Parameters parameters = new Parameters();
          parameters.setParameter( "element-name", "leaf" );
          parameters.setParameter( "count", "1" );
          parameters.setParameter( "blocknr", "1" );
  
          String input = "resource://org/apache/cocoon/transformation/filter-input.xml";
          String result = "resource://org/apache/cocoon/transformation/filter-result-1-1.xml";
          String src =  null;
          
          assertEqual(load(result), transform("filter", src, parameters, load(input)));
      }
      
      /**
       * Testcase for count=3, blocknr=1
       */
      public void testFilter_3_1() {
          getLogger().debug("testFilter_3_1");
          
          Parameters parameters = new Parameters();
          parameters.setParameter( "element-name", "leaf" );
          parameters.setParameter( "count", "3" );
          parameters.setParameter( "blocknr", "1" );
          
          String input = "resource://org/apache/cocoon/transformation/filter-input.xml";
          String result = "resource://org/apache/cocoon/transformation/filter-result-3-1.xml";
          String src =  null;
          
          assertEqual(load(result), transform("filter", src, parameters, load(input)));
      }
  
      /**
       * Testcase for count=1, blocknr=3
       */
      public void testFilter_1_3() {
          getLogger().debug("testFilter_1_3");
          
          Parameters parameters = new Parameters();
          parameters.setParameter( "element-name", "leaf" );
          parameters.setParameter( "count", "1" );
          parameters.setParameter( "blocknr", "3" );
          
          String input = "resource://org/apache/cocoon/transformation/filter-input.xml";
          String result = "resource://org/apache/cocoon/transformation/filter-result-1-3.xml";
          String src =  null;
          
          assertEqual(load(result), transform("filter", src, parameters, load(input)));
      }
  }
  
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/FilterTransformerTestCase.xtest
  
  Index: FilterTransformerTestCase.xtest
  ===================================================================
  <?xml version="1.0" ?>
  <testcase>
   <annotation>
    Test Cases: FilterTransformer
   </annotation>
  
   <logkit>
    <factories>
     <factory type="stream" class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/>
    </factories>
    <targets>
     <stream id="root">
      <stream>System.out</stream>
      <format type="extended">
       %7.7{priority} %5.5{time}   [%9.9{category}] (%{context}): %{message}\n%{throwable}
      </format>
     </stream>
    </targets>
    <categories>
     <category name="test" log-level="DEBUG">
      <log-target id-ref="root"/>
     </category>
    </categories>
   </logkit>
  
   <context/>
  
   <roles>
    <role name="org.apache.excalibur.xml.sax.SAXParser"
          shorthand="xml-parser"
          default-class="org.apache.excalibur.xml.impl.JaxpParser"/>
  
    <role name="org.apache.excalibur.xmlizer.XMLizer"
          shorthand="xmlizer"
          default-class="org.apache.excalibur.xmlizer.DefaultXMLizer"/>
  
    <role name="org.apache.excalibur.xml.xslt.XSLTProcessor"
          shorthand="xslt-processor"
          default-class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl"/>
  
    <role name="org.apache.excalibur.source.SourceFactorySelector"
          shorthand="source-factories"
          default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>
  
    <role name="org.apache.excalibur.source.SourceResolver"
          shorthand="source-resolver"
          default-class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
  
    <role name="org.apache.cocoon.transformation.TransformerSelector"
          shorthand="transformers"
          default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
  
    <role name="org.apache.excalibur.store.Store/TransientStore"
          shorthand="transient-store"
          default-class="org.apache.excalibur.store.impl.MemoryStore"/>
  
    <role name="org.apache.excalibur.store.Store"
         shorthand="persistent-store"
         default-class="org.apache.excalibur.store.impl.MemoryStore"/>
   </roles>
  
   <components>
    <xml-parser class="org.apache.excalibur.xml.impl.JaxpParser">
     <parameter name="validate" value="false"/>
     <parameter name="namespace-prefixes" value="false"/>
     <parameter name="stop-on-warning" value="true"/>
     <parameter name="stop-on-recoverable-error" value="true"/>
     <parameter name="reuse-parsers" value="false"/>
    </xml-parser>
  
    <xmlizer/>
  
    <transient-store/>
  
    <persistent-store/>
  
    <source-factories>
     <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory" name="resource"/>
     <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
    </source-factories>
  
    <source-resolver class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
  
    <xslt-processor logger="core.xslt-processor">
     <parameter name="use-store" value="true"/>
     <parameter name="incremental-processing" value="true"/>
    </xslt-processor>
  
    <transformers logger="test">
     <component-instance class="org.apache.cocoon.transformation.FilterTransformer" 
                         name="filter">
     </component-instance>
  
    </transformers>
   </components>
  
  </testcase>
  
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/i18n-input-1.xml
  
  Index: i18n-input-1.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
      xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
  >
    <title><i18n:text>titletext</i18n:text></title>
  
    <p>
      <i18n:text key="a_key">article_text1</i18n:text>
    </p>
    <p>
      <i18n:text key="a_key_which_does_not_exist">article_text2</i18n:text>
    </p>
  
  </root>
  
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/i18n-input-2.xml
  
  Index: i18n-input-2.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
      xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
  >
    <title><i18n:text>titletext</i18n:text></title>
  
    <p>
      <i18n:text key="a_key">article_text1</i18n:text>
    </p>
    <p>
      <i18n:text key="a_key_which_does_not_exist">article_text2</i18n:text>
    </p>
    <p>
      <i18n:text i18n:catalogue="menu">Documentation</i18n:text>
    </p>
  
  </root>
  
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/i18n-menu.xml
  
  Index: i18n-menu.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <!--+
      | Default (English) message catalogue file for menu in Cocoon 2 i18n sample
      |
      | CVS $Id: i18n-menu.xml,v 1.1 2003/12/10 18:52:39 huber Exp $
      +-->
  
  <catalogue xml:lang="en">
      <message key="Documentation">Documentation For I18NTransformerTestCase</message>
  </catalogue>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/i18n-messages.xml
  
  Index: i18n-messages.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <!--+
      | Default (English) message catalogue file for Cocoon 2 i18n sample
      |
      | CVS $Id: i18n-messages.xml,v 1.1 2003/12/10 18:52:39 huber Exp $
      +-->
  
  <catalogue xml:lang="en">
      <message key="a_key">This is a key value.</message>
      <message key="language">English</message>
      <message key="titletext">Hello, internationalization!</message>
  </catalogue>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/i18n-result-1.xml
  
  Index: i18n-result-1.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
      xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
  >
    <title>Hello, internationalization!</title>
  
    <p>
      This is a key value.
    </p>
    <p>
      article_text2
    </p>
  
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/i18n-result-2.xml
  
  Index: i18n-result-2.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
      xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
  >
    <title>Hello, internationalization!</title>
  
    <p>
      This is a key value.
    </p>
    <p>
      article_text2
    </p>
    <p>
      Documentation For I18NTransformerTestCase
    </p>
  
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/I18NTransformerTestCase.java
  
  Index: I18NTransformerTestCase.java
  ===================================================================
  /*
   
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
   
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
   
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
   
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
   
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
   
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
   
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
   
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
   
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
   
   */
  
  package org.apache.cocoon.transformation;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  import junit.textui.TestRunner;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.cocoon.Processor;
  import org.apache.cocoon.SitemapComponentTestCase;
  import org.apache.cocoon.components.CocoonComponentManager;
  import org.apache.cocoon.environment.mock.MockEnvironment;
  
  /**
   * A simple testcase for FilterTransformer.
   *
   * @author <a href="mailto:stephan@apache.org">Stephan Michels </a>
   * @version CVS $Id: I18NTransformerTestCase.java,v 1.1 2003/12/10 18:52:39 huber Exp $
   */
  public class I18NTransformerTestCase extends SitemapComponentTestCase {
      
      /** Create new testcase
       * @param name of testase
       */
      public I18NTransformerTestCase(String name) {
          super(name);
      }
      
      /**
       * Run this test suite from commandline
       *
       * @param args commandline arguments (ignored)
       */
      public static void main( String[] args ) {
          TestRunner.run(suite());
      }
      
      /** Create a test suite.
       * This test suite contains all test cases of this class.
       * @return the Test object containing all test cases.
       */
      public static Test suite() {
          TestSuite suite = new TestSuite(I18NTransformerTestCase.class);
          return suite;
      }
      
      /** Testcase for i18n
       *
       * @throws Exception iff ComponentManager enterEnvironment fails
       */
      public void testI18n1() throws Exception {
          getLogger().debug("testI18n1");
          
          Parameters parameters = new Parameters();
          parameters.setParameter( "support-caching", "false" );
          
          String input = "resource://org/apache/cocoon/transformation/i18n-input-1.xml";
          String result = "resource://org/apache/cocoon/transformation/i18n-result-1.xml";
          String src =  null;
          
          // enter & leave environment, as a manager is looked up using
          // the processing context stack
          MockEnvironment env = new
          MockEnvironment(null);
          Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
          
          CocoonComponentManager.enterEnvironment(
          env, this.manager, processor);
          
          assertEqual( load(result),
          transform("i18n", src, parameters, load(input)));
          
          CocoonComponentManager.leaveEnvironment();
      }
      
      /** Testcase for i18n
       *
       * @throws Exception iff ComponentManager enterEnvironment fails
       */
      public void testI18n2() throws Exception {
          getLogger().debug("testI18n2");
          
          Parameters parameters = new Parameters();
          parameters.setParameter( "support-caching", "false" );
          
          String input = "resource://org/apache/cocoon/transformation/i18n-input-2.xml";
          String result = "resource://org/apache/cocoon/transformation/i18n-result-2.xml";
          String src =  null;
          
          // enter & leave environment, as a manager is looked up using
          // the processing context stack
          MockEnvironment env = new
          MockEnvironment(null);
          Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
          
          CocoonComponentManager.enterEnvironment(
          env, this.manager, processor);
          
          assertEqual( load(result),
          transform("i18n", src, parameters, load(input)));
          
          CocoonComponentManager.leaveEnvironment();
      }
  }
  
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/I18NTransformerTestCase.xtest
  
  Index: I18NTransformerTestCase.xtest
  ===================================================================
  <?xml version="1.0" ?>
  <testcase>
   <annotation>
    Test Cases: CIncludeTransformer
   </annotation>
  
   <logkit>
    <factories>
     <factory type="stream" class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/>
    </factories>
    <targets>
     <stream id="root">
      <stream>System.out</stream>
      <format type="extended">
       %7.7{priority} %5.5{time}   [%9.9{category}] (%{context}): %{message}\n%{throwable}
      </format>
     </stream>
    </targets>
    <categories>
     <category name="test" log-level="DEBUG">
      <log-target id-ref="root"/>
     </category>
    </categories>
   </logkit>
  
   <context/>
  
   <roles>
    <role name="org.apache.cocoon.Processor"
          shorthand="sitemap"
          default-class="org.apache.cocoon.components.treeprocessor.TreeProcessor"/>
    <role name="org.apache.excalibur.xml.dom.DOMParser"
          shorthand="dom-parser"
          default-class="org.apache.excalibur.xml.impl.JaxpParser"/>
    <role name="org.apache.excalibur.xml.sax.SAXParser"
          shorthand="xml-parser"
          default-class="org.apache.excalibur.xml.impl.JaxpParser"/>
  
    <role name="org.apache.excalibur.xmlizer.XMLizer"
          shorthand="xmlizer"
          default-class="org.apache.excalibur.xmlizer.DefaultXMLizer"/>
  
    <role name="org.apache.excalibur.xml.xslt.XSLTProcessor"
          shorthand="xslt-processor"
          default-class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl"/>
          
    <role name="org.apache.excalibur.xml.xpath.XPathProcessor"
          shorthand="xpath-processor"
          default-class="org.apache.excalibur.xml.xpath.XPathProcessorImpl"/>
  
    <role name="org.apache.excalibur.source.SourceFactorySelector"
          shorthand="source-factories"
          default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>
  
    <role name="org.apache.excalibur.source.SourceResolver"
          shorthand="source-resolver"
          default-class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
  
    <role name="org.apache.cocoon.transformation.TransformerSelector"
          shorthand="transformers"
          default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
  
    <role name="org.apache.excalibur.store.Store/TransientStore"
          shorthand="transient-store"
          default-class="org.apache.excalibur.store.impl.MemoryStore"/>
  
    <role name="org.apache.excalibur.store.Store"
         shorthand="persistent-store"
         default-class="org.apache.excalibur.store.impl.MemoryStore"/>
  
    <!-- i18n components for resource bundle handling -->
    <role name="org.apache.cocoon.i18n.BundleFactory"
          shorthand="i18n-bundles"
          default-class="org.apache.cocoon.i18n.XMLResourceBundleFactory"/>
   </roles>
  
   <components>
    <sitemap check-reload="yes" 
      config="resource://org/apache/cocoon/components/treeprocessor/treeprocessor-builtins.xml" 
      file="context://sitemap.xmap" 
      logger="sitemap"/>
  
    <xml-parser class="org.apache.excalibur.xml.impl.JaxpParser">
     <parameter name="validate" value="false"/>
     <parameter name="namespace-prefixes" value="false"/>
     <parameter name="stop-on-warning" value="true"/>
     <parameter name="stop-on-recoverable-error" value="true"/>
     <parameter name="reuse-parsers" value="false"/>
    </xml-parser>
  
    <xmlizer/>
  
    <transient-store/>
  
    <persistent-store/>
  
    <source-factories>
     <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory" name="resource"/>
     <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
    </source-factories>
  
    <source-resolver class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
  
    <xslt-processor logger="core.xslt-processor">
     <parameter name="use-store" value="true"/>
     <parameter name="incremental-processing" value="true"/>
    </xslt-processor>
    
    <i18n-bundles logger="core.i18n-bundles">
      <catalogue-name>messages</catalogue-name>
      <catalogue-location>resource://org/apache/cocoon/transformation</catalogue-location>
      <cache-at-startup>true</cache-at-startup>
    </i18n-bundles>
  
    <transformers logger="test">
     <component-instance class="org.apache.cocoon.transformation.I18nTransformer" 
                         name="i18n">
      <catalogues default="messages">
        <catalogue id="messages" name="i18n-messages" location="resource://org/apache/cocoon/transformation"/>
        <catalogue id="menu" name="i18n-menu" location="resource://org/apache/cocoon/transformation"/>
      </catalogues>
      <cache-at-startup>true</cache-at-startup>
     </component-instance>
  
    </transformers>
   </components>
  
  </testcase>
  
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/xinclude-incl.txt
  
  Index: xinclude-incl.txt
  ===================================================================
  Only some text getting included.
  
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/xinclude-incl.xml
  
  Index: xinclude-incl.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root-include>
    <p>include 1</p>
    <p>include 2</p>
    <p>include 3</p>
    <p>include 4</p>
  </root-include>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/xinclude-input-1.xml
  
  Index: xinclude-input-1.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
    xmlns:xi="http://www.w3.org/2001/XInclude">
    <p>P1</p>
    <p>P2</p>
  
  <xi:include href="resource://org/apache/cocoon/transformation/xinclude-incl.xml"
  />
  
    <p>P3</p>
    <p>P4</p>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/xinclude-input-2.xml
  
  Index: xinclude-input-2.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
    xmlns:xi="http://www.w3.org/2001/XInclude">
    <p>P1</p>
    <p>P2</p>
  <p>
  <xi:include parse="text" href="resource://org/apache/cocoon/transformation/xinclude-incl.txt"
  />
  </p>
  
    <p>P3</p>
    <p>P4</p>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/xinclude-result-1.xml
  
  Index: xinclude-result-1.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
    xmlns:xi="http://apache.org/cocoon/include/1.0">
    <p>P1</p>
    <p>P2</p>
  
  <root-include>
    <p>include 1</p>
    <p>include 2</p>
    <p>include 3</p>
    <p>include 4</p>
  </root-include>
  
    <p>P3</p>
    <p>P4</p>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/xinclude-result-2.xml
  
  Index: xinclude-result-2.xml
  ===================================================================
  <?xml version="1.0" ?>
  
  <root
    xmlns:xi="http://apache.org/cocoon/include/1.0">
    <p>P1</p>
    <p>P2</p>
  
  <p>
  Only some text getting included.
  </p>
  
    <p>P3</p>
    <p>P4</p>
  </root>
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/XIncludeTransformerTestCase.java
  
  Index: XIncludeTransformerTestCase.java
  ===================================================================
  /*
   
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
   
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
   
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
   
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
   
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
   
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
   
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
   
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
   
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
   
   */
  
  package org.apache.cocoon.transformation;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  import junit.textui.TestRunner;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.cocoon.Processor;
  import org.apache.cocoon.SitemapComponentTestCase;
  import org.apache.cocoon.components.CocoonComponentManager;
  import org.apache.cocoon.environment.mock.MockEnvironment;
  
  /**
   * A simple testcase for FilterTransformer.
   *
   * @author <a href="mailto:stephan@apache.org">Stephan Michels </a>
   * @version CVS $Id: XIncludeTransformerTestCase.java,v 1.1 2003/12/10 18:52:39 huber Exp $
   */
  public class XIncludeTransformerTestCase extends SitemapComponentTestCase {
      
      /** Create new testcase
       * @param name of testase
       */
      public XIncludeTransformerTestCase(String name) {
          super(name);
      }
      
      /**
       * Run this test suite from commandline
       *
       * @param args commandline arguments (ignored)
       */
      public static void main( String[] args ) {
          TestRunner.run(suite());
      }
      
      /** Create a test suite.
       * This test suite contains all test cases of this class.
       * @return the Test object containing all test cases.
       */
      public static Test suite() {
          TestSuite suite = new TestSuite(XIncludeTransformerTestCase.class);
          return suite;
      }
      
      /** Testcase for xinclude simple include
       *
       * @throws Exception iff ComponentManager enterEnvironment fails
       */
      public void testXInclude1() throws Exception {
          getLogger().debug("testXInclude1");
          
          Parameters parameters = new Parameters();
          
          String input = "resource://org/apache/cocoon/transformation/xinclude-input-1.xml";
          String result = "resource://org/apache/cocoon/transformation/xinclude-result-1.xml";
          String src =  null;
          
          // enter & leave environment, as a manager is looked up using
          // the processing context stack
          MockEnvironment env = new
          MockEnvironment(null);
          Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
          
          CocoonComponentManager.enterEnvironment(
          env, this.manager, processor);
          
          assertEqual( load(result),
          transform("xinclude", src, parameters, load(input)));
          
          CocoonComponentManager.leaveEnvironment();
      }
      /** Testcase for xinclude simple text include
       *
       * @throws Exception iff ComponentManager enterEnvironment fails
       */
      public void testXInclude2() throws Exception {
          getLogger().debug("testXInclude2");
          
          Parameters parameters = new Parameters();
          
          String input = "resource://org/apache/cocoon/transformation/xinclude-input-2.xml";
          String result = "resource://org/apache/cocoon/transformation/xinclude-result-2.xml";
          String src =  null;
          
          // enter & leave environment, as a manager is looked up using
          // the processing context stack
          MockEnvironment env = new
          MockEnvironment(null);
          Processor processor = (Processor)this.manager.lookup(Processor.ROLE);
          
          CocoonComponentManager.enterEnvironment(
          env, this.manager, processor);
          
          assertEqual( load(result),
          transform("xinclude", src, parameters, load(input)));
          
          CocoonComponentManager.leaveEnvironment();
      }
      
  }
  
  
  
  1.1                  cocoon-2.1/src/test/org/apache/cocoon/transformation/XIncludeTransformerTestCase.xtest
  
  Index: XIncludeTransformerTestCase.xtest
  ===================================================================
  <?xml version="1.0" ?>
  <testcase>
   <annotation>
    Test Cases: CIncludeTransformer
   </annotation>
  
   <logkit>
    <factories>
     <factory type="stream" class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/>
    </factories>
    <targets>
     <stream id="root">
      <stream>System.out</stream>
      <format type="extended">
       %7.7{priority} %5.5{time}   [%9.9{category}] (%{context}): %{message}\n%{throwable}
      </format>
     </stream>
    </targets>
    <categories>
     <category name="test" log-level="DEBUG">
      <log-target id-ref="root"/>
     </category>
    </categories>
   </logkit>
  
   <context/>
  
   <roles>
    <role name="org.apache.cocoon.Processor"
          shorthand="sitemap"
          default-class="org.apache.cocoon.components.treeprocessor.TreeProcessor"/>
    <role name="org.apache.excalibur.xml.dom.DOMParser"
          shorthand="dom-parser"
          default-class="org.apache.excalibur.xml.impl.JaxpParser"/>
    <role name="org.apache.excalibur.xml.sax.SAXParser"
          shorthand="xml-parser"
          default-class="org.apache.excalibur.xml.impl.JaxpParser"/>
  
    <role name="org.apache.excalibur.xmlizer.XMLizer"
          shorthand="xmlizer"
          default-class="org.apache.excalibur.xmlizer.DefaultXMLizer"/>
  
    <role name="org.apache.excalibur.xml.xslt.XSLTProcessor"
          shorthand="xslt-processor"
          default-class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl"/>
          
    <role name="org.apache.excalibur.xml.xpath.XPathProcessor"
          shorthand="xpath-processor"
          default-class="org.apache.excalibur.xml.xpath.XPathProcessorImpl"/>
  
    <role name="org.apache.excalibur.source.SourceFactorySelector"
          shorthand="source-factories"
          default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>
  
    <role name="org.apache.excalibur.source.SourceResolver"
          shorthand="source-resolver"
          default-class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
  
    <role name="org.apache.cocoon.transformation.TransformerSelector"
          shorthand="transformers"
          default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
  
    <role name="org.apache.excalibur.store.Store/TransientStore"
          shorthand="transient-store"
          default-class="org.apache.excalibur.store.impl.MemoryStore"/>
  
    <role name="org.apache.excalibur.store.Store"
         shorthand="persistent-store"
         default-class="org.apache.excalibur.store.impl.MemoryStore"/>
   </roles>
  
   <components>
    <sitemap check-reload="yes" 
      config="resource://org/apache/cocoon/components/treeprocessor/treeprocessor-builtins.xml" 
      file="context://sitemap.xmap" 
      logger="sitemap"/>
  
    <xml-parser class="org.apache.excalibur.xml.impl.JaxpParser">
     <parameter name="validate" value="false"/>
     <parameter name="namespace-prefixes" value="false"/>
     <parameter name="stop-on-warning" value="true"/>
     <parameter name="stop-on-recoverable-error" value="true"/>
     <parameter name="reuse-parsers" value="false"/>
    </xml-parser>
  
    <xmlizer/>
  
    <transient-store/>
  
    <persistent-store/>
  
    <source-factories>
     <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory" name="resource"/>
     <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
    </source-factories>
  
    <source-resolver class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
  
    <xslt-processor logger="core.xslt-processor">
     <parameter name="use-store" value="true"/>
     <parameter name="incremental-processing" value="true"/>
    </xslt-processor>
  
    <transformers logger="test">
     <component-instance class="org.apache.cocoon.transformation.XIncludeTransformer" 
                         name="xinclude">
     </component-instance>
  
    </transformers>
   </components>
  
  </testcase>
  
  
  

Mime
View raw message