cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: rev 55517 - in cocoon/trunk/src: core/test/org/apache/cocoon/core/container test/org/apache/cocoon test/org/apache/cocoon/components/treeprocessor/variables test/org/apache/cocoon/transformation
Date Mon, 25 Oct 2004 17:54:52 GMT
Author: cziegeler
Date: Mon Oct 25 10:54:51 2004
New Revision: 55517

Added:
   cocoon/trunk/src/test/org/apache/cocoon/MockProcessor.java
Modified:
   cocoon/trunk/src/core/test/org/apache/cocoon/core/container/ContainerTestCase.java
   cocoon/trunk/src/test/org/apache/cocoon/SitemapComponentTestCase.java
   cocoon/trunk/src/test/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.java
   cocoon/trunk/src/test/org/apache/cocoon/transformation/AugmentTransformerTestCase.java
   cocoon/trunk/src/test/org/apache/cocoon/transformation/AugmentTransformerTestCase.xtest
   cocoon/trunk/src/test/org/apache/cocoon/transformation/CIncludeTransformerTestCase.java
   cocoon/trunk/src/test/org/apache/cocoon/transformation/CIncludeTransformerTestCase.xtest
   cocoon/trunk/src/test/org/apache/cocoon/transformation/EncodeURLTransformerTestCase.java
   cocoon/trunk/src/test/org/apache/cocoon/transformation/EncodeURLTransformerTestCase.xtest
   cocoon/trunk/src/test/org/apache/cocoon/transformation/FilterTransformerTestCase.java
   cocoon/trunk/src/test/org/apache/cocoon/transformation/FilterTransformerTestCase.xtest
   cocoon/trunk/src/test/org/apache/cocoon/transformation/I18NTransformerTestCase.java
   cocoon/trunk/src/test/org/apache/cocoon/transformation/I18NTransformerTestCase.xtest
   cocoon/trunk/src/test/org/apache/cocoon/transformation/XAbstractDOMTransformerTestCase.java
   cocoon/trunk/src/test/org/apache/cocoon/transformation/XIncludeTransformerTestCase.java
   cocoon/trunk/src/test/org/apache/cocoon/transformation/XIncludeTransformerTestCase.xtest
Log:
Update test cases for transformers
Fix preparable resolver test case

Modified: cocoon/trunk/src/core/test/org/apache/cocoon/core/container/ContainerTestCase.java
==============================================================================
--- cocoon/trunk/src/core/test/org/apache/cocoon/core/container/ContainerTestCase.java	(original)
+++ cocoon/trunk/src/core/test/org/apache/cocoon/core/container/ContainerTestCase.java	Mon Oct 25 10:54:51 2004
@@ -22,6 +22,7 @@
 import junit.framework.TestCase;
 
 import org.apache.avalon.excalibur.logger.LoggerManager;
+import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
@@ -30,6 +31,7 @@
 import org.apache.avalon.framework.context.DefaultContext;
 import org.apache.avalon.framework.logger.ConsoleLogger;
 import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.parameters.Parameterizable;
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
@@ -291,15 +293,27 @@
     }
     
     private Object getComponent(String classname,
-                                  Configuration conf,
-                                  Parameters p) 
+                                Configuration conf,
+                                Parameters p) 
     throws Exception {
         final Object instance = Class.forName(classname).newInstance();
         ContainerUtil.enableLogging(instance, getLogger());
         ContainerUtil.contextualize(instance, this.context);
         ContainerUtil.service(instance, getManager());
-        ContainerUtil.configure(instance, conf);
-        ContainerUtil.parameterize(instance, p);
+        if ( instance instanceof Configurable ) {
+            // default configuration to invoke method!
+            if ( conf == null ) {
+                conf = new DefaultConfiguration("", "-");
+            }
+            ContainerUtil.configure(instance, conf);
+        }
+        if ( instance instanceof Parameterizable ) {
+            // default configuration to invoke method!
+            if ( p == null ) {
+                p = new Parameters();
+            }
+            ContainerUtil.parameterize(instance, p);                       
+        }
         ContainerUtil.initialize(instance);
         return instance;
     }
