Search in sources :

Example 1 with TransitionEvent

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;
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) TransitionEvent(net.geoprism.registry.graph.transition.TransitionEvent) Date(java.util.Date) Request(com.runwaysdk.session.Request)

Example 2 with TransitionEvent

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();
    }
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) TransitionEvent(net.geoprism.registry.graph.transition.TransitionEvent) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 3 with TransitionEvent

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();
    }
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) TransitionEvent(net.geoprism.registry.graph.transition.TransitionEvent) Date(java.util.Date) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 4 with TransitionEvent

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();
    }
}
Also used : HistoricalRow(net.geoprism.registry.view.HistoricalRow) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) TransitionEvent(net.geoprism.registry.graph.transition.TransitionEvent) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException) IOException(java.io.IOException) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 5 with TransitionEvent

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();
    }
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) TransitionEvent(net.geoprism.registry.graph.transition.TransitionEvent) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

Request (com.runwaysdk.session.Request)17 TransitionEvent (net.geoprism.registry.graph.transition.TransitionEvent)17 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)17 Test (org.junit.Test)16 HistoricalRow (net.geoprism.registry.view.HistoricalRow)4 Date (java.util.Date)3 Transition (net.geoprism.registry.graph.transition.Transition)3 JsonArray (com.google.gson.JsonArray)2 JsonObject (com.google.gson.JsonObject)2 QueryFactory (com.runwaysdk.query.QueryFactory)2 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)2 TaskQuery (net.geoprism.registry.task.TaskQuery)2 ProgrammingErrorException (com.runwaysdk.dataaccess.ProgrammingErrorException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Task (net.geoprism.registry.task.Task)1 Row (org.apache.poi.ss.usermodel.Row)1 Sheet (org.apache.poi.ss.usermodel.Sheet)1