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