use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method setUpTestInstanceData.
@Request
private void setUpTestInstanceData() {
ServerGeoObjectIF cambodia = FastTestDataset.CAMBODIA.getServerObject();
String votOid = cambodia.getValuesOverTime(FastTestDataset.AT_National_Anthem.getAttributeName()).getValueOverTime(FastTestDataset.DEFAULT_OVER_TIME_DATE, TestDataSet.DEFAULT_END_TIME_DATE).getOid();
UPDATE_ATTR_JSON = "{" + "\"valuesOverTime\" : [" + "{" + "\"oid\" : \"" + votOid + "\"," + "\"action\" : \"UPDATE\"," + "\"oldValue\" : \"" + FastTestDataset.CAMBODIA.getDefaultValue(FastTestDataset.AT_National_Anthem.getAttributeName()) + "\"," + "\"newValue\" : \"" + NEW_ANTHEM + "\"," + "\"newStartDate\" : \"" + NEW_START_DATE + "\"," + "\"newEndDate\" : \"" + NEW_END_DATE + "\"," + "\"oldStartDate\" : \"" + OLD_START_DATE + "\"," + "\"oldEndDate\" : \"" + OLD_END_DATE + "\"" + "}" + "]" + "}";
ServerGeoObjectIF central_prov = FastTestDataset.PROV_CENTRAL.getServerObject();
ServerParentTreeNode ptn = central_prov.getParentGeoObjects(new String[] { FastTestDataset.COUNTRY.getCode() }, false, TestDataSet.DEFAULT_OVER_TIME_DATE).getParents().get(0);
UPDATE_PARENT_ATTR_JSON = "{" + "\"hierarchyCode\" : \"" + FastTestDataset.HIER_ADMIN.getCode() + "\"," + "\"valuesOverTime\" : [" + "{" + "\"oid\" : \"" + ptn.getOid() + "\"," + "\"action\" : \"UPDATE\"," + "\"oldValue\" : \"" + FastTestDataset.COUNTRY.getCode() + UpdateParentValueOverTimeView.VALUE_SPLIT_TOKEN + FastTestDataset.CAMBODIA.getCode() + "\"," + "\"newValue\" : \"" + FastTestDataset.COUNTRY.getCode() + UpdateParentValueOverTimeView.VALUE_SPLIT_TOKEN + BELIZE.getCode() + "\"," + "\"newStartDate\" : \"" + NEW_START_DATE + "\"," + "\"newEndDate\" : \"" + NEW_END_DATE + "\"," + "\"oldStartDate\" : \"" + OLD_START_DATE + "\"," + "\"oldEndDate\" : \"" + OLD_END_DATE + "\"" + "}" + "]" + "}";
}
use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testImplementDecisionsVerify.
@Request
private void testImplementDecisionsVerify(String crOid) throws Exception {
ChangeRequest cr = ChangeRequest.get(crOid);
Assert.assertEquals(AllGovernanceStatus.ACCEPTED.name(), cr.getApprovalStatus().get(0).name());
AbstractAction action = cr.getAllAction().next();
Assert.assertEquals(AllGovernanceStatus.ACCEPTED.name(), action.getApprovalStatus().get(0).name());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
sdf.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
Date newStartDate = sdf.parse(NEW_START_DATE);
Date newEndDate = sdf.parse(NEW_END_DATE);
ServerGeoObjectIF serverGo = FastTestDataset.CAMBODIA.getServerObject();
ValueOverTimeCollection votc = serverGo.getValuesOverTime(FastTestDataset.AT_National_Anthem.getAttributeName());
Assert.assertEquals(1, votc.size());
ValueOverTime vot = votc.get(0);
Assert.assertEquals(newStartDate, vot.getStartDate());
Assert.assertEquals(newEndDate, vot.getEndDate());
Assert.assertEquals(NEW_ANTHEM, vot.getValue());
Assert.assertEquals(NEW_ANTHEM, serverGo.getValue(FastTestDataset.AT_National_Anthem.getAttributeName(), newStartDate));
}
use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.
the class RegistryVersionTest method addVersionData.
// @Test
// public void testSetAttributeVersions()
// {
// String attributeName = "status";
// AttributeType type = getAttributeType(attributeName);
//
// ServerGeoObjectIF serverObj = testData.PROV_CENTRAL.getServerObject();
//
// Assert.assertEquals(0, serverObj.getValuesOverTime(attributeName).size());
//
// ValueOverTimeCollectionDTO dto = buildVersionDTO(type);
//
// testData.adapter.setAttributeVersions(testData.PROV_CENTRAL.getCode(), testData.PROV_CENTRAL.getGeoObjectType().getCode(), "status", dto);
//
// assertVersionData(ValueOverTimeConverter.colToDTO(serverObj.getValuesOverTime(attributeName), type));
// }
//
// private void assertVersionData(ValueOverTimeCollectionDTO dto)
// {
// SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");
// dateFormat.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
//
// Assert.assertEquals(3, dto.size());
//
// try
// {
// Assert.assertEquals(dto.get(0).getValue(), GeoObjectStatus.INACTIVE);
// Assert.assertEquals(dto.get(0).getStartDate(), dateFormat.parse("01-01-1990"));
// Assert.assertEquals(dto.get(0).getEndDate(), dateFormat.parse("01-31-1990"));
//
// Assert.assertEquals(dto.get(1).getValue(), GeoObjectStatus.NEW);
// Assert.assertEquals(dto.get(1).getStartDate(), dateFormat.parse("02-01-1990"));
// Assert.assertEquals(dto.get(1).getEndDate(), dateFormat.parse("02-28-1990"));
//
// Assert.assertEquals(dto.get(2).getValue(), GeoObjectStatus.PENDING);
// Assert.assertEquals(dto.get(2).getStartDate(), dateFormat.parse("03-01-1990"));
// Assert.assertEquals(dto.get(2).getEndDate(), ValueOverTime.INFINITY_END_DATE);
// }
// catch (ParseException e)
// {
// throw new RuntimeException(e);
// }
// }
//
@Request
@SuppressWarnings("unchecked")
private void addVersionData(TestGeoObjectInfo geoObj) throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");
dateFormat.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
ServerGeoObjectIF serverObj = geoObj.getServerObject();
serverObj.getValuesOverTime(DefaultAttribute.EXISTS.getName()).clear();
serverObj.setExists(Boolean.FALSE, dateFormat.parse("01-01-1990"), dateFormat.parse("01-31-1990"));
Assert.assertEquals(Boolean.FALSE, serverObj.getExists(dateFormat.parse("01-01-1990")));
serverObj.setExists(Boolean.TRUE, dateFormat.parse("02-01-1990"), dateFormat.parse("02-28-1990"));
Assert.assertEquals(Boolean.TRUE, serverObj.getExists(dateFormat.parse("02-01-1990")));
serverObj.setExists(Boolean.FALSE, dateFormat.parse("03-01-1990"), dateFormat.parse("03-31-1990"));
Assert.assertEquals(Boolean.FALSE, serverObj.getExists(dateFormat.parse("03-01-1990")));
serverObj.apply(false);
Assert.assertEquals(Boolean.FALSE, serverObj.getExists(dateFormat.parse("01-01-1990")));
}
use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.
the class SearchServiceTest method testSearchTable.
@Test
@Request
public void testSearchTable() {
SearchService service = new SearchService();
service.clear();
service.deleteSearchTable();
service.createSearchTable();
new SearchTablePatch().createRecords(service);
Date date = USATestData.DEFAULT_OVER_TIME_DATE;
List<ServerGeoObjectIF> results = service.search(USATestData.CO_D_ONE.getDisplayLabel(), date, 10L);
Assert.assertEquals(1, results.size());
ServerGeoObjectIF result = results.get(0);
Assert.assertEquals(result.getCode(), USATestData.CO_D_ONE.getCode());
Assert.assertEquals(3, service.search(USATestData.TEST_DATA_KEY + "ColoradoDistrict", date, 10L).size());
Assert.assertEquals(1, service.search(USATestData.TEST_DATA_KEY, date, 1L).size());
}
use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.
the class ValueOverTimeParentTest method testFullConsumeDifferentValue.
/**
* Imported data completely consumes existing data, and the values are different.
*/
@Test
@Request
public void testFullConsumeDifferentValue() {
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();
ValueOverTimeCollection votc = go.getParentCollection(FastTestDataset.HIER_ADMIN.getServerObject());
Assert.assertEquals(1, votc.size());
ValueOverTime vot = votc.get(0);
Assert.assertEquals(BELIZE.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());
}
Aggregations