1 package org.tigris.scarab.pipeline; 2 3 48 49 import java.io.File ; 50 import java.io.FileReader ; 51 import java.io.Reader ; 52 53 import junit.framework.TestCase; 54 55 import org.apache.turbine.Pipeline; 56 57 import com.thoughtworks.xstream.XStream; 58 import com.thoughtworks.xstream.io.xml.DomDriver; 59 60 68 public class PipelineCreationTest extends TestCase 69 { 70 private Pipeline pipeline; 71 74 public PipelineCreationTest(String testName) 75 { 76 super(testName); 77 } 78 79 80 public void testReadingPipelineWXstream() throws Exception { 81 File file = new File ("./src/conf/conf/scarab-pipeline.xml").getAbsoluteFile(); 82 Reader reader = new FileReader (file); 83 XStream xstream = new XStream(new DomDriver()); Object o = xstream.fromXML(reader); 85 Pipeline pipeline = (Pipeline)o; 86 assertEquals(18,pipeline.getValves().length); 87 assertTrue(pipeline.getValves()[9] instanceof FreshenUserValve); 88 FreshenUserValve valve = (FreshenUserValve)pipeline.getValves()[9]; 89 valve.initialize(); 90 assertTrue(FreshenUserValve.XMIT_SCREENS.size()>0); 91 92 93 } 94 95 } 96 | Popular Tags |