Search in sources :

Example 41 with ValueOverTime

use of com.runwaysdk.dataaccess.graph.attributes.ValueOverTime in project geoprism-registry by terraframe.

the class ValueOverTimeTest method testFullOverlapDifferentValue.

/**
 * Imported data is completely eclipsed by existing data, and the values are different.
 */
@Test
@Request
public void testFullOverlapDifferentValue() {
    ServerGeoObjectIF go = TEST_GO.getServerObject();
    go.setValue(DefaultAttribute.EXISTS.getName(), false, addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 5), addDay(TestDataSet.DEFAULT_END_TIME_DATE, -5));
    go.apply(false);
    go = TEST_GO.getServerObject();
    ValueOverTimeCollection votc = go.getValuesOverTime(DefaultAttribute.EXISTS.getName());
    Assert.assertEquals(3, votc.size());
    ValueOverTime vot = votc.get(0);
    Assert.assertEquals(true, vot.getValue());
    Assert.assertEquals(TestDataSet.DEFAULT_OVER_TIME_DATE, vot.getStartDate());
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 4), vot.getEndDate());
    ValueOverTime vot2 = votc.get(1);
    Assert.assertEquals(false, vot2.getValue());
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 5), vot2.getStartDate());
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_END_TIME_DATE, -5), vot2.getEndDate());
    ValueOverTime vot3 = votc.get(2);
    Assert.assertEquals(true, vot3.getValue());
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_END_TIME_DATE, -4), vot3.getStartDate());
    Assert.assertEquals(TestDataSet.DEFAULT_END_TIME_DATE, vot3.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 42 with ValueOverTime

use of com.runwaysdk.dataaccess.graph.attributes.ValueOverTime in project geoprism-registry by terraframe.

the class ValueOverTimeTest method testStoreDifferentLocalizedValue.

@Test
@Request
public void testStoreDifferentLocalizedValue() {
    final String defaultValue = "default store";
    LocalizedValue original = new LocalizedValue(defaultValue);
    original.setValue(LocalizedValue.DEFAULT_LOCALE, defaultValue);
    ServerGeoObjectIF go = TEST_GO.getServerObject();
    go.setDisplayLabel(original, TestDataSet.DEFAULT_OVER_TIME_DATE, TestDataSet.DEFAULT_END_TIME_DATE);
    go.apply(false);
    final String newValue = "new value";
    LocalizedValue lvNew = new LocalizedValue(newValue);
    lvNew.setValue(LocalizedValue.DEFAULT_LOCALE, newValue);
    ServerGeoObjectIF go2 = TEST_GO.getServerObject();
    go2.setDisplayLabel(lvNew, addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 5), addDay(TestDataSet.DEFAULT_END_TIME_DATE, -5));
    go2.apply(false);
    ServerGeoObjectIF go3 = TEST_GO.getServerObject();
    ValueOverTimeCollection votc = go3.getValuesOverTime(DefaultAttribute.DISPLAY_LABEL.getName());
    Assert.assertEquals(3, votc.size());
    ValueOverTime vot = votc.get(0);
    Assert.assertEquals(defaultValue, ((VertexObjectDAO) vot.getValue()).getObjectValue(com.runwaysdk.constants.MdAttributeLocalInfo.DEFAULT_LOCALE));
    Assert.assertEquals(TestDataSet.DEFAULT_OVER_TIME_DATE, vot.getStartDate());
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 4), vot.getEndDate());
    ValueOverTime vot2 = votc.get(1);
    Assert.assertEquals(newValue, ((VertexObjectDAO) vot2.getValue()).getObjectValue(com.runwaysdk.constants.MdAttributeLocalInfo.DEFAULT_LOCALE));
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 5), vot2.getStartDate());
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_END_TIME_DATE, -5), vot2.getEndDate());
    ValueOverTime vot3 = votc.get(2);
    Assert.assertEquals(defaultValue, ((VertexObjectDAO) vot3.getValue()).getObjectValue(com.runwaysdk.constants.MdAttributeLocalInfo.DEFAULT_LOCALE));
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_END_TIME_DATE, -4), vot3.getStartDate());
    Assert.assertEquals(TestDataSet.DEFAULT_END_TIME_DATE, vot3.getEndDate());
}
Also used : ValueOverTime(com.runwaysdk.dataaccess.graph.attributes.ValueOverTime) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ValueOverTimeCollection(com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 43 with ValueOverTime

use of com.runwaysdk.dataaccess.graph.attributes.ValueOverTime in project geoprism-registry by terraframe.

the class ValueOverTimeTest 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.setValue(DefaultAttribute.EXISTS.getName(), true, addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, -30), addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 5));
    go.apply(false);
    go = TEST_GO.getServerObject();
    ValueOverTimeCollection votc = go.getValuesOverTime(DefaultAttribute.EXISTS.getName());
    Assert.assertEquals(1, votc.size());
    ValueOverTime vot = votc.get(0);
    Assert.assertEquals(true, vot.getValue());
    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 44 with ValueOverTime

use of com.runwaysdk.dataaccess.graph.attributes.ValueOverTime in project geoprism-registry by terraframe.

the class ValueOverTimeTest method testPartialOverlapDifferentValue.

/**
 * Imported data partially overlaps an existing range, and the values are different.
 */
@Test
@Request
public void testPartialOverlapDifferentValue() {
    ServerGeoObjectIF go = TEST_GO.getServerObject();
    go.setValue(DefaultAttribute.EXISTS.getName(), false, addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, -30), addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 5));
    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(addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, -30), vot.getStartDate());
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 5), vot.getEndDate());
    ValueOverTime vot2 = votc.get(1);
    Assert.assertEquals(true, vot2.getValue());
    Assert.assertEquals(addDay(TestDataSet.DEFAULT_OVER_TIME_DATE, 6), 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) ValueOverTimeCollection(com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)44 ValueOverTimeCollection (com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection)29 Request (com.runwaysdk.session.Request)26 Date (java.util.Date)22 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)18 Test (org.junit.Test)16 EdgeObject (com.runwaysdk.business.graph.EdgeObject)10 ChangeRequest (net.geoprism.registry.action.ChangeRequest)10 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)10 VertexObject (com.runwaysdk.business.graph.VertexObject)9 UpdateAttributeAction (net.geoprism.registry.action.geoobject.UpdateAttributeAction)9 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)8 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)8 SimpleDateFormat (java.text.SimpleDateFormat)6 AbstractAction (net.geoprism.registry.action.AbstractAction)6 JsonArray (com.google.gson.JsonArray)5 JsonObject (com.google.gson.JsonObject)5 QueryFactory (com.runwaysdk.query.QueryFactory)5 TreeSet (java.util.TreeSet)5 ChangeRequestQuery (net.geoprism.registry.action.ChangeRequestQuery)5