1 16 package org.apache.pluto.portalImpl.portlet; 17 18 import java.io.IOException ; 19 import java.io.InputStream ; 20 import java.util.List ; 21 22 import org.apache.commons.digester.Digester; 23 import org.xml.sax.SAXException ; 24 25 29 public class TestConfigFactory { 30 31 private Digester digester = new Digester(); 32 33 public TestConfigFactory() { 34 digester = new Digester(); 35 digester.addObjectCreate("testportlet-config", 36 java.util.ArrayList .class); 37 38 39 digester.addObjectCreate("testportlet-config/testsuite-config", 40 TestConfig.class); 41 42 digester.addBeanPropertySetter("testportlet-config/testsuite-config/name", 43 "name"); 44 45 digester.addBeanPropertySetter("testportlet-config/testsuite-config/class", 46 "testClassName"); 47 48 digester.addBeanPropertySetter("testportlet-config/testsuite-config/display-uri", 49 "displayURI"); 50 51 digester.addCallMethod("testportlet-config/testsuite-config/init-param", "addInitParameter", 2); 52 digester.addCallParam("testportlet-config/testsuite-config/init-param/name", 0); 53 digester.addCallParam("testportlet-config/testsuite-config/init-param/value", 1); 54 55 digester.addCallMethod("testportlet-config/testsuite-config/action-param", "addActionParameter", 2); 56 digester.addCallParam("testportlet-config/testsuite-config/action-param/name", 0); 57 digester.addCallParam("testportlet-config/testsuite-config/action-param/value", 1); 58 59 digester.addCallMethod("testportlet-config/testsuite-config/render-param", "addRenderParameter", 2); 60 digester.addCallParam("testportlet-config/testsuite-config/render-param/name", 0); 61 digester.addCallParam("testportlet-config/testsuite-config/render-param/value", 1); 62 63 digester.addSetRoot("testportlet-config/testsuite-config", 64 "add"); 65 66 } 67 68 public List createTests(InputStream in) 69 throws SAXException , IOException { 70 return (List )digester.parse(in); 71 } 72 } 73 | Popular Tags |