@@ -316,7 +330,12 @@
         return this.getComponent(classname, null, p);
     }
     
-     /**
+    protected Object getComponent(String classname) 
+    throws Exception {
+        return this.getComponent(classname, null, null);
+    }
+
+    /**
      * We use this simple logger manager that sends all output to the console (logger)
      */
     protected static class DefaultLoggerManager implements LoggerManager {

Added: cocoon/trunk/src/test/org/apache/cocoon/MockProcessor.java
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/test/org/apache/cocoon/MockProcessor.java	Mon Oct 25 10:54:51 2004
@@ -0,0 +1,70 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+package org.apache.cocoon;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.SourceResolver;
+
+/**
+ * Mock processor
+ * 
+ * @version CVS $Id$
+ */
+public class MockProcessor implements Processor {
+    
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#buildPipeline(org.apache.cocoon.environment.Environment)
+     */
+    public InternalPipelineDescription buildPipeline(Environment environment)
+    throws Exception {
+        return null;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getComponentConfigurations()
+     */
+    public Configuration[] getComponentConfigurations() {
+        return null;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getContext()
+     */
+    public String getContext() {
+        return null;
+    }
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getRootProcessor()
+     */
+    public Processor getRootProcessor() {
+        return this;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getSourceResolver()
+     */
+    public SourceResolver getSourceResolver() {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#process(org.apache.cocoon.environment.Environment)
+     */
+    public boolean process(Environment environment) throws Exception {
+        return false;
+    }
+}

Modified: cocoon/trunk/src/test/org/apache/cocoon/SitemapComponentTestCase.java
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/SitemapComponentTestCase.java	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/SitemapComponentTestCase.java	Mon Oct 25 10:54:51 2004
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.cocoon;
 
 import java.io.ByteArrayOutputStream;
@@ -43,7 +42,9 @@
 import org.apache.cocoon.core.container.CocoonServiceManager;
 import org.apache.cocoon.core.container.CocoonServiceSelector;
 import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.internal.EnvironmentHelper;
 import org.apache.cocoon.environment.mock.MockContext;
+import org.apache.cocoon.environment.mock.MockEnvironment;
 import org.apache.cocoon.environment.mock.MockRedirector;
 import org.apache.cocoon.environment.mock.MockRequest;
 import org.apache.cocoon.environment.mock.MockResponse;
@@ -352,73 +353,83 @@
      * @param input Input document.
      */ 
     public final Document transform(String type, String source, Parameters parameters, Document input) 
-        throws SAXException, ProcessingException, IOException {
-
-        ServiceSelector selector = null;
-        Transformer transformer = null;
-        SourceResolver resolver = null;
-        SAXParser parser = null;
-        Source inputsource = null;
-
-        assertNotNull("Test for component manager", this.getManager());
+    throws Exception {
+        // enter & leave environment, as a manager is looked up using
+        // the processing context stack
+        MockEnvironment env = new MockEnvironment();
+        Processor processor = new MockProcessor();
+        
+        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
 
-        Document document = null;
         try {
-            selector = (ServiceSelector) this.lookup(Transformer.ROLE+
-                "Selector");
-            assertNotNull("Test lookup of transformer selector", selector);
-
-            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
-            assertNotNull("Test lookup of source resolver", resolver);
-
-            parser = (SAXParser) this.lookup(SAXParser.ROLE);
-            assertNotNull("Test lookup of parser", parser);
-
-
-            assertNotNull("Test if transformer name is not null", type);
-            transformer = (Transformer) selector.select(type);
-            assertNotNull("Test lookup of transformer", transformer);
-
-            transformer.setup(new SourceResolverAdapter(resolver, getManager()),
-                                  objectmodel, source, parameters);
-
-            DOMBuilder builder = new DOMBuilder();
-            transformer.setConsumer(new WhitespaceFilter(builder));
-
-            assertNotNull("Test if input document is not null", input);
-            DOMStreamer streamer = new DOMStreamer(transformer);
-            streamer.stream(input);
-
-            document = builder.getDocument();
-            assertNotNull("Test for transformer document", document);
-
-        } catch (ServiceException ce) {
-            getLogger().error("Could not retrieve transformer", ce);
-            ce.printStackTrace();
-            fail("Could not retrieve transformer:"+ce.toString());
-        } finally {
-            if (transformer!=null) {
-                selector.release(transformer);
-            }
-
-            if (selector!=null) {
-                this.release(selector);
-            }
-
-            if (inputsource!=null) {
-                resolver.release(inputsource);
-            }
-
-            if (resolver!=null) {
-                this.release(resolver);
-            }
-
-            if (parser!=null) {
-                this.release(parser);
+            ServiceSelector selector = null;
+            Transformer transformer = null;
+            SourceResolver resolver = null;
+            SAXParser parser = null;
+            Source inputsource = null;
+    
+            assertNotNull("Test for component manager", this.getManager());
+    
+            Document document = null;
+            try {
+                selector = (ServiceSelector) this.lookup(Transformer.ROLE+
+                    "Selector");
+                assertNotNull("Test lookup of transformer selector", selector);
+    
+                resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
+                assertNotNull("Test lookup of source resolver", resolver);
+    
+                parser = (SAXParser) this.lookup(SAXParser.ROLE);
+                assertNotNull("Test lookup of parser", parser);
+    
+    
+                assertNotNull("Test if transformer name is not null", type);
+                transformer = (Transformer) selector.select(type);
+                assertNotNull("Test lookup of transformer", transformer);
+    
+                transformer.setup(new SourceResolverAdapter(resolver, getManager()),
+                                      objectmodel, source, parameters);
+    
+                DOMBuilder builder = new DOMBuilder();
+                transformer.setConsumer(new WhitespaceFilter(builder));
+    
+                assertNotNull("Test if input document is not null", input);
+                DOMStreamer streamer = new DOMStreamer(transformer);
+                streamer.stream(input);
+    
+                document = builder.getDocument();
+                assertNotNull("Test for transformer document", document);
+    
+            } catch (ServiceException ce) {
+                getLogger().error("Could not retrieve transformer", ce);
+                ce.printStackTrace();
+                fail("Could not retrieve transformer:"+ce.toString());
+            } finally {
+                if (transformer!=null) {
+                    selector.release(transformer);
+                }
+    
+                if (selector!=null) {
+                    this.release(selector);
+                }
+    
+                if (inputsource!=null) {
+                    resolver.release(inputsource);
+                }
+    
+                if (resolver!=null) {
+                    this.release(resolver);
+                }
+    
+                if (parser!=null) {
+                    this.release(parser);
+                }
             }
+    
+            return document;
+        } finally {
+            EnvironmentHelper.leaveProcessor();           
         }
-
-        return document; 
     }
 
     /**

Modified: cocoon/trunk/src/test/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.java
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.java	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/treeprocessor/variables/PreparedVariableResolverTestCase.java	Mon Oct 25 10:54:51 2004
@@ -19,7 +19,6 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.avalon.framework.service.ServiceException;
 import org.apache.cocoon.SitemapComponentTestCase;
 import org.apache.cocoon.components.treeprocessor.InvokeContext;
 import org.apache.cocoon.environment.mock.MockRequest;
@@ -33,7 +32,7 @@
  */
 public class PreparedVariableResolverTestCase extends SitemapComponentTestCase {
 
-    public void testNestedExpressions() throws PatternException, ServiceException {
+    public void testNestedExpressions() throws Exception {
         String expr = "{request-param:{request-param:foo}}";
         MockRequest request = getRequest();
         request.reset();
@@ -44,11 +43,11 @@
         
         Map sitemapElements = new HashMap();
         context.pushMap("sitemap", sitemapElements);
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("123", resolver.resolve(context, getObjectModel()));
     }
 
-    public void testNestedModuleAndSitemapExpressions() throws PatternException, ServiceException {
+    public void testNestedModuleAndSitemapExpressions() throws Exception {
         String expr = "{request-param:f{1}}";
         MockRequest request = getRequest();
         request.reset();
@@ -59,7 +58,7 @@
         Map sitemapElements = new HashMap();
         sitemapElements.put("1", "oo");
         context.pushMap("sitemap", sitemapElements);
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("123", resolver.resolve(context, getObjectModel()));
     }
     
@@ -72,7 +71,7 @@
         Map sitemapElements = new HashMap();
         sitemapElements.put("name", "123");
         context.pushMap("label", sitemapElements);
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("123", resolver.resolve(context, getObjectModel()));        
     }
     
@@ -85,7 +84,7 @@
         Map sitemapElements = new HashMap();
         sitemapElements.put("1", "abc");
         context.pushMap("label", sitemapElements);
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("123abc", resolver.resolve(context, getObjectModel()));
     }
 
@@ -98,7 +97,7 @@
         Map sitemapElements = new HashMap();
         sitemapElements.put("1", "abc");
         context.pushMap("label", sitemapElements);
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("123abc/def", resolver.resolve(context, getObjectModel()));
     }
     
@@ -111,7 +110,7 @@
         Map sitemapElements = new HashMap();
         sitemapElements.put("1", "abc");
         context.pushMap("label", sitemapElements);
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("123abc/def", resolver.resolve(context, getObjectModel()));
     }
 
@@ -130,7 +129,7 @@
         sitemapElements.put("1", "oscar");
         context.pushMap("label2", sitemapElements);
 
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("from juliet to oscar", resolver.resolve(context, getObjectModel()));
     }
 
@@ -149,7 +148,7 @@
         sitemapElements.put("1", "oscar");
         context.pushMap("label2", sitemapElements);
 
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("from juliet to oscar", resolver.resolve(context, getObjectModel()));
     }
     
@@ -163,7 +162,7 @@
         sitemapElements = new HashMap();
         context.pushMap("label", sitemapElements);
         
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("http://cocoon.apache.org", resolver.resolve(context, getObjectModel()));
     }
     
@@ -177,7 +176,7 @@
         sitemapElements = new HashMap();
         context.pushMap("label", sitemapElements);
         
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals(":colon-starts-this", resolver.resolve(context, getObjectModel()));
     }
     
@@ -192,7 +191,7 @@
         sitemapElements.put("1", "abc");
         context.pushMap("label", sitemapElements);
         
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("abc:abc", resolver.resolve(context, getObjectModel()));
     }
 
@@ -206,7 +205,7 @@
         sitemapElements = new HashMap();
         context.pushMap("label", sitemapElements);
 
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("This is a {brace}", resolver.resolve(context, getObjectModel()));
     }
 
