1 16 17 package org.apache.cocoon.transformation; 18 19 import junit.framework.Test; 20 import junit.framework.TestSuite; 21 import junit.textui.TestRunner; 22 23 import org.apache.avalon.framework.component.WrapperComponentManager; 24 import org.apache.avalon.framework.parameters.Parameters; 25 import org.apache.cocoon.Processor; 26 import org.apache.cocoon.SitemapComponentTestCase; 27 import org.apache.cocoon.components.CocoonComponentManager; 28 import org.apache.cocoon.environment.mock.MockEnvironment; 29 30 36 public class XIncludeTransformerTestCase extends SitemapComponentTestCase { 37 38 43 public static void main( String [] args ) { 44 TestRunner.run(suite()); 45 } 46 47 51 public static Test suite() { 52 TestSuite suite = new TestSuite(XIncludeTransformerTestCase.class); 53 return suite; 54 } 55 56 60 public void testXInclude1() throws Exception { 61 getLogger().debug("testXInclude1"); 62 63 Parameters parameters = new Parameters(); 64 65 String input = "resource://org/apache/cocoon/transformation/xinclude-input-1.xml"; 66 String result = "resource://org/apache/cocoon/transformation/xinclude-result-1.xml"; 67 String src = null; 68 69 MockEnvironment env = new 72 MockEnvironment(null); 73 Processor processor = (Processor)this.lookup(Processor.ROLE); 74 75 CocoonComponentManager.enterEnvironment( 76 env, new WrapperComponentManager(this.getManager()), processor); 77 78 assertEqual( load(result), 79 transform("xinclude", src, parameters, load(input))); 80 81 CocoonComponentManager.leaveEnvironment(); 82 } 83 87 public void testXInclude2() throws Exception { 88 getLogger().debug("testXInclude2"); 89 90 Parameters parameters = new Parameters(); 91 92 String input = "resource://org/apache/cocoon/transformation/xinclude-input-2.xml"; 93 String result = "resource://org/apache/cocoon/transformation/xinclude-result-2.xml"; 94 String src = null; 95 96 MockEnvironment env = new 99 MockEnvironment(null); 100 Processor processor = (Processor)this.lookup(Processor.ROLE); 101 102 CocoonComponentManager.enterEnvironment( 103 env, new WrapperComponentManager(this.getManager()), processor); 104 105 assertEqual( load(result), 106 transform("xinclude", src, parameters, load(input))); 107 108 CocoonComponentManager.leaveEnvironment(); 109 } 110 111 } 112 | Popular Tags |