View Javadoc
1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 1.3.1</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8   package org.exolab.castor.tests.framework.testDescriptor;
9   
10  /**
11   * Test marshaling.
12   *  
13   * 
14   * @version $Revision$ $Date$
15   */
16  public class MarshallingTest implements java.io.Serializable {
17  
18  
19        //--------------------------/
20       //- Class/Member Variables -/
21      //--------------------------/
22  
23      /**
24       * The qualified name of the root Object.
25       *  TODO: define a pattern to describe a Java quailified name.
26       *  
27       */
28      private org.exolab.castor.tests.framework.testDescriptor.Root_Object _root_Object;
29  
30      /**
31       */
32      private org.exolab.castor.tests.framework.testDescriptor.Configuration _configuration;
33  
34      /**
35       * A definition of a single Unit Test testcase.
36       *  
37       */
38      private java.util.List _unitTestCaseList;
39  
40  
41        //----------------/
42       //- Constructors -/
43      //----------------/
44  
45      public MarshallingTest() {
46          super();
47          this._unitTestCaseList = new java.util.ArrayList();
48      }
49  
50  
51        //-----------/
52       //- Methods -/
53      //-----------/
54  
55      /**
56       * 
57       * 
58       * @param vUnitTestCase
59       * @throws java.lang.IndexOutOfBoundsException if the index
60       * given is outside the bounds of the collection
61       */
62      public void addUnitTestCase(
63              final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase)
64      throws java.lang.IndexOutOfBoundsException {
65          this._unitTestCaseList.add(vUnitTestCase);
66      }
67  
68      /**
69       * 
70       * 
71       * @param index
72       * @param vUnitTestCase
73       * @throws java.lang.IndexOutOfBoundsException if the index
74       * given is outside the bounds of the collection
75       */
76      public void addUnitTestCase(
77              final int index,
78              final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase)
79      throws java.lang.IndexOutOfBoundsException {
80          this._unitTestCaseList.add(index, vUnitTestCase);
81      }
82  
83      /**
84       * Method enumerateUnitTestCase.
85       * 
86       * @return an Enumeration over all possible elements of this
87       * collection
88       */
89      public java.util.Enumeration enumerateUnitTestCase(
90      ) {
91          return java.util.Collections.enumeration(this._unitTestCaseList);
92      }
93  
94      /**
95       * Returns the value of field 'configuration'.
96       * 
97       * @return the value of field 'Configuration'.
98       */
99      public org.exolab.castor.tests.framework.testDescriptor.Configuration getConfiguration(
100     ) {
101         return this._configuration;
102     }
103 
104     /**
105      * Returns the value of field 'root_Object'. The field
106      * 'root_Object' has the following description: The qualified
107      * name of the root Object.
108      *  TODO: define a pattern to describe a Java quailified name.
109      *  
110      * 
111      * @return the value of field 'Root_Object'.
112      */
113     public org.exolab.castor.tests.framework.testDescriptor.Root_Object getRoot_Object(
114     ) {
115         return this._root_Object;
116     }
117 
118     /**
119      * Method getUnitTestCase.
120      * 
121      * @param index
122      * @throws java.lang.IndexOutOfBoundsException if the index
123      * given is outside the bounds of the collection
124      * @return the value of the
125      * org.exolab.castor.tests.framework.testDescriptor.UnitTestCase
126      * at the given index
127      */
128     public org.exolab.castor.tests.framework.testDescriptor.UnitTestCase getUnitTestCase(
129             final int index)
130     throws java.lang.IndexOutOfBoundsException {
131         // check bounds for index
132         if (index < 0 || index >= this._unitTestCaseList.size()) {
133             throw new IndexOutOfBoundsException("getUnitTestCase: Index value '" + index + "' not in range [0.." + (this._unitTestCaseList.size() - 1) + "]");
134         }
135 
136         return (org.exolab.castor.tests.framework.testDescriptor.UnitTestCase) _unitTestCaseList.get(index);
137     }
138 
139     /**
140      * Method getUnitTestCase.Returns the contents of the
141      * collection in an Array.  <p>Note:  Just in case the
142      * collection contents are changing in another thread, we pass
143      * a 0-length Array of the correct type into the API call. 
144      * This way we <i>know</i> that the Array returned is of
145      * exactly the correct length.
146      * 
147      * @return this collection as an Array
148      */
149     public org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[] getUnitTestCase(
150     ) {
151         org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[] array = new org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[0];
152         return (org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[]) this._unitTestCaseList.toArray(array);
153     }
154 
155     /**
156      * Method getUnitTestCaseCount.
157      * 
158      * @return the size of this collection
159      */
160     public int getUnitTestCaseCount(
161     ) {
162         return this._unitTestCaseList.size();
163     }
164 
165     /**
166      * Method isValid.
167      * 
168      * @return true if this object is valid according to the schema
169      */
170     public boolean isValid(
171     ) {
172         try {
173             validate();
174         } catch (org.exolab.castor.xml.ValidationException vex) {
175             return false;
176         }
177         return true;
178     }
179 
180     /**
181      * Method iterateUnitTestCase.
182      * 
183      * @return an Iterator over all possible elements in this
184      * collection
185      */
186     public java.util.Iterator iterateUnitTestCase(
187     ) {
188         return this._unitTestCaseList.iterator();
189     }
190 
191     /**
192      * 
193      * 
194      * @param out
195      * @throws org.exolab.castor.xml.MarshalException if object is
196      * null or if any SAXException is thrown during marshaling
197      * @throws org.exolab.castor.xml.ValidationException if this
198      * object is an invalid instance according to the schema
199      */
200     public void marshal(
201             final java.io.Writer out)
202     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
203         org.exolab.castor.xml.Marshaller.marshal(this, out);
204     }
205 
206     /**
207      * 
208      * 
209      * @param handler
210      * @throws java.io.IOException if an IOException occurs during
211      * marshaling
212      * @throws org.exolab.castor.xml.ValidationException if this
213      * object is an invalid instance according to the schema
214      * @throws org.exolab.castor.xml.MarshalException if object is
215      * null or if any SAXException is thrown during marshaling
216      */
217     public void marshal(
218             final org.xml.sax.ContentHandler handler)
219     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
220         org.exolab.castor.xml.Marshaller.marshal(this, handler);
221     }
222 
223     /**
224      */
225     public void removeAllUnitTestCase(
226     ) {
227         this._unitTestCaseList.clear();
228     }
229 
230     /**
231      * Method removeUnitTestCase.
232      * 
233      * @param vUnitTestCase
234      * @return true if the object was removed from the collection.
235      */
236     public boolean removeUnitTestCase(
237             final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase) {
238         boolean removed = _unitTestCaseList.remove(vUnitTestCase);
239         return removed;
240     }
241 
242     /**
243      * Method removeUnitTestCaseAt.
244      * 
245      * @param index
246      * @return the element removed from the collection
247      */
248     public org.exolab.castor.tests.framework.testDescriptor.UnitTestCase removeUnitTestCaseAt(
249             final int index) {
250         java.lang.Object obj = this._unitTestCaseList.remove(index);
251         return (org.exolab.castor.tests.framework.testDescriptor.UnitTestCase) obj;
252     }
253 
254     /**
255      * Sets the value of field 'configuration'.
256      * 
257      * @param configuration the value of field 'configuration'.
258      */
259     public void setConfiguration(
260             final org.exolab.castor.tests.framework.testDescriptor.Configuration configuration) {
261         this._configuration = configuration;
262     }
263 
264     /**
265      * Sets the value of field 'root_Object'. The field
266      * 'root_Object' has the following description: The qualified
267      * name of the root Object.
268      *  TODO: define a pattern to describe a Java quailified name.
269      *  
270      * 
271      * @param root_Object the value of field 'root_Object'.
272      */
273     public void setRoot_Object(
274             final org.exolab.castor.tests.framework.testDescriptor.Root_Object root_Object) {
275         this._root_Object = root_Object;
276     }
277 
278     /**
279      * 
280      * 
281      * @param index
282      * @param vUnitTestCase
283      * @throws java.lang.IndexOutOfBoundsException if the index
284      * given is outside the bounds of the collection
285      */
286     public void setUnitTestCase(
287             final int index,
288             final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase)
289     throws java.lang.IndexOutOfBoundsException {
290         // check bounds for index
291         if (index < 0 || index >= this._unitTestCaseList.size()) {
292             throw new IndexOutOfBoundsException("setUnitTestCase: Index value '" + index + "' not in range [0.." + (this._unitTestCaseList.size() - 1) + "]");
293         }
294 
295         this._unitTestCaseList.set(index, vUnitTestCase);
296     }
297 
298     /**
299      * 
300      * 
301      * @param vUnitTestCaseArray
302      */
303     public void setUnitTestCase(
304             final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[] vUnitTestCaseArray) {
305         //-- copy array
306         _unitTestCaseList.clear();
307 
308         for (int i = 0; i < vUnitTestCaseArray.length; i++) {
309                 this._unitTestCaseList.add(vUnitTestCaseArray[i]);
310         }
311     }
312 
313     /**
314      * Method unmarshal.
315      * 
316      * @param reader
317      * @throws org.exolab.castor.xml.MarshalException if object is
318      * null or if any SAXException is thrown during marshaling
319      * @throws org.exolab.castor.xml.ValidationException if this
320      * object is an invalid instance according to the schema
321      * @return the unmarshaled
322      * org.exolab.castor.tests.framework.testDescriptor.MarshallingTest
323      */
324     public static org.exolab.castor.tests.framework.testDescriptor.MarshallingTest unmarshal(
325             final java.io.Reader reader)
326     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
327         return (org.exolab.castor.tests.framework.testDescriptor.MarshallingTest) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.tests.framework.testDescriptor.MarshallingTest.class, reader);
328     }
329 
330     /**
331      * 
332      * 
333      * @throws org.exolab.castor.xml.ValidationException if this
334      * object is an invalid instance according to the schema
335      */
336     public void validate(
337     )
338     throws org.exolab.castor.xml.ValidationException {
339         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
340         validator.validate(this);
341     }
342 
343 }