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   * Tests source generation only, and does not attempt to use the
12   * generated code. While
13   *  a SourceGeneratorTest is better because it is more thorough,
14   * sometimes
15   *  the only thing that requires testing is the code generation.
16   *  
17   * 
18   * @version $Revision$ $Date$
19   */
20  public class OnlySourceGenerationTest implements java.io.Serializable {
21  
22  
23        //--------------------------/
24       //- Class/Member Variables -/
25      //--------------------------/
26  
27      /**
28       * Field _schemaList.
29       */
30      private java.util.List _schemaList;
31  
32      /**
33       * Field _property_File.
34       */
35      private java.lang.String _property_File;
36  
37      /**
38       * The data type to use in collections.
39       *  
40       */
41      private org.exolab.castor.tests.framework.testDescriptor.types.CollectionType _collection = org.exolab.castor.tests.framework.testDescriptor.types.CollectionType.valueOf("vector");
42  
43      /**
44       * Field _bindingFile.
45       */
46      private java.lang.String _bindingFile;
47  
48      /**
49       * Field _package.
50       */
51      private java.lang.String _package;
52  
53      /**
54       * A definition of a single Unit Test testcase.
55       *  
56       */
57      private java.util.List _unitTestCaseList;
58  
59  
60        //----------------/
61       //- Constructors -/
62      //----------------/
63  
64      public OnlySourceGenerationTest() {
65          super();
66          this._schemaList = new java.util.ArrayList();
67          setCollection(org.exolab.castor.tests.framework.testDescriptor.types.CollectionType.valueOf("vector"));
68          this._unitTestCaseList = new java.util.ArrayList();
69      }
70  
71  
72        //-----------/
73       //- Methods -/
74      //-----------/
75  
76      /**
77       * 
78       * 
79       * @param vSchema
80       * @throws java.lang.IndexOutOfBoundsException if the index
81       * given is outside the bounds of the collection
82       */
83      public void addSchema(
84              final java.lang.String vSchema)
85      throws java.lang.IndexOutOfBoundsException {
86          this._schemaList.add(vSchema);
87      }
88  
89      /**
90       * 
91       * 
92       * @param index
93       * @param vSchema
94       * @throws java.lang.IndexOutOfBoundsException if the index
95       * given is outside the bounds of the collection
96       */
97      public void addSchema(
98              final int index,
99              final java.lang.String vSchema)
100     throws java.lang.IndexOutOfBoundsException {
101         this._schemaList.add(index, vSchema);
102     }
103 
104     /**
105      * 
106      * 
107      * @param vUnitTestCase
108      * @throws java.lang.IndexOutOfBoundsException if the index
109      * given is outside the bounds of the collection
110      */
111     public void addUnitTestCase(
112             final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase)
113     throws java.lang.IndexOutOfBoundsException {
114         this._unitTestCaseList.add(vUnitTestCase);
115     }
116 
117     /**
118      * 
119      * 
120      * @param index
121      * @param vUnitTestCase
122      * @throws java.lang.IndexOutOfBoundsException if the index
123      * given is outside the bounds of the collection
124      */
125     public void addUnitTestCase(
126             final int index,
127             final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase)
128     throws java.lang.IndexOutOfBoundsException {
129         this._unitTestCaseList.add(index, vUnitTestCase);
130     }
131 
132     /**
133      * Method enumerateSchema.
134      * 
135      * @return an Enumeration over all possible elements of this
136      * collection
137      */
138     public java.util.Enumeration enumerateSchema(
139     ) {
140         return java.util.Collections.enumeration(this._schemaList);
141     }
142 
143     /**
144      * Method enumerateUnitTestCase.
145      * 
146      * @return an Enumeration over all possible elements of this
147      * collection
148      */
149     public java.util.Enumeration enumerateUnitTestCase(
150     ) {
151         return java.util.Collections.enumeration(this._unitTestCaseList);
152     }
153 
154     /**
155      * Returns the value of field 'bindingFile'.
156      * 
157      * @return the value of field 'BindingFile'.
158      */
159     public java.lang.String getBindingFile(
160     ) {
161         return this._bindingFile;
162     }
163 
164     /**
165      * Returns the value of field 'collection'. The field
166      * 'collection' has the following description: The data type to
167      * use in collections.
168      *  
169      * 
170      * @return the value of field 'Collection'.
171      */
172     public org.exolab.castor.tests.framework.testDescriptor.types.CollectionType getCollection(
173     ) {
174         return this._collection;
175     }
176 
177     /**
178      * Returns the value of field 'package'.
179      * 
180      * @return the value of field 'Package'.
181      */
182     public java.lang.String getPackage(
183     ) {
184         return this._package;
185     }
186 
187     /**
188      * Returns the value of field 'property_File'.
189      * 
190      * @return the value of field 'Property_File'.
191      */
192     public java.lang.String getProperty_File(
193     ) {
194         return this._property_File;
195     }
196 
197     /**
198      * Method getSchema.
199      * 
200      * @param index
201      * @throws java.lang.IndexOutOfBoundsException if the index
202      * given is outside the bounds of the collection
203      * @return the value of the java.lang.String at the given index
204      */
205     public java.lang.String getSchema(
206             final int index)
207     throws java.lang.IndexOutOfBoundsException {
208         // check bounds for index
209         if (index < 0 || index >= this._schemaList.size()) {
210             throw new IndexOutOfBoundsException("getSchema: Index value '" + index + "' not in range [0.." + (this._schemaList.size() - 1) + "]");
211         }
212 
213         return (java.lang.String) _schemaList.get(index);
214     }
215 
216     /**
217      * Method getSchema.Returns the contents of the collection in
218      * an Array.  <p>Note:  Just in case the collection contents
219      * are changing in another thread, we pass a 0-length Array of
220      * the correct type into the API call.  This way we <i>know</i>
221      * that the Array returned is of exactly the correct length.
222      * 
223      * @return this collection as an Array
224      */
225     public java.lang.String[] getSchema(
226     ) {
227         java.lang.String[] array = new java.lang.String[0];
228         return (java.lang.String[]) this._schemaList.toArray(array);
229     }
230 
231     /**
232      * Method getSchemaCount.
233      * 
234      * @return the size of this collection
235      */
236     public int getSchemaCount(
237     ) {
238         return this._schemaList.size();
239     }
240 
241     /**
242      * Method getUnitTestCase.
243      * 
244      * @param index
245      * @throws java.lang.IndexOutOfBoundsException if the index
246      * given is outside the bounds of the collection
247      * @return the value of the
248      * org.exolab.castor.tests.framework.testDescriptor.UnitTestCase
249      * at the given index
250      */
251     public org.exolab.castor.tests.framework.testDescriptor.UnitTestCase getUnitTestCase(
252             final int index)
253     throws java.lang.IndexOutOfBoundsException {
254         // check bounds for index
255         if (index < 0 || index >= this._unitTestCaseList.size()) {
256             throw new IndexOutOfBoundsException("getUnitTestCase: Index value '" + index + "' not in range [0.." + (this._unitTestCaseList.size() - 1) + "]");
257         }
258 
259         return (org.exolab.castor.tests.framework.testDescriptor.UnitTestCase) _unitTestCaseList.get(index);
260     }
261 
262     /**
263      * Method getUnitTestCase.Returns the contents of the
264      * collection in an Array.  <p>Note:  Just in case the
265      * collection contents are changing in another thread, we pass
266      * a 0-length Array of the correct type into the API call. 
267      * This way we <i>know</i> that the Array returned is of
268      * exactly the correct length.
269      * 
270      * @return this collection as an Array
271      */
272     public org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[] getUnitTestCase(
273     ) {
274         org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[] array = new org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[0];
275         return (org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[]) this._unitTestCaseList.toArray(array);
276     }
277 
278     /**
279      * Method getUnitTestCaseCount.
280      * 
281      * @return the size of this collection
282      */
283     public int getUnitTestCaseCount(
284     ) {
285         return this._unitTestCaseList.size();
286     }
287 
288     /**
289      * Method isValid.
290      * 
291      * @return true if this object is valid according to the schema
292      */
293     public boolean isValid(
294     ) {
295         try {
296             validate();
297         } catch (org.exolab.castor.xml.ValidationException vex) {
298             return false;
299         }
300         return true;
301     }
302 
303     /**
304      * Method iterateSchema.
305      * 
306      * @return an Iterator over all possible elements in this
307      * collection
308      */
309     public java.util.Iterator iterateSchema(
310     ) {
311         return this._schemaList.iterator();
312     }
313 
314     /**
315      * Method iterateUnitTestCase.
316      * 
317      * @return an Iterator over all possible elements in this
318      * collection
319      */
320     public java.util.Iterator iterateUnitTestCase(
321     ) {
322         return this._unitTestCaseList.iterator();
323     }
324 
325     /**
326      * 
327      * 
328      * @param out
329      * @throws org.exolab.castor.xml.MarshalException if object is
330      * null or if any SAXException is thrown during marshaling
331      * @throws org.exolab.castor.xml.ValidationException if this
332      * object is an invalid instance according to the schema
333      */
334     public void marshal(
335             final java.io.Writer out)
336     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
337         org.exolab.castor.xml.Marshaller.marshal(this, out);
338     }
339 
340     /**
341      * 
342      * 
343      * @param handler
344      * @throws java.io.IOException if an IOException occurs during
345      * marshaling
346      * @throws org.exolab.castor.xml.ValidationException if this
347      * object is an invalid instance according to the schema
348      * @throws org.exolab.castor.xml.MarshalException if object is
349      * null or if any SAXException is thrown during marshaling
350      */
351     public void marshal(
352             final org.xml.sax.ContentHandler handler)
353     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
354         org.exolab.castor.xml.Marshaller.marshal(this, handler);
355     }
356 
357     /**
358      */
359     public void removeAllSchema(
360     ) {
361         this._schemaList.clear();
362     }
363 
364     /**
365      */
366     public void removeAllUnitTestCase(
367     ) {
368         this._unitTestCaseList.clear();
369     }
370 
371     /**
372      * Method removeSchema.
373      * 
374      * @param vSchema
375      * @return true if the object was removed from the collection.
376      */
377     public boolean removeSchema(
378             final java.lang.String vSchema) {
379         boolean removed = _schemaList.remove(vSchema);
380         return removed;
381     }
382 
383     /**
384      * Method removeSchemaAt.
385      * 
386      * @param index
387      * @return the element removed from the collection
388      */
389     public java.lang.String removeSchemaAt(
390             final int index) {
391         java.lang.Object obj = this._schemaList.remove(index);
392         return (java.lang.String) obj;
393     }
394 
395     /**
396      * Method removeUnitTestCase.
397      * 
398      * @param vUnitTestCase
399      * @return true if the object was removed from the collection.
400      */
401     public boolean removeUnitTestCase(
402             final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase) {
403         boolean removed = _unitTestCaseList.remove(vUnitTestCase);
404         return removed;
405     }
406 
407     /**
408      * Method removeUnitTestCaseAt.
409      * 
410      * @param index
411      * @return the element removed from the collection
412      */
413     public org.exolab.castor.tests.framework.testDescriptor.UnitTestCase removeUnitTestCaseAt(
414             final int index) {
415         java.lang.Object obj = this._unitTestCaseList.remove(index);
416         return (org.exolab.castor.tests.framework.testDescriptor.UnitTestCase) obj;
417     }
418 
419     /**
420      * Sets the value of field 'bindingFile'.
421      * 
422      * @param bindingFile the value of field 'bindingFile'.
423      */
424     public void setBindingFile(
425             final java.lang.String bindingFile) {
426         this._bindingFile = bindingFile;
427     }
428 
429     /**
430      * Sets the value of field 'collection'. The field 'collection'
431      * has the following description: The data type to use in
432      * collections.
433      *  
434      * 
435      * @param collection the value of field 'collection'.
436      */
437     public void setCollection(
438             final org.exolab.castor.tests.framework.testDescriptor.types.CollectionType collection) {
439         this._collection = collection;
440     }
441 
442     /**
443      * Sets the value of field 'package'.
444      * 
445      * @param _package
446      * @param package the value of field 'package'.
447      */
448     public void setPackage(
449             final java.lang.String _package) {
450         this._package = _package;
451     }
452 
453     /**
454      * Sets the value of field 'property_File'.
455      * 
456      * @param property_File the value of field 'property_File'.
457      */
458     public void setProperty_File(
459             final java.lang.String property_File) {
460         this._property_File = property_File;
461     }
462 
463     /**
464      * 
465      * 
466      * @param index
467      * @param vSchema
468      * @throws java.lang.IndexOutOfBoundsException if the index
469      * given is outside the bounds of the collection
470      */
471     public void setSchema(
472             final int index,
473             final java.lang.String vSchema)
474     throws java.lang.IndexOutOfBoundsException {
475         // check bounds for index
476         if (index < 0 || index >= this._schemaList.size()) {
477             throw new IndexOutOfBoundsException("setSchema: Index value '" + index + "' not in range [0.." + (this._schemaList.size() - 1) + "]");
478         }
479 
480         this._schemaList.set(index, vSchema);
481     }
482 
483     /**
484      * 
485      * 
486      * @param vSchemaArray
487      */
488     public void setSchema(
489             final java.lang.String[] vSchemaArray) {
490         //-- copy array
491         _schemaList.clear();
492 
493         for (int i = 0; i < vSchemaArray.length; i++) {
494                 this._schemaList.add(vSchemaArray[i]);
495         }
496     }
497 
498     /**
499      * 
500      * 
501      * @param index
502      * @param vUnitTestCase
503      * @throws java.lang.IndexOutOfBoundsException if the index
504      * given is outside the bounds of the collection
505      */
506     public void setUnitTestCase(
507             final int index,
508             final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase)
509     throws java.lang.IndexOutOfBoundsException {
510         // check bounds for index
511         if (index < 0 || index >= this._unitTestCaseList.size()) {
512             throw new IndexOutOfBoundsException("setUnitTestCase: Index value '" + index + "' not in range [0.." + (this._unitTestCaseList.size() - 1) + "]");
513         }
514 
515         this._unitTestCaseList.set(index, vUnitTestCase);
516     }
517 
518     /**
519      * 
520      * 
521      * @param vUnitTestCaseArray
522      */
523     public void setUnitTestCase(
524             final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[] vUnitTestCaseArray) {
525         //-- copy array
526         _unitTestCaseList.clear();
527 
528         for (int i = 0; i < vUnitTestCaseArray.length; i++) {
529                 this._unitTestCaseList.add(vUnitTestCaseArray[i]);
530         }
531     }
532 
533     /**
534      * Method unmarshal.
535      * 
536      * @param reader
537      * @throws org.exolab.castor.xml.MarshalException if object is
538      * null or if any SAXException is thrown during marshaling
539      * @throws org.exolab.castor.xml.ValidationException if this
540      * object is an invalid instance according to the schema
541      * @return the unmarshaled
542      * org.exolab.castor.tests.framework.testDescriptor.OnlySourceGenerationTest
543      */
544     public static org.exolab.castor.tests.framework.testDescriptor.OnlySourceGenerationTest unmarshal(
545             final java.io.Reader reader)
546     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
547         return (org.exolab.castor.tests.framework.testDescriptor.OnlySourceGenerationTest) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.tests.framework.testDescriptor.OnlySourceGenerationTest.class, reader);
548     }
549 
550     /**
551      * 
552      * 
553      * @throws org.exolab.castor.xml.ValidationException if this
554      * object is an invalid instance according to the schema
555      */
556     public void validate(
557     )
558     throws org.exolab.castor.xml.ValidationException {
559         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
560         validator.validate(this);
561     }
562 
563 }