Search in sources :

Example 86 with ServerGeoObjectIF

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());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerParentGraphNode(net.geoprism.registry.model.ServerParentGraphNode) Date(java.util.Date) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 87 with ServerGeoObjectIF

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());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerParentGraphNode(net.geoprism.registry.model.ServerParentGraphNode) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 88 with ServerGeoObjectIF

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());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerParentGraphNode(net.geoprism.registry.model.ServerParentGraphNode) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 89 with ServerGeoObjectIF

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);
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerParentGraphNode(net.geoprism.registry.model.ServerParentGraphNode) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 90 with ServerGeoObjectIF

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);
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) GeoObjectAtTimeShapefileExporter(net.geoprism.registry.shapefile.GeoObjectAtTimeShapefileExporter) SimpleFeature(org.opengis.feature.simple.SimpleFeature) AttributeLocalType(org.commongeoregistry.adapter.metadata.AttributeLocalType) SimpleFeatureType(org.opengis.feature.simple.SimpleFeatureType) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) AttributeTermType(org.commongeoregistry.adapter.metadata.AttributeTermType) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)106 Request (com.runwaysdk.session.Request)68 Test (org.junit.Test)43 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)28 ServerGeoObjectService (net.geoprism.registry.geoobject.ServerGeoObjectService)23 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)18 ValueOverTimeCollection (com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection)18 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)16 Date (java.util.Date)15 GeoObject (org.commongeoregistry.adapter.dataaccess.GeoObject)15 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)13 LinkedList (java.util.LinkedList)11 OAuthClientRequest (org.apache.oltu.oauth2.client.request.OAuthClientRequest)10 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)10 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)10 JsonObject (com.google.gson.JsonObject)9 VertexObject (com.runwaysdk.business.graph.VertexObject)9 ChangeRequest (net.geoprism.registry.action.ChangeRequest)9 ServerParentTreeNode (net.geoprism.registry.model.ServerParentTreeNode)9 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)9