Search in sources :

Example 81 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class TestHierarchyTypeInfo method apply.

@Request
public void apply() {
    if (this.getServerObject(true) != null) {
        return;
    }
    HierarchyType dto = this.toDTO();
    this.serverObj = new ServerHierarchyTypeBuilder().createHierarchyType(dto);
}
Also used : HierarchyType(org.commongeoregistry.adapter.metadata.HierarchyType) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) ServerHierarchyTypeBuilder(net.geoprism.registry.conversion.ServerHierarchyTypeBuilder) Request(com.runwaysdk.session.Request)

Example 82 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class GeoObjectQueryTest method testQueryTreeNodes.

@Test
@Request
public void testQueryTreeNodes() {
    ServerGeoObjectType type = USATestData.STATE.getServerObject();
    VertexGeoObjectQuery query = new VertexGeoObjectQuery(type, null);
    List<ServerGeoObjectIF> results = query.getResults();
    Assert.assertEquals(2, results.size());
    ServerGeoObjectIF result = results.get(0);
    Assert.assertEquals(USATestData.COLORADO.getCode(), result.getCode());
    Assert.assertNotNull(result.getGeometry());
    Assert.assertEquals(USATestData.COLORADO.getDisplayLabel(), result.getDisplayLabel().getValue());
    Assert.assertEquals(true, result.getExists());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) VertexGeoObjectQuery(net.geoprism.registry.query.graph.VertexGeoObjectQuery) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 83 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class GeoObjectQueryTest method testLeafCodeRestriction.

@Test
@Request
public void testLeafCodeRestriction() {
    ServerGeoObjectType type = USATestData.DISTRICT.getServerObject();
    VertexGeoObjectQuery query = new VertexGeoObjectQuery(type, null);
    query.setRestriction(new ServerCodeRestriction(USATestData.CO_D_ONE.getCode()));
    ServerGeoObjectIF result = query.getSingleResult();
    Assert.assertEquals(USATestData.CO_D_ONE.getCode(), result.getCode());
    Assert.assertNotNull(result.getGeometry());
    Assert.assertEquals(USATestData.CO_D_ONE.getDisplayLabel(), result.getDisplayLabel().getValue());
    Assert.assertEquals(true, result.getExists());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) VertexGeoObjectQuery(net.geoprism.registry.query.graph.VertexGeoObjectQuery) ServerCodeRestriction(net.geoprism.registry.query.ServerCodeRestriction) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 84 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class GeoObjectQueryTest method testTreeSynonymRestrictionByCode.

@Test
@Request
public void testTreeSynonymRestrictionByCode() {
    ServerGeoObjectType type = USATestData.STATE.getServerObject();
    VertexGeoObjectQuery query = new VertexGeoObjectQuery(type, null);
    query.setRestriction(new ServerSynonymRestriction(USATestData.COLORADO.getCode(), USATestData.COLORADO.getDate()));
    ServerGeoObjectIF result = query.getSingleResult();
    Assert.assertEquals(USATestData.COLORADO.getCode(), result.getCode());
    Assert.assertNotNull(result.getGeometry());
    Assert.assertEquals(USATestData.COLORADO.getDisplayLabel(), result.getDisplayLabel().getValue());
    Assert.assertEquals(true, result.getExists());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) VertexGeoObjectQuery(net.geoprism.registry.query.graph.VertexGeoObjectQuery) ServerSynonymRestriction(net.geoprism.registry.query.ServerSynonymRestriction) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 85 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class GeotoolsLoopTest method runInReq.

@Request
public static Set<String> runInReq(ApplicationResource res, boolean sort) throws Exception {
    Set<String> featureIdSet = new HashSet<String>();
    Set<String> nonUniqueFeatureIds = new HashSet<String>();
    try (CloseableFile shp = ShapefileImporter.getShapefileFromResource(res, "shp")) {
        FileDataStore myData = FileDataStoreFinder.getDataStore(shp);
        try {
            SimpleFeatureSource source = myData.getFeatureSource();
            Query query = new Query();
            if (sort) {
                // Enforce predictable ordering based on alphabetical Feature Ids
                query.setSortBy(new SortBy[] { SortBy.NATURAL_ORDER });
            }
            long total = source.getFeatures(query).size();
            SimpleFeatureIterator iterator = source.getFeatures(query).features();
            long count = 0;
            try {
                while (iterator.hasNext()) {
                    SimpleFeature feature = iterator.next();
                    String featureId = feature.getID();
                    if (!featureIdSet.add(featureId)) {
                        nonUniqueFeatureIds.add(featureId);
                    }
                    count++;
                }
            } finally {
                iterator.close();
            }
            System.out.println("Imported " + count + " of total " + total);
        } finally {
            myData.dispose();
        }
    }
    if (nonUniqueFeatureIds.size() > 0) {
        throw new RuntimeException("Detected non-unique feature Ids [" + StringUtils.join(nonUniqueFeatureIds, ", ") + "]");
    }
    return featureIdSet;
}
Also used : SimpleFeatureIterator(org.geotools.data.simple.SimpleFeatureIterator) Query(org.geotools.data.Query) SimpleFeatureSource(org.geotools.data.simple.SimpleFeatureSource) CloseableFile(com.runwaysdk.resource.CloseableFile) FileDataStore(org.geotools.data.FileDataStore) SimpleFeature(org.opengis.feature.simple.SimpleFeature) HashSet(java.util.HashSet) Request(com.runwaysdk.session.Request)

Aggregations

Request (com.runwaysdk.session.Request)340 Test (org.junit.Test)145 JsonObject (com.google.gson.JsonObject)85 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)73 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)73 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)53 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)40 JsonArray (com.google.gson.JsonArray)36 Date (java.util.Date)33 ChangeRequest (net.geoprism.registry.action.ChangeRequest)32 OAuthClientRequest (org.apache.oltu.oauth2.client.request.OAuthClientRequest)31 QueryFactory (com.runwaysdk.query.QueryFactory)30 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)26 ValueOverTimeCollection (com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection)22 ListType (net.geoprism.registry.ListType)21 SimpleDateFormat (java.text.SimpleDateFormat)19 Classification (net.geoprism.registry.model.Classification)19 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)19 ClassificationTypeTest (net.geoprism.registry.classification.ClassificationTypeTest)17 TransitionEvent (net.geoprism.registry.graph.transition.TransitionEvent)17