use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class FundingByLocationControllerTest method plannedFundingByLocation.
@Test
public void plannedFundingByLocation() throws Exception {
final List<DBObject> plannedFundingByLocation = fundingByLocationController.plannedFundingByLocation(new YearFilterPagingRequest());
final DBObject first = plannedFundingByLocation.get(0);
int year = (int) first.get(FundingByLocationController.Keys.YEAR);
BasicDBObject projectLocation = (BasicDBObject) first.get(FundingByLocationController.Keys.PLANNING_BUDGET_PROJECTLOCATION);
BasicDBObject geometry = (BasicDBObject) projectLocation.get("geometry");
String geometryType = (String) geometry.get("type");
List<Double> coordinates = (List<Double>) geometry.get("coordinates");
double totalPlannedAmount = (double) first.get(FundingByLocationController.Keys.TOTAL_PLANNED_AMOUNT);
Assert.assertEquals(2016, year);
Assert.assertEquals("Point", geometryType);
Assert.assertEquals(new ArrayList<>(Arrays.asList(47.411, 28.36)), coordinates);
Assert.assertEquals(1000.0, totalPlannedAmount, 0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class FundingByLocationControllerTest method qualityPlannedFundingByLocation.
@Test
public void qualityPlannedFundingByLocation() throws Exception {
final List<DBObject> qualityPlannedFundingByLocation = fundingByLocationController.qualityPlannedFundingByLocation(new YearFilterPagingRequest());
final DBObject first = qualityPlannedFundingByLocation.get(0);
int totalPlansWithAmounts = (int) first.get(FundingByLocationController.Keys.TOTAL_PLANS_WITH_AMOUNTS);
int totalPlansWithAmountsAndLocation = (int) first.get(FundingByLocationController.Keys.TOTAL_PLANS_WITH_AMOUNTS_AND_LOCATION);
double percentPlansWithAmountsAndLocation = (double) first.get(FundingByLocationController.Keys.PERCENT_PLANS_WITH_AMOUNTS_AND_LOCATION);
Assert.assertEquals(3, totalPlansWithAmounts);
Assert.assertEquals(1, totalPlansWithAmountsAndLocation);
Assert.assertEquals(33.33, percentPlansWithAmountsAndLocation, 1E-2);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class LocationInfowindowControllerTest method tendersByLocation.
@Test
public void tendersByLocation() throws Exception {
final List<DBObject> tendersByLocation = locationInfowindowController.tendersByLocation(new YearFilterPagingRequest());
Assert.assertEquals(1, tendersByLocation.size());
final DBObject first = tendersByLocation.get(0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class CorruptionRiskDashboardIndicatorsStatsControllerTest method totalProjectsByYearTest.
@Test
public void totalProjectsByYearTest() throws Exception {
final List<DBObject> result = corruptionRiskDashboardIndicatorsStatsController.totalProjectsByYear(new YearFilterPagingRequest());
Assert.assertEquals(2, result.size());
Assert.assertEquals(2014, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.YEAR));
Assert.assertEquals(1, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.PROJECT_COUNT));
Assert.assertEquals(2015, result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.YEAR));
Assert.assertEquals(2, result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.PROJECT_COUNT));
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class CorruptionRiskDashboardIndicatorsStatsControllerTest method percentTotalProjectsFlaggedByYearTest.
@Test
public void percentTotalProjectsFlaggedByYearTest() throws Exception {
final List<DBObject> result = corruptionRiskDashboardIndicatorsStatsController.percentTotalProjectsFlaggedByYear(new YearFilterPagingRequest());
Assert.assertEquals(1, result.size());
Assert.assertEquals(2015, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.YEAR));
Assert.assertEquals(FlagType.RIGGING.toString(), result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.TYPE));
Assert.assertEquals(2, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.FLAGGED_COUNT));
Assert.assertEquals(1, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.FLAGGED_PROJECT_COUNT));
Assert.assertEquals(2, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.PROJECT_COUNT));
Assert.assertTrue(BigDecimal.valueOf(50).compareTo((BigDecimal) result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.PERCENT)) == 0);
}
Aggregations