1 19 20 28 29 import java.io.*; 30 import java.util.*; 31 import org.w3c.dom.*; 32 33 import invoice.*; 34 35 36 public class TestInvoice extends BaseTest { 37 public static void main(String [] argv) { 38 TestInvoice o = new TestInvoice(); 39 if (argv.length > 0) 40 o.setDocumentDir(argv[0]); 41 try { 42 o.run(); 43 } catch (Exception e) { 44 e.printStackTrace(); 45 System.exit(1); 46 } 47 System.exit(0); 48 } 49 50 public void run() throws Exception { 51 Invoice invoice; 52 53 this.readDocument(); 54 55 out("creating the bean graph"); 56 invoice = Invoice.read(doc); 57 58 out("bean graph created"); 60 invoice.write(out); 61 62 out("Adding an item"); 63 Item item = new Item(); 64 item.setId("123"); 65 item.setCategory("office"); 66 item.setQuantity(10); 67 item.setPrice(new java.math.BigDecimal ("15.99")); 68 invoice.addItem(item); 69 invoice.write(out); 70 } 71 } 72 | Popular Tags |