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 CIncludeTransformerTestCase 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(CIncludeTransformerTestCase.class); 53 return suite; 54 } 55 56 60 public void testCInclude1() throws Exception { 61 getLogger().debug("testCInclude1"); 62 63 Parameters parameters = new Parameters(); 64 parameters.setParameter( "support-caching", "false" ); 65 66 String input = "resource://org/apache/cocoon/transformation/cinclude-input-1.xml"; 67 String result = "resource://org/apache/cocoon/transformation/cinclude-result-1.xml"; 68 String src = null; 69 70 MockEnvironment env = new 73 MockEnvironment(null); 74 Processor processor = (Processor)this.lookup(Processor.ROLE); 75 76 CocoonComponentManager.enterEnvironment( 77 env, new WrapperComponentManager(this.getManager()), processor); 78 79 assertEqual( load(result), 80 transform("cinclude", src, parameters, load(input))); 81 82 CocoonComponentManager.leaveEnvironment(); 83 } 84 85 90 public void testCInclude2() throws Exception { 91 getLogger().debug("testCInclude2"); 92 93 Parameters parameters = new Parameters(); 94 parameters.setParameter( "support-caching", "false" ); 95 96 String input = "resource://org/apache/cocoon/transformation/cinclude-input-2.xml"; 97 String result = "resource://org/apache/cocoon/transformation/cinclude-result-2.xml"; 98 String src = null; 99 100 MockEnvironment env = new 103 MockEnvironment(null); 104 Processor processor = (Processor)this.lookup(Processor.ROLE); 105 106 CocoonComponentManager.enterEnvironment( 107 env, new WrapperComponentManager(this.getManager()), processor); 108 109 assertEqual( load(result), 110 transform("cinclude", src, parameters, load(input))); 111 112 CocoonComponentManager.leaveEnvironment(); 113 } 114 115 120 public void testCInclude3() throws Exception { 121 getLogger().debug("testCInclude3"); 122 123 Parameters parameters = new Parameters(); 124 parameters.setParameter( "support-caching", "false" ); 125 126 String input = "resource://org/apache/cocoon/transformation/cinclude-input-3.xml"; 127 String result = "resource://org/apache/cocoon/transformation/cinclude-result-3.xml"; 128 String src = null; 129 130 MockEnvironment env = new 133 MockEnvironment(null); 134 Processor processor = (Processor)this.lookup(Processor.ROLE); 135 136 CocoonComponentManager.enterEnvironment( 137 env, new WrapperComponentManager(this.getManager()), processor); 138 139 assertEqual( load(result), 140 transform("cinclude", src, parameters, load(input))); 141 142 CocoonComponentManager.leaveEnvironment(); 143 } 144 } 145 | Popular Tags |