Search in sources :

Example 6 with JAXBFeatureTypeReader

use of org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader in project geotoolkit by Geomatys.

the class XmlFeatureTypeTest method testReadComplexFeatureType.

@Test
public void testReadComplexFeatureType() throws JAXBException {
    final JAXBFeatureTypeReader reader = getReader(true);
    final List<FeatureType> types = new ArrayList<>(reader.read(XmlFeatureTypeTest.class.getResourceAsStream("/org/geotoolkit/feature/xml/ComplexType.xsd")).getValues());
    removeGMLBaseTypes(types);
    assertEquals(1, types.size());
    Collection<? extends PropertyType> expProperties = complexType.getProperties(false);
    Collection<? extends PropertyType> resProperties = types.get(0).getProperties(false);
    assertEquals(diffSizeProperties(expProperties, resProperties), expProperties.size(), resProperties.size());
    FeatureComparator comparator = new FeatureComparator(complexType, types.get(0));
    comparator.ignoredCharacteristics.add("http://www.w3.org/1999/xlink:href");
    comparator.ignoredCharacteristics.add("http://www.w3.org/2001/XMLSchema-instance:@nil");
    comparator.ignoredCharacteristics.add("mapping");
    comparator.ignoreDescription = true;
    comparator.compare();
}
Also used : FeatureType(org.opengis.feature.FeatureType) ArrayList(java.util.ArrayList) JAXBFeatureTypeReader(org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader) FeatureComparator(org.apache.sis.test.feature.FeatureComparator)

Example 7 with JAXBFeatureTypeReader

use of org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader in project geotoolkit by Geomatys.

the class XmlFeatureTypeTest method testReadReferenceType.

@Test
public void testReadReferenceType() throws JAXBException, IOException, ParserConfigurationException, SAXException {
    final JAXBFeatureTypeReader reader = getReader(true);
    final List<FeatureType> types = new ArrayList<>(reader.read(XmlFeatureTypeTest.class.getResourceAsStream("/org/geotoolkit/feature/xml/ReferenceType.xsd")).getValues());
    removeGMLBaseTypes(types);
    assertEquals(1, types.size());
    final FeatureType readType = types.get(0);
    FeatureComparator comparator = new FeatureComparator(typeReference, readType);
    comparator.ignoredCharacteristics.add("http://www.w3.org/1999/xlink:href");
    comparator.ignoredCharacteristics.add("mapping");
    comparator.ignoreDescription = true;
    comparator.compare();
}
Also used : FeatureType(org.opengis.feature.FeatureType) ArrayList(java.util.ArrayList) JAXBFeatureTypeReader(org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader) FeatureComparator(org.apache.sis.test.feature.FeatureComparator)

Example 8 with JAXBFeatureTypeReader

use of org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader in project geotoolkit by Geomatys.

the class XmlFeatureTypeTest method testReadVeryComplexFeatureType.

@Test
@Ignore("Random test failure due to connection timeout or when internet is not available. See #GEOTK-485")
public void testReadVeryComplexFeatureType() throws Exception {
    final JAXBFeatureTypeReader reader = getReader(true);
    final URL url = new URL("http://schemas.opengis.net/gml/3.1.1/base/feature.xsd");
    final List<FeatureType> types = new ArrayList<>(reader.read(url).getValues());
    removeGMLBaseTypes(types);
    System.out.println("RESULT:" + types);
}
Also used : FeatureType(org.opengis.feature.FeatureType) ArrayList(java.util.ArrayList) JAXBFeatureTypeReader(org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader) URL(java.net.URL)

Example 9 with JAXBFeatureTypeReader

use of org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader in project geotoolkit by Geomatys.

the class XmlFeatureTypeTest method testReadSimpleFeatureEmpty.

@Test
public void testReadSimpleFeatureEmpty() throws JAXBException {
    final JAXBFeatureTypeReader reader = getReader(true);
    final List<FeatureType> types = new ArrayList<>(reader.read(XmlFeatureTypeTest.class.getResourceAsStream("/org/geotoolkit/feature/xml/SimpleTypeEmpty.xsd")).getValues());
    removeGMLBaseTypes(types);
    assertEquals(1, types.size());
    final FeatureType readType = types.get(0);
    FeatureComparator comparator = new FeatureComparator(typeEmpty, readType);
    comparator.ignoredCharacteristics.add("http://www.w3.org/1999/xlink:href");
    comparator.ignoredCharacteristics.add("mapping");
    comparator.ignoreDescription = true;
    comparator.compare();
}
Also used : FeatureType(org.opengis.feature.FeatureType) ArrayList(java.util.ArrayList) JAXBFeatureTypeReader(org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader) FeatureComparator(org.apache.sis.test.feature.FeatureComparator)

Example 10 with JAXBFeatureTypeReader

use of org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader in project geotoolkit by Geomatys.

the class XmlFeatureTypeTest method testReadSimpleGeomFeatureType.

@Test
public void testReadSimpleGeomFeatureType() throws JAXBException {
    final JAXBFeatureTypeReader reader = getReader(true);
    final List<FeatureType> types = new ArrayList<>(reader.read(XmlFeatureTypeTest.class.getResourceAsStream("/org/geotoolkit/feature/xml/SimpleGeomType.xsd")).getValues());
    removeGMLBaseTypes(types);
    assertEquals(1, types.size());
    FeatureComparator comparator = new FeatureComparator(simpleTypeGeom, types.get(0));
    comparator.ignoredCharacteristics.add("http://www.w3.org/1999/xlink:href");
    comparator.ignoredCharacteristics.add("mapping");
    comparator.compare();
}
Also used : FeatureType(org.opengis.feature.FeatureType) ArrayList(java.util.ArrayList) JAXBFeatureTypeReader(org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader) FeatureComparator(org.apache.sis.test.feature.FeatureComparator)

Aggregations

JAXBFeatureTypeReader (org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader)26 FeatureType (org.opengis.feature.FeatureType)22 ArrayList (java.util.ArrayList)13 FeatureComparator (org.apache.sis.test.feature.FeatureComparator)8 JAXBException (javax.xml.bind.JAXBException)7 IOException (java.io.IOException)4 URL (java.net.URL)4 FeatureTypeBuilder (org.apache.sis.feature.builder.FeatureTypeBuilder)3 JAXPStreamFeatureReader (org.geotoolkit.feature.xml.jaxp.JAXPStreamFeatureReader)3 PropertyType (org.opengis.feature.PropertyType)3 InputStream (java.io.InputStream)2 MalformedURLException (java.net.MalformedURLException)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 DataStoreException (org.apache.sis.storage.DataStoreException)2 UnconvertibleObjectException (org.apache.sis.util.UnconvertibleObjectException)2 FeatureReader (org.geotoolkit.storage.feature.FeatureReader)2 GenericNameIndex (org.geotoolkit.storage.feature.GenericNameIndex)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1