Statistics
| Revision:

root / org.gvsig.xmlschema / library / trunk / org.gvsig.xmlschema / org.gvsig.xmlschema.lib / org.gvsig.xmlschema.lib.spi / src / test / java / org / gvsig / xmlschema / lib / spi / reader / WFSCITSchemaReaderTest.java @ 257

History | View | Annotate | Download (2.84 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.xmlschema.lib.spi.reader;
23

    
24
import java.util.Iterator;
25

    
26
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator;
27
import org.gvsig.xmlschema.lib.api.som.IXSComplexTypeDefinition;
28
import org.gvsig.xmlschema.lib.api.som.IXSContentType;
29
import org.gvsig.xmlschema.lib.api.som.IXSElementDeclaration;
30
import org.gvsig.xmlschema.lib.api.som.IXSSequence;
31
import org.gvsig.xmlschema.lib.api.som.IXSTypeDefinition;
32

    
33

    
34
/**
35
 * @author gvSIG Team
36
 * @version $Id$
37
 *
38
 */
39
public abstract class WFSCITSchemaReaderTest extends SchemaReaderBaseTest{
40
    private String targetNamespace = "http://inspire.cop.gva.es";
41
    private String genericCityElement = "municipios_cv";
42
           
43

    
44
    public String getResourceFileName() {
45
        return "schemas/munic.xsd";
46
    }
47

    
48
    public void makeAsserts(){
49
        IXSElementDeclaration element = getSchema().getElementDeclarationByName(targetNamespace, genericCityElement);       
50
        assertEquals(element.getQName().getLocalPart(), genericCityElement);
51
        assertTrue(element.getTypeDefinition() instanceof IXSComplexTypeDefinition); 
52
        
53
        IXSContentType contentType = ((IXSComplexTypeDefinition)element.getTypeDefinition()).getContentType();
54
        assertNotNull(contentType);
55
        assertNotNull(contentType.getExtension());        
56
        assertNotNull(contentType.getExtension().getGroup());
57
        
58
        IXSSequence sequence = (IXSSequence)contentType.getExtension().getGroup();
59
        Iterator it = sequence.getItems().iterator();
60
        while(it.hasNext()){
61
            IXSElementDeclaration childElement = (IXSElementDeclaration)it.next();
62
            IXSTypeDefinition childTypeDefinition = childElement.getTypeDefinition();
63
            assertNotNull(childTypeDefinition);        
64
        }       
65
        
66
    }
67
    
68
    public void testShortType(){    
69
        IXSTypeDefinition typeDefinition = XMLSchemaLocator.getXMLSchemaManager().getTypeDefinition("short");
70
        assertNotNull(typeDefinition);  
71
    }
72
}