use of eu.esdihumboldt.hale.io.gml.reader.internal.StreamGmlReader in project hale by halestudio.
the class FilterTest method loadXML.
@Before
public void loadXML() throws Exception {
if (init == false) {
SchemaReader reader = new XmlSchemaReader();
reader.setSharedTypes(null);
reader.setSource(new DefaultInputSupplier((getClass().getResource("/testdata/inspire3/HydroPhysicalWaters.xsd").toURI())));
IOReport report = reader.execute(null);
assertTrue(report.isSuccess());
Schema schema = reader.getSchema();
StreamGmlReader instanceReader = new GmlInstanceReader();
instanceReader.setSource(new DefaultInputSupplier(getClass().getResource("/testdata/out/transformWrite_ERM_HPW.gml").toURI()));
instanceReader.setSourceSchema(schema);
instanceReader.validate();
report = instanceReader.execute(null);
assertTrue(report.isSuccess());
FilterTest.complexinstances = instanceReader.getInstances();
assertFalse(FilterTest.complexinstances.isEmpty());
init = true;
}
}
use of eu.esdihumboldt.hale.io.gml.reader.internal.StreamGmlReader in project hale by halestudio.
the class PropertyResolverTest method testComplexInstances.
/**
* Test with complex instances.
*
* @throws Exception if an error occurs
*/
@Ignore
public void testComplexInstances() throws Exception {
SchemaReader reader = new XmlSchemaReader();
reader.setSharedTypes(null);
reader.setSource(new DefaultInputSupplier((getClass().getResource("/data/erm/inspire3/HydroPhysicalWaters.xsd").toURI())));
IOReport report = reader.execute(null);
assertTrue(report.isSuccess());
Schema schema = reader.getSchema();
StreamGmlReader instanceReader = new GmlInstanceReader();
instanceReader.setSource(new DefaultInputSupplier(getClass().getResource("/data/out/transformWrite_ERM_HPW.gml").toURI()));
instanceReader.setSourceSchema(schema);
instanceReader.validate();
report = instanceReader.execute(null);
assertTrue(report.isSuccess());
InstanceCollection instances = instanceReader.getInstances();
assertFalse(instances.isEmpty());
ResourceIterator<Instance> ri = instances.iterator();
try {
Instance instance = ri.next();
assertTrue(PropertyResolver.hasProperty(instance, "description"));
assertTrue(PropertyResolver.hasProperty(instance, "{http://www.opengis.net/gml/3.2}description"));
assertTrue(PropertyResolver.hasProperty(instance, "boundedBy.Envelope.coordinates"));
assertTrue(PropertyResolver.hasProperty(instance, "boundedBy.Envelope.{http://www.opengis.net/gml/3.2}coordinates"));
assertTrue(PropertyResolver.hasProperty(instance, "{http://www.opengis.net/gml/3.2}boundedBy.{http://www.opengis.net/gml/3.2}Envelope.{http://www.opengis.net/gml/3.2}coordinates"));
assertFalse(PropertyResolver.hasProperty(instance, "boundedBy.Envelope.{http://www.opengis.net/gml/3.2}coordinates.description"));
assertTrue(PropertyResolver.hasProperty(instance, "location.AbstractSolid.id"));
assertTrue(PropertyResolver.hasProperty(instance, "location.CompositeCurve.curveMember.CompositeCurve.curveMember.type"));
assertTrue(PropertyResolver.hasProperty(instance, "{http://www.opengis.net/gml/3.2}location.{http://www.opengis.net/gml/3.2}CompositeCurve.{http://www.opengis.net/gml/3.2}curveMember.{http://www.opengis.net/gml/3.2}CompositeCurve.{http://www.opengis.net/gml/3.2}curveMember.type"));
assertTrue(PropertyResolver.hasProperty(instance, "{http://www.opengis.net/gml/3.2}location.CompositeCurve.{http://www.opengis.net/gml/3.2}curveMember.{http://www.opengis.net/gml/3.2}CompositeCurve.curveMember.type"));
assertEquals("EPSG:4326", PropertyResolver.getValues(instance, "geometry.Polygon.srsName").iterator().next().toString());
// TODO
} finally {
ri.close();
}
}
Aggregations