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 I18NTransformerTestCase 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(I18NTransformerTestCase.class); 53 return suite; 54 } 55 56 60 public void testI18n1() throws Exception { 61 getLogger().debug("testI18n1"); 62 63 Parameters parameters = new Parameters(); 64 parameters.setParameter( "support-caching", "false" ); 65 66 String input = "resource://org/apache/cocoon/transformation/i18n-input-1.xml"; 67 String result = "resource://org/apache/cocoon/transformation/i18n-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("i18n", src, parameters, load(input))); 81 82 CocoonComponentManager.leaveEnvironment(); 83 } 84 85 89 public void testI18n2() throws Exception { 90 getLogger().debug("testI18n2"); 91 92 Parameters parameters = new Parameters(); 93 parameters.setParameter( "support-caching", "false" ); 94 95 String input = "resource://org/apache/cocoon/transformation/i18n-input-2.xml"; 96 String result = "resource://org/apache/cocoon/transformation/i18n-result-2.xml"; 97 String src = null; 98 99 MockEnvironment env = new 102 MockEnvironment(null); 103 Processor processor = (Processor)this.lookup(Processor.ROLE); 104 105 CocoonComponentManager.enterEnvironment( 106 env, new WrapperComponentManager(this.getManager()), processor); 107 108 assertEqual( load(result), 109 transform("i18n", src, parameters, load(input))); 110 111 CocoonComponentManager.leaveEnvironment(); 112 } 113 } 114 | Popular Tags |