use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.
the class DirectedAcyclicGraphTest method testAddParentCyclic_DifferentTimes.
@Test
@Request
public void testAddParentCyclic_DifferentTimes() {
ServerGeoObjectIF provCentral = FastTestDataset.PROV_CENTRAL.getServerObject();
ServerGeoObjectIF provWestern = FastTestDataset.PROV_WESTERN.getServerObject();
ServerGeoObjectIF distCentral = FastTestDataset.DIST_CENTRAL.getServerObject();
ServerGeoObjectIF cambodia = FastTestDataset.CAMBODIA.getServerObject();
ServerGeoObjectIF privateCentral = FastTestDataset.PROV_CENTRAL_PRIVATE.getServerObject();
ServerGeoObjectIF centralHospital = FastTestDataset.CENTRAL_HOSPITAL.getServerObject();
provWestern.addGraphParent(provCentral, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
provCentral.addGraphParent(distCentral, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
provCentral.addGraphParent(cambodia, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
cambodia.addGraphParent(privateCentral, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
cambodia.addGraphParent(centralHospital, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
distCentral.addGraphParent(provWestern, type, new Date(), ValueOverTime.INFINITY_END_DATE);
ServerParentGraphNode node = provWestern.getGraphParents(type, false, FastTestDataset.DEFAULT_OVER_TIME_DATE);
Assert.assertEquals(1, node.getParents().size());
}
use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.
the class UndirectedGraphTest method testAddParent.
@Test
@Request
public void testAddParent() {
ServerGeoObjectIF parent = FastTestDataset.PROV_CENTRAL.getServerObject();
ServerGeoObjectIF child = FastTestDataset.PROV_WESTERN.getServerObject();
ServerParentGraphNode node = child.addGraphParent(parent, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
Assert.assertNotNull(node);
Assert.assertEquals(child.getCode(), node.getGeoObject().getCode());
Assert.assertEquals(FastTestDataset.DEFAULT_OVER_TIME_DATE, node.getStartDate());
Assert.assertEquals(FastTestDataset.DEFAULT_OVER_TIME_DATE, node.getEndDate());
List<ServerParentGraphNode> parents = node.getParents();
Assert.assertEquals(1, parents.size());
Assert.assertEquals(parent.getCode(), parents.get(0).getGeoObject().getCode());
}
use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.
the class UndirectedGraphTest method testGetParents.
@Test
@Request
public void testGetParents() {
ServerGeoObjectIF parent = FastTestDataset.PROV_CENTRAL.getServerObject();
ServerGeoObjectIF child = FastTestDataset.PROV_WESTERN.getServerObject();
child.addGraphParent(parent, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
ServerParentGraphNode node = child.getGraphParents(type, false, FastTestDataset.DEFAULT_OVER_TIME_DATE);
List<ServerParentGraphNode> parents = node.getParents();
Assert.assertEquals(1, parents.size());
Assert.assertEquals(parent.getCode(), parents.get(0).getGeoObject().getCode());
}
use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.
the class UndirectedGraphTest method testGetParentCyclic.
@Test
@Request
public void testGetParentCyclic() {
ServerGeoObjectIF provCentral = FastTestDataset.PROV_CENTRAL.getServerObject();
ServerGeoObjectIF provWestern = FastTestDataset.PROV_WESTERN.getServerObject();
ServerGeoObjectIF distCentral = FastTestDataset.DIST_CENTRAL.getServerObject();
ServerGeoObjectIF cambodia = FastTestDataset.CAMBODIA.getServerObject();
ServerGeoObjectIF privateCentral = FastTestDataset.PROV_CENTRAL_PRIVATE.getServerObject();
ServerGeoObjectIF centralHospital = FastTestDataset.CENTRAL_HOSPITAL.getServerObject();
provWestern.addGraphParent(provCentral, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
provCentral.addGraphParent(distCentral, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
provCentral.addGraphParent(cambodia, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
cambodia.addGraphParent(privateCentral, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
cambodia.addGraphParent(centralHospital, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
distCentral.addGraphParent(provWestern, type, FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE);
ServerParentGraphNode node = provWestern.getGraphParents(type, true, FastTestDataset.DEFAULT_OVER_TIME_DATE);
Assert.assertNotNull(node);
}
use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.
the class GeoObjectAtTimeShapefileExporterTest method testCreateFeatures.
@Test
@Request
public void testCreateFeatures() {
ServerGeoObjectType type = FastTestDataset.PROVINCE.getServerObject();
GeoObjectAtTimeShapefileExporter exporter = new GeoObjectAtTimeShapefileExporter(type, FastTestDataset.DEFAULT_OVER_TIME_DATE);
SimpleFeatureType featureType = exporter.createFeatureType();
FeatureCollection<SimpleFeatureType, SimpleFeature> features = exporter.features(featureType);
Assert.assertTrue(features.size() > 0);
final FeatureIterator<SimpleFeature> it = features.features();
boolean hasCentralProvince = false;
while (it.hasNext()) {
SimpleFeature feature = it.next();
if (feature.getID().equals(FastTestDataset.PROV_CENTRAL.getCode())) {
hasCentralProvince = true;
final ServerGeoObjectIF object = FastTestDataset.PROV_CENTRAL.getServerObject();
Object geometry = feature.getDefaultGeometry();
Assert.assertNotNull(geometry);
Collection<AttributeType> attributes = new ImportAttributeSerializer(Session.getCurrentLocale(), false, false, LocalizationFacade.getInstalledLocales()).attributes(type.getType());
for (AttributeType attribute : attributes) {
String attributeName = attribute.getName();
Object oValue = object.getValue(attributeName);
Object fValue = feature.getAttribute(exporter.getColumnName(attributeName));
if (attribute instanceof AttributeTermType) {
Assert.assertEquals("Attributes not equal [" + attributeName + "]", GeoObjectUtil.convertToTermString((AttributeTermType) attribute, oValue), fValue);
} else if (attribute instanceof AttributeLocalType) {
Assert.assertEquals("Attributes not equal [" + attributeName + "]", ((LocalizedValue) oValue).getValue(), fValue);
} else {
Assert.assertEquals("Attributes not equal [" + attributeName + "]", oValue, fValue);
}
}
}
}
Assert.assertTrue("Unable to find the central province feature", hasCentralProvince);
}
Aggregations