Coverage report

  %line %branch
be.dvw.administration.util.CastorUtils
0% 
0% 

 1  
 package be.dvw.administration.util;
 2  
 
 3  
 import be.dvw.administration.model.Score;
 4  
 import be.dvw.administration.model.Instrument;
 5  
 
 6  
 import java.io.FileWriter;
 7  
 import java.io.OutputStream;
 8  
 import java.io.IOException;
 9  
 import java.io.OutputStreamWriter;
 10  
 import java.util.List;
 11  
 import java.util.Vector;
 12  
 import java.util.Calendar;
 13  
 
 14  
 import org.exolab.castor.xml.Marshaller;
 15  
 import org.exolab.castor.xml.ValidationException;
 16  
 import org.exolab.castor.xml.MarshalException;
 17  
 
 18  
 
 19  
 /**
 20  
  * User: Toon
 21  
  * Date: 4-jul-2005
 22  
  * Time: 18:49:50
 23  
  */
 24  0
 public class CastorUtils
 25  
 {
 26  
 
 27  
     public static void main(String[] args) throws Exception
 28  
     {
 29  0
         CreatePartituurList();
 30  0
         CreateInstrumentList();
 31  0
     }
 32  
 
 33  
     public static void CreatePartituurList() throws IOException, ValidationException, MarshalException
 34  
     {
 35  0
         List list = new Vector();
 36  
         Score p;
 37  
         OutputStreamWriter writer;
 38  
 
 39  0
         p = new Score();
 40  0
         p.setId(1);
 41  0
         p.setName("Jericho");
 42  0
         p.setComposer("Bert Appermont");
 43  0
         p.setDescription("Ferm stukske");
 44  0
         p.setPrice(100);
 45  0
         p.setBoxNumber(1);
 46  0
         list.add(p);
 47  0
         CreatePartituurXML(p);
 48  
 
 49  0
         p = new Score();
 50  0
         p.setId(2);
 51  0
         p.setName("Absalon");
 52  0
         p.setComposer("Bert kwappermont");
 53  0
         p.setDescription("Ferm stukske");
 54  0
         p.setPrice(100);
 55  0
         p.setBoxNumber(1);
 56  0
         list.add(p);
 57  0
         CreatePartituurXML(p);
 58  
 
 59  
         // create a new partituur
 60  0
         writer = new FileWriter("C:\\tomcat\\dvw-management\\administratie\\src\\JavaSource\\etc\\partituurlijst-search.xml");
 61  
         // Marshal the person object
 62  0
         Marshaller.marshal(list, writer);
 63  
 
 64  0
         p = new Score();
 65  0
         p.setId(3);
 66  0
         p.setName("obladi, oblada");
 67  0
         p.setComposer("Bert beatlekont");
 68  0
         p.setArranger("John & Ringo");
 69  0
         p.setDescription("Ferm stukske");
 70  0
         p.setPrice(100);
 71  0
         p.setBoxNumber(2);
 72  0
         list.add(p);
 73  0
         CreatePartituurXML(p);
 74  
 
 75  
         // create a new partituur
 76  0
         writer = new FileWriter("C:\\tomcat\\dvw-management\\administratie\\src\\JavaSource\\etc\\partituurlijst-all.xml");
 77  
         // Marshal the person object
 78  0
         Marshaller.marshal(list, writer);
 79  
 
 80  
 
 81  0
     }
 82  
 
 83  
     public static void CreatePartituurXML(Score p) throws IOException, ValidationException, MarshalException
 84  
     {
 85  
         // create a new partituur
 86  0
         String fileName = "C:\\tomcat\\dvw-management\\administratie\\src\\JavaSource\\etc\\partituur_"+p.getId()+".xml";
 87  0
         OutputStreamWriter writer = new FileWriter(fileName);
 88  
         // Marshal the person object
 89  0
         Marshaller.marshal(p, writer);
 90  0
     }
 91  
 
 92  
     public static void CreateInstrumentList() throws IOException, ValidationException, MarshalException {
 93  
          OutputStreamWriter writer;
 94  0
         List list = new Vector();
 95  
 
 96  0
         Instrument i = new Instrument();
 97  0
         i.setId(1);
 98  0
         i.setBrand("Tama");
 99  0
         i.setType("Swingstar Drumset");
 100  0
         i.setInstrumentGroup("Percussion");
 101  0
         i.setPurchaseDate("23/10/2003");
 102  0
         i.setPurchasedFrom("ADAMS");
 103  0
         i.setPurchasedNew(true);
 104  0
         i.setPurchasePrice(2500);
 105  0
         i.setSerialNumber("123-AB-456");
 106  0
         CreateInstrumentXML(i);
 107  0
         list.add(i);
 108  
 
 109  0
         i = new Instrument();
 110  0
         i.setId(2);
 111  0
         i.setBrand("Besson");
 112  0
         i.setType("BU-123");
 113  0
         i.setInstrumentGroup("Bugel");
 114  0
         i.setPurchaseDate("23/11/2003");
 115  0
         i.setPurchasedFrom("ADAMS");
 116  0
         i.setPurchasedNew(true);
 117  0
         i.setPurchasePrice(1500);
 118  0
         i.setSerialNumber("987-BU-654");
 119  0
         CreateInstrumentXML(i);
 120  0
         list.add(i);
 121  
 
 122  
       // create a new partituur
 123  0
         writer = new FileWriter("C:\\tomcat\\dvw-management\\administratie\\src\\JavaSource\\etc\\instrumentlijst-search.xml");
 124  
         // Marshal the person object
 125  0
         Marshaller.marshal(list, writer);
 126  
 
 127  0
         i = new Instrument();
 128  0
         i.setId(3);
 129  0
         i.setBrand("Besson");
 130  0
         i.setType("BU-124");
 131  0
         i.setInstrumentGroup("Bugel");
 132  0
         i.setPurchaseDate("23/11/2001");
 133  0
         i.setPurchasedFrom("ADAMS");
 134  0
         i.setPurchasedNew(false);
 135  0
         i.setPurchasePrice(1250);
 136  0
         i.setSerialNumber("123-AB-456");
 137  0
         CreateInstrumentXML(i);
 138  0
         list.add(i);
 139  
 
 140  
         // create a new partituur
 141  0
         writer = new FileWriter("C:\\tomcat\\dvw-management\\administratie\\src\\JavaSource\\etc\\instrumentlijst-all.xml");
 142  
         // Marshal the person object
 143  0
         Marshaller.marshal(list, writer);
 144  0
     }
 145  
 
 146  
     public static void CreateInstrumentXML(Instrument i) throws IOException, ValidationException, MarshalException
 147  
     {
 148  
         // create a new partituur
 149  0
         String fileName = "C:\\tomcat\\dvw-management\\administratie\\src\\JavaSource\\etc\\instrument_"+i.getId()+".xml";
 150  0
         OutputStreamWriter writer = new FileWriter(fileName);
 151  
         // Marshal the person object
 152  0
         Marshaller.marshal(i, writer);
 153  0
     }
 154  
 
 155  
 
 156  
 
 157  
 
 158  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.