use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class TenderPriceByTypeYearControllerTest method tenderPriceByProcurementMethod.
@Test
public void tenderPriceByProcurementMethod() throws Exception {
final List<DBObject> tenderPriceByProcurementMethod = tenderPriceByTypeYearController.tenderPriceByProcurementMethod(new YearFilterPagingRequest());
final DBObject first = tenderPriceByProcurementMethod.get(0);
String procurementMethod = (String) first.get(TenderPriceByTypeYearController.Keys.PROCUREMENT_METHOD);
Number totalTenderAmount = (Number) first.get(TenderPriceByTypeYearController.Keys.TOTAL_TENDER_AMOUNT);
Assert.assertEquals("selective", procurementMethod);
Assert.assertEquals(600000.0, totalTenderAmount.doubleValue(), 0);
final DBObject second = tenderPriceByProcurementMethod.get(1);
procurementMethod = (String) second.get(TenderPriceByTypeYearController.Keys.PROCUREMENT_METHOD);
totalTenderAmount = (Number) second.get(TenderPriceByTypeYearController.Keys.TOTAL_TENDER_AMOUNT);
Assert.assertEquals("open", procurementMethod);
Assert.assertEquals(9000.0, totalTenderAmount.doubleValue(), 0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class TendersByItemClassificationTest method tendersByItemClassification.
@Test
public void tendersByItemClassification() throws Exception {
final List<DBObject> numberOfTendersByItem = tendersByItemClassification.tendersByItemClassification(new YearFilterPagingRequest());
final DBObject first = numberOfTendersByItem.get(0);
String id = (String) first.get(Fields.UNDERSCORE_ID);
String description = (String) first.get(TendersByItemClassification.Keys.DESCRIPTION);
int totalTenders = (int) first.get(TendersByItemClassification.Keys.TOTAL_TENDERS);
double totalTenderAmount = (double) first.get(TendersByItemClassification.Keys.TOTAL_TENDER_AMOUNT);
Assert.assertEquals("09100000", id);
Assert.assertEquals("Fuels", description);
Assert.assertEquals(1, totalTenders);
Assert.assertEquals(9000.0, totalTenderAmount, 0);
final DBObject second = numberOfTendersByItem.get(1);
id = (String) second.get(Fields.UNDERSCORE_ID);
description = (String) second.get(TendersByItemClassification.Keys.DESCRIPTION);
totalTenders = (int) second.get(TendersByItemClassification.Keys.TOTAL_TENDERS);
totalTenderAmount = (double) second.get(TendersByItemClassification.Keys.TOTAL_TENDER_AMOUNT);
Assert.assertEquals("45233130", id);
Assert.assertEquals("Construction work for highways", description);
Assert.assertEquals(2, totalTenders);
Assert.assertEquals(1000000, totalTenderAmount, 0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class TenderPercentagesControllerTest method percentTendersUsingEBid.
@Test
public void percentTendersUsingEBid() throws Exception {
final List<DBObject> percentTendersUsingEBid = tenderPercentagesController.percentTendersUsingEBid(new YearFilterPagingRequest());
final DBObject first = percentTendersUsingEBid.get(0);
int year = (int) first.get(TenderPercentagesController.Keys.YEAR);
int totalTenders = (int) first.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
int totalTendersUsingEbid = (int) first.get(TenderPercentagesController.Keys.TOTAL_TENDERS_USING_EBID);
double percentageTendersUsingEbid = (double) first.get(TenderPercentagesController.Keys.PERCENTAGE_TENDERS_USING_EBID);
Assert.assertEquals(2014, year);
Assert.assertEquals(1, totalTenders);
Assert.assertEquals(1, totalTendersUsingEbid);
Assert.assertEquals(100.0, percentageTendersUsingEbid, 0);
final DBObject second = percentTendersUsingEBid.get(1);
year = (int) second.get(TenderPercentagesController.Keys.YEAR);
totalTenders = (int) second.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
totalTendersUsingEbid = (int) second.get(TenderPercentagesController.Keys.TOTAL_TENDERS_USING_EBID);
percentageTendersUsingEbid = (double) second.get(TenderPercentagesController.Keys.PERCENTAGE_TENDERS_USING_EBID);
Assert.assertEquals(2015, year);
Assert.assertEquals(1, totalTenders);
Assert.assertEquals(1, totalTendersUsingEbid);
Assert.assertEquals(100.0, percentageTendersUsingEbid, 0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.
the class TenderPercentagesControllerTest method percentTendersUsingEgp.
@Test
public void percentTendersUsingEgp() throws Exception {
final List<DBObject> percentTendersUsingEgp = tenderPercentagesController.percentTendersUsingEgp(new YearFilterPagingRequest());
final DBObject first = percentTendersUsingEgp.get(0);
int year = (int) first.get(TenderPercentagesController.Keys.YEAR);
int totalTenders = (int) first.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
int totalEgp = (int) first.get(TenderPercentagesController.Keys.TOTAL_EGP);
double percentEgp = (double) first.get(TenderPercentagesController.Keys.PERCENTAGE_EGP);
Assert.assertEquals(2014, year);
Assert.assertEquals(1, totalTenders);
Assert.assertEquals(0, totalEgp);
Assert.assertEquals(0.0, percentEgp, 0);
final DBObject second = percentTendersUsingEgp.get(1);
year = (int) second.get(TenderPercentagesController.Keys.YEAR);
totalTenders = (int) second.get(TenderPercentagesController.Keys.TOTAL_TENDERS);
totalEgp = (int) second.get(TenderPercentagesController.Keys.TOTAL_EGP);
percentEgp = (double) second.get(TenderPercentagesController.Keys.PERCENTAGE_EGP);
Assert.assertEquals(2015, year);
Assert.assertEquals(2, totalTenders);
Assert.assertEquals(1, totalEgp);
Assert.assertEquals(50.0, percentEgp, 0);
}
use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn 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);
}
Aggregations