@@ -217,7 +216,7 @@
         
         Map sitemapElements = new HashMap();
         context.pushMap("sitemap", sitemapElements);
-        VariableResolver resolver = VariableResolverFactory.getResolver(expr, getManager());
+        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
         assertEquals("", resolver.resolve(context, getObjectModel()));
     }
     

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/AugmentTransformerTestCase.java
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/AugmentTransformerTestCase.java	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/AugmentTransformerTestCase.java	Mon Oct 25 10:54:51 2004
@@ -16,15 +16,8 @@
 
 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.environment.internal.EnvironmentHelper;
-import org.apache.cocoon.environment.mock.MockEnvironment;
 import org.w3c.dom.Document;
 
 
@@ -36,24 +29,15 @@
  */
 public class AugmentTransformerTestCase extends SitemapComponentTestCase {
     
-    /**
-     * 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.
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.SitemapComponentTestCase#getSitemapComponentInfo()
      */
-    public static Test suite() {
-        TestSuite suite = new TestSuite(AugmentTransformerTestCase.class);
-        return suite;
+    protected String[] getSitemapComponentInfo() {
+        return new String[] {Transformer.class.getName(),
+                             AugmentTransformer.class.getName(),
+                             "augment"};
     }
-    
+
     /** Testcase for augment transformation
      *
      * @throws Exception if ServiceManager enterEnvironment fails
@@ -68,13 +52,6 @@
         String result = "resource://org/apache/cocoon/transformation/augment-result-1.xml";
         String src =  null;
         
-        // enter & leave environment, as a manager is looked up using
-        // the processing context stack
-        MockEnvironment env = new MockEnvironment();
-        Processor processor = (Processor)this.lookup(Processor.ROLE);
-        
-        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
-        
         Document resultDocument = load(result);
         Document inputDocument = load(input);
         Document transformDocument = transform("augment", src, parameters, inputDocument );
@@ -82,8 +59,6 @@
         printDocs( resultDocument, inputDocument, transformDocument );
         
         assertIdentical( resultDocument, transformDocument );
-        
-        EnvironmentHelper.leaveProcessor();
     }
     
     /**

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/AugmentTransformerTestCase.xtest
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/AugmentTransformerTestCase.xtest	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/AugmentTransformerTestCase.xtest	Mon Oct 25 10:54:51 2004
@@ -20,9 +20,6 @@
  </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"/>
@@ -42,10 +39,6 @@
         shorthand="xpath-processor"
         default-class="org.apache.excalibur.xml.xpath.XPathProcessorImpl"/>
 
-  <role name="org.apache.cocoon.transformation.TransformerSelector"
-        shorthand="transformers"
-        default-class="org.apache.cocoon.core.container.CocoonServiceSelector"/>
-        
   <role name="org.apache.excalibur.store.Store/TransientStore"
         shorthand="transient-store"
         default-class="org.apache.excalibur.store.impl.MemoryStore"/>
@@ -57,10 +50,6 @@
  </roles>
 
  <components>
-  <sitemap check-reload="yes" 
-    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"/>
@@ -80,12 +69,6 @@
    <parameter name="incremental-processing" value="true"/>
   </xslt-processor>
 
-  <transformers logger="test">
-   <component-instance class="org.apache.cocoon.transformation.AugmentTransformer" 
-                       name="augment">
-   </component-instance>
-
-  </transformers>
  </components>
 
 </testcase>

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/CIncludeTransformerTestCase.java
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/CIncludeTransformerTestCase.java	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/CIncludeTransformerTestCase.java	Mon Oct 25 10:54:51 2004
@@ -16,14 +16,8 @@
 
 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.environment.internal.EnvironmentHelper;
-import org.apache.cocoon.environment.mock.MockEnvironment;
 
 /**
  * A simple testcase for FilterTransformer.
@@ -33,24 +27,15 @@
  */
 public class CIncludeTransformerTestCase extends SitemapComponentTestCase {
     
-    /**
-     * 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.
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.SitemapComponentTestCase#getSitemapComponentInfo()
      */
-    public static Test suite() {
-        TestSuite suite = new TestSuite(CIncludeTransformerTestCase.class);
-        return suite;
+    protected String[] getSitemapComponentInfo() {
+        return new String[] {Transformer.class.getName(),
+                             CIncludeTransformer.class.getName(),
+                             "cinclude"};
     }
-    
+
     /** Testcase for cinclude simple include
      *
      * @throws Exception if ServiceManager enterEnvironment fails
@@ -65,17 +50,8 @@
         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();
-        Processor processor = (Processor)this.lookup(Processor.ROLE);
-        
-        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
-        
         assertEqual( load(result),
         transform("cinclude", src, parameters, load(input)));
-        
-        EnvironmentHelper.leaveProcessor();
     }
     
     /**
@@ -93,17 +69,8 @@
         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();
-        Processor processor = (Processor)this.lookup(Processor.ROLE);
-        
-        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
-        
         assertEqual( load(result),
         transform("cinclude", src, parameters, load(input)));
-        
-        EnvironmentHelper.leaveProcessor();
     }
     
     /**
@@ -121,16 +88,7 @@
         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();
-        Processor processor = (Processor)this.lookup(Processor.ROLE);
-        
-        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
-        
         assertEqual( load(result),
         transform("cinclude", src, parameters, load(input)));
-        
-        EnvironmentHelper.leaveProcessor();
     }
 }

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/CIncludeTransformerTestCase.xtest
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/CIncludeTransformerTestCase.xtest	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/CIncludeTransformerTestCase.xtest	Mon Oct 25 10:54:51 2004
@@ -20,9 +20,6 @@
  </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"/>
@@ -42,10 +39,6 @@
         shorthand="xpath-processor"
         default-class="org.apache.excalibur.xml.xpath.XPathProcessorImpl"/>
 
-  <role name="org.apache.cocoon.transformation.TransformerSelector"
-        shorthand="transformers"
-        default-class="org.apache.cocoon.core.container.CocoonServiceSelector"/>
-
   <role name="org.apache.excalibur.store.Store/TransientStore"
         shorthand="transient-store"
         default-class="org.apache.excalibur.store.impl.MemoryStore"/>
@@ -56,10 +49,6 @@
  </roles>
 
  <components>
-  <sitemap check-reload="yes" 
-    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"/>
@@ -78,13 +67,6 @@
    <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>

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/EncodeURLTransformerTestCase.java
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/EncodeURLTransformerTestCase.java	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/EncodeURLTransformerTestCase.java	Mon Oct 25 10:54:51 2004
@@ -16,14 +16,8 @@
 
 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.environment.internal.EnvironmentHelper;
-import org.apache.cocoon.environment.mock.MockEnvironment;
 import org.apache.cocoon.environment.mock.MockRequest;
 import org.apache.cocoon.environment.mock.MockResponse;
 import org.apache.cocoon.environment.mock.MockSession;
@@ -38,22 +32,13 @@
  */
 public class EncodeURLTransformerTestCase extends SitemapComponentTestCase {
     
-    /**
-     * Run this test suite from commandline
-     *
-     * @param args commandline arguments (ignored)
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.SitemapComponentTestCase#getSitemapComponentInfo()
      */
-    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(EncodeURLTransformerTestCase.class);
-        return suite;
+    protected String[] getSitemapComponentInfo() {
+        return new String[] {Transformer.class.getName(),
+                             EncodeURLTransformer.class.getName(),
+                             "encodeurl"};
     }
     
     /** Testcase for encode url transformation
@@ -69,15 +54,6 @@
         String result = "resource://org/apache/cocoon/transformation/encodeurl-result-1.xml";
         String src =  null;
         
-        // enter & leave environment, as a manager is looked up using
-        // the processing context stack
-        // enter & leave environment, as a manager is looked up using
-        // the processing context stack
-        MockEnvironment env = new MockEnvironment();
-        Processor processor = (Processor)this.lookup(Processor.ROLE);
-        
-        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
-        
         Document inputDocument = load(input);
         Document resultDocument = load(result);
         Document transformDocument = transform("encodeurl", src, parameters, inputDocument);
@@ -85,8 +61,6 @@
         printDocs( resultDocument, inputDocument, transformDocument );
         
         assertIdentical( resultDocument, transformDocument );
-        
-        EnvironmentHelper.leaveProcessor();
     }
     
     /** Testcase for encode url transformation
@@ -112,23 +86,12 @@
 
         session.setIsNew(true);
         
-        // enter & leave environment, as a manager is looked up using
-        // the processing context stack
-        // enter & leave environment, as a manager is looked up using
-        // the processing context stack
-        MockEnvironment env = new MockEnvironment();
-        Processor processor = (Processor)this.lookup(Processor.ROLE);
-        
-        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
-        
         Document inputDocument = load(input);
         Document resultDocument = load(result);
         Document transformDocument = transform("encodeurl", src, parameters, inputDocument);
         
         printDocs( resultDocument, inputDocument, transformDocument );
         assertIdentical( resultDocument, transformDocument );
-        
-        EnvironmentHelper.leaveProcessor();
     }
     
     /**

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/EncodeURLTransformerTestCase.xtest
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/EncodeURLTransformerTestCase.xtest	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/EncodeURLTransformerTestCase.xtest	Mon Oct 25 10:54:51 2004
@@ -20,9 +20,6 @@
  </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"/>
@@ -42,10 +39,6 @@
         shorthand="xpath-processor"
         default-class="org.apache.excalibur.xml.xpath.XPathProcessorImpl"/>
 
-  <role name="org.apache.cocoon.transformation.TransformerSelector"
-        shorthand="transformers"
-        default-class="org.apache.cocoon.core.container.CocoonServiceSelector"/>
-
   <role name="org.apache.excalibur.store.Store/TransientStore"
         shorthand="transient-store"
         default-class="org.apache.excalibur.store.impl.MemoryStore"/>
@@ -56,10 +49,6 @@
  </roles>
 
  <components>
-  <sitemap check-reload="yes" 
-    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"/>
@@ -79,12 +68,6 @@
    <parameter name="incremental-processing" value="true"/>
   </xslt-processor>
 
-  <transformers logger="test">
-   <component-instance class="org.apache.cocoon.transformation.EncodeURLTransformer" 
-                       name="encodeurl">
-   </component-instance>
-
-  </transformers>
  </components>
 
 </testcase>

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/FilterTransformerTestCase.java
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/FilterTransformerTestCase.java	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/FilterTransformerTestCase.java	Mon Oct 25 10:54:51 2004
@@ -16,9 +16,6 @@
 
 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;
 
@@ -30,22 +27,13 @@
  */
 public class FilterTransformerTestCase extends SitemapComponentTestCase {
 
-    /**
-     * Run this test suite from commandline
-     *
-     * @param args commandline arguments (ignored) 
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.SitemapComponentTestCase#getSitemapComponentInfo()
      */
-    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;
+    protected String[] getSitemapComponentInfo() {
+        return new String[] {Transformer.class.getName(),
+                             FilterTransformer.class.getName(),
+                             "filter"};
     }
 
     /**

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/FilterTransformerTestCase.xtest
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/FilterTransformerTestCase.xtest	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/FilterTransformerTestCase.xtest	Mon Oct 25 10:54:51 2004
@@ -28,10 +28,6 @@
         shorthand="xslt-processor"
         default-class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl"/>
 
-  <role name="org.apache.cocoon.transformation.TransformerSelector"
-        shorthand="transformers"
-        default-class="org.apache.cocoon.core.container.CocoonServiceSelector"/>
-
   <role name="org.apache.excalibur.store.Store/TransientStore"
         shorthand="transient-store"
         default-class="org.apache.excalibur.store.impl.MemoryStore"/>
@@ -61,12 +57,6 @@
    <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>

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/I18NTransformerTestCase.java
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/I18NTransformerTestCase.java	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/I18NTransformerTestCase.java	Mon Oct 25 10:54:51 2004
@@ -16,41 +16,17 @@
 
 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.environment.internal.EnvironmentHelper;
-import org.apache.cocoon.environment.mock.MockEnvironment;
 
 /**
- * A simple testcase for FilterTransformer.
+ * A simple testcase for I18nTransformer.
  *
  * @author <a href="mailto:stephan@apache.org">Stephan Michels </a>
  * @version CVS $Id$
  */
 public class I18NTransformerTestCase extends SitemapComponentTestCase {
     
-    /**
-     * 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 if ServiceManager enterEnvironment fails
@@ -65,17 +41,8 @@
         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();
-        Processor processor = (Processor)this.lookup(Processor.ROLE);
-        
-        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
-        
         assertEqual( load(result),
         transform("i18n", src, parameters, load(input)));
-        
-        EnvironmentHelper.leaveProcessor();
     }
     
     /** Testcase for i18n
@@ -92,16 +59,7 @@
         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();
-        Processor processor = (Processor)this.lookup(Processor.ROLE);
-        
-        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
-        
         assertEqual( load(result),
         transform("i18n", src, parameters, load(input)));
-        
-        EnvironmentHelper.leaveProcessor();
     }
 }

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/I18NTransformerTestCase.xtest
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/I18NTransformerTestCase.xtest	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/I18NTransformerTestCase.xtest	Mon Oct 25 10:54:51 2004
@@ -20,9 +20,6 @@
  </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"/>
@@ -61,10 +58,6 @@
  </roles>
 
  <components>
-  <sitemap check-reload="yes" 
-    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"/>

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/XAbstractDOMTransformerTestCase.java
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/XAbstractDOMTransformerTestCase.java	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/XAbstractDOMTransformerTestCase.java	Mon Oct 25 10:54:51 2004
@@ -30,17 +30,9 @@
 /**
  * A simple testcase for AbstractDOMTransformer.
  *
- * @version CVS $Id: XAbstractDOMTransformerTestCase.java,v 1.1 2004/05/07 14:56:44 ugo Exp $
+ * @version CVS $Id$
  */
 public class XAbstractDOMTransformerTestCase extends TestCase {
-
-    /**
-     * Constructor.
-     * @param name
-     */
-    public XAbstractDOMTransformerTestCase(String name) {
-        super(name);
-    }
 
     /**
      * Test if sending two consecutive "characters" events to the transformer

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/XIncludeTransformerTestCase.java
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/XIncludeTransformerTestCase.java	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/XIncludeTransformerTestCase.java	Mon Oct 25 10:54:51 2004
@@ -16,14 +16,8 @@
 
 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.environment.internal.EnvironmentHelper;
-import org.apache.cocoon.environment.mock.MockEnvironment;
 
 /**
  * A simple testcase for FilterTransformer.
@@ -33,22 +27,13 @@
  */
 public class XIncludeTransformerTestCase extends SitemapComponentTestCase {
     
-    /**
-     * 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.
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.SitemapComponentTestCase#getSitemapComponentInfo()
      */
-    public static Test suite() {
-        TestSuite suite = new TestSuite(XIncludeTransformerTestCase.class);
-        return suite;
+    protected String[] getSitemapComponentInfo() {
+        return new String[] {Transformer.class.getName(),
+                             XIncludeTransformer.class.getName(),
+                             "xinclude"};
     }
     
     /** Testcase for xinclude simple include
@@ -64,18 +49,10 @@
         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();
-        Processor processor = (Processor)this.lookup(Processor.ROLE);
-        
-        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
-        
         assertEqual( load(result),
         transform("xinclude", src, parameters, load(input)));
-        
-        EnvironmentHelper.leaveProcessor();
     }
+
     /** Testcase for xinclude simple text include
      *
      * @throws Exception if ServiceManager enterEnvironment fails
@@ -89,17 +66,8 @@
         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();
-        Processor processor = (Processor)this.lookup(Processor.ROLE);
-        
-        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
-        
         assertEqual( load(result),
         transform("xinclude", src, parameters, load(input)));
-        
-        EnvironmentHelper.leaveProcessor();
     }
     
 }

Modified: cocoon/trunk/src/test/org/apache/cocoon/transformation/XIncludeTransformerTestCase.xtest
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/transformation/XIncludeTransformerTestCase.xtest	(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/transformation/XIncludeTransformerTestCase.xtest	Mon Oct 25 10:54:51 2004
@@ -20,9 +20,6 @@
  </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"/>
@@ -42,10 +39,6 @@
         shorthand="xpath-processor"
         default-class="org.apache.excalibur.xml.xpath.XPathProcessorImpl"/>
 
-  <role name="org.apache.cocoon.transformation.TransformerSelector"
-        shorthand="transformers"
-        default-class="org.apache.cocoon.core.container.CocoonServiceSelector"/>
-
   <role name="org.apache.excalibur.store.Store/TransientStore"
         shorthand="transient-store"
         default-class="org.apache.excalibur.store.impl.MemoryStore"/>
@@ -56,10 +49,6 @@
  </roles>
 
  <components>
-  <sitemap check-reload="yes" 
-    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"/>
@@ -79,12 +68,6 @@
    <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