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);
}
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());
}
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());
}
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());
}
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;
}
Aggregations