use of eu.esdihumboldt.hale.common.instance.model.InstanceCollection in project hale by halestudio.
the class LineStringHandlerTest method testLineStringGml32.
/**
* Test linestring geometries read from a GML 3.2 file
*
* @throws Exception if an error occurs
*/
@Test
public void testLineStringGml32() throws Exception {
InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/linestring/sample-linestring-gml32.xml").toURI());
// five instances expected
ResourceIterator<Instance> it = instances.iterator();
try {
// 1. LineStringProperty with LineString defined through coordinates
assertTrue("First sample feature missing", it.hasNext());
Instance instance = it.next();
checkSingleGeometry(instance, checker);
// 2. LineStringProperty with LineString defined through pos
assertTrue("Second sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, checker);
// 3. LineStringProperty with LineString defined through pointRep
assertTrue("Third sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, checker);
// 4. LineStringProperty with LineString defined through
// pointProperty
assertTrue("Fourth sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, checker);
// 5. LineStringProperty with LineString defined through posList
assertTrue("Fifth sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, checker);
} finally {
it.close();
}
}
use of eu.esdihumboldt.hale.common.instance.model.InstanceCollection in project hale by halestudio.
the class LinearRingHandlerTest method testLinearRingGml3_Grid.
/**
* Test linear ring geometries read from a GML 3 file
*
* @throws Exception if an error occurs
*/
@Test
public void testLinearRingGml3_Grid() throws Exception {
InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml3.xsd").toURI(), getClass().getResource("/data/linearring/sample-linearring-gml3.xml").toURI(), gridConfig);
// four instances expected
ResourceIterator<Instance> it = instances.iterator();
try {
// 1. LinearRingProperty with LinearRing defined through coordinates
assertTrue("First sample feature missing", it.hasNext());
Instance instance = it.next();
checkSingleGeometry(instance, gridChecker);
// 2. LinearRingProperty with LinearRing defined through coord
assertTrue("Second sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, gridChecker);
// 3. LinearRingProperty with LinearRing defined through pointRep
assertTrue("Third sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, gridChecker);
// 4. LinearRingProperty with LinearRing defined through pos
assertTrue("Fourth sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, gridChecker);
} finally {
it.close();
}
}
use of eu.esdihumboldt.hale.common.instance.model.InstanceCollection in project hale by halestudio.
the class LinearRingHandlerTest method testLinearRingGml32_Grid.
/**
* Test linear ring geometries read from a GML 3.2 file
*
* @throws Exception if an error occurs
*/
@Test
public void testLinearRingGml32_Grid() throws Exception {
InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/linearring/sample-linearring-gml32.xml").toURI(), gridConfig);
// five instances expected
ResourceIterator<Instance> it = instances.iterator();
try {
// 1. LinearRingProperty with LinearRing defined through coordinates
assertTrue("First sample feature missing", it.hasNext());
Instance instance = it.next();
checkSingleGeometry(instance, gridChecker);
// 2. LinearRingProperty with LinearRing defined through pos
assertTrue("Second sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, gridChecker);
// 3. LinearRingProperty with LinearRing defined through pointRep
assertTrue("Third sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, gridChecker);
// 4. LinearRingProperty with LinearRing defined through
// pointProperty
assertTrue("Fourth sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, gridChecker);
// 5. LinearRingProperty with LinearRing defined through posList
assertTrue("Fifth sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, gridChecker);
} finally {
it.close();
}
}
use of eu.esdihumboldt.hale.common.instance.model.InstanceCollection in project hale by halestudio.
the class PointHandlerTest method testPointGml2_Grid.
/**
* Test point geometries read from a GML 2 file.
*
* @throws Exception if an error occurs
*/
@Test
public void testPointGml2_Grid() throws Exception {
InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml2.xsd").toURI(), getClass().getResource("/data/point/sample-point-gml2.xml").toURI(), gridConfig);
// three instances expected
ResourceIterator<Instance> it = instances.iterator();
try {
// 1. PointProperty with Point defined through coordinates
assertTrue("First sample feature missing", it.hasNext());
Instance instance = it.next();
checkSingleGeometry(instance, gridChecker);
// 2. PointProperty with Point defined through coord
assertTrue("Second sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, gridChecker);
// 3. GeometryProperty with Point defined through coordinates
assertTrue("Third sample feature missing", it.hasNext());
instance = it.next();
checkSingleGeometry(instance, gridChecker);
} finally {
it.close();
}
}
use of eu.esdihumboldt.hale.common.instance.model.InstanceCollection in project hale by halestudio.
the class FilterTest method testLoadShiporderCQL.
/**
* Test loading a simple XML file with one instance
*
* @throws Exception if an error occurs
*/
@Ignore
// element)
@Test
public void testLoadShiporderCQL() throws Exception {
InstanceCollection instances = loadXMLInstances(getClass().getResource("/testdata/shiporder/shiporder.xsd").toURI(), getClass().getResource("/testdata/shiporder/shiporder.xml").toURI());
ResourceIterator<Instance> it = instances.iterator();
try {
assertTrue(it.hasNext());
boolean foundIt = false;
boolean stayFalse = false;
boolean stayFalseToo = false;
boolean foundIt2 = false;
Filter cqlfilter = new FilterGeoCqlImpl("shipto.city = '4000 Stavanger'");
Filter foulfilter = new FilterGeoCqlImpl("HERP = 'DERP'");
Filter foulfilter1 = new FilterGeoCqlImpl("shipto.city = 'HURR'");
Filter cqlfilter2 = new FilterGeoCqlImpl("\"{http://www.example.com}shipto.{http://www.example.com}city\" = '4000 Stavanger'");
while (it.hasNext()) {
Instance instance = it.next();
assertNotNull(instance);
if (cqlfilter.match(instance)) {
foundIt = true;
}
if (foulfilter.match(instance)) {
stayFalse = true;
}
if (foulfilter1.match(instance)) {
stayFalseToo = true;
}
if (cqlfilter2.match(instance)) {
foundIt2 = true;
}
}
assertTrue(foundIt);
assertTrue(foundIt2);
assertFalse(stayFalse);
assertFalse(stayFalseToo);
} finally {
it.close();
}
}
Aggregations