use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class CorruptionRiskDashboardIndicatorsStatsControllerTest method totalFlagsTest.
@Test
public void totalFlagsTest() throws Exception {
final List<DBObject> result = corruptionRiskDashboardIndicatorsStatsController.totalFlags(new YearFilterPagingRequest());
Assert.assertEquals(2, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.FLAGGED_COUNT));
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class CorruptionRiskDashboardIndicatorsStatsControllerTest method percentOfEligibleProjectsFlaggedByYearTest.
@Test
public void percentOfEligibleProjectsFlaggedByYearTest() throws Exception {
final List<DBObject> result = corruptionRiskDashboardIndicatorsStatsController.percentOfEligibleProjectsFlaggedByYear(new YearFilterPagingRequest());
Assert.assertEquals(6, result.size());
Assert.assertEquals(2014, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.YEAR));
Assert.assertEquals(FlagType.COLLUSION.toString(), result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.TYPE));
Assert.assertEquals(1, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_COUNT));
Assert.assertEquals(1, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_PROJECT_COUNT));
Assert.assertEquals(0, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.FLAGGED_PROJECT_COUNT));
Assert.assertTrue(BigDecimal.valueOf(0).compareTo((BigDecimal) result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.PERCENT)) == 0);
Assert.assertEquals(2014, result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.YEAR));
Assert.assertEquals(FlagType.FRAUD.toString(), result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.TYPE));
Assert.assertEquals(1, result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_COUNT));
Assert.assertEquals(1, result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_PROJECT_COUNT));
Assert.assertEquals(0, result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.FLAGGED_PROJECT_COUNT));
Assert.assertTrue(BigDecimal.ZERO.compareTo((BigDecimal) result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.PERCENT)) == 0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class CorruptionRiskDashboardIndicatorsStatsControllerTest method totalEligibleProjectsByIndicatorTypeByYearTest.
@Test
public void totalEligibleProjectsByIndicatorTypeByYearTest() throws Exception {
final List<DBObject> result = corruptionRiskDashboardIndicatorsStatsController.totalEligibleProjectsByIndicatorTypeByYear(new YearFilterPagingRequest());
Assert.assertEquals(6, result.size());
Assert.assertEquals(FlagType.COLLUSION.toString(), result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.TYPE));
Assert.assertEquals(2014, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.YEAR));
Assert.assertEquals(1, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_COUNT));
Assert.assertEquals(1, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_PROJECT_COUNT));
Assert.assertEquals(FlagType.FRAUD.toString(), result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.TYPE));
Assert.assertEquals(2014, result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.YEAR));
Assert.assertEquals(1, result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_COUNT));
Assert.assertEquals(1, result.get(1).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_PROJECT_COUNT));
Assert.assertEquals(FlagType.RIGGING.toString(), result.get(2).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.TYPE));
Assert.assertEquals(2014, result.get(2).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.YEAR));
Assert.assertEquals(1, result.get(2).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_COUNT));
Assert.assertEquals(1, result.get(2).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_PROJECT_COUNT));
Assert.assertEquals(FlagType.COLLUSION.toString(), result.get(3).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.TYPE));
Assert.assertEquals(2015, result.get(3).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.YEAR));
Assert.assertEquals(1, result.get(3).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_COUNT));
Assert.assertEquals(1, result.get(3).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.ELIGIBLE_PROJECT_COUNT));
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class CostEffectivenessVisualsControllerTest method costEffectivenessAwardAmount.
@Test
public void costEffectivenessAwardAmount() throws Exception {
final List<DBObject> costEffectivenessAwardAmount = costEffectivenessVisualsController.costEffectivenessAwardAmount(new YearFilterPagingRequest());
final DBObject first = costEffectivenessAwardAmount.get(0);
int year = (int) first.get(CostEffectivenessVisualsController.Keys.YEAR);
double totalAwardAmount = (double) first.get(CostEffectivenessVisualsController.Keys.TOTAL_AWARD_AMOUNT);
int totalAwards = (int) first.get(CostEffectivenessVisualsController.Keys.TOTAL_AWARDS);
int totalAwardsWithTender = (int) first.get(CostEffectivenessVisualsController.Keys.TOTAL_AWARDS_WITH_TENDER);
double percentageAwardsWithTender = (double) first.get(CostEffectivenessVisualsController.Keys.PERCENTAGE_AWARDS_WITH_TENDER);
Assert.assertEquals(2014, year);
Assert.assertEquals(6000000.0, totalAwardAmount, 0);
Assert.assertEquals(1, totalAwards);
Assert.assertEquals(1, totalAwardsWithTender);
Assert.assertEquals(100.0, percentageAwardsWithTender, 0);
final DBObject second = costEffectivenessAwardAmount.get(1);
year = (int) second.get(CostEffectivenessVisualsController.Keys.YEAR);
totalAwardAmount = (double) second.get(CostEffectivenessVisualsController.Keys.TOTAL_AWARD_AMOUNT);
totalAwards = (int) second.get(CostEffectivenessVisualsController.Keys.TOTAL_AWARDS);
totalAwardsWithTender = (int) second.get(CostEffectivenessVisualsController.Keys.TOTAL_AWARDS_WITH_TENDER);
percentageAwardsWithTender = (double) second.get(CostEffectivenessVisualsController.Keys.PERCENTAGE_AWARDS_WITH_TENDER);
Assert.assertEquals(2015, year);
Assert.assertEquals(40000.0, totalAwardAmount, 0);
Assert.assertEquals(1, totalAwards);
Assert.assertEquals(1, totalAwardsWithTender);
Assert.assertEquals(100.0, percentageAwardsWithTender, 0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class VNImportAndEndpointsTest method testAverageTenderPeriod.
@Test
public void testAverageTenderPeriod() {
List<DBObject> averageTenderPeriod = averageTenderAndAwardPeriodsController.averageTenderPeriod(new YearFilterPagingRequest());
DBObject root = averageTenderPeriod.get(0);
int year = (int) root.get(AverageTenderAndAwardPeriodsController.Keys.YEAR);
Assert.assertEquals(2012, year);
double n = (double) root.get("averageTenderDays");
Assert.assertEquals(15, n, 0);
root = averageTenderPeriod.get(1);
year = (int) root.get(AverageTenderAndAwardPeriodsController.Keys.YEAR);
Assert.assertEquals(2013, year);
n = (double) root.get("averageTenderDays");
Assert.assertEquals(15, n, 0);
}
Aggregations