Search in sources :

Example 96 with ServerGeoObjectIF

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

the class ValueOverTimeParentTest method testGetParentAtTime.

/**
 * Imported data completely consumes existing data, and the values are different.
 */
@Test
@Request
public void testGetParentAtTime() {
    ServerGeoObjectIF go = TEST_GO.getServerObject();
    go.addParent(BELIZE.getServerObject(), FastTestDataset.HIER_ADMIN.getServerObject(), addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, -5), addDay(TestDataSet.DEFAULT_END_TIME_DATE, 5));
    go.apply(false);
    go = TEST_GO.getServerObject();
    ServerParentTreeNode node = go.getParentsForHierarchy(FastTestDataset.HIER_ADMIN.getServerObject(), false, TestDataSet.DEFAULT_OVER_TIME_DATE);
    Assert.assertEquals(1, node.getParents().size());
    ServerGeoObjectIF value = node.getParents().get(0).getGeoObject();
    Assert.assertEquals(BELIZE.getCode(), value.getCode());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerParentTreeNode(net.geoprism.registry.model.ServerParentTreeNode) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 97 with ServerGeoObjectIF

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

the class ValueOverTimeParentTest method testFullConsumeSameValue.

/**
 * Imported data completely consumes existing data, and the values are the same.
 */
@Test
@Request
public void testFullConsumeSameValue() {
    ServerGeoObjectIF go = TEST_GO.getServerObject();
    go.addParent(FastTestDataset.CAMBODIA.getServerObject(), FastTestDataset.HIER_ADMIN.getServerObject(), addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, -5), addDay(TestDataSet.DEFAULT_END_TIME_DATE, 5));
    go.apply(false);
    go = TEST_GO.getServerObject();
    ValueOverTimeCollection votc = go.getParentCollection(FastTestDataset.HIER_ADMIN.getServerObject());
    Assert.assertEquals(1, votc.size());
    ValueOverTime vot = votc.get(0);
    Assert.assertEquals(FastTestDataset.CAMBODIA.getCode(), ((ServerGeoObjectIF) vot.getValue()).getCode());
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, -5), vot.getStartDate());
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_END_TIME_DATE, 5), vot.getEndDate());
}
Also used : ValueOverTime(com.runwaysdk.dataaccess.graph.attributes.ValueOverTime) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ValueOverTimeCollection(com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 98 with ServerGeoObjectIF

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

the class ValueOverTimeParentTest method testPartialOverlapSameValue.

/**
 * Imported data partially overlaps an existing range, and the values are the same.
 */
@Test
@Request
public void testPartialOverlapSameValue() {
    ServerGeoObjectIF go = TEST_GO.getServerObject();
    go.addParent(FastTestDataset.CAMBODIA.getServerObject(), FastTestDataset.HIER_ADMIN.getServerObject(), addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, -30), addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 5));
    go.apply(false);
    go = TEST_GO.getServerObject();
    ValueOverTimeCollection votc = go.getParentCollection(FastTestDataset.HIER_ADMIN.getServerObject());
    Assert.assertEquals(1, votc.size());
    ValueOverTime vot = votc.get(0);
    Assert.assertEquals(FastTestDataset.CAMBODIA.getCode(), ((ServerGeoObjectIF) vot.getValue()).getCode());
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, -30), vot.getStartDate());
    Assert.assertEquals(TestDataSet.DEFAULT_END_TIME_DATE, vot.getEndDate());
}
Also used : ValueOverTime(com.runwaysdk.dataaccess.graph.attributes.ValueOverTime) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ValueOverTimeCollection(com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 99 with ServerGeoObjectIF

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

the class ValueOverTimeParentTest method testFullOverlapSameValue.

/**
 * Imported data is completely eclipsed by existing data, and the values are the same.
 */
@Test
@Request
public void testFullOverlapSameValue() {
    ServerGeoObjectIF go = TEST_GO.getServerObject();
    go.addParent(FastTestDataset.CAMBODIA.getServerObject(), FastTestDataset.HIER_ADMIN.getServerObject(), addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 1), addDay(TestDataSet.DEFAULT_END_TIME_DATE, -1));
    go.apply(false);
    go = TEST_GO.getServerObject();
    ValueOverTimeCollection votc = go.getParentCollection(FastTestDataset.HIER_ADMIN.getServerObject());
    Assert.assertEquals(1, votc.size());
    ValueOverTime vot = votc.get(0);
    Assert.assertEquals(FastTestDataset.CAMBODIA.getCode(), ((ServerGeoObjectIF) vot.getValue()).getCode());
    Assert.assertEquals(TestDataSet.DEFAULT_OVER_TIME_DATE, vot.getStartDate());
    Assert.assertEquals(TestDataSet.DEFAULT_END_TIME_DATE, vot.getEndDate());
}
Also used : ValueOverTime(com.runwaysdk.dataaccess.graph.attributes.ValueOverTime) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ValueOverTimeCollection(com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 100 with ServerGeoObjectIF

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

the class ValueOverTimeTest method testNoOverlap.

/**
 * Imported data has no conflict with any existing data in the system.
 */
@Test
@Request
public void testNoOverlap() {
    Calendar cStart = Calendar.getInstance(GeoRegistryUtil.SYSTEM_TIMEZONE);
    cStart.clear();
    cStart.set(2005, Calendar.JANUARY, 1);
    Date start = cStart.getTime();
    Calendar cEnd = Calendar.getInstance(GeoRegistryUtil.SYSTEM_TIMEZONE);
    cEnd.clear();
    cEnd.set(2006, Calendar.JANUARY, 1);
    Date end = cEnd.getTime();
    ServerGeoObjectIF go = TEST_GO.getServerObject();
    go.setValue(DefaultAttribute.EXISTS.getName(), false, start, end);
    go.apply(false);
    go = TEST_GO.getServerObject();
    ValueOverTimeCollection votc = go.getValuesOverTime(DefaultAttribute.EXISTS.getName());
    Assert.assertEquals(2, votc.size());
    ValueOverTime vot = votc.get(0);
    Assert.assertEquals(false, vot.getValue());
    Assert.assertEquals(start, vot.getStartDate());
    Assert.assertEquals(end, vot.getEndDate());
    ValueOverTime vot2 = votc.get(1);
    Assert.assertEquals(true, vot2.getValue());
    Assert.assertEquals(TestDataSet.DEFAULT_OVER_TIME_DATE, vot2.getStartDate());
    Assert.assertEquals(TestDataSet.DEFAULT_END_TIME_DATE, vot2.getEndDate());
}
Also used : ValueOverTime(com.runwaysdk.dataaccess.graph.attributes.ValueOverTime) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) Calendar(java.util.Calendar) ValueOverTimeCollection(com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection) Date(java.util.Date) 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