1 package org.apache.turbine.pipeline; 2 3 56 57 import java.io.StringWriter ; 58 59 import junit.framework.Test; 60 import junit.framework.TestCase; 61 import junit.framework.TestSuite; 62 63 import org.apache.turbine.Pipeline; 64 import org.apache.turbine.pipeline.TurbinePipeline; 65 import org.apache.turbine.services.rundata.DefaultTurbineRunData; 66 67 73 public class PipelineTest 74 extends TestCase 75 { 76 79 public PipelineTest(String testName) 80 { 81 super(testName); 82 } 83 84 87 public static Test suite() 88 { 89 return new TestSuite(PipelineTest.class); 90 } 91 92 95 public void setUp() 96 { 97 } 99 100 103 public void tearDown() 104 { 105 } 107 108 111 public void testPipeline() 112 { 113 try 114 { 115 StringWriter writer = new StringWriter (); 118 Pipeline pipeline = new TurbinePipeline(); 119 120 SimpleValve valve = new SimpleValve(); 121 valve.setWriter(writer); 122 valve.setValue("foo"); 123 pipeline.addValve(valve); 124 valve = new SimpleValve(); 125 valve.setWriter(writer); 126 valve.setValue("bar"); 127 pipeline.addValve(valve); 128 129 pipeline.invoke(new DefaultTurbineRunData()); 130 131 assertEquals("foobar", writer.toString()); 132 } 133 catch (Exception e) 134 { 135 e.printStackTrace(); 136 fail(e.getMessage()); 137 } 138 } 139 } 140 | Popular Tags |