1 19 35 36 import java.io.*; 37 import java.util.*; 38 import org.w3c.dom.*; 39 40 import webapp.*; 41 42 public class TestFinalWebApp extends BaseTest { 43 public static void main(String [] argv) { 44 TestFinalWebApp o = new TestFinalWebApp(); 45 if (argv.length > 0) 46 o.setDocumentDir(argv[0]); 47 try { 48 o.run(); 49 } catch (Exception e) { 50 e.printStackTrace(); 51 System.exit(1); 52 } 53 System.exit(0); 54 } 55 56 public void run() throws Exception { 57 WebApp webApp; 58 59 this.readDocument(); 60 61 out("creating the bean graph"); 62 webApp = WebApp.read(doc); 63 64 out("bean graph created"); 66 webApp.write(out); 67 68 out("Adding filters"); 69 FilterType filter = new FilterType(); 70 filter.addDisplayName("filter BLUE"); 71 filter.addDisplayNameXmlLang("en"); 72 webApp.addFilter(filter); 73 filter = new FilterType(); 74 filter.addDisplayName("filter GREEN"); 75 webApp.write(out); 76 out("Validating"); 77 try { 78 webApp.validate(); 79 out("No validation problem"); 80 } catch (webapp.WebApp.ValidateException e) { 81 out("Got exception: "+e.getMessage()); 82 } 83 84 WebApp copy1 = new WebApp(webApp); 85 copy1.write(out); 86 } 87 } 88 | Popular Tags |