use of net.geoprism.registry.task.TaskQuery in project geoprism-registry by terraframe.
the class TransitionEventTest method testAddTransitionSameType.
@Test
@Request
public void testAddTransitionSameType() {
long beforeCount = new TaskQuery(new QueryFactory()).getCount();
TransitionEvent event = new TransitionEvent();
try {
LocalizedValueConverter.populate(event, TransitionEvent.DESCRIPTION, new LocalizedValue("Test"));
event.setEventDate(FastTestDataset.DEFAULT_OVER_TIME_DATE);
event.setBeforeTypeCode(FastTestDataset.PROVINCE.getCode());
event.setBeforeTypeOrgCode(FastTestDataset.PROVINCE.getOrganization().getCode());
event.setAfterTypeCode(FastTestDataset.PROVINCE.getCode());
event.setAfterTypeOrgCode(FastTestDataset.PROVINCE.getOrganization().getCode());
event.apply();
Transition transition = event.addTransition(FastTestDataset.PROV_WESTERN.getServerObject(), FastTestDataset.PROV_CENTRAL.getServerObject(), TransitionType.REASSIGN, TransitionImpact.FULL);
Assert.assertEquals(3, Task.getTasks(transition.getOid()).size());
List<Transition> transitions = event.getTransitions();
Assert.assertEquals(1, transitions.size());
transition = transitions.get(0);
VertexServerGeoObject source = transition.getSourceVertex();
VertexServerGeoObject target = transition.getTargetVertex();
Assert.assertEquals(FastTestDataset.PROV_WESTERN.getCode(), source.getCode());
Assert.assertEquals(FastTestDataset.PROV_CENTRAL.getCode(), target.getCode());
} finally {
event.delete();
}
// Ensure that the unresolved tasks are deleted on event delete
Assert.assertEquals(beforeCount, new TaskQuery(new QueryFactory()).getCount());
}
use of net.geoprism.registry.task.TaskQuery in project geoprism-registry by terraframe.
the class TransitionEventTest method testAddTransition.
@Test
@Request
public void testAddTransition() {
long beforeCount = new TaskQuery(new QueryFactory()).getCount();
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();
Transition transition = event.addTransition(FastTestDataset.CAMBODIA.getServerObject(), FastTestDataset.PROV_CENTRAL.getServerObject(), TransitionType.DOWNGRADE, TransitionImpact.FULL);
Assert.assertEquals(6, Task.getTasks(transition.getOid()).size());
List<Transition> transitions = event.getTransitions();
Assert.assertEquals(1, transitions.size());
transition = transitions.get(0);
VertexServerGeoObject source = transition.getSourceVertex();
VertexServerGeoObject target = transition.getTargetVertex();
Assert.assertEquals(FastTestDataset.CAMBODIA.getCode(), source.getCode());
Assert.assertEquals(FastTestDataset.PROV_CENTRAL.getCode(), target.getCode());
} finally {
event.delete();
}
// Ensure that the unresolved tasks are deleted on event delete
Assert.assertEquals(beforeCount, new TaskQuery(new QueryFactory()).getCount());
}
Aggregations