use of org.devgateway.ocds.web.rest.controller.request.LangYearFilterPagingRequest in project ocvn by devgateway.
the class AverageTenderAndAwardsExcelControllerTest method bidTimelineExcelChart.
@Test
public void bidTimelineExcelChart() throws Exception {
LangYearFilterPagingRequest filter = getLangYearFilterMockRequest();
averageTenderAndAwardsExcelController.bidTimelineExcelChart(filter, mockHttpServletResponse);
final byte[] responseOutput = mockHttpServletResponse.getContentAsByteArray();
final Workbook workbook = new XSSFWorkbook(new ByteArrayInputStream(responseOutput));
Assert.assertNotNull(workbook);
final Sheet sheet = workbook.getSheet(ChartType.stackedbar.toString());
Assert.assertNotNull("check chart type, sheet name should be the same as the type", sheet);
final XSSFDrawing drawing = (XSSFDrawing) sheet.getDrawingPatriarch();
final List<XSSFChart> charts = drawing.getCharts();
Assert.assertEquals("number of charts", 1, charts.size());
final XSSFChart chart = charts.get(0);
Assert.assertEquals("chart title", translationService.getValue(filter.getLanguage(), "charts:bidPeriod:title"), chart.getTitle().getString());
final List<? extends XSSFChartAxis> axis = chart.getAxis();
Assert.assertEquals("number of axis", 2, axis.size());
final CTChart ctChart = chart.getCTChart();
Assert.assertEquals("Check if we have 1 bar chart", 1, ctChart.getPlotArea().getBarChartArray().length);
}
use of org.devgateway.ocds.web.rest.controller.request.LangYearFilterPagingRequest in project ocvn by devgateway.
the class TenderPercentagesExcelControllerTest method numberTendersUsingEBidExcelChart.
@Test
public void numberTendersUsingEBidExcelChart() throws Exception {
LangYearFilterPagingRequest filter = getLangYearFilterMockRequest();
tenderPercentagesExcelController.numberTendersUsingEBidExcelChart(filter, mockHttpServletResponse);
final byte[] responseOutput = mockHttpServletResponse.getContentAsByteArray();
final Workbook workbook = new XSSFWorkbook(new ByteArrayInputStream(responseOutput));
Assert.assertNotNull(workbook);
final Sheet sheet = workbook.getSheet(ChartType.area.toString());
Assert.assertNotNull("check chart type, sheet name should be the same as the type", sheet);
final XSSFDrawing drawing = (XSSFDrawing) sheet.getDrawingPatriarch();
final List<XSSFChart> charts = drawing.getCharts();
Assert.assertEquals("number of charts", 1, charts.size());
final XSSFChart chart = charts.get(0);
Assert.assertEquals("chart title", translationService.getValue(filter.getLanguage(), "charts:nrEBid:title"), chart.getTitle().getString());
final List<? extends XSSFChartAxis> axis = chart.getAxis();
Assert.assertEquals("number of axis", 2, axis.size());
final CTChart ctChart = chart.getCTChart();
Assert.assertEquals("Check if we have 1 area chart", 1, ctChart.getPlotArea().getAreaChartArray().length);
}
use of org.devgateway.ocds.web.rest.controller.request.LangYearFilterPagingRequest in project ocvn by devgateway.
the class TenderPercentagesExcelControllerTest method tendersWithLinkedProcurementPlanExcelChart.
@Test
public void tendersWithLinkedProcurementPlanExcelChart() throws Exception {
LangYearFilterPagingRequest filter = getLangYearFilterMockRequest();
tenderPercentagesExcelController.tendersWithLinkedProcurementPlanExcelChart(filter, mockHttpServletResponse);
final byte[] responseOutput = mockHttpServletResponse.getContentAsByteArray();
final Workbook workbook = new XSSFWorkbook(new ByteArrayInputStream(responseOutput));
Assert.assertNotNull(workbook);
final Sheet sheet = workbook.getSheet(ChartType.area.toString());
Assert.assertNotNull("check chart type, sheet name should be the same as the type", sheet);
final XSSFDrawing drawing = (XSSFDrawing) sheet.getDrawingPatriarch();
final List<XSSFChart> charts = drawing.getCharts();
Assert.assertEquals("number of charts", 1, charts.size());
final XSSFChart chart = charts.get(0);
Assert.assertEquals("chart title", translationService.getValue(filter.getLanguage(), "charts:percentWithTenders:title"), chart.getTitle().getString());
final List<? extends XSSFChartAxis> axis = chart.getAxis();
Assert.assertEquals("number of axis", 2, axis.size());
final CTChart ctChart = chart.getCTChart();
Assert.assertEquals("Check if we have 1 area chart", 1, ctChart.getPlotArea().getAreaChartArray().length);
}
use of org.devgateway.ocds.web.rest.controller.request.LangYearFilterPagingRequest in project ocvn by devgateway.
the class TenderPriceExcelControllerTest method procurementMethodExcelChart.
@Test
public void procurementMethodExcelChart() throws Exception {
LangYearFilterPagingRequest filter = getLangYearFilterMockRequest();
tenderPriceExcelController.procurementMethodExcelChart(filter, mockHttpServletResponse);
final byte[] responseOutput = mockHttpServletResponse.getContentAsByteArray();
final Workbook workbook = new XSSFWorkbook(new ByteArrayInputStream(responseOutput));
Assert.assertNotNull(workbook);
final Sheet sheet = workbook.getSheet(ChartType.barcol.toString());
Assert.assertNotNull("check chart type, sheet name should be the same as the type", sheet);
final XSSFDrawing drawing = (XSSFDrawing) sheet.getDrawingPatriarch();
final List<XSSFChart> charts = drawing.getCharts();
Assert.assertEquals("number of charts", 1, charts.size());
final XSSFChart chart = charts.get(0);
Assert.assertEquals("chart title", translationService.getValue(filter.getLanguage(), "charts:procurementMethod:title"), chart.getTitle().getString());
final List<? extends XSSFChartAxis> axis = chart.getAxis();
Assert.assertEquals("number of axis", 2, axis.size());
final CTChart ctChart = chart.getCTChart();
Assert.assertEquals("Check if we have 1 bar chart", 1, ctChart.getPlotArea().getBarChartArray().length);
}
use of org.devgateway.ocds.web.rest.controller.request.LangYearFilterPagingRequest in project oc-explorer by devgateway.
the class AbstractExcelControllerTest method getLangYearFilterMockRequest.
public LangYearFilterPagingRequest getLangYearFilterMockRequest() {
LangYearFilterPagingRequest filter = new LangYearFilterPagingRequest();
filter.setLanguage(SettingsUtils.DEFAULT_LANGUAGE);
return filter;
}
Aggregations