use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class OcdsControllerTest method ocdsReleases.
@Test
public void ocdsReleases() throws Exception {
final List<Release> releases = ocdsController.ocdsReleases(new YearFilterPagingRequest());
Assert.assertEquals(3, releases.size());
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class TenderPercentagesControllerTest method percentTendersWithLinkedProcurementPlan.
@Test
public void percentTendersWithLinkedProcurementPlan() throws Exception {
final List<DBObject> percentTendersWithLinkedProcurementPlan = tenderPercentagesController.percentTendersWithLinkedProcurementPlan(new YearFilterPagingRequest());
final DBObject first = percentTendersWithLinkedProcurementPlan.get(0);
int year = (int) first.get(TenderPercentagesController.Keys.YEAR);
int totalTendersWithLinkedProcurementPlan = (int) first.get(TenderPercentagesController.Keys.TOTAL_TENDERS_WITH_LINKED_PROCUREMENT_PLAN);
int totalTenders = (int) first.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
double percentTenders = (double) first.get(TenderPercentagesController.Keys.PERCENT_TENDERS);
Assert.assertEquals(2014, year);
Assert.assertEquals(1, totalTendersWithLinkedProcurementPlan);
Assert.assertEquals(1, totalTenders);
Assert.assertEquals(100.0, percentTenders, 0);
final DBObject second = percentTendersWithLinkedProcurementPlan.get(1);
year = (int) second.get(TenderPercentagesController.Keys.YEAR);
totalTendersWithLinkedProcurementPlan = (int) second.get(TenderPercentagesController.Keys.TOTAL_TENDERS_WITH_LINKED_PROCUREMENT_PLAN);
totalTenders = (int) second.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
percentTenders = (double) second.get(TenderPercentagesController.Keys.PERCENT_TENDERS);
Assert.assertEquals(2015, year);
Assert.assertEquals(2, totalTendersWithLinkedProcurementPlan);
Assert.assertEquals(2, totalTenders);
Assert.assertEquals(100.0, percentTenders, 0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class TenderPercentagesControllerTest method percentTendersCancelled.
@Test
public void percentTendersCancelled() throws Exception {
final List<DBObject> percentTendersCancelled = tenderPercentagesController.percentTendersCancelled(new YearFilterPagingRequest());
final DBObject first = percentTendersCancelled.get(0);
int year = (int) first.get(TenderPercentagesController.Keys.YEAR);
int totalTenders = (int) first.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
int totalCancelled = (int) first.get(TenderPercentagesController.Keys.TOTAL_CANCELLED);
double percentCancelled = (double) first.get(TenderPercentagesController.Keys.PERCENT_CANCELLED);
Assert.assertEquals(2014, year);
Assert.assertEquals(1, totalTenders);
Assert.assertEquals(0, totalCancelled);
Assert.assertEquals(0.0, percentCancelled, 0);
final DBObject second = percentTendersCancelled.get(1);
year = (int) second.get(TenderPercentagesController.Keys.YEAR);
totalTenders = (int) second.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
totalCancelled = (int) second.get(TenderPercentagesController.Keys.TOTAL_CANCELLED);
percentCancelled = (double) second.get(TenderPercentagesController.Keys.PERCENT_CANCELLED);
Assert.assertEquals(2015, year);
Assert.assertEquals(2, totalTenders);
Assert.assertEquals(0, totalCancelled);
Assert.assertEquals(0.0, percentCancelled, 0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class TopTenControllerTest method topTenLargestTenders.
@Test
public void topTenLargestTenders() throws Exception {
final List<DBObject> topTenLargestTenders = topTenController.topTenLargestTenders(new YearFilterPagingRequest());
Assert.assertEquals(3, topTenLargestTenders.size());
final DBObject first = topTenLargestTenders.get(0);
BasicDBObject tender = (BasicDBObject) first.get("tender");
BasicDBObject value = (BasicDBObject) tender.get("value");
double amount = (double) value.get("amount");
Assert.assertEquals(600000.0, amount, 0);
final DBObject second = topTenLargestTenders.get(1);
tender = (BasicDBObject) second.get("tender");
value = (BasicDBObject) tender.get("value");
amount = (double) value.get("amount");
Assert.assertEquals(400000.0, amount, 0);
final DBObject third = topTenLargestTenders.get(2);
tender = (BasicDBObject) third.get("tender");
value = (BasicDBObject) tender.get("value");
amount = (double) value.get("amount");
Assert.assertEquals(9000.0, amount, 0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project oc-explorer by devgateway.
the class TotalCancelledTendersByYearControllerTest method totalCancelledTendersByYear.
@Test
public void totalCancelledTendersByYear() throws Exception {
final List<DBObject> totalCancelledTendersByYear = totalCancelledTendersByYearController.totalCancelledTendersByYear(new YearFilterPagingRequest());
Assert.assertEquals(0, totalCancelledTendersByYear.size());
}
Aggregations