Statistics
| Revision:

root / branches / Mobile1.0 / org.gvsig.gpe / src-test / org / gvsig / xmlschema / writer / SequenceWrittingTest.java @ 79

History | View | Annotate | Download (3.74 KB)

1
package org.gvsig.xmlschema.writer;
2

    
3
import java.util.Iterator;
4

    
5
import org.gvsig.xmlschema.som.IXSComplexTypeDefinition;
6
import org.gvsig.xmlschema.som.IXSContentType;
7
import org.gvsig.xmlschema.som.IXSSequence;
8
import org.gvsig.xmlschema.som.IXSTypeDefinition;
9

    
10
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
11
 *
12
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
13
 *
14
 * This program is free software; you can redistribute it and/or
15
 * modify it under the terms of the GNU General Public License
16
 * as published by the Free Software Foundation; either version 2
17
 * of the License, or (at your option) any later version.
18
 *
19
 * This program is distributed in the hope that it will be useful,
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 * GNU General Public License for more details.
23
 *
24
 * You should have received a copy of the GNU General Public License
25
 * along with this program; if not, write to the Free Software
26
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
27
 *
28
 * For more information, contact:
29
 *
30
 *  Generalitat Valenciana
31
 *   Conselleria d'Infraestructures i Transport
32
 *   Av. Blasco Ib??ez, 50
33
 *   46010 VALENCIA
34
 *   SPAIN
35
 *
36
 *      +34 963862235
37
 *   gvsig@gva.es
38
 *      www.gvsig.gva.es
39
 *
40
 *    or
41
 *
42
 *   IVER T.I. S.A
43
 *   Salamanca 50
44
 *   46005 Valencia
45
 *   Spain
46
 *
47
 *   +34 963163400
48
 *   dac@iver.es
49
 */
50
/* CVS MESSAGES:
51
 *
52
 * $Id: SequenceWrittingTest.java 161 2007-06-28 13:05:27Z jorpiell $
53
 * $Log$
54
 * Revision 1.3  2007/06/28 13:04:33  jorpiell
55
 * The Qname has been updated to the 1.5 JVM machine. The schema validation is made in the GPEWriterHandlerImplementor class
56
 *
57
 * Revision 1.2  2007/06/22 12:21:18  jorpiell
58
 * The typeNotFoundException has been deleted. It never was thrown
59
 *
60
 * Revision 1.1  2007/06/14 16:15:03  jorpiell
61
 * builds to create the jars generated and add the schema code to the libGPEProject
62
 *
63
 * Revision 1.1  2007/06/14 13:50:07  jorpiell
64
 * The schema jar name has been changed
65
 *
66
 * Revision 1.3  2007/06/08 11:35:16  jorpiell
67
 * IXSSchema interface updated
68
 *
69
 * Revision 1.2  2007/06/07 14:54:13  jorpiell
70
 * Add the schema support
71
 *
72
 * Revision 1.1  2007/05/30 12:25:48  jorpiell
73
 * Add the element collection
74
 *
75
 *
76
 */
77
/**
78
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
79
 */
80
public class SequenceWrittingTest extends WriterBaseTest {
81
        private String typeName1 = "river_type";
82
        private String typeType1 = IXSComplexTypeDefinition.SEQUENCE;
83
        private String contentType1 = IXSContentType.WITOUT_CONTENT;
84
        private String contentRestriction1 = IXSContentType.WITOUT_RESTRICTION;        
85
        private String type1ElementName1 = "length";
86
        private String type1ElementType1 = "xs:double";        
87
        private String type1ElementName2 = "name";
88
        private String type1ElementType2 = "xs:string";
89

    
90
        /*
91
         * (non-Javadoc)
92
         * @see org.gvsig.gpe.schema.writer.WriterBaseTest#readSchema()
93
         */
94
        public void readSchema(){
95
                IXSTypeDefinition type = getSchema().getTypeByName(getNamespaceURI(), typeName1);
96
                assertNotNull(type);
97
                assertEquals(type.getQName().getLocalPart(), typeName1);
98
                IXSComplexTypeDefinition cType = (IXSComplexTypeDefinition)type;
99
                Iterator it = cType.getItems().iterator();
100
                IXSSequence sequence = null;
101
                while (it.hasNext()){
102
                        sequence = (IXSSequence) it.next();
103
                }
104
                assertNotNull(sequence);                
105
        }
106

    
107
        /*
108
         * (non-Javadoc)
109
         * @see org.gvsig.gpe.schema.writer.WriterBaseTest#writeSchema()
110
         */
111
        public void writeSchema() {
112
                IXSComplexTypeDefinition complexType = getSchema().addComplexType(
113
                                typeName1, typeType1, contentType1, contentRestriction1);
114
                complexType.addElement(
115
                                type1ElementName1,
116
                                type1ElementType1);                
117
                complexType.addElement(
118
                                type1ElementName2,
119
                                type1ElementType2);        
120
        }
121

    
122
}