Search in sources :

Example 11 with SortInfo

use of com.extjs.gxt.ui.client.data.SortInfo in project activityinfo by bedatadriven.

the class GetSitesTest method linkedSitesFilteredByIndicator.

@Test
@OnDataSet("/dbunit/sites-linked.db.xml")
public void linkedSitesFilteredByIndicator() {
    setUser(1);
    GetSites cmd = new GetSites();
    cmd.filter().addRestriction(DimensionType.Indicator, 1);
    cmd.setSortInfo(new SortInfo("locationName", SortDir.ASC));
    SiteResult result = execute(cmd);
    assertThat(result.getData().size(), equalTo(2));
    SiteDTO site1 = result.getData().get(0);
    SiteDTO site2 = result.getData().get(1);
    System.out.println(site1.getProperties());
    System.out.println(site2.getProperties());
    assertThat(site1.getId(), equalTo(1));
    assertThat(site1.getLocationName(), equalTo("Penekusu Kivu"));
    assertThat(site1.getActivityId(), equalTo(1));
    assertThat((Double) site1.getIndicatorValue(1), equalTo(1500d));
    assertThat(site2.getId(), equalTo(2));
    assertThat(site2.getLocationName(), equalTo("Penekusu Kivu 2"));
    assertThat(site2.getActivityId(), equalTo(1));
    assertThat((Double) site2.getIndicatorValue(1), equalTo(400d));
}
Also used : SiteResult(org.activityinfo.legacy.shared.command.result.SiteResult) GetSites(org.activityinfo.legacy.shared.command.GetSites) SiteDTO(org.activityinfo.legacy.shared.model.SiteDTO) SortInfo(com.extjs.gxt.ui.client.data.SortInfo) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Aggregations

SortInfo (com.extjs.gxt.ui.client.data.SortInfo)11 GetSites (org.activityinfo.legacy.shared.command.GetSites)10 SiteDTO (org.activityinfo.legacy.shared.model.SiteDTO)9 Test (org.junit.Test)9 SiteResult (org.activityinfo.legacy.shared.command.result.SiteResult)5 OnDataSet (org.activityinfo.server.database.OnDataSet)4 Ignore (org.junit.Ignore)2 LocalDate (com.bedatadriven.rebar.time.calendar.LocalDate)1 TableData (org.activityinfo.legacy.shared.reports.content.TableData)1 TableColumn (org.activityinfo.legacy.shared.reports.model.TableColumn)1 FormTree (org.activityinfo.model.formTree.FormTree)1 ImportModel (org.activityinfo.ui.client.component.importDialog.model.ImportModel)1 PastedTable (org.activityinfo.ui.client.component.importDialog.model.source.PastedTable)1 ValidatedRowTable (org.activityinfo.ui.client.component.importDialog.model.validation.ValidatedRowTable)1