use of net.geoprism.registry.graph.transition.TransitionEvent in project geoprism-registry by terraframe.
the class TransitionEventTest method testPagePermissionsSetUp.
@Request()
private TransitionEvent testPagePermissionsSetUp() {
TransitionEvent event = new TransitionEvent();
Date date = FastTestDataset.DEFAULT_OVER_TIME_DATE;
LocalizedValue expectedDescription = new LocalizedValue("Test");
LocalizedValueConverter.populate(event, TransitionEvent.DESCRIPTION, expectedDescription);
event.setEventDate(date);
event.setBeforeTypeCode(FastTestDataset.COUNTRY.getCode());
event.setBeforeTypeOrgCode(FastTestDataset.COUNTRY.getOrganization().getCode());
event.setAfterTypeCode(FastTestDataset.PROVINCE.getCode());
event.setAfterTypeOrgCode(FastTestDataset.PROVINCE.getOrganization().getCode());
event.apply();
return event;
}
use of net.geoprism.registry.graph.transition.TransitionEvent in project geoprism-registry by terraframe.
the class TransitionEventTest method testRemoveTransitionsBySource.
@Test
@Request
public void testRemoveTransitionsBySource() {
TransitionEvent event = new TransitionEvent();
try {
LocalizedValueConverter.populate(event, TransitionEvent.DESCRIPTION, new LocalizedValue("Test"));
event.setEventDate(FastTestDataset.DEFAULT_OVER_TIME_DATE);
event.setBeforeTypeCode(FastTestDataset.COUNTRY.getCode());
event.setBeforeTypeOrgCode(FastTestDataset.COUNTRY.getOrganization().getCode());
event.setAfterTypeCode(FastTestDataset.PROVINCE.getCode());
event.setAfterTypeOrgCode(FastTestDataset.PROVINCE.getOrganization().getCode());
event.apply();
event.addTransition(FastTestDataset.CAMBODIA.getServerObject(), FastTestDataset.PROV_CENTRAL.getServerObject(), TransitionType.REASSIGN, TransitionImpact.FULL);
Assert.assertEquals(1, event.getTransitions().size());
Transition.removeAll(FastTestDataset.COUNTRY.getServerObject());
Assert.assertEquals(0, event.getTransitions().size());
} finally {
event.delete();
}
}
use of net.geoprism.registry.graph.transition.TransitionEvent in project geoprism-registry by terraframe.
the class TransitionEventTest method testPage.
@Test
@Request
public void testPage() {
TransitionEvent event = new TransitionEvent();
try {
Date date = FastTestDataset.DEFAULT_OVER_TIME_DATE;
LocalizedValue expectedDescription = new LocalizedValue("Test");
LocalizedValueConverter.populate(event, TransitionEvent.DESCRIPTION, expectedDescription);
event.setEventDate(date);
event.setBeforeTypeCode(FastTestDataset.COUNTRY.getCode());
event.setBeforeTypeOrgCode(FastTestDataset.COUNTRY.getOrganization().getCode());
event.setAfterTypeCode(FastTestDataset.PROVINCE.getCode());
event.setAfterTypeOrgCode(FastTestDataset.PROVINCE.getOrganization().getCode());
event.apply();
Page<TransitionEvent> page = TransitionEvent.page(10, 1, null);
Assert.assertEquals(new Long(1), page.getCount());
Assert.assertEquals(new Integer(1), page.getPageNumber());
Assert.assertEquals(new Integer(10), page.getPageSize());
Assert.assertEquals(event.getOid(), page.getResults().get(0).getOid());
} finally {
event.delete();
}
}
use of net.geoprism.registry.graph.transition.TransitionEvent in project geoprism-registry by terraframe.
the class TransitionEventTest method testGetHistoricalReportWithPage.
@Test
@Request
public void testGetHistoricalReportWithPage() {
TransitionEvent event = new TransitionEvent();
try {
LocalizedValueConverter.populate(event, TransitionEvent.DESCRIPTION, new LocalizedValue("Test"));
event.setEventDate(FastTestDataset.DEFAULT_OVER_TIME_DATE);
event.setBeforeTypeCode(FastTestDataset.COUNTRY.getCode());
event.setAfterTypeCode(FastTestDataset.PROVINCE.getCode());
event.setBeforeTypeOrgCode(FastTestDataset.COUNTRY.getOrganization().getCode());
event.setAfterTypeOrgCode(FastTestDataset.PROVINCE.getOrganization().getCode());
event.apply();
event.addTransition(FastTestDataset.CAMBODIA.getServerObject(), FastTestDataset.PROV_CENTRAL.getServerObject(), TransitionType.REASSIGN, TransitionImpact.FULL);
Page<HistoricalRow> page = HistoricalRow.getHistoricalReport(FastTestDataset.PROVINCE.getServerObject(), FastTestDataset.DEFAULT_OVER_TIME_DATE, FastTestDataset.DEFAULT_OVER_TIME_DATE, 2, 10);
Assert.assertEquals(new Long(1L), page.getCount());
Assert.assertEquals(0, page.getResults().size());
} catch (Exception e) {
e.printStackTrace();
} finally {
event.delete();
}
}
use of net.geoprism.registry.graph.transition.TransitionEvent in project geoprism-registry by terraframe.
the class TransitionEventTest method testRemoveEventsBySource.
@Test
@Request
public void testRemoveEventsBySource() {
TransitionEvent event = new TransitionEvent();
try {
LocalizedValueConverter.populate(event, TransitionEvent.DESCRIPTION, new LocalizedValue("Test"));
event.setEventDate(FastTestDataset.DEFAULT_OVER_TIME_DATE);
event.setBeforeTypeCode(FastTestDataset.COUNTRY.getCode());
event.setBeforeTypeOrgCode(FastTestDataset.COUNTRY.getOrganization().getCode());
event.setAfterTypeCode(FastTestDataset.PROVINCE.getCode());
event.setAfterTypeOrgCode(FastTestDataset.PROVINCE.getOrganization().getCode());
event.apply();
event.addTransition(FastTestDataset.CAMBODIA.getServerObject(), FastTestDataset.PROV_CENTRAL.getServerObject(), TransitionType.REASSIGN, TransitionImpact.FULL);
Assert.assertEquals(1, TransitionEvent.getAll(FastTestDataset.COUNTRY.getServerObject()).size());
TransitionEvent.removeAll(FastTestDataset.COUNTRY.getServerObject());
Assert.assertEquals(0, TransitionEvent.getAll(FastTestDataset.COUNTRY.getServerObject()).size());
} finally {
event.delete();
}
}
Aggregations