Search in sources :

Example 16 with YearFilterPagingRequest

use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.

the class FrequentTenderersControllerTest method frequentTenderersTest.

@Test
public void frequentTenderersTest() throws Exception {
    final List<DBObject> frequentTenderers = frequentTenderersController.frequentTenderers(new YearFilterPagingRequest());
    Assert.assertEquals(0, frequentTenderers.size());
}
Also used : YearFilterPagingRequest(org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest) DBObject(com.mongodb.DBObject) Test(org.junit.Test)

Example 17 with YearFilterPagingRequest

use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.

the class OcdsControllerTest method ocdsPackages.

@Test
public void ocdsPackages() throws Exception {
    final List<ReleasePackage> releasePackages = ocdsController.ocdsPackages(new YearFilterPagingRequest());
    Assert.assertEquals(3, releasePackages.size());
}
Also used : ReleasePackage(org.devgateway.ocds.persistence.mongo.ReleasePackage) YearFilterPagingRequest(org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest) Test(org.junit.Test)

Example 18 with YearFilterPagingRequest

use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.

the class TenderPriceByTypeYearControllerTest method tenderPriceByAllBidSelectionMethods.

@Test
public void tenderPriceByAllBidSelectionMethods() throws Exception {
    final List<DBObject> tenderPriceByAllBidSelectionMethods = tenderPriceByTypeYearController.tenderPriceByAllBidSelectionMethods(new YearFilterPagingRequest());
    final DBObject first = tenderPriceByAllBidSelectionMethods.get(1);
    Number totalTenderAmount = (Number) first.get(TenderPriceByTypeYearController.Keys.TOTAL_TENDER_AMOUNT);
    String procurementMethodDetails = (String) first.get(TenderPriceByTypeYearController.Keys.PROCUREMENT_METHOD_DETAILS);
    Assert.assertEquals("Competitive offers", procurementMethodDetails);
    Assert.assertEquals(9000.0, totalTenderAmount.doubleValue(), 0);
    final DBObject second = tenderPriceByAllBidSelectionMethods.get(0);
    totalTenderAmount = (Number) second.get(TenderPriceByTypeYearController.Keys.TOTAL_TENDER_AMOUNT);
    procurementMethodDetails = (String) second.get(TenderPriceByTypeYearController.Keys.PROCUREMENT_METHOD_DETAILS);
    Assert.assertEquals("Chưa xác định", procurementMethodDetails);
    Assert.assertEquals(600000.0, totalTenderAmount.doubleValue(), 0);
}
Also used : YearFilterPagingRequest(org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest) DBObject(com.mongodb.DBObject) Test(org.junit.Test)

Example 19 with YearFilterPagingRequest

use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn 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);
}
Also used : BasicDBObject(com.mongodb.BasicDBObject) YearFilterPagingRequest(org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest) DBObject(com.mongodb.DBObject) BasicDBObject(com.mongodb.BasicDBObject) Test(org.junit.Test)

Example 20 with YearFilterPagingRequest

use of org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest in project ocvn by devgateway.

the class CorruptionRiskDashboardIndicatorsStatsControllerTest method totalFlaggedIndicatorsByIndicatorTypeByYearTest.

@Test
public void totalFlaggedIndicatorsByIndicatorTypeByYearTest() throws Exception {
    final List<DBObject> result = corruptionRiskDashboardIndicatorsStatsController.totalFlaggedIndicatorsByIndicatorTypeByYear(new YearFilterPagingRequest());
    Assert.assertEquals(1, result.size());
    Assert.assertEquals(FlagType.RIGGING.toString(), result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.TYPE));
    Assert.assertEquals(2, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.INDICATOR_COUNT));
    Assert.assertEquals(2015, result.get(0).get(CorruptionRiskDashboardIndicatorsStatsController.Keys.YEAR));
}
Also used : YearFilterPagingRequest(org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest) DBObject(com.mongodb.DBObject) Test(org.junit.Test)

Aggregations

YearFilterPagingRequest (org.devgateway.ocds.web.rest.controller.request.YearFilterPagingRequest)100 Test (org.junit.Test)98 DBObject (com.mongodb.DBObject)96 BasicDBObject (com.mongodb.BasicDBObject)13 AbstractEndPointControllerTest (org.devgateway.ocds.web.rest.controller.AbstractEndPointControllerTest)10 ArrayList (java.util.ArrayList)5 List (java.util.List)5 AbstractWebTest (org.devgateway.toolkit.web.AbstractWebTest)4 Collection (java.util.Collection)3 ApiOperation (io.swagger.annotations.ApiOperation)2 BigDecimal (java.math.BigDecimal)2 Valid (javax.validation.Valid)2 Release (org.devgateway.ocds.persistence.mongo.Release)2 ReleasePackage (org.devgateway.ocds.persistence.mongo.ReleasePackage)2 MongoConstants (org.devgateway.ocds.persistence.mongo.constants.MongoConstants)2 CacheConfig (org.springframework.cache.annotation.CacheConfig)2 Cacheable (org.springframework.cache.annotation.Cacheable)2 Aggregation (org.springframework.data.mongodb.core.aggregation.Aggregation)2 Aggregation.group (org.springframework.data.mongodb.core.aggregation.Aggregation.group)2 Aggregation.match (org.springframework.data.mongodb.core.aggregation.Aggregation.match)2