use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.
the class TestGeoObjectTypeInfo method getServerObject.
public ServerGeoObjectType getServerObject(boolean forceFetch) {
if (this.serverObject != null && !forceFetch) {
return this.serverObject;
} else {
Optional<ServerGeoObjectType> got = ServiceFactory.getMetadataCache().getGeoObjectType(code);
if (got.isPresent()) {
this.serverObject = got.get();
return this.serverObject;
} else {
Universal uni = TestDataSet.getUniversalIfExist(getCode());
if (uni == null) {
return null;
}
this.serverObject = new ServerGeoObjectTypeConverter().build(uni);
return this.serverObject;
}
}
}
use of net.geoprism.registry.model.ServerGeoObjectType 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 net.geoprism.registry.model.ServerGeoObjectType 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 net.geoprism.registry.model.ServerGeoObjectType 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 net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.
the class ShapefileServiceTest method testGetAttributeInformationPostalCode.
@Test
@Request
public void testGetAttributeInformationPostalCode() {
InputStream istream = this.getClass().getResourceAsStream("/cb_2017_us_state_500k.zip.test");
ServerGeoObjectType type = USATestData.STATE.getServerObject();
PostalCodeFactory.addPostalCode(type, new LocationBuilder() {
@Override
public Location build(ShapefileFunction function) {
return null;
}
});
Assert.assertNotNull(istream);
ShapefileService service = new ShapefileService();
JSONObject result = service.getShapefileConfiguration(testData.clientRequest.getSessionId(), USATestData.STATE.getCode(), null, null, "cb_2017_us_state_500k.zip", istream, ImportStrategy.NEW_AND_UPDATE, false);
Assert.assertTrue(result.getBoolean(GeoObjectImportConfiguration.HAS_POSTAL_CODE));
}
Aggregations