Search in sources :

Example 31 with ServerGeoObjectIF

use of net.geoprism.registry.model.ServerGeoObjectIF 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 32 with ServerGeoObjectIF

use of net.geoprism.registry.model.ServerGeoObjectIF 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 33 with ServerGeoObjectIF

use of net.geoprism.registry.model.ServerGeoObjectIF 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 34 with ServerGeoObjectIF

use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.

the class ExternalSystemTest method testAddExternalId.

@Test
@Request
public void testAddExternalId() {
    RevealExternalSystem system = new RevealExternalSystem();
    system.setId(EXTERNAL_SYSTEM_ID);
    system.setOrganization(FastTestDataset.ORG_CGOV.getServerObject());
    system.getEmbeddedComponent(ExternalSystem.LABEL).setValue("defaultLocale", "Test");
    system.getEmbeddedComponent(ExternalSystem.DESCRIPTION).setValue("defaultLocale", "Test");
    system.apply();
    String expected = "EXTERNAL ID";
    ServerGeoObjectIF serverGO = FastTestDataset.PROV_CENTRAL.getServerObject();
    serverGO.createExternalId(system, expected, ImportStrategy.NEW_ONLY);
    String actual = serverGO.getExternalId(system);
    Assert.assertEquals(expected, actual);
}
Also used : RevealExternalSystem(net.geoprism.registry.graph.RevealExternalSystem) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 35 with ServerGeoObjectIF

use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.

the class FhirImportTest method testBasicImport.

@Request
@Test
public void testBasicImport() throws InterruptedException {
    try {
        FhirExternalSystem system = createExternalSystem();
        SynchronizationConfig config = createSyncConfig(system);
        FhirSyncImportConfig iConfig = (FhirSyncImportConfig) config.buildConfiguration();
        FhirResourceProcessor processor = FhirFactory.getProcessor(iConfig.getImplementation());
        IParser parser = FhirContext.forR4().newJsonParser();
        Bundle bundle = new Bundle();
        bundle.addEntry(new BundleEntryComponent().setResource((Resource) parser.parseResource(this.getClass().getResourceAsStream("/fhir/organization.json"))));
        bundle.addEntry(new BundleEntryComponent().setResource((Resource) parser.parseResource(this.getClass().getResourceAsStream("/fhir/location.json"))));
        FhirResourceImporter importer = new FhirResourceImporter(new BasicFhirConnection(system), processor, null, null);
        importer.synchronize(bundle);
        ServerGeoObjectIF geoobject = new ServerGeoObjectService().getGeoObjectByCode("USATestDataHsTwo", "USATestDataHealthStop");
        geoobject.setDate(new Date());
        LocalizedValue displayLabel = geoobject.getDisplayLabel();
        Assert.assertEquals("USATestDataHsTwo ZZZZZZZ", displayLabel.getValue());
    } finally {
        TestDataSet.deleteExternalSystems("FHIRImportTest");
    }
}
Also used : FhirResourceImporter(net.geoprism.registry.etl.fhir.FhirResourceImporter) ServerGeoObjectService(net.geoprism.registry.geoobject.ServerGeoObjectService) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) Bundle(org.hl7.fhir.r4.model.Bundle) Resource(org.hl7.fhir.r4.model.Resource) BasicFhirResourceProcessor(net.geoprism.registry.etl.fhir.BasicFhirResourceProcessor) FhirResourceProcessor(net.geoprism.registry.etl.fhir.FhirResourceProcessor) BasicFhirConnection(net.geoprism.registry.etl.fhir.BasicFhirConnection) FhirExternalSystem(net.geoprism.registry.graph.FhirExternalSystem) Date(java.util.Date) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) SynchronizationConfig(net.geoprism.registry.SynchronizationConfig) IParser(ca.uhn.fhir.parser.IParser) 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