summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java274
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java2
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartWebRuntime.java2
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/upgrade/SystemUpgrade.java124
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnHeaderRow.java6
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ReportData.java8
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/ActionHandlerTest.java470
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandlerTest.java126
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/DbUtilsTest.java352
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/RemDbUtilsTest.java258
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletControllerTest.java103
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerTest.java146
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/web/ReportsSearchListControllerTest.java69
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderRowTest.java75
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderTest.java98
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnVisualTest.java54
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabColumnValuesTest.java67
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabOrderManagerTest.java144
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabTotalValueTest.java49
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataRowTest.java65
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java90
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/HtmlFormatterTest.java117
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ReportColumnHeaderRowsTest.java54
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java75
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java60
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartD3HelperTest.java1078
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/GlobalsTest.java1314
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportDataTest.java762
28 files changed, 5838 insertions, 204 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java
index f5c641a4..f09309e1 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java
@@ -113,144 +113,144 @@ public class ChartD3Helper {
this.reportRuntime = rr;
}
- public String createVisualization(String reportID, HttpServletRequest request) throws RaptorException {
- //From annotations chart
- clearReportRuntimeBackup(request);
-
- //HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
- final Long user_id = new Long((long) UserUtils.getUserId(request));
- //String action = request.getParameter(AppConstants.RI_ACTION);
- //String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
-
- ReportHandler rh = new ReportHandler();
- ReportData reportData = null;
- HashMap<String, String> chartOptionsMap = new HashMap<String, String>();
- try {
- if(reportID !=null) {
- reportRuntime = rh.loadReportRuntime(request, reportID, true, 1);
- setChartType(reportRuntime.getChartType());
- reportData = reportRuntime.loadReportData(0, user_id.toString(), 10000,request, false);
- }
-
-
-
- String rotateLabelsStr = "";
- rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle());
- if(rotateLabelsStr.toLowerCase().equals("standard")) {
- rotateLabelsStr = "0";
- } else if (rotateLabelsStr.toLowerCase().equals("up45")) {
- rotateLabelsStr = "45";
- } else if (rotateLabelsStr.toLowerCase().equals("down45")) {
- rotateLabelsStr = "-45";
- } else if (rotateLabelsStr.toLowerCase().equals("up90")) {
- rotateLabelsStr = "90";
- } else if (rotateLabelsStr.toLowerCase().equals("down90")) {
- rotateLabelsStr = "-90";
- } else
- rotateLabelsStr = "0";
-
- String width = (AppUtils.getRequestNvlValue(request, "width").length()>0?AppUtils.getRequestNvlValue(request, "width"):(AppUtils.nvl(reportRuntime.getChartWidth()).length()>0?reportRuntime.getChartWidth():"700"));
- String height = (AppUtils.getRequestNvlValue(request, "height").length()>0?AppUtils.getRequestNvlValue(request, "height"):(AppUtils.nvl(reportRuntime.getChartHeight()).length()>0?reportRuntime.getChartHeight():"300"));
- String animationStr = (AppUtils.getRequestNvlValue(request, "animation").length()>0?AppUtils.getRequestNvlValue(request, "animation"):new Boolean(reportRuntime.isAnimateAnimatedChart()).toString());
-
- String rotateLabels = (AppUtils.getRequestNvlValue(request, "rotateLabels").length()>0?AppUtils.getRequestNvlValue(request, "rotateLabels"):(rotateLabelsStr.length()>0?rotateLabelsStr:"0"));
- String staggerLabelsStr = (AppUtils.getRequestNvlValue(request, "staggerLabels").length()>0?AppUtils.getRequestNvlValue(request, "staggerLabels"):"false");
- String showMaxMinStr = (AppUtils.getRequestNvlValue(request, "showMaxMin").length()>0?AppUtils.getRequestNvlValue(request, "showMaxMin"):"false");
- String showControlsStr = (AppUtils.getRequestNvlValue(request, "showControls").length()>0?AppUtils.getRequestNvlValue(request, "showControls"):new Boolean(reportRuntime.displayBarControls()).toString());
- String showLegendStr = (AppUtils.getRequestNvlValue(request, "showLegend").length()>0?AppUtils.getRequestNvlValue(request, "showLegend"):new Boolean(!new Boolean(reportRuntime.hideChartLegend())).toString());
- String topMarginStr = AppUtils.getRequestNvlValue(request, "topMargin");
- String topMargin = (AppUtils.nvl(topMarginStr).length()<=0)?(reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"):topMarginStr;
- String bottomMarginStr = AppUtils.getRequestNvlValue(request, "bottomMargin");
- String bottomMargin = (AppUtils.nvl(bottomMarginStr).length()<=0)?(reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"):bottomMarginStr;
- String leftMarginStr = AppUtils.getRequestNvlValue(request, "leftMargin");
- String leftMargin = (AppUtils.nvl(leftMarginStr).length()<=0)?(reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"):leftMarginStr;
- String rightMarginStr = AppUtils.getRequestNvlValue(request, "rightMargin");
- String rightMargin = (AppUtils.nvl(rightMarginStr).length()<=0)?(reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"):rightMarginStr;
- String showTitleStr = (AppUtils.getRequestNvlValue(request, "showTitle").length()>0?AppUtils.getRequestNvlValue(request, "showTitle"):new Boolean(reportRuntime.displayChartTitle()).toString());
- String subType = AppUtils.getRequestNvlValue(request, "subType").length()>0?AppUtils.getRequestNvlValue(request, "subType"):(AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():"");
- String stackedStr = AppUtils.getRequestNvlValue(request, "stacked").length()>0?AppUtils.getRequestNvlValue(request, "stacked"):new Boolean(reportRuntime.isChartStacked()).toString();
- String horizontalBar = AppUtils.getRequestNvlValue(request, "horizontalBar").length()>0?AppUtils.getRequestNvlValue(request, "horizontalBar"):new Boolean(reportRuntime.isHorizontalOrientation()).toString();
- String barRealTimeAxis = AppUtils.getRequestNvlValue(request, "barRealTimeAxis");
- String barReduceXAxisLabels = AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels").length()>0?AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels"):new Boolean(reportRuntime.isLessXaxisTickers()).toString();;
- String timeAxis = AppUtils.getRequestNvlValue(request, "timeAxis").length()>0?AppUtils.getRequestNvlValue(request, "timeAxis"):new Boolean(reportRuntime.isTimeAxis()).toString();
- String logScale = AppUtils.getRequestNvlValue(request, "logScale").length()>0?AppUtils.getRequestNvlValue(request, "logScale"):new Boolean(reportRuntime.isLogScale()).toString();
- String precision = AppUtils.getRequestNvlValue(request, "precision").length()>0?AppUtils.getRequestNvlValue(request, "precision"):"2";
-
-
- chartOptionsMap.put("width", width);
- chartOptionsMap.put("height", height);
- chartOptionsMap.put("animation", animationStr);
- chartOptionsMap.put("rotateLabels", rotateLabels);
- chartOptionsMap.put("staggerLabels", staggerLabelsStr);
- chartOptionsMap.put("showMaxMin", showMaxMinStr);
- chartOptionsMap.put("showControls", showControlsStr);
- chartOptionsMap.put("showLegend", showLegendStr);
- chartOptionsMap.put("topMargin", topMargin);
- chartOptionsMap.put("bottomMargin", bottomMargin);
- chartOptionsMap.put("leftMargin", leftMargin);
- chartOptionsMap.put("rightMargin", rightMargin);
- chartOptionsMap.put("showTitle", showTitleStr);
- chartOptionsMap.put("subType", subType);
- chartOptionsMap.put("stacked", stackedStr);
- chartOptionsMap.put("horizontalBar", horizontalBar);
- chartOptionsMap.put("timeAxis", timeAxis);
- chartOptionsMap.put("barRealTimeAxis", barRealTimeAxis);
- chartOptionsMap.put("barReduceXAxisLabels", barReduceXAxisLabels);
-
- chartOptionsMap.put("logScale", logScale);
- chartOptionsMap.put("precision", precision);
-
-
- } catch (RaptorException ex) {
- ex.printStackTrace();
- }
- return createVisualization(reportRuntime, chartOptionsMap, request);
- }
+// public String createVisualization(String reportID, HttpServletRequest request) throws RaptorException {
+// //From annotations chart
+// clearReportRuntimeBackup(request);
+//
+// //HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
+// final Long user_id = new Long((long) UserUtils.getUserId(request));
+// //String action = request.getParameter(AppConstants.RI_ACTION);
+// //String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+//
+// ReportHandler rh = new ReportHandler();
+// ReportData reportData = null;
+// HashMap<String, String> chartOptionsMap = new HashMap<String, String>();
+// try {
+// if(reportID !=null) {
+// reportRuntime = rh.loadReportRuntime(request, reportID, true, 1);
+// setChartType(reportRuntime.getChartType());
+// reportData = reportRuntime.loadReportData(0, user_id.toString(), 10000,request, false);
+// }
+//
+//
+//
+// String rotateLabelsStr = "";
+// rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle());
+// if(rotateLabelsStr.toLowerCase().equals("standard")) {
+// rotateLabelsStr = "0";
+// } else if (rotateLabelsStr.toLowerCase().equals("up45")) {
+// rotateLabelsStr = "45";
+// } else if (rotateLabelsStr.toLowerCase().equals("down45")) {
+// rotateLabelsStr = "-45";
+// } else if (rotateLabelsStr.toLowerCase().equals("up90")) {
+// rotateLabelsStr = "90";
+// } else if (rotateLabelsStr.toLowerCase().equals("down90")) {
+// rotateLabelsStr = "-90";
+// } else
+// rotateLabelsStr = "0";
+//
+// String width = (AppUtils.getRequestNvlValue(request, "width").length()>0?AppUtils.getRequestNvlValue(request, "width"):(AppUtils.nvl(reportRuntime.getChartWidth()).length()>0?reportRuntime.getChartWidth():"700"));
+// String height = (AppUtils.getRequestNvlValue(request, "height").length()>0?AppUtils.getRequestNvlValue(request, "height"):(AppUtils.nvl(reportRuntime.getChartHeight()).length()>0?reportRuntime.getChartHeight():"300"));
+// String animationStr = (AppUtils.getRequestNvlValue(request, "animation").length()>0?AppUtils.getRequestNvlValue(request, "animation"):new Boolean(reportRuntime.isAnimateAnimatedChart()).toString());
+//
+// String rotateLabels = (AppUtils.getRequestNvlValue(request, "rotateLabels").length()>0?AppUtils.getRequestNvlValue(request, "rotateLabels"):(rotateLabelsStr.length()>0?rotateLabelsStr:"0"));
+// String staggerLabelsStr = (AppUtils.getRequestNvlValue(request, "staggerLabels").length()>0?AppUtils.getRequestNvlValue(request, "staggerLabels"):"false");
+// String showMaxMinStr = (AppUtils.getRequestNvlValue(request, "showMaxMin").length()>0?AppUtils.getRequestNvlValue(request, "showMaxMin"):"false");
+// String showControlsStr = (AppUtils.getRequestNvlValue(request, "showControls").length()>0?AppUtils.getRequestNvlValue(request, "showControls"):new Boolean(reportRuntime.displayBarControls()).toString());
+// String showLegendStr = (AppUtils.getRequestNvlValue(request, "showLegend").length()>0?AppUtils.getRequestNvlValue(request, "showLegend"):new Boolean(!new Boolean(reportRuntime.hideChartLegend())).toString());
+// String topMarginStr = AppUtils.getRequestNvlValue(request, "topMargin");
+// String topMargin = (AppUtils.nvl(topMarginStr).length()<=0)?(reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"):topMarginStr;
+// String bottomMarginStr = AppUtils.getRequestNvlValue(request, "bottomMargin");
+// String bottomMargin = (AppUtils.nvl(bottomMarginStr).length()<=0)?(reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"):bottomMarginStr;
+// String leftMarginStr = AppUtils.getRequestNvlValue(request, "leftMargin");
+// String leftMargin = (AppUtils.nvl(leftMarginStr).length()<=0)?(reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"):leftMarginStr;
+// String rightMarginStr = AppUtils.getRequestNvlValue(request, "rightMargin");
+// String rightMargin = (AppUtils.nvl(rightMarginStr).length()<=0)?(reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"):rightMarginStr;
+// String showTitleStr = (AppUtils.getRequestNvlValue(request, "showTitle").length()>0?AppUtils.getRequestNvlValue(request, "showTitle"):new Boolean(reportRuntime.displayChartTitle()).toString());
+// String subType = AppUtils.getRequestNvlValue(request, "subType").length()>0?AppUtils.getRequestNvlValue(request, "subType"):(AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():"");
+// String stackedStr = AppUtils.getRequestNvlValue(request, "stacked").length()>0?AppUtils.getRequestNvlValue(request, "stacked"):new Boolean(reportRuntime.isChartStacked()).toString();
+// String horizontalBar = AppUtils.getRequestNvlValue(request, "horizontalBar").length()>0?AppUtils.getRequestNvlValue(request, "horizontalBar"):new Boolean(reportRuntime.isHorizontalOrientation()).toString();
+// String barRealTimeAxis = AppUtils.getRequestNvlValue(request, "barRealTimeAxis");
+// String barReduceXAxisLabels = AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels").length()>0?AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels"):new Boolean(reportRuntime.isLessXaxisTickers()).toString();;
+// String timeAxis = AppUtils.getRequestNvlValue(request, "timeAxis").length()>0?AppUtils.getRequestNvlValue(request, "timeAxis"):new Boolean(reportRuntime.isTimeAxis()).toString();
+// String logScale = AppUtils.getRequestNvlValue(request, "logScale").length()>0?AppUtils.getRequestNvlValue(request, "logScale"):new Boolean(reportRuntime.isLogScale()).toString();
+// String precision = AppUtils.getRequestNvlValue(request, "precision").length()>0?AppUtils.getRequestNvlValue(request, "precision"):"2";
+//
+//
+// chartOptionsMap.put("width", width);
+// chartOptionsMap.put("height", height);
+// chartOptionsMap.put("animation", animationStr);
+// chartOptionsMap.put("rotateLabels", rotateLabels);
+// chartOptionsMap.put("staggerLabels", staggerLabelsStr);
+// chartOptionsMap.put("showMaxMin", showMaxMinStr);
+// chartOptionsMap.put("showControls", showControlsStr);
+// chartOptionsMap.put("showLegend", showLegendStr);
+// chartOptionsMap.put("topMargin", topMargin);
+// chartOptionsMap.put("bottomMargin", bottomMargin);
+// chartOptionsMap.put("leftMargin", leftMargin);
+// chartOptionsMap.put("rightMargin", rightMargin);
+// chartOptionsMap.put("showTitle", showTitleStr);
+// chartOptionsMap.put("subType", subType);
+// chartOptionsMap.put("stacked", stackedStr);
+// chartOptionsMap.put("horizontalBar", horizontalBar);
+// chartOptionsMap.put("timeAxis", timeAxis);
+// chartOptionsMap.put("barRealTimeAxis", barRealTimeAxis);
+// chartOptionsMap.put("barReduceXAxisLabels", barReduceXAxisLabels);
+//
+// chartOptionsMap.put("logScale", logScale);
+// chartOptionsMap.put("precision", precision);
+//
+//
+// } catch (RaptorException ex) {
+// ex.printStackTrace();
+// }
+// return createVisualization(reportRuntime, chartOptionsMap, request);
+// }
- public String createVisualization(ReportRuntime reportRuntime, HttpServletRequest request) throws RaptorException {
-
- String rotateLabelsStr = "";
- rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle());
- if(rotateLabelsStr.toLowerCase().equals("standard")) {
- rotateLabelsStr = "0";
- } else if (rotateLabelsStr.toLowerCase().equals("up45")) {
- rotateLabelsStr = "45";
- } else if (rotateLabelsStr.toLowerCase().equals("down45")) {
- rotateLabelsStr = "-45";
- } else if (rotateLabelsStr.toLowerCase().equals("up90")) {
- rotateLabelsStr = "90";
- } else if (rotateLabelsStr.toLowerCase().equals("down90")) {
- rotateLabelsStr = "-90";
- } else
- rotateLabelsStr = "0";
-
- HashMap<String,String> chartOptionsMap = new HashMap<String, String>();
- chartOptionsMap.put("width", reportRuntime.getChartWidth());
- chartOptionsMap.put("height", reportRuntime.getChartHeight());
- chartOptionsMap.put("animation", new Boolean(reportRuntime.isAnimateAnimatedChart()).toString());
- chartOptionsMap.put("rotateLabels", rotateLabelsStr);
- chartOptionsMap.put("staggerLabels", "false");
- chartOptionsMap.put("showMaxMin", "false");
- chartOptionsMap.put("showControls", new Boolean(reportRuntime.displayBarControls()).toString());
- chartOptionsMap.put("showLegend", new Boolean(!reportRuntime.hideChartLegend()).toString());
- chartOptionsMap.put("topMargin", reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30");
- chartOptionsMap.put("bottomMargin", reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50");
- chartOptionsMap.put("leftMargin", reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100");
- chartOptionsMap.put("rightMargin", reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160");
- chartOptionsMap.put("showTitle", new Boolean(reportRuntime.displayChartTitle()).toString());
- chartOptionsMap.put("subType", (AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():""));
- chartOptionsMap.put("stacked", new Boolean(reportRuntime.isChartStacked()).toString());
- chartOptionsMap.put("horizontalBar", new Boolean(reportRuntime.isHorizontalOrientation()).toString());
- chartOptionsMap.put("timeAxis", new Boolean(reportRuntime.isTimeAxis()).toString());
- chartOptionsMap.put("barReduceXAxisLabels", new Boolean(reportRuntime.isLessXaxisTickers()).toString());
-
- chartOptionsMap.put("logScale", new Boolean(reportRuntime.isLogScale()).toString());
- chartOptionsMap.put("precision", "2");
-
-
-
- return createVisualization(reportRuntime, chartOptionsMap, request);
- }
+// public String createVisualization(ReportRuntime reportRuntime, HttpServletRequest request) throws RaptorException {
+//
+// String rotateLabelsStr = "";
+// rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle());
+// if(rotateLabelsStr.toLowerCase().equals("standard")) {
+// rotateLabelsStr = "0";
+// } else if (rotateLabelsStr.toLowerCase().equals("up45")) {
+// rotateLabelsStr = "45";
+// } else if (rotateLabelsStr.toLowerCase().equals("down45")) {
+// rotateLabelsStr = "-45";
+// } else if (rotateLabelsStr.toLowerCase().equals("up90")) {
+// rotateLabelsStr = "90";
+// } else if (rotateLabelsStr.toLowerCase().equals("down90")) {
+// rotateLabelsStr = "-90";
+// } else
+// rotateLabelsStr = "0";
+//
+// HashMap<String,String> chartOptionsMap = new HashMap<String, String>();
+// chartOptionsMap.put("width", reportRuntime.getChartWidth());
+// chartOptionsMap.put("height", reportRuntime.getChartHeight());
+// chartOptionsMap.put("animation", new Boolean(reportRuntime.isAnimateAnimatedChart()).toString());
+// chartOptionsMap.put("rotateLabels", rotateLabelsStr);
+// chartOptionsMap.put("staggerLabels", "false");
+// chartOptionsMap.put("showMaxMin", "false");
+// chartOptionsMap.put("showControls", new Boolean(reportRuntime.displayBarControls()).toString());
+// chartOptionsMap.put("showLegend", new Boolean(!reportRuntime.hideChartLegend()).toString());
+// chartOptionsMap.put("topMargin", reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30");
+// chartOptionsMap.put("bottomMargin", reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50");
+// chartOptionsMap.put("leftMargin", reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100");
+// chartOptionsMap.put("rightMargin", reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160");
+// chartOptionsMap.put("showTitle", new Boolean(reportRuntime.displayChartTitle()).toString());
+// chartOptionsMap.put("subType", (AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():""));
+// chartOptionsMap.put("stacked", new Boolean(reportRuntime.isChartStacked()).toString());
+// chartOptionsMap.put("horizontalBar", new Boolean(reportRuntime.isHorizontalOrientation()).toString());
+// chartOptionsMap.put("timeAxis", new Boolean(reportRuntime.isTimeAxis()).toString());
+// chartOptionsMap.put("barReduceXAxisLabels", new Boolean(reportRuntime.isLessXaxisTickers()).toString());
+//
+// chartOptionsMap.put("logScale", new Boolean(reportRuntime.isLogScale()).toString());
+// chartOptionsMap.put("precision", "2");
+//
+//
+//
+// return createVisualization(reportRuntime, chartOptionsMap, request);
+// }
public String createVisualization(ReportRuntime reportRuntime, HashMap<String,String> chartOptionsMap, HttpServletRequest request) throws RaptorException {
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java
index 59ae4996..0470ddb8 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java
@@ -1563,4 +1563,4 @@ public class ChartJSONHelper {
}
-}
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartWebRuntime.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartWebRuntime.java
index 3329528d..b046dabd 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartWebRuntime.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartWebRuntime.java
@@ -94,7 +94,7 @@ public class ChartWebRuntime implements Serializable {
public List getRolesCommaSeperated(HttpServletRequest request) {
Map roles = UserUtils.getRoles(request);
List roleList = null;
- StringBuffer roleBuf = new StringBuffer("");
+// StringBuffer roleBuf = new StringBuffer("");
int count = 0;
if( roles != null ) {
roleList = Arrays.asList(roles.keySet().toArray());
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/upgrade/SystemUpgrade.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/upgrade/SystemUpgrade.java
index 9c2255b4..9a427003 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/upgrade/SystemUpgrade.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/upgrade/SystemUpgrade.java
@@ -77,67 +77,67 @@ public class SystemUpgrade extends org.onap.portalsdk.analytics.RaptorObject {
}*/
} // upgradeDB
- private static void upgrateFromV1ToV2_0(HttpServletRequest request) throws Exception {
- StringBuffer log = new StringBuffer();
- log.append("Starting upgrade...<br>\n");
-
- DataSet ds = DbUtils.executeQuery("SELECT cr.rep_id, cr.sched_mailto_user_ids FROM cr_report cr");
- for(int i=0; i<ds.getRowCount(); i++) {
- String repId = ds.getString(i, 0);
- log.append("<li>Processing report ["+repId+"]: ");
-
- Connection connection = DbUtils.startTransaction();
- String emailIds = nvls(ds.getString(i, 1));
- if(emailIds.length()>0)
- try {
- log.append("Converting emails ");
- StringTokenizer st = new StringTokenizer(emailIds, ",");
- while(st.hasMoreTokens()) {
- String userId = nvls(st.nextToken());
- log.append(userId);
- if(userId.length()>0)
- DbUtils.executeUpdate(connection, "INSERT INTO cr_report_schedule_users (rep_id, user_id) VALUES ("+repId+", "+userId+")");
- log.append("-success, ");
- } // while
- log.append(" <font color=green>COMPLETED</font>; ");
- } catch(Exception e) {
- log.append("-<font color=red>FAILED</font>; ");
- }
-
- String reportXML = ReportLoader.loadCustomReportXML(repId);
- ReportDefinition rdef = ReportDefinition.unmarshal(reportXML, repId, request);
- ReportWrapper rw = new ReportWrapper(rdef.cloneCustomReport(), repId, null, null, null, null, null, null, false);
-
- for(Iterator iter=rw.getAllColumns().iterator(); iter.hasNext(); ) {
- DataColumnType col = (DataColumnType) iter.next();
- String drillDownURL = nvls(col.getDrillDownURL());
- if(drillDownURL.startsWith("dispatcher?action=custrep.run&c_master=")) {
- drillDownURL = AppUtils.getReportExecuteActionURL()+drillDownURL.substring("dispatcher?action=custrep.run&c_master=".length());
- log.append("Drill-down processed; ");
- col.setDrillDownURL(drillDownURL);
- }
- } // for
-
- reportXML = rw.marshal();
-
- /*PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File(AppUtils.getTempFolderPath()+AppUtils.getUserID(request)))));
- xmlOut.println(reportXML);
- xmlOut.close();*/
-
- try {
- ReportLoader.updateCustomReportRec(connection, rw, reportXML);
- DbUtils.commitTransaction(connection);
- log.append("<font color=green>REPORT UPDATED</font></li>\n");
- } catch(Exception e) {
- log.append("<font color=red>REPORT UPDATE FAILED</font></li>\n");
- DbUtils.rollbackTransaction(connection);
- } finally {
- DbUtils.clearConnection(connection);
- }
- } // for
-
- log.append("<br>\nSystem upgrade successfully completed...<br>\n");
- request.setAttribute("system_message", log.toString());
- } // upgrateFromV1ToV2_0
+// private static void upgrateFromV1ToV2_0(HttpServletRequest request) throws Exception {
+// StringBuffer log = new StringBuffer();
+// log.append("Starting upgrade...<br>\n");
+//
+// DataSet ds = DbUtils.executeQuery("SELECT cr.rep_id, cr.sched_mailto_user_ids FROM cr_report cr");
+// for(int i=0; i<ds.getRowCount(); i++) {
+// String repId = ds.getString(i, 0);
+// log.append("<li>Processing report ["+repId+"]: ");
+//
+// Connection connection = DbUtils.startTransaction();
+// String emailIds = nvls(ds.getString(i, 1));
+// if(emailIds.length()>0)
+// try {
+// log.append("Converting emails ");
+// StringTokenizer st = new StringTokenizer(emailIds, ",");
+// while(st.hasMoreTokens()) {
+// String userId = nvls(st.nextToken());
+// log.append(userId);
+// if(userId.length()>0)
+// DbUtils.executeUpdate(connection, "INSERT INTO cr_report_schedule_users (rep_id, user_id) VALUES ("+repId+", "+userId+")");
+// log.append("-success, ");
+// } // while
+// log.append(" <font color=green>COMPLETED</font>; ");
+// } catch(Exception e) {
+// log.append("-<font color=red>FAILED</font>; ");
+// }
+//
+// String reportXML = ReportLoader.loadCustomReportXML(repId);
+// ReportDefinition rdef = ReportDefinition.unmarshal(reportXML, repId, request);
+// ReportWrapper rw = new ReportWrapper(rdef.cloneCustomReport(), repId, null, null, null, null, null, null, false);
+//
+// for(Iterator iter=rw.getAllColumns().iterator(); iter.hasNext(); ) {
+// DataColumnType col = (DataColumnType) iter.next();
+// String drillDownURL = nvls(col.getDrillDownURL());
+// if(drillDownURL.startsWith("dispatcher?action=custrep.run&c_master=")) {
+// drillDownURL = AppUtils.getReportExecuteActionURL()+drillDownURL.substring("dispatcher?action=custrep.run&c_master=".length());
+// log.append("Drill-down processed; ");
+// col.setDrillDownURL(drillDownURL);
+// }
+// } // for
+//
+// reportXML = rw.marshal();
+//
+// /*PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File(AppUtils.getTempFolderPath()+AppUtils.getUserID(request)))));
+// xmlOut.println(reportXML);
+// xmlOut.close();*/
+//
+// try {
+// ReportLoader.updateCustomReportRec(connection, rw, reportXML);
+// DbUtils.commitTransaction(connection);
+// log.append("<font color=green>REPORT UPDATED</font></li>\n");
+// } catch(Exception e) {
+// log.append("<font color=red>REPORT UPDATE FAILED</font></li>\n");
+// DbUtils.rollbackTransaction(connection);
+// } finally {
+// DbUtils.clearConnection(connection);
+// }
+// } // for
+//
+// log.append("<br>\nSystem upgrade successfully completed...<br>\n");
+// request.setAttribute("system_message", log.toString());
+// } // upgrateFromV1ToV2_0
} // SystemUpgrade
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnHeaderRow.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnHeaderRow.java
index 8be2a68d..b85ed44e 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnHeaderRow.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnHeaderRow.java
@@ -101,9 +101,9 @@ public class ColumnHeaderRow extends Vector {
return (s == null) ? "" : s;
}
- private String nvl(String s, String sDefault) {
- return nvl(s).equals("") ? sDefault : s;
- }
+// private String nvl(String s, String sDefault) {
+// return nvl(s).equals("") ? sDefault : s;
+// }
public String getAlignment() {
return alignment;
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ReportData.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ReportData.java
index b11cfd29..d82cb654 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ReportData.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ReportData.java
@@ -88,6 +88,14 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
columnVisuals = new Vector();
} // ReportData
+ public Vector getColumnVisuals() {
+ return columnVisuals;
+ }
+
+ public void setColumnVisuals(Vector columnVisuals) {
+ this.columnVisuals = columnVisuals;
+ }
+
public int getPageNo() {
return pageNo;
} // pageNo
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/ActionHandlerTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/ActionHandlerTest.java
new file mode 100644
index 00000000..2c9a30b0
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/ActionHandlerTest.java
@@ -0,0 +1,470 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.controller;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import static org.powermock.api.mockito.PowerMockito.whenNew;
+
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.model.ReportLoader;
+import org.onap.portalsdk.analytics.model.SearchHandler;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.definition.ReportDefinition;
+import org.onap.portalsdk.analytics.model.runtime.ChartWebRuntime;
+import org.onap.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.onap.portalsdk.analytics.system.AppUtils;
+import org.onap.portalsdk.analytics.system.DbUtils;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.onap.portalsdk.analytics.xmlobj.ChartAdditionalOptions;
+import org.onap.portalsdk.analytics.xmlobj.CustomReportType;
+import org.onap.portalsdk.analytics.xmlobj.DashboardReports;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnList;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnType;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceList;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceType;
+import org.onap.portalsdk.analytics.xmlobj.MockitoTestSuite;
+import org.onap.portalsdk.analytics.xmlobj.Reports;
+import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.onap.portalsdk.core.util.SecurityCodecUtil;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.owasp.esapi.ESAPI;
+import org.owasp.esapi.Encoder;
+import org.owasp.esapi.codecs.Codec;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ AppUtils.class, UserUtils.class, ESAPI.class, AppConstants.class, AlarmSeverityEnum.class, ReportWrapper.class,
+ ReportDefinition.class, SecurityCodecUtil.class, Globals.class, DbUtils.class, ReportLoader.class })
+public class ActionHandlerTest {
+
+ @InjectMocks
+ ActionHandler actionHandler = new ActionHandler();
+
+ @Mock
+ Connection connection;
+ @Mock
+ PreparedStatement stmt;
+ @Mock
+ ResultSet rs;
+ @Mock
+ java.sql.Clob clob;
+ @Mock
+ InputStream in;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Test
+ public void reportRunExceptionTest() {
+ when(mockedRequest.getParameter("action")).thenReturn("test");
+ PowerMockito.mockStatic(AppUtils.class);
+ when(AppUtils.getRequestFlag(mockedRequest, "fromDashboard")).thenReturn(true);
+ assertEquals(actionHandler.reportRun(mockedRequest, "test").getClass(), String.class);
+ }
+
+ @Test
+ public void reportRunRaptorReportExceptionTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(ReportLoader.class);
+ PowerMockito.mockStatic(ReportWrapper.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ReportDefinition.class);
+ PowerMockito.mockStatic(ESAPI.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ when(mockedRequest.getParameter("action")).thenReturn("test");
+ when(AppUtils.getRequestFlag(mockedRequest, "fromDashboard")).thenReturn(false);
+ when(AppUtils.getRequestNvlValue(mockedRequest, "pdfAttachmentKey")).thenReturn("test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *");
+ when(Globals.getDownloadAllEmailSent()).thenReturn("test");
+ DataSet set = Mockito.mock(DataSet.class);
+ when(DbUtils.executeQuery(Matchers.anyString(), Matchers.anyInt())).thenReturn(set);
+ when(DbUtils.getConnection()).thenReturn(connection);
+ when(AppUtils.getRequestValue(mockedRequest, AppConstants.RI_REPORT_ID)).thenReturn("test2");
+ when(rr.getReportID()).thenReturn("test");
+ when(AppUtils.getRequestFlag(mockedRequest, AppConstants.RI_SHOW_BACK_BTN)).thenReturn(true);
+ when(Globals.getLoadCustomReportXml()).thenReturn("java.lang.String");
+ String str = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><CustomReportType xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xsi:type=\"xs:string\"><reportName>name</reportName><reportDescr>desc</reportDescr><chartType>type</chartType><showChartTitle>false</showChartTitle><public>false</public><createId>id</createId><pageNav>false</pageNav></CustomReportType>";
+ when(connection.prepareStatement("1")).thenReturn(stmt);
+ when(stmt.executeQuery()).thenReturn(rs);
+ when(Globals.isWeblogicServer()).thenReturn(true);
+ when(rs.getClob(1)).thenReturn(clob);
+ when(rs.next()).thenReturn(true);
+ when(clob.getAsciiStream()).thenReturn(in);
+ when(in.read(Matchers.any())).thenReturn(1);
+ when(AppUtils.getRequestNvlValue(mockedRequest, "pdfAttachmentKey")).thenReturn("test");
+ when(AppUtils.nvl(rr.getLegendLabelAngle())).thenReturn("standard");
+ when(AppUtils.getRequestNvlValue(Matchers.any(), Matchers.anyString())).thenReturn("test");
+ when(AppUtils.nvl("Y")).thenReturn("Y");
+ when(AppUtils.nvl("bottom")).thenReturn("Y");
+ when(AppUtils.nvl("test")).thenReturn("test|");
+ when(AppUtils.getRequestValue(mockedRequest, "c_dashboard")).thenReturn("1");
+ when(ReportLoader.isDashboardType("-1")).thenReturn(false);
+ ReportDefinition rdf = PowerMockito.mock(ReportDefinition.class);
+ whenNew(ReportDefinition.class)
+ .withArguments(Matchers.any(ReportWrapper.class), Matchers.any(HttpServletRequest.class))
+ .thenReturn(rdf);
+ when(ReportDefinition.unmarshal(Mockito.anyString(), Mockito.anyString(), Mockito.anyObject())).thenReturn(rdf);
+ CustomReportType crType = Mockito.mock(CustomReportType.class);
+ when(ReportWrapper.unmarshalCR(Matchers.anyString())).thenReturn(crType);
+ when(Globals.getReportWrapperFormat()).thenReturn("[Globals.getTimeFormat()]");
+ when(Globals.getTimeFormat()).thenReturn("[reportID]");
+ when(Globals.getReportUserAccess()).thenReturn("[reportID]");
+ when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(set);
+ when(set.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test");
+ whenNew(ReportRuntime.class).withArguments(Matchers.any(CustomReportType.class), Matchers.anyString(),
+ Matchers.any(HttpServletRequest.class), Matchers.anyString(), Matchers.anyString(),
+ Matchers.anyString(), Matchers.anyString(), Matchers.anyString(), Matchers.anyString(),
+ Matchers.anyBoolean()).thenReturn(rr);
+ when(ReportLoader.loadCustomReportXML("test2")).thenReturn(str);
+
+ assertEquals(actionHandler.reportRun(mockedRequest, "test").getClass(), String.class);
+ }
+
+ @Test
+ public void reportRunForCSVDownloadTest() throws Exception {
+ when(mockedRequest.getParameter("action")).thenReturn("test");
+ when(mockedRequest.getParameter("r_action")).thenReturn("report.csv.download");
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+
+ when(AppUtils.getRequestFlag(mockedRequest, "fromDashboard")).thenReturn(false);
+ when(AppUtils.getRequestNvlValue(mockedRequest, "pdfAttachmentKey")).thenReturn("");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ when(AppUtils.getRequestFlag(mockedRequest, "fromReportLog")).thenReturn(true);
+ when(rr.getReportType()).thenReturn(AppConstants.RT_LINEAR);
+ when(rr.getReportDataSQL(Matchers.anyString(), Matchers.anyInt(), Matchers.any())).thenReturn("test");
+ PowerMockito.mockStatic(ESAPI.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *");
+ when(Globals.getDownloadAllEmailSent()).thenReturn("test");
+ DataSet set = new DataSet();
+ when(DbUtils.executeQuery(Matchers.anyString(), Matchers.anyInt())).thenReturn(set);
+ assertEquals(actionHandler.reportRun(mockedRequest, "test").getClass(), String.class);
+ }
+
+ public ReportRuntime mockReportRunTime1() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ when(Globals.getReportUserAccess()).thenReturn("test");
+ ResultSet rs = PowerMockito.mock(ResultSet.class);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ when(rsmd.getColumnCount()).thenReturn(1);
+ when(rs.getMetaData()).thenReturn(rsmd);
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ // datset = new DataSet(rs);
+ when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ when(Globals.getNewScheduleData()).thenReturn("test");
+ CustomReportType customReportType = new CustomReportType();
+ DataSourceList dataSourceList = new DataSourceList();
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("[test");
+ dataColumnType.setColOnChart("LEGEND");
+ dataColumnType.setDisplayName("chart_total");
+ dataColumnType.setColId("1");
+ dataColumnType.setTableId("1");
+ dataColumnType.setColType("DATE");
+ dataColumnTypeList.add(dataColumnType);
+ customReportType.setReportType("test");
+ customReportType.setReportTitle("test");
+ customReportType.setDataSourceList(dataSourceList);
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ PowerMockito.mockStatic(UserUtils.class);
+ when(Globals.getRequestParams()).thenReturn("test");
+ when(Globals.getSessionParams()).thenReturn("test");
+ when(Globals.getSessionParamsForScheduling()).thenReturn("test");
+ PowerMockito.mockStatic(AppUtils.class);
+ when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ ReportRuntime rr = new ReportRuntime(reportWrapper, mockedRequest);
+ rr.setLegendLabelAngle("test");
+ rr.setMultiSeries(false);
+ rr.setChartType("test");
+ return rr;
+ }
+
+ @Test
+ public void reportRunTestCase1() throws Exception {
+ when(mockedRequest.getParameter("action")).thenReturn("test");
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+
+ when(AppUtils.getRequestFlag(mockedRequest, "fromDashboard")).thenReturn(false);
+ when(AppUtils.getRequestNvlValue(mockedRequest, "pdfAttachmentKey")).thenReturn("test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+
+ PowerMockito.mockStatic(ESAPI.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *");
+ when(Globals.getDownloadAllEmailSent()).thenReturn("test");
+ DataSet set = PowerMockito.mock(DataSet.class);
+ when(set.isEmpty()).thenReturn(false);
+ when(DbUtils.executeQuery(Matchers.anyString(), Matchers.anyInt())).thenReturn(set);
+ when(AppUtils.getRequestValue(mockedRequest, AppConstants.RI_REPORT_ID)).thenReturn(null);
+ PowerMockito.mockStatic(ReportLoader.class);
+ when(ReportLoader.loadCustomReportXML(Matchers.anyString())).thenReturn("test");
+ assertEquals(actionHandler.reportRun(mockedRequest, "test").getClass(), String.class);
+ }
+
+ @Test
+ public void reportDeleteTest() throws Exception {
+ PowerMockito.mockStatic(ESAPI.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AlarmSeverityEnum.class);
+ DataSet set = Mockito.mock(DataSet.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ ReportDefinition rd = PowerMockito.mock(ReportDefinition.class);
+ when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ when(AppUtils.getRequestValue(mockedRequest, AppConstants.RI_REPORT_ID)).thenReturn("1");
+ when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("1");
+ when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ when(Globals.getReportSecurity()).thenReturn("[rw.getReportID()]");
+ when(Globals.getReportUserAccess()).thenReturn("[reportID]");
+ when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(set);
+ when(Globals.getDeleteOnlyByOwner()).thenReturn(true);
+ when(Globals.getLogVariablesInSession()).thenReturn("test");
+ HttpSession session = Mockito.mock(HttpSession.class);
+ when(session.getAttribute(Matchers.anyString())).thenReturn(rr);
+ when(session.getAttribute(Matchers.anyString())).thenReturn(rd);
+ assertEquals(actionHandler.reportDelete(mockedRequest, "10").getClass(), String.class);
+ }
+
+ @Test
+ public void reportSearchTest() throws Exception {
+ PowerMockito.mockStatic(ESAPI.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ when(AppUtils.getImgFolderURL()).thenReturn("test");
+ when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ when(AppUtils.getRequestValue(mockedRequest, AppConstants.RI_F_REPORT_ID)).thenReturn("test");
+ when(AppUtils.getRequestValue(mockedRequest, AppConstants.RI_F_REPORT_NAME)).thenReturn("test");
+ when(AppUtils.getRequestValue(mockedRequest, AppConstants.RI_SORT_ORDER)).thenReturn("f_owner_id");
+ when(AppUtils.getRequestValue(mockedRequest, AppConstants.RI_LIST_CATEGORY)).thenReturn("test");
+ when(AppUtils.getRequestFlag(mockedRequest, AppConstants.RI_USER_REPORTS)).thenReturn(true);
+ when(AppUtils.getRequestFlag(mockedRequest, AppConstants.RI_PUBLIC_REPORTS)).thenReturn(true);
+ when(AppUtils.getRequestFlag(mockedRequest, AppConstants.RI_FAVORITE_REPORTS)).thenReturn(true);
+ when(AppUtils.nvl(Matchers.anyString())).thenReturn("te");
+ when(Globals.getLoadReportSearchResult()).thenReturn("test");
+ when(Globals.getLoadReportSearchRepIdSql()).thenReturn("test");
+ when(Globals.getLoadReportSearchInstr()).thenReturn("test");
+ when(Globals.getLoadReportSearchResultUser()).thenReturn("test");
+ when(Globals.getLoadReportSearchResultPublic()).thenReturn("test");
+ when(Globals.getLoadReportSearchResultFav()).thenReturn("test");
+ when(Globals.getLoadReportSearchResultSort()).thenReturn("test");
+ when(AppUtils.getRequestNvlValue(mockedRequest, "r_page")).thenReturn("10");
+ Vector<String> vc = new Vector<>();
+ vc.add("test");
+ vc.add("test2");
+ when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc);
+ when(AppUtils.isSuperUser(mockedRequest)).thenReturn(false);
+ DataSet set = Mockito.mock(DataSet.class);
+ when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(set);
+ Enumeration<String> enums;
+ Vector<String> attrs = new Vector<String>();
+ attrs.add("parent_test");
+ attrs.add("child_test");
+ enums = attrs.elements();
+ when(mockedRequest.getSession().getAttributeNames()).thenReturn(enums);
+ when(mockedRequest.getParameter("rep_id")).thenReturn("test");
+ when(mockedRequest.getParameter("rep_id_options")).thenReturn("test");
+ when(mockedRequest.getParameter("rep_name_options")).thenReturn("test");
+ when(mockedRequest.getParameter("rep_name")).thenReturn("test");
+ SearchHandler sh = Mockito.mock(SearchHandler.class);
+ whenNew(SearchHandler.class).withNoArguments().thenReturn(sh);
+ actionHandler.reportSearch(mockedRequest, "10");
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Test(expected = NullPointerException.class)
+ public void reportChartRunTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(ReportLoader.class);
+ PowerMockito.mockStatic(ReportWrapper.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ReportDefinition.class);
+ PowerMockito.mockStatic(ESAPI.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ PowerMockito.mockStatic(UserUtils.class);
+ when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ when(AppUtils.isSuperUser(mockedRequest)).thenReturn(true);
+ Map roles = new HashMap<>();
+ roles.put("role1", "test1");
+ roles.put("role2", "test2");
+ when(UserUtils.getRoles(mockedRequest)).thenReturn(roles);
+ when(mockedRequest.getParameter(AppConstants.RI_ACTION)).thenReturn("chart.data.json");
+ ChartWebRuntime cwr = Mockito.mock(ChartWebRuntime.class);
+ whenNew(ChartWebRuntime.class).withNoArguments().thenReturn(cwr);
+ when(AppUtils.getRequestValue(mockedRequest, AppConstants.RI_REPORT_ID)).thenReturn("test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ when(DbUtils.getConnection()).thenReturn(connection);
+ when(AppUtils.getRequestValue(mockedRequest, AppConstants.RI_REPORT_ID)).thenReturn("1");
+ when(rr.getReportID()).thenReturn("test");
+ when(AppUtils.getRequestFlag(mockedRequest, AppConstants.RI_SHOW_BACK_BTN)).thenReturn(true);
+ when(Globals.getLoadCustomReportXml()).thenReturn("java.lang.String");
+ String str = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><CustomReportType xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xsi:type=\"xs:string\"><reportType>Hive</reportType><reportName>name</reportName><reportDescr>desc</reportDescr><chartType>type</chartType><showChartTitle>false</showChartTitle><public>false</public><createId>id</createId><pageNav>false</pageNav></CustomReportType>";
+ when(connection.prepareStatement("1")).thenReturn(stmt);
+ when(stmt.executeQuery()).thenReturn(rs);
+ when(Globals.isWeblogicServer()).thenReturn(true);
+ when(rs.getClob(1)).thenReturn(clob);
+ when(rs.next()).thenReturn(true);
+ when(clob.getAsciiStream()).thenReturn(in);
+ when(in.read(Matchers.any())).thenReturn(1);
+ when(AppUtils.getRequestNvlValue(mockedRequest, "pdfAttachmentKey")).thenReturn("test");
+ when(AppUtils.nvl(rr.getLegendLabelAngle())).thenReturn("standard");
+ when(AppUtils.getRequestNvlValue(Matchers.any(), Matchers.anyString())).thenReturn("test");
+ when(AppUtils.nvl("Y")).thenReturn("Y");
+ when(AppUtils.nvl("bottom")).thenReturn("Y");
+ when(AppUtils.nvl("test")).thenReturn("test|");
+ when(AppUtils.getRequestValue(mockedRequest, "c_dashboard")).thenReturn("1");
+ when(ReportLoader.isDashboardType("-1")).thenReturn(false);
+ ReportDefinition rdf = PowerMockito.mock(ReportDefinition.class);
+ whenNew(ReportDefinition.class)
+ .withArguments(Matchers.any(ReportWrapper.class), Matchers.any(HttpServletRequest.class))
+ .thenReturn(rdf);
+ PowerMockito.mockStatic(ReportDefinition.class);
+ when(ReportDefinition.unmarshal(Mockito.anyString(), Mockito.anyString(), Mockito.anyObject())).thenReturn(rdf);
+ CustomReportType crType = Mockito.mock(CustomReportType.class);
+ when(ReportWrapper.unmarshalCR(Matchers.anyString())).thenReturn(crType);
+ when(Globals.getReportWrapperFormat()).thenReturn("[Globals.getTimeFormat()]");
+ when(Globals.getTimeFormat()).thenReturn("[reportID]");
+ when(Globals.getReportUserAccess()).thenReturn("[reportID]");
+ DataSet set = PowerMockito.mock(DataSet.class);
+ when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(set);
+ when(set.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test");
+ whenNew(ReportRuntime.class).withArguments(Matchers.any(CustomReportType.class), Matchers.anyString(),
+ Matchers.any(HttpServletRequest.class), Matchers.anyString(), Matchers.anyString(),
+ Matchers.anyString(), Matchers.anyString(), Matchers.anyString(), Matchers.anyString(),
+ Matchers.anyBoolean()).thenReturn(rr);
+ DataSourceList dsl = Mockito.mock(DataSourceList.class);
+ List<DataSourceType> list = new ArrayList<>();
+ DataSourceType sr1 = new DataSourceType();
+ sr1.setComment("test");
+ sr1.setRefDefinition("test");
+ sr1.setDataColumnList(new DataColumnList());
+ sr1.setTableId("test");
+ sr1.setTableName("test");
+ list.add(sr1);
+ when(crType.getDataSourceList()).thenReturn(dsl);
+ when(dsl.getDataSource()).thenReturn(list);
+ DashboardReports rps = Mockito.mock(DashboardReports.class);
+ List<Reports> reportList = new ArrayList<>();
+ Reports rp = new Reports();
+ rp.setBgcolor("white");
+ rp.setReportId("1");
+ reportList.add(rp);
+ when(rdf.getDashBoardReports()).thenReturn(rps);
+ when(rps.getReportsList()).thenReturn(reportList);
+ when(ReportLoader.loadCustomReportXML("1")).thenReturn(str);
+ actionHandler.reportChartRun(mockedRequest, "10");
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandlerTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandlerTest.java
new file mode 100644
index 00000000..2fb16f15
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandlerTest.java
@@ -0,0 +1,126 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.model.pdf;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.TreeMap;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.onap.portalsdk.analytics.system.AppUtils;
+import org.onap.portalsdk.analytics.system.DbUtils;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.view.ReportData;
+import org.onap.portalsdk.analytics.xmlobj.MockitoTestSuite;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.lowagie.text.Document;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ PdfReportHandler.class, AppUtils.class, Globals.class, DbUtils.class})
+public class PdfReportHandlerTest {
+
+ @InjectMocks
+ PdfReportHandler pdfReportHandler;
+
+ @Before
+ public void init() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Test
+ public void createPdfFileContentTest() throws Exception {
+ Document doc = mock(Document.class);
+ PowerMockito.whenNew(Document.class).withNoArguments().thenReturn(doc);
+ PowerMockito.when(doc.newPage()).thenReturn(true);
+ when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ ReportRuntime rr = mock(ReportRuntime.class);
+ ReportData rd = mock(ReportData.class);
+ when(Globals.isCoverPageNeeded()).thenReturn(true);
+ when(Globals.getSessionInfoForTheCoverPage()).thenReturn("test,test1");
+ when(AppUtils.getRequestNvlValue(mockedRequest, "test1")).thenReturn("test1");
+ when(rr.isPDFCoverPage()).thenReturn(true);
+ when(rr.getReportID()).thenReturn("test");
+ when(rr.getPDFOrientation()).thenReturn("portait");
+ when(mockedRequest.getSession().getAttribute("report_runtime")).thenReturn(rr);
+ when(mockedRequest.getSession().getAttribute("dashboard_report_id")).thenReturn("test");
+ ServletContext servConxt = mock(ServletContext.class);
+ when(mockedRequest.getSession().getServletContext()).thenReturn(servConxt);
+ when(servConxt.getRealPath(File.separator)).thenReturn("testpath");
+ when(rr.getChartType()).thenReturn("test");
+ when(rr.getDisplayChart()).thenReturn(true);
+ ArrayList paramNamePDFValues = new ArrayList();
+ paramNamePDFValues.add("test1");
+ paramNamePDFValues.add("test2");
+ when(rr.getParamNameValuePairsforPDFExcel(mockedRequest, 2)).thenReturn(paramNamePDFValues);
+ when(rr.getFormFieldComments(mockedRequest)).thenReturn("test");
+ TreeMap values = new TreeMap<>();
+ values.put("test", rr);
+ TreeMap values2 = new TreeMap<>();
+ values2.put("test3", rd);
+ TreeMap values3 = new TreeMap<>();
+ values3.put("test4", "c");
+ when(mockedRequest.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP)).thenReturn(values);
+ when(mockedRequest.getSession().getAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP)).thenReturn(values2);
+ when(mockedRequest.getSession().getAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP)).thenReturn(values3);
+ pdfReportHandler.createPdfFileContent(mockedRequest, mockedResponse, 3);
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/DbUtilsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/DbUtilsTest.java
new file mode 100644
index 00000000..664e27c7
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/DbUtilsTest.java
@@ -0,0 +1,352 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.system;
+import static org.junit.Assert.*;
+
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import javax.sql.DataSource;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.error.RaptorException;
+import org.onap.portalsdk.analytics.error.ReportSQLException;
+import org.onap.portalsdk.core.web.support.AppUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({AppUtils.class, Globals.class})
+public class DbUtilsTest {
+
+ @Mock
+ DataSource dataSource;
+
+ @InjectMocks
+ DbUtils dbUtils = new DbUtils();
+
+ @Mock
+ Connection connection;
+ @Mock
+ CallableStatement stmt;
+
+ @Mock
+ Statement statement;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getConnectionTest() throws Exception
+ {
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getDatasource()).thenReturn(dataSource);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ dbUtils.getConnection();
+ }
+
+ @SuppressWarnings({ "static-access", "unchecked" })
+ @Test
+ public void getConnectionExceptionTest() throws Exception
+ {
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getDatasource()).thenThrow(SQLException.class);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ assertNull(dbUtils.getConnection());
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void clearConnectionTest() throws Exception
+ {
+ PowerMockito.mockStatic(Globals.class);
+ IDbUtils iDbUtils= PowerMockito.mock(IDbUtils.class);
+ Mockito.when(Globals.getDbUtils()).thenReturn(iDbUtils);
+ Mockito.doNothing().when(iDbUtils).clearConnection(connection);
+ Globals.getDbUtils().clearConnection(connection);
+ Mockito.when(connection.isClosed()).thenReturn(false);
+ dbUtils.clearConnection(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void clearConnection1Test() throws Exception
+ {
+ dbUtils.clearConnection(null);
+ }
+
+ @SuppressWarnings({ "static-access", "unchecked" })
+ @Test(expected = Exception.class)
+ public void clearConnectionExceptionTest() throws Exception
+ {
+ PowerMockito.mockStatic(Globals.class);
+ IDbUtils iDbUtils= PowerMockito.mock(IDbUtils.class);
+ Mockito.when(Globals.getDbUtils()).thenThrow(Exception.class);
+ Mockito.doNothing().when(iDbUtils).clearConnection(connection);
+ Globals.getDbUtils().clearConnection(connection);
+ Mockito.when(connection.isClosed()).thenReturn(false);
+ dbUtils.clearConnection(connection);
+ }
+
+ @SuppressWarnings({ "static-access", "unchecked" })
+ @Test(expected = SQLException.class)
+ public void clearConnectionException2Test() throws Exception
+ {
+ PowerMockito.mockStatic(Globals.class);
+ IDbUtils iDbUtils= PowerMockito.mock(IDbUtils.class);
+ Mockito.when(Globals.getDbUtils()).thenThrow(SQLException.class);
+ Mockito.doNothing().when(iDbUtils).clearConnection(connection);
+ Globals.getDbUtils().clearConnection(connection);
+ Mockito.when(connection.isClosed()).thenReturn(false);
+ dbUtils.clearConnection(connection);
+ }
+ @SuppressWarnings("static-access")
+ @Test
+ public void startTransactionTest() throws Exception
+ {
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getDatasource()).thenReturn(dataSource);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.doNothing().when(connection).setAutoCommit(false);
+ dbUtils.startTransaction();
+ }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = ReportSQLException.class)
+ public void startTransactionExceptionTest() throws Exception
+ {
+ Mockito.doNothing().when(connection).setAutoCommit(false);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getDatasource()).thenThrow(SQLException.class);
+ Mockito.when(dataSource.getConnection()).thenReturn(null);
+ assertNull(dbUtils.startTransaction());
+ }
+
+ @SuppressWarnings({ "static-access", "unchecked" })
+ @Test(expected = ReportSQLException.class)
+ public void startTransactionException1Test() throws Exception
+ {
+ Mockito.doNothing().when(connection).setAutoCommit(false);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getDatasource()).thenThrow(Exception.class);
+ Mockito.when(dataSource.getConnection()).thenReturn(null);
+ assertNull(dbUtils.startTransaction());
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void commitTransactionTest() throws Exception
+ {
+ Mockito.doNothing().when(connection).commit();
+ dbUtils.commitTransaction(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = RaptorException.class)
+ public void commitTransactionExceptionTest() throws Exception {
+ Mockito.doThrow(SQLException.class).when(connection).commit();
+ dbUtils.commitTransaction(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = Exception.class)
+ public void commitTransactionException2Test() throws Exception {
+ Mockito.doThrow(Exception.class).when(connection).commit();
+ dbUtils.commitTransaction(connection);
+ }
+
+// @SuppressWarnings("static-access")
+// @Test
+// public void rollbackTransactionTest() throws Exception
+// {
+// Mockito.doNothing().when(connection).rollback();
+// dbUtils.rollbackTransaction(connection);
+// }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = RaptorException.class)
+ public void rollbackTransactionExceptionTest() throws Exception {
+ Mockito.doThrow(SQLException.class).when(connection).rollback();
+ dbUtils.rollbackTransaction(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = Exception.class)
+ public void rollbackTransactionException2Test() throws Exception {
+ Mockito.doThrow(Exception.class).when(connection).rollback();
+ dbUtils.rollbackTransaction(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void executeCallTest() throws Exception
+ {
+ Mockito.when(connection.isClosed()).thenReturn(true);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getDatasource()).thenReturn(dataSource);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.when(connection.prepareCall(Matchers.anyString())).thenReturn(stmt);
+ Mockito.when(stmt.getString(1)).thenReturn("test");
+ dbUtils.executeCall(connection ,"test", false);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void executeCall1Test() throws Exception
+ {
+ Mockito.when(connection.isClosed()).thenReturn(true);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getDatasource()).thenReturn(dataSource);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.when(connection.prepareCall(Matchers.anyString())).thenReturn(stmt);
+ Mockito.when(stmt.getString(1)).thenReturn("test");
+ dbUtils.executeCall(connection ,"test", true);
+ }
+
+
+ @SuppressWarnings({ "static-access", "unchecked" })
+ @Test(expected = RaptorException.class)
+ public void executeCall2Test() throws Exception
+ {
+ Mockito.when(connection.isClosed()).thenReturn(true);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getDatasource()).thenReturn(dataSource);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.when(connection.prepareCall(Matchers.anyString())).thenThrow(SQLException.class);
+ Mockito.when(stmt.getString(1)).thenReturn("test");
+ dbUtils.executeCall(connection ,"test", true);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void executeCall3Test() throws Exception
+ {
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getDatasource()).thenReturn(dataSource);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.when(connection.isClosed()).thenReturn(true);
+ Mockito.when(connection.prepareCall(Matchers.anyString())).thenReturn(stmt);
+ Mockito.when(stmt.getString(1)).thenReturn("test");
+ dbUtils.executeCall("test", true);
+ }
+ @SuppressWarnings("static-access")
+ @Test
+ public void executeUpdateTest() throws Exception
+ {
+ Mockito.when(connection.createStatement()).thenReturn(statement);
+ Mockito.when(statement.executeUpdate(Matchers.anyString())).thenReturn(1);
+ assertEquals(dbUtils.executeUpdate(connection, "test"),1);
+ }
+
+ @SuppressWarnings({ "static-access", "unchecked" })
+ @Test(expected = RaptorException.class )
+ public void executeUpdate1Test() throws Exception
+ {
+ Mockito.when(connection.createStatement()).thenReturn(statement);
+ Mockito.when(statement.executeUpdate(Matchers.anyString())).thenThrow(SQLException.class);
+ dbUtils.executeUpdate(connection, "test");
+ }
+ @SuppressWarnings("static-access")
+ @Test
+ public void executeUpdate2Test() throws Exception
+ {
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getDatasource()).thenReturn(dataSource);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.when(connection.isClosed()).thenReturn(true);
+ Mockito.when(connection.prepareCall(Matchers.anyString())).thenReturn(stmt);
+ Mockito.when(connection.createStatement()).thenReturn(statement);
+ Mockito.when(statement.executeUpdate(Matchers.anyString())).thenReturn(1);
+ Mockito.when(stmt.getString(1)).thenReturn("test");
+ Mockito.when(Globals.getDBType()).thenReturn("oracle");
+ Mockito.doNothing().when(connection).commit();
+ dbUtils.executeUpdate("test");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void executeUpdate3Test() throws Exception
+ {
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getDatasource()).thenReturn(dataSource);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.when(connection.isClosed()).thenReturn(true);
+ Mockito.when(connection.prepareCall(Matchers.anyString())).thenReturn(stmt);
+ Mockito.when(connection.createStatement()).thenReturn(statement);
+ Mockito.when(statement.executeUpdate(Matchers.anyString())).thenReturn(1);
+ Mockito.when(stmt.getString(1)).thenReturn("test");
+ Mockito.when(Globals.getDBType()).thenReturn("oracle1");
+ Mockito.doNothing().when(connection).commit();
+ dbUtils.executeUpdate("test");
+ }
+
+
+ @SuppressWarnings("static-access")
+ @Test(expected = RaptorException.class)
+ public void executeUpdate4Test() throws Exception
+ {
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getDatasource()).thenReturn(dataSource);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.when(connection.isClosed()).thenReturn(true);
+ Mockito.when(connection.prepareCall(Matchers.anyString())).thenReturn(stmt);
+ Mockito.when(connection.createStatement()).thenReturn(statement);
+ Mockito.when(statement.executeUpdate(Matchers.anyString())).thenReturn(1);
+ Mockito.when(stmt.getString(1)).thenReturn("test");
+ Mockito.when(Globals.getDBType()).thenReturn("oracle");
+ Mockito.doThrow(SQLException.class).when(connection).commit();
+ dbUtils.executeUpdate("test");
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/RemDbUtilsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/RemDbUtilsTest.java
new file mode 100644
index 00000000..5bab7371
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/RemDbUtilsTest.java
@@ -0,0 +1,258 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.system;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.onap.portalsdk.analytics.error.RaptorException;
+import org.onap.portalsdk.analytics.error.RaptorRuntimeException;
+import org.onap.portalsdk.analytics.error.ReportSQLException;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ Globals.class, Runtime.class })
+public class RemDbUtilsTest {
+
+ @InjectMocks
+ RemDbUtils remDbUtils = new RemDbUtils();
+ Connection connection = PowerMockito.mock(Connection.class);
+
+ NullPointerException nullPointerException = new NullPointerException();
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getConnectionTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.when(utils.getRemoteConnection("test")).thenReturn(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ remDbUtils.getConnection("test");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void startTransactionTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.when(utils.getRemoteConnection("test")).thenReturn(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ remDbUtils.startTransaction("test");
+ }
+
+ @SuppressWarnings({ "static-access", "unchecked" })
+ @Test(expected = RaptorRuntimeException.class)
+ public void startTransactionExceptionTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.when(utils.getRemoteConnection("test")).thenThrow(SQLException.class);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ remDbUtils.startTransaction("test");
+ }
+
+ @SuppressWarnings({ "static-access", "unchecked" })
+ @Test(expected = RaptorException.class)
+ public void startTransactionException2Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.when(utils.getRemoteConnection("test")).thenThrow(Exception.class);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ remDbUtils.startTransaction("test");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void clearConnectionTest() throws Exception {
+ Mockito.when(connection.isClosed()).thenReturn(false);
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.doNothing().when(utils).clearConnection(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ remDbUtils.clearConnection(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void clearConnection1Test() throws Exception {
+ Mockito.when(connection.isClosed()).thenReturn(true);
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.doNothing().when(utils).clearConnection(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ remDbUtils.clearConnection(connection);
+ }
+
+ @SuppressWarnings({ "static-access", "unchecked" })
+ @Test(expected = ReportSQLException.class)
+ public void clearConnectionExceptionTest() throws Exception {
+ Mockito.when(connection.isClosed()).thenThrow(ReportSQLException.class);
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.doNothing().when(utils).clearConnection(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ remDbUtils.clearConnection(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void commitTransactionTest() throws Exception {
+ Mockito.doNothing().when(connection).commit();
+ remDbUtils.commitTransaction(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = RaptorException.class)
+ public void commitTransactionExceptionTest() throws Exception {
+ Mockito.doThrow(SQLException.class).when(connection).commit();
+ remDbUtils.commitTransaction(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = Exception.class)
+ public void commitTransactionException2Test() throws Exception {
+ Mockito.doThrow(Exception.class).when(connection).commit();
+ remDbUtils.commitTransaction(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void rollbackTransactionTest() throws Exception {
+ Mockito.doNothing().when(connection).rollback();
+ Mockito.when(connection.isClosed()).thenReturn(false);
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.doNothing().when(utils).clearConnection(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ remDbUtils.rollbackTransaction(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = RaptorException.class)
+ public void rollbackTransactionExceptionTest() throws Exception {
+ Mockito.doThrow(Exception.class).when(connection).rollback();
+ Mockito.when(connection.isClosed()).thenReturn(false);
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.doNothing().when(utils).clearConnection(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ remDbUtils.rollbackTransaction(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = Exception.class)
+ public void rollbackTransactionException2Test() throws Exception {
+ Mockito.doThrow(SQLException.class).when(connection).rollback();
+ Mockito.when(connection.isClosed()).thenReturn(false);
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.doNothing().when(utils).clearConnection(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ remDbUtils.rollbackTransaction(connection);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void executeQueryTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.when(utils.getRemoteConnection("test")).thenReturn(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ Statement stmt = PowerMockito.mock(Statement.class);
+ Mockito.when(connection.createStatement()).thenReturn(stmt);
+ ResultSet rs = PowerMockito.mock(ResultSet.class);
+ Mockito.when(stmt.executeQuery(Matchers.anyString())).thenReturn(rs);
+
+ Mockito.when(connection.isClosed()).thenReturn(false);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.doNothing().when(utils).clearConnection(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ PowerMockito.mockStatic(Runtime.class);
+ Runtime runtime = PowerMockito.mock(Runtime.class);
+ Mockito.when(Runtime.getRuntime()).thenReturn(runtime);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(2);
+ Mockito.when(rsmd.getColumnLabel(Matchers.anyInt())).thenReturn("test");
+
+ remDbUtils.executeQuery("test", "test");
+ }
+
+ @SuppressWarnings({ "static-access", "unchecked" })
+ @Test(expected = ReportSQLException.class)
+ public void executeQueryExceptionTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ RDbUtils utils = PowerMockito.mock(RDbUtils.class);
+ Mockito.when(utils.getRemoteConnection("test")).thenReturn(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+ Statement stmt = PowerMockito.mock(Statement.class);
+ Mockito.when(connection.createStatement()).thenThrow(SQLException.class);
+ ResultSet rs = PowerMockito.mock(ResultSet.class);
+ Mockito.when(stmt.executeQuery(Matchers.anyString())).thenReturn(rs);
+
+ Mockito.when(connection.isClosed()).thenReturn(false);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.doNothing().when(utils).clearConnection(connection);
+ Mockito.when(Globals.getRDbUtils()).thenReturn(utils);
+
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ PowerMockito.mockStatic(Runtime.class);
+ Runtime runtime = PowerMockito.mock(Runtime.class);
+ Mockito.when(Runtime.getRuntime()).thenReturn(runtime);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(2);
+ Mockito.when(rsmd.getColumnLabel(Matchers.anyInt())).thenReturn("test");
+
+ remDbUtils.executeQuery("test", "test");
+ }
+
+// @Test
+// public void excecuteQueryTest2() throws Exception
+// {
+// remDbUtils.executeQuery(null, "test", Integer.MAX_VALUE,"test");
+// }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletControllerTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletControllerTest.java
new file mode 100644
index 00000000..7b79c58c
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletControllerTest.java
@@ -0,0 +1,103 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.system.fusion.controller;
+
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.util.XSSFilter;
+import org.onap.portalsdk.analytics.xmlobj.MockitoTestSuite;
+import org.onap.portalsdk.core.service.DataAccessService;
+import org.owasp.esapi.ESAPI;
+import org.owasp.esapi.Encoder;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ ESAPI.class, XSSFilter.class})
+public class FileServletControllerTest {
+
+ @InjectMocks
+ FileServletController fileServletController = new FileServletController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Mock
+ DataAccessService dataAccessService;
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Test
+ public void handleRequestInternalTest() throws Exception {
+ List<Object> objs = new ArrayList<>();
+ byte [] byteVal = "test123".getBytes();
+ objs.add(byteVal);
+ PowerMockito.mockStatic(ESAPI.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ when(ESAPI.encoder()).thenReturn(encoder);
+ when(encoder.canonicalize(Matchers.anyString())).thenReturn("test");
+ when(mockedRequest.getParameter(Matchers.anyString())).thenReturn("test");
+ ServletOutputStream sos = mock(ServletOutputStream.class);
+ when(mockedResponse.getOutputStream()).thenReturn(sos);
+ when(fileServletController.getDataAccessService().executeNamedQuery(Matchers.anyString(), Matchers.anyMap(), Matchers.anyMap())).thenReturn(objs);
+ assertNull(fileServletController.handleRequestInternal(mockedRequest, mockedResponse));
+ }
+}
+
+
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerTest.java
new file mode 100644
index 00000000..491554d8
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerTest.java
@@ -0,0 +1,146 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.system.fusion.web;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.portalsdk.analytics.controller.ActionMapping;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.xmlobj.MockitoTestSuite;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.onap.portalsdk.analytics.controller.Action;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest(Globals.class)
+public class RaptorControllerTest {
+
+ @InjectMocks
+ RaptorController raptorController = new RaptorController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Test
+ public void reportTest() {
+ assertEquals(raptorController.report(mockedRequest).getViewName(), "report");
+ }
+
+ @Test
+ public void reportDS1Test() {
+ assertEquals(raptorController.reportDS1(mockedRequest).getViewName(), "reportDS1");
+ }
+
+ @Test
+ public void reportEmbeddedTest() {
+ assertEquals(raptorController.reportEmbedded(mockedRequest).getViewName(), "report_embedded");
+ }
+
+ @Test
+ public void reportSampleTest() {
+ assertEquals(raptorController.reportSample(mockedRequest).getViewName(), "report_sample");
+ }
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void reportImportTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ ActionMapping actionMapping = PowerMockito.mock(ActionMapping.class);
+ Mockito.when(Globals.getRaptorActionMapping()).thenReturn(actionMapping);
+ Mockito.when(actionMapping.getAction(Matchers.anyString())).thenReturn(null);
+ assertEquals(raptorController.reportImport(mockedRequest).getViewName(), "report_sample");
+ }
+
+ @Test
+ public void reportImport1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ ActionMapping actionMapping = PowerMockito.mock(ActionMapping.class);
+ Mockito.when(Globals.getRaptorActionMapping()).thenReturn(actionMapping);
+ Action action = PowerMockito.mock(Action.class);
+
+ Mockito.when(actionMapping.getAction(Matchers.anyString())).thenReturn(action);
+ assertEquals(raptorController.reportImport(mockedRequest).getViewName(), "report_import");
+ }
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void reportWizardExceptionTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ ActionMapping actionMapping = PowerMockito.mock(ActionMapping.class);
+ Mockito.when(Globals.getRaptorActionMapping()).thenReturn(actionMapping);
+ raptorController.reportWizard(mockedRequest, mockedResponse);
+ }
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void reportWizardTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ ActionMapping actionMapping = PowerMockito.mock(ActionMapping.class);
+ Mockito.when(Globals.getRaptorActionMapping()).thenReturn(actionMapping);
+ Action action = PowerMockito.mock(Action.class);
+ Mockito.when(actionMapping.getAction(Matchers.anyString())).thenReturn(action);
+ raptorController.reportWizard(mockedRequest, mockedResponse);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/web/ReportsSearchListControllerTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/web/ReportsSearchListControllerTest.java
new file mode 100644
index 00000000..ab3542cd
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/web/ReportsSearchListControllerTest.java
@@ -0,0 +1,69 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.system.fusion.web;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.xmlobj.MockitoTestSuite;
+
+public class ReportsSearchListControllerTest {
+ @InjectMocks
+ ReportsSearchListController reportsSearchListController = new ReportsSearchListController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Test
+ public void handleRequestInternalTest() {
+ assertNull(reportsSearchListController.handleRequestInternal(mockedRequest, mockedResponse));
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderRowTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderRowTest.java
new file mode 100644
index 00000000..bb4a1176
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderRowTest.java
@@ -0,0 +1,75 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.view;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ColumnHeaderRowTest {
+
+ public ColumnHeaderRow mockColumnHeaderRow() {
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ columnHeaderRow.setAlignment("alignment");
+ columnHeaderRow.setRowHeight("rowHeight");
+ columnHeaderRow.setDisplayWidth("displayWidth");
+ columnHeaderRow.resetNext(1);
+ return columnHeaderRow;
+ }
+
+ @Test
+ public void columnHeaderRowTest() {
+ ColumnHeaderRow columnHeaderRow = mockColumnHeaderRow();
+ assertEquals(columnHeaderRow.getAlignment(), "alignment");
+ assertEquals(columnHeaderRow.getRowHeight(), "rowHeight");
+ assertEquals(columnHeaderRow.getDisplayWidth(), "displayWidth");
+ assertFalse(columnHeaderRow.hasNext());
+ columnHeaderRow.resetNext();
+ columnHeaderRow.getNext();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ columnHeaderRow.getNext();
+ assertEquals(columnHeaderRow.getRowHeightHtml()," height=rowHeight");
+ columnHeaderRow.setRowHeight("");
+ assertEquals(columnHeaderRow.getRowHeightHtml(),"");
+ columnHeaderRow.setAlignment(null);
+ assertEquals(columnHeaderRow.getAlignment(), "alignment");
+
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderTest.java
new file mode 100644
index 00000000..7ada6cb8
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderTest.java
@@ -0,0 +1,98 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.view;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ColumnHeaderTest {
+
+ public ColumnHeader mockColumnHeader() {
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeader.setColId("colId");
+ columnHeader.setAlignment("alignment");
+ columnHeader.setColumnTitle("columnTitle");
+ columnHeader.setColumnWidth("columnWidth");
+ columnHeader.setRowSpan(1);
+ columnHeader.setVisible(true);
+ columnHeader.setLinkColId("linkColId");
+ columnHeader.setGroupLevel(2);
+ columnHeader.setStartGroup(1);
+ columnHeader.setColSpan(1);
+ columnHeader.setSortable(true);
+ return columnHeader;
+ }
+
+ @Test
+ public void columnHeader1Test() {
+ ColumnHeader columnHeader = new ColumnHeader("columnTitle");
+ assertEquals(columnHeader.getColumnTitle(), "columnTitle");
+ ColumnHeader columnHeader1 = new ColumnHeader("columnTitle", 1);
+ assertEquals(columnHeader1.getColumnSort(), 1);
+ ColumnHeader columnHeader2 = new ColumnHeader("columnTitle", "columnWidth");
+ assertEquals(columnHeader2.getColumnWidth(), "columnWidth");
+ ColumnHeader columnHeader3 = new ColumnHeader("columnTitle", "columnWidth", 1);
+ assertEquals(columnHeader3.getColSpan(), 1);
+ ColumnHeader columnHeader4 = new ColumnHeader("columnTitle", "columnWidth", 1, 1);
+ assertEquals(columnHeader4.getRowSpan(), 1);
+ ColumnHeader columnHeader5 = new ColumnHeader("columnTitle", "columnWidth", "alignment", 1, "linkColId");
+ assertEquals(columnHeader5.getAlignment(), "alignment");
+ assertEquals(columnHeader5.getLinkColId(), "linkColId");
+ ColumnHeader columnHeader6 = mockColumnHeader();
+ assertTrue(columnHeader6.isSortable());
+ assertTrue(columnHeader6.isVisible());
+ assertEquals(columnHeader6.getColId(), "colId");
+ assertEquals(columnHeader6.getGroupLevel(), 2);
+ assertEquals(columnHeader6.getColumnWidthHtml(), " width=columnWidth");
+ columnHeader6.setColumnWidth("");
+ assertEquals(columnHeader6.getColumnWidthHtml(), "");
+ assertEquals(columnHeader6.getRowSpanHtml(), "");
+ columnHeader6.setRowSpan(2);
+ assertEquals(columnHeader6.getRowSpanHtml(), " rowspan=2");
+ assertEquals(columnHeader6.getColSpanHtml(), "");
+ columnHeader6.setVisible(false);
+ assertEquals(columnHeader6.getColSpanHtml(), " colspan=0");
+ columnHeader6.getColumnTitleHtml();
+ columnHeader6.setLinkColId(null);
+ columnHeader6.getColumnTitleHtml();
+ assertEquals(columnHeader6.getStartGroup(), 1);
+ assertEquals(columnHeader6.getColSpanGroup(), 0);
+ columnHeader6.setAlignment("");
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnVisualTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnVisualTest.java
new file mode 100644
index 00000000..24693446
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnVisualTest.java
@@ -0,0 +1,54 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.view;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ColumnVisualTest {
+ @Test
+ public void mockColumnVisualTest() {
+ ColumnVisual ColumnVisual = new ColumnVisual("colId", "colDisplay", false, "sortType");
+ assertEquals(ColumnVisual.getColId(), "colId");
+ assertEquals(ColumnVisual.getColDisplay(), "colDisplay");
+ assertEquals(ColumnVisual.getSortType(), "sortType");
+ assertFalse(ColumnVisual.isVisible());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabColumnValuesTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabColumnValuesTest.java
new file mode 100644
index 00000000..2a01b252
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabColumnValuesTest.java
@@ -0,0 +1,67 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.view;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.onap.portalsdk.analytics.system.ConnectionUtils;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest(ConnectionUtils.class)
+public class CrossTabColumnValuesTest {
+
+ @Test
+ public void mockCrossTabColumnValuesTest() throws Exception
+ {
+ DataSet set = new DataSet();
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(set);
+ CrossTabColumnValues crossTabColumnValues= new CrossTabColumnValues("colId", "loadValuesSQL", "dbInfo");
+ assertEquals(crossTabColumnValues.getColId(),"colId");
+ assertEquals(crossTabColumnValues.getColumnValues().size(), 0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabOrderManagerTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabOrderManagerTest.java
new file mode 100644
index 00000000..71d7dbca
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabOrderManagerTest.java
@@ -0,0 +1,144 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.view;
+
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.controller.ActionHandler;
+import org.onap.portalsdk.analytics.error.RaptorException;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.onap.portalsdk.analytics.system.AppUtils;
+import org.onap.portalsdk.analytics.system.ConnectionUtils;
+import org.onap.portalsdk.analytics.system.DbUtils;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.onap.portalsdk.analytics.xmlobj.ChartAdditionalOptions;
+import org.onap.portalsdk.analytics.xmlobj.CustomReportType;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnType;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceList;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceType;
+import org.onap.portalsdk.analytics.xmlobj.MockitoTestSuite;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({Globals.class,DbUtils.class, UserUtils.class, AppUtils.class} )
+public class CrossTabOrderManagerTest {
+
+ @InjectMocks
+ ActionHandler actionHandler = new ActionHandler();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Test
+ public void mockCrossTabOrderManagerTest() throws Exception
+ {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ ResultSet rs = PowerMockito.mock(ResultSet.class);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ // datset = new DataSet(rs);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
+ CustomReportType customReportType = new CustomReportType();
+ DataSourceList dataSourceList = new DataSourceList();
+ List<DataSourceType> list = new ArrayList<>();
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("[test");
+ dataColumnType.setColOnChart("LEGEND");
+ dataColumnType.setDisplayName("chart_total");
+ dataColumnType.setColId("1");
+ dataColumnType.setTableId("1");
+ dataColumnType.setColType("DATE");
+ dataColumnTypeList.add(dataColumnType);
+ customReportType.setReportType("test");
+ customReportType.setReportTitle("test");
+ customReportType.setDataSourceList(dataSourceList);
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(Globals.getRequestParams()).thenReturn("test");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test");
+ Mockito.when(Globals.getSessionParamsForScheduling()).thenReturn("test");
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ ReportRuntime rr = new ReportRuntime(reportWrapper, mockedRequest);
+ CrossTabOrderManager crossTabOrderManager= new CrossTabOrderManager(rr,"test",mockedRequest);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabTotalValueTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabTotalValueTest.java
new file mode 100644
index 00000000..69994c23
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabTotalValueTest.java
@@ -0,0 +1,49 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.view;
+
+import org.junit.Test;
+
+public class CrossTabTotalValueTest {
+ @Test
+ public void mockCrossTabTotalValueTest()
+ {
+ CrossTabTotalValue crossTabTotalValue = new CrossTabTotalValue();
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataRowTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataRowTest.java
new file mode 100644
index 00000000..05c5512b
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataRowTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.view;
+
+import static org.junit.Assert.*;
+
+import java.util.Vector;
+
+import org.junit.Test;
+
+public class DataRowTest {
+
+ @Test
+ public void mockDataRowTest() {
+ DataRow dataRow = new DataRow();
+
+ DataValue dataValue = new DataValue();
+ dataRow.setRowFormat(false);
+ HtmlFormatter formatter = new HtmlFormatter();
+ dataRow.setRowFormatter(formatter);
+ dataRow.setRowNum(1);
+ Vector vc = new Vector<>();
+ vc.add(dataRow);
+ dataRow.setRowValues(vc);
+ dataRow.setFormatId("test");
+ assertEquals(dataRow.getFormatId(), "test");
+ assertEquals(dataRow.getRowNum(), 1);
+ assertEquals(dataRow.getRowValues(), vc);
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java
new file mode 100644
index 00000000..21197368
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java
@@ -0,0 +1,90 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.view;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class DataValueTest {
+
+ @Test
+ public void mockDataValueTest() {
+ DataValue dataValue = new DataValue();
+ dataValue.setDisplayName("displayName");
+ dataValue.setDisplayCalculatedValue("displayCalculatedValue");
+ dataValue.setDrillDownURL("drillDownURL");
+ dataValue.setDrillDowninPoPUp(false);
+ dataValue.setIndentation("indentation");
+ dataValue.setAlignment("alignment");
+ dataValue.setVisible(false);
+ dataValue.setHidden(false);
+ HtmlFormatter formatter = new HtmlFormatter();
+ dataValue.setCellFormatter(formatter);
+ dataValue.setBold(false);
+ dataValue.setRowFormatter(formatter);
+ dataValue.setFormatId("formatId");
+ dataValue.setCellFormat(false);
+ dataValue.setColId("colId");
+ dataValue.setDisplayName("displayName");
+ dataValue.setNowrap("nowrap");
+ dataValue.setHyperlinkURL("hyperlinkURL");
+ dataValue.setDisplayType("displayType");
+ dataValue.setActionImg("actionImg");
+
+ assertEquals(dataValue.getDisplayName(), "displayName");
+ assertEquals(dataValue.getDisplayCalculatedValue(), "displayCalculatedValue");
+ assertEquals(dataValue.getDrillDownURL(), "drillDownURL");
+ assertFalse(dataValue.isDrillDowninPoPUp());
+ assertEquals(dataValue.getIndentation(), "indentation");
+ assertEquals(dataValue.getAlignment(), "alignment");
+ assertFalse(dataValue.isVisible());
+ assertFalse(dataValue.isHidden());
+ assertEquals(dataValue.getCellFormatter(), formatter);
+ assertEquals(dataValue.getRowFormatter(), formatter);
+ assertEquals(dataValue.getFormatId(), "formatId");
+ assertFalse(dataValue.isBold());
+ assertEquals(dataValue.getColId(), "colId");
+ assertEquals(dataValue.getDisplayName(), "displayName");
+ assertEquals(dataValue.getNowrap(), "nowrap");
+ assertEquals(dataValue.getHyperlinkURL(), "hyperlinkURL");
+ assertEquals(dataValue.getDisplayType(), "displayType");
+ assertEquals(dataValue.getActionImg(), "actionImg");
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/HtmlFormatterTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/HtmlFormatterTest.java
new file mode 100644
index 00000000..a5a838a3
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/HtmlFormatterTest.java
@@ -0,0 +1,117 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.view;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class HtmlFormatterTest {
+
+ @Test
+ public void mockHtmlFormatterTest() {
+ HtmlFormatter HtmlFormatter = new HtmlFormatter();
+ HtmlFormatter.setBold(false);
+ HtmlFormatter.setItalic(false);
+ HtmlFormatter.setUnderline(false);
+ HtmlFormatter.setBgColor("bgColor");
+ HtmlFormatter.setFontColor("fontColor");
+ HtmlFormatter.setFontFace("fontFace");
+ HtmlFormatter.setFontSize("fontSize");
+ HtmlFormatter.setAlignment("alignment");
+ HtmlFormatter.setFormatId("formatId");
+
+ assertFalse(HtmlFormatter.isBold());
+ assertFalse(HtmlFormatter.isItalic());
+ assertFalse(HtmlFormatter.isUnderline());
+ assertEquals(HtmlFormatter.getBgColor(), "bgColor");
+ assertEquals(HtmlFormatter.getFontColor(), "fontColor");
+ assertEquals(HtmlFormatter.getFontFace(), "fontFace");
+ assertEquals(HtmlFormatter.getFontSize(), "fontSize");
+ assertEquals(HtmlFormatter.getAlignment(), "alignment");
+ assertEquals(HtmlFormatter.getFormatId(), "formatId");
+
+ }
+
+ @Test
+ public void formatValueTest() {
+ HtmlFormatter HtmlFormatter1 = new HtmlFormatter(false, false, false, "bgColor", "fontColor", "fontFace",
+ "fontSize");
+ HtmlFormatter1.formatValue("test");
+ }
+
+ @Test
+ public void formatValue1Test() {
+ HtmlFormatter htmlFormatter2 = new HtmlFormatter(true, true, true, "bgColor", "fontColor", "fontFace",
+ "fontSize", "alignment");
+ htmlFormatter2.formatValue("test");
+ }
+
+ @Test
+ public void formatValue2Test() {
+ HtmlFormatter htmlFormatter2 = new HtmlFormatter(false, false, false, "", "", "", "");
+ htmlFormatter2.formatValue("test");
+ }
+
+ @Test
+ public void formatLinkTest() {
+ HtmlFormatter htmlFormatter2 = new HtmlFormatter(false, false, false, "", "", "", "");
+ htmlFormatter2.formatLink("test", "url", false);
+ }
+
+ @Test
+ public void formatLink1Test() {
+ HtmlFormatter htmlFormatter2 = new HtmlFormatter(false, false, false, "", "", "", "");
+ htmlFormatter2.formatLink("test", "url", true);
+ }
+
+ @Test
+ public void generateStyleForZKTest() {
+ HtmlFormatter htmlFormatter2 = new HtmlFormatter(true, true, true, "bgColor", "fontColor", "fontFace",
+ "fontSize", "alignment");
+ htmlFormatter2.generateStyleForZK();
+
+ }
+
+ @Test
+ public void generateStyleForZK1Test() {
+ HtmlFormatter htmlFormatter2 = new HtmlFormatter(false, false, false, "", "", "", "");
+ htmlFormatter2.generateStyleForZK();
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ReportColumnHeaderRowsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ReportColumnHeaderRowsTest.java
new file mode 100644
index 00000000..e6b98298
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ReportColumnHeaderRowsTest.java
@@ -0,0 +1,54 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.view;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ReportColumnHeaderRowsTest {
+
+ @Test
+ public void ReportColumnHeaderRowsTest()
+ {
+ ReportColumnHeaderRows reportColumnHeaderRows= new ReportColumnHeaderRows();
+ reportColumnHeaderRows.resetNext(1);
+ assertFalse(reportColumnHeaderRows.hasNext());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java
new file mode 100644
index 00000000..48dc5e12
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java
@@ -0,0 +1,75 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.view;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class RowHeaderColTest {
+
+ @Test
+ public void mockRowHeaderColTest() {
+ RowHeaderCol rowHeaderCol = new RowHeaderCol();
+ rowHeaderCol.setColumnTitle("columnTitle");
+ rowHeaderCol.setColumnWidth("columnWidth");
+ rowHeaderCol.setAlignment("alignment");
+ rowHeaderCol.setColId("colId");
+ rowHeaderCol.setDisplayHeaderAlignment(null);
+ assertNull(rowHeaderCol.getDisplayHeaderAlignment());
+ assertEquals(rowHeaderCol.getColId(), "colId");
+ assertEquals(rowHeaderCol.getColumnTitle(), "columnTitle");
+ assertEquals(rowHeaderCol.getColumnWidth(), "columnWidth");
+ assertEquals(rowHeaderCol.getAlignment(), "alignment");
+ assertEquals(rowHeaderCol.getColumnTitleHtml(), "columnTitle");
+ assertEquals(rowHeaderCol.getColumnWidthHtml(), " width=columnWidth");
+ assertEquals(rowHeaderCol.getAlignmentHtml(), " align=alignment");
+ rowHeaderCol.resetNext();
+ RowHeader rowHeader = new RowHeader();
+ rowHeaderCol.addRowHeader(rowHeader);
+ rowHeaderCol.addRowHeader(1, rowHeader);
+ rowHeaderCol.setColumnTitle("");
+ rowHeaderCol.setColumnWidth("");
+ rowHeaderCol.setAlignment("");
+ assertEquals(rowHeaderCol.getColumnTitleHtml(), "&nbsp;");
+ assertEquals(rowHeaderCol.getColumnWidthHtml(), "");
+ assertEquals(rowHeaderCol.getAlignmentHtml(), " align=center");
+
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java
new file mode 100644
index 00000000..2cc01aba
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java
@@ -0,0 +1,60 @@
+
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */package org.onap.portalsdk.analytics.view;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class RowHeaderTest {
+
+ @Test
+ public void mockRowHeaderTest() {
+ RowHeader rowHeader = new RowHeader();
+ rowHeader.setRowTitle("rowTitle");
+ rowHeader.setRowHeight("rowHeight");
+ rowHeader.setRowSpan(1);
+ rowHeader.setColSpan(1);
+ rowHeader.setBold(false);
+ assertEquals(rowHeader.getRowTitle(), "rowTitle");
+ assertEquals(rowHeader.getRowHeight(), "rowHeight");
+ assertEquals(rowHeader.getRowSpan(), 1);
+ assertEquals(rowHeader.getColSpan(), 1);
+ assertFalse(rowHeader.isBold());
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartD3HelperTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartD3HelperTest.java
new file mode 100644
index 00000000..49b9ddcb
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartD3HelperTest.java
@@ -0,0 +1,1078 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import java.io.FileWriter;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.model.DataCache;
+import org.onap.portalsdk.analytics.model.ReportLoader;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.definition.ReportDefinition;
+import org.onap.portalsdk.analytics.model.runtime.ChartD3Helper;
+import org.onap.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.onap.portalsdk.analytics.system.AppUtils;
+import org.onap.portalsdk.analytics.system.ConnectionUtils;
+import org.onap.portalsdk.analytics.system.DbUtils;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.onap.portalsdk.analytics.util.Utils;
+import org.onap.portalsdk.analytics.util.XSSFilter;
+import org.onap.portalsdk.core.util.SecurityCodecUtil;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.owasp.esapi.ESAPI;
+import org.owasp.esapi.codecs.Codec;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ AppConstants.class, Globals.class, AppUtils.class, ReportWrapper.class, DataCache.class,
+ DbUtils.class, DataSet.class, ReportLoader.class, ReportRuntime.class, Utils.class, ESAPI.class, Codec.class,
+ SecurityCodecUtil.class, ConnectionUtils.class, XSSFilter.class, ReportDefinition.class, UserUtils.class })
+public class ChartD3HelperTest {
+ @InjectMocks
+ ChartD3Helper chartD3Helper = new ChartD3Helper();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ MockRunTimeReport mockRunTimeReport = new MockRunTimeReport();
+
+ public ReportRuntime mockReportRunTime1() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ ResultSet rs = PowerMockito.mock(ResultSet.class);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ // datset = new DataSet(rs);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
+ CustomReportType customReportType = new CustomReportType();
+ DataSourceList dataSourceList = new DataSourceList();
+ List<DataSourceType> list = new ArrayList<>();
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("[test");
+ dataColumnType.setColOnChart("LEGEND");
+ dataColumnType.setDisplayName("testLEGEND");
+ dataColumnType.setColId("1");
+ dataColumnType.setTableId("1");
+ dataColumnType.setColType("DATE");
+ dataColumnType.setDependsOnFormField("tes[t");
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setReportTitle("test");
+ customReportType.setChartMultiSeries("Y");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setChartMultiSeries("Y");
+ customReportType.setChartRightAxisLabel("test");
+ customReportType.setChartLeftAxisLabel("test");
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ List<FormFieldType> formFields = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldId("test");
+ formFieldType.setColId("1");
+ formFieldType.setFieldName("test");
+ formFieldType.setFieldType("type");
+ formFieldType.setValidationType("validation");
+ formFieldType.setMandatory("Y");
+ formFieldType.setDefaultValue("test");
+ formFields.add(formFieldType);
+ formFieldList.formField = formFields;
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(Globals.getRequestParams()).thenReturn("test");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test");
+ Mockito.when(Globals.getSessionParamsForScheduling()).thenReturn("test");
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ ReportRuntime rr = new ReportRuntime(reportWrapper, mockedRequest);
+ rr.setLegendLabelAngle("test");
+ rr.setMultiSeries(false);
+ rr.setChartType("test");
+ return rr;
+ }
+
+ public ReportRuntime mockReportRunTime2() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ ResultSet rs = PowerMockito.mock(ResultSet.class);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ // datset = new DataSet(rs);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
+ CustomReportType customReportType = new CustomReportType();
+ DataSourceList dataSourceList = new DataSourceList();
+// List<DataSourceType> list = new ArrayList<>();
+// DataSourceType dataSourceType = new DataSourceType();
+// dataSourceType.setTableName("test");
+// dataSourceType.setRefTableId("1");
+// dataSourceType.setTableId("1");
+// List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+// DataColumnType dataColumnType = new DataColumnType();
+// dataColumnType.setChartGroup("test");
+// dataColumnType.setYAxis("test");
+// dataColumnType.setColName("[test");
+// dataColumnType.setColOnChart("LEGEND");
+// dataColumnType.setDisplayName("testLEGEND");
+// dataColumnType.setColId("1");
+// dataColumnType.setTableId("1");
+// dataColumnType.setColType("DATE");
+// dataColumnType.setDependsOnFormField("tes[t");
+// dataColumnTypeList.add(dataColumnType);
+// DataColumnList dataColumnList = new DataColumnList();
+// dataColumnList.dataColumn = dataColumnTypeList;
+// dataSourceType.setDataColumnList(dataColumnList);
+// list.add(dataSourceType);
+// dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setReportTitle("test");
+ customReportType.setChartMultiSeries("Y");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setChartMultiSeries("Y");
+ customReportType.setChartRightAxisLabel("test");
+ customReportType.setChartLeftAxisLabel("test");
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ List<FormFieldType> formFields = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldId("test");
+ formFieldType.setColId("1");
+ formFieldType.setFieldName("test");
+ formFieldType.setFieldType("type");
+ formFieldType.setValidationType("validation");
+ formFieldType.setMandatory("Y");
+ formFieldType.setDefaultValue("test");
+ formFields.add(formFieldType);
+ formFieldList.formField = formFields;
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(Globals.getRequestParams()).thenReturn("test");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test");
+ Mockito.when(Globals.getSessionParamsForScheduling()).thenReturn("test");
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ ReportRuntime rr = new ReportRuntime(reportWrapper, mockedRequest);
+ rr.setLegendLabelAngle("test");
+ rr.setMultiSeries(false);
+ rr.setChartType("test");
+ return rr;
+ }
+
+
+ @Test
+ public void createVisualizationTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+
+ }
+
+ @Test
+ public void createVisualization1Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("AnnotationChart");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization2Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("HierarchicalChart");
+ rr.getChartLegendColumn().setDisplayName(null);
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn("Y");
+ PowerMockito.mock(FileWriter.class);
+ // PowerMockito.whenNew(FileWriter.class).withArguments(Matchers.anyString()).thenThrow(NullPointerException.class);
+ // PowerMockito.whenNew(BufferedWriter.class).withArguments(Matchers.any(Writer.class)).thenThrow(NullPointerException.class);
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization3Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("HierarchicalSunBurstChart");
+ rr.getChartLegendColumn().setDisplayName(null);
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization4Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("TimeSeriesChart");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization5Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("BarChart3D");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(true);
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("timeAxis", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("test");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("1");
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization6Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("BarChart3D");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(true);
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("timeAxis", "test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "test");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("test");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("test");
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization7Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("BarChart3D");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(false);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("timeAxis", "test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "test");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("test");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("test");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization8Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("BarChart3D");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(false);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "test");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11/11/1990");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("test");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ chartOptionsMap.put("timeAxis", null);
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization9Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("BarChart3D");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(false);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "test");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11/11/1990");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("test");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1.000");
+ chartOptionsMap.put("precision", "test");
+ chartOptionsMap.put("timeAxis", null);
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization10Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("TimeSeriesChart");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(false);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "test");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11/11/1990");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("test");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ chartOptionsMap.put("timeAxis", null);
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization11Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("PieChart");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(false);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "test");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11/11/1990");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("test");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ chartOptionsMap.put("timeAxis", null);
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization12Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("Pie3DChart");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(false);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "test");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11/11/1990");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("test");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ chartOptionsMap.put("timeAxis", null);
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization13Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("ScatterPlotChart");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(false);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "test");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11/11/1990");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("test");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ chartOptionsMap.put("timeAxis", null);
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization14Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("HierarchicalSunBurstChart");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(false);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "test");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11/11/1990");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("test");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ chartOptionsMap.put("timeAxis", null);
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization15Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("BarChart3D");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(true);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "test");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11/11/1990");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("test");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ chartOptionsMap.put("timeAxis", null);
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization16Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("BarChart3D");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(true);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "test");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11/11/1990");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("1");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("");
+
+ chartOptionsMap.put("timeAxis", null);
+ chartOptionsMap.put("logScale", "Y");
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+
+ @Test
+ public void createVisualization17Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("BarChart3D");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(true);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11/11/1990");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("1");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("");
+
+ chartOptionsMap.put("timeAxis", null);
+ chartOptionsMap.put("logScale", "Y");
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization21Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("BarChart3D");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(true);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11-11-1999");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("1");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("");
+
+ chartOptionsMap.put("timeAxis", null);
+ chartOptionsMap.put("logScale", "Y");
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+
+ @Test
+ public void createVisualization18Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("BarChart3D");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(true);
+ rr.getAllColumns().get(0).setColOnChart("tesrt");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11-11-1999 11:11");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("1");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("");
+
+ chartOptionsMap.put("timeAxis", null);
+ chartOptionsMap.put("logScale", "Y");
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+
+ @Test
+ public void createVisualization19Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("TimeSeriesChart");
+ rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+ rr.getAllColumns().get(0).setDisplayName("chart_total");
+ rr.getAllColumns().get(0).setChartSeries(true);
+ rr.getAllColumns().get(0).setColOnChart("LEGEND1");
+ rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11-11-1999 11:11");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("1");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("");
+ rr.getCustomReport().setChartLeftAxisLabel("");
+ chartOptionsMap.put("timeAxis", null);
+ chartOptionsMap.put("logScale", "Y");
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+
+ @Test
+ public void createVisualization20Test() throws Exception {
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("TimeSeriesChart");
+// rr.getChartLegendColumn().setDisplayName(null);
+ rr.setWholeSQL("testFROM");
+ PowerMockito.mockStatic(UserUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ HashMap<String, String> chartOptionsMap = new HashMap<>();
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("Y");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, "level1")).thenReturn("1");
+ Mockito.when(ds.getString(0, "mid")).thenReturn("");
+ Mockito.when(mockedRequest.getParameter("embedded")).thenReturn("test");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ chartD3Helper.setChartType("test");
+ ChartD3Helper chartD3Helper = new ChartD3Helper(rr);
+ chartD3Helper.setChartType("test");
+// rr.getAllColumns().get(0).setDisplayName("chart_total");
+// rr.getAllColumns().get(0).setChartSeries(true);
+// rr.getAllColumns().get(0).setColOnChart("LEGEND1");
+// rr.getAllColumns().get(0).setChartSeq(3);
+ rr.getCustomReport().setChartMultiSeries("N");
+ Mockito.when(ds.getString(0, "chart_color")).thenReturn("test");
+ chartOptionsMap.put("animation", "test");
+ chartOptionsMap.put("showControls", "test");
+ chartOptionsMap.put("barRealTimeAxis", "");
+ chartOptionsMap.put("barReduceXAxisLabels", "test");
+ chartOptionsMap.put("subType", "area");
+ Mockito.when(ds.getString(0, 0)).thenReturn("test");
+ Mockito.when(ds.getString(0, 1)).thenReturn("11-11-1999 11:11");
+ Mockito.when(ds.getString(0, 2)).thenReturn("test");
+ Mockito.when(ds.getString(0, 3)).thenReturn("1");
+ Mockito.when(ds.getString(0, "1")).thenReturn("1");
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("");
+ rr.getCustomReport().setChartLeftAxisLabel("");
+ rr.setTimeAxis(false);
+ chartOptionsMap.put("timeAxis", "test");
+ chartOptionsMap.put("logScale", "Y");
+ chartD3Helper.createVisualization(rr, chartOptionsMap, mockedRequest);
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/GlobalsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/GlobalsTest.java
new file mode 100644
index 00000000..826e25db
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/GlobalsTest.java
@@ -0,0 +1,1314 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Properties;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.onap.portalsdk.analytics.config.ConfigLoader;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.runtime.FormField;
+import org.onap.portalsdk.analytics.model.runtime.ReportFormFields;
+import org.onap.portalsdk.analytics.model.runtime.ReportParamValues;
+import org.onap.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.onap.portalsdk.analytics.system.AppUtils;
+import org.onap.portalsdk.analytics.system.DbUtils;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.onap.portalsdk.core.web.support.UserUtils;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ ConfigLoader.class, AppUtils.class })
+public class GlobalsTest {
+
+ Properties properties = PowerMockito.mock(Properties.class);
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Test(expected = java.lang.RuntimeException.class)
+ public void initializeSystemTest() throws Exception {
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ PowerMockito.mockStatic(ConfigLoader.class);
+ Properties sqlProperty = PowerMockito.mock(Properties.class);
+ Mockito.when(ConfigLoader.getProperties(Matchers.any(ServletContext.class), Matchers.anyString()))
+ .thenReturn(sqlProperty);
+ Globals.initializeSystem(servletContext);
+ }
+
+ @Test
+ public void initializeRaptorPropertiesTest() throws Exception {
+ PowerMockito.mockStatic(ConfigLoader.class);
+ Properties sqlProperty = PowerMockito.mock(Properties.class);
+ Mockito.when(ConfigLoader.getProperties(Matchers.any(ServletContext.class), Matchers.anyString()))
+ .thenReturn(sqlProperty);
+ Globals.initializeRaptorProperties(sqlProperty);
+ }
+
+ @Test(expected = java.lang.RuntimeException.class)
+ public void getRaptorActionMappingTest() {
+ Globals.getRaptorActionMapping();
+ }
+
+ @Test(expected = java.lang.RuntimeException.class)
+ public void getSystemTypeTest() {
+ Globals.getSystemType();
+ }
+
+ @Test(expected = java.lang.RuntimeException.class)
+ public void getAppUtilsTest() {
+ Globals.getAppUtils();
+ }
+
+ @Test(expected = java.lang.RuntimeException.class)
+ public void getDbUtilsTest() {
+ Globals.getDbUtils();
+ }
+
+ @Test(expected = java.lang.RuntimeException.class)
+ public void getRDbUtilsTest() {
+ Globals.getRDbUtils();
+ }
+
+ @Test
+ public void getDebugLevelTest() {
+ assertEquals(Globals.getDebugLevel(), 5);
+ }
+
+ @Test
+ public void getDownloadLimitTest() {
+ assertEquals(Globals.getDownloadLimit(), 65000);
+ }
+
+ // @Test(expected = java.lang.NullPointerException.class)
+ // public void getCSVDownloadLimitTest() {
+ // assertEquals(Globals.getCSVDownloadLimit(),65000);
+ // }
+ //
+
+ @Test
+ public void getDownloadLimitAsTextTest() {
+ assertEquals(Globals.getDownloadLimitAsText(),
+ java.text.NumberFormat.getNumberInstance(java.util.Locale.US).format(65000));
+ }
+
+ @Test
+ public void getDefaultPageSizeTest() {
+ assertEquals(Globals.getDefaultPageSize(), 50);
+ }
+
+ @Test
+ public void getFormFieldsListSizeTest() {
+ assertEquals(Globals.getFormFieldsListSize(), 50);
+ }
+
+ @Test
+ public void getSchedulerIntervalTest() {
+ assertEquals(Globals.getSchedulerInterval(), 0);
+ }
+
+ @Test
+ public void getBaseTitleTest() {
+ assertEquals(Globals.getBaseTitle(), "ANALYSIS");
+ }
+
+ @Test
+ public void getSystemNameTest() {
+ assertEquals(Globals.getSystemName(), "MSA Databank");
+ }
+
+ @Test
+ public void getAllowSQLBasedReportsTest() {
+ assertTrue(Globals.getAllowSQLBasedReports());
+ }
+
+ @Test
+ public void getShowDisclaimerTest() {
+ assertTrue(Globals.getShowDisclaimer());
+ }
+
+ @Test
+ public void getDisplayFormBeforeRunTest() {
+ assertTrue(Globals.getDisplayFormBeforeRun());
+ }
+
+ @Test
+ public void getIncludeFormWithDataTest() {
+ assertTrue(Globals.getIncludeFormWithData());
+ }
+
+ @Test
+ public void getCacheChartDataTest() {
+ assertTrue(Globals.getCacheChartData());
+ }
+
+ @Test
+ public void getCacheCurPageDataTest() {
+ assertTrue(Globals.getCacheCurPageData());
+ }
+
+ @Test
+ public void getDeleteOnlyByOwnerTest() {
+ assertTrue(Globals.getDeleteOnlyByOwner());
+ }
+
+ @Test
+ public void getEnableReportLogTest() {
+ assertTrue(Globals.getEnableReportLog());
+ }
+
+ @Test
+ public void getCacheUserRolesest() {
+ assertTrue(Globals.getCacheUserRoles());
+ }
+
+ @Test
+ public void getMonthFormatUseLastDayTest() {
+ assertTrue(Globals.getMonthFormatUseLastDay());
+ }
+
+ @Test
+ public void getPrintTitleInDownloadTest() {
+ assertFalse(Globals.getPrintTitleInDownload());
+ }
+
+ @Test
+ public void getShowDescrAtRuntimeTest() {
+ assertFalse(Globals.getShowDescrAtRuntime());
+ }
+
+ @Test
+ public void getShowNonstandardChartsTest() {
+ assertFalse(Globals.getShowNonstandardCharts());
+ }
+
+ @Test
+ public void getAllowRuntimeChartSelTest() {
+ assertTrue(Globals.getAllowRuntimeChartSel());
+ }
+
+ @Test
+ public void getDisplayChartTitleTest() {
+ assertFalse(Globals.getDisplayChartTitle());
+ }
+
+ @Test
+ public void getMergeCrosstabRowHeadingsTest() {
+ assertTrue(Globals.getMergeCrosstabRowHeadings());
+ }
+
+ @Test
+ public void getPrintParamsInDownloadTest() {
+ assertFalse(Globals.getPrintParamsInDownload());
+ }
+
+ @Test
+ public void getCanCopyOnReadOnlyTest() {
+ assertTrue(Globals.getCanCopyOnReadOnly());
+ }
+
+ @Test
+ public void getMaxDecimalsOnTotalsTest() {
+ assertEquals(Globals.getMaxDecimalsOnTotals(), 2);
+ }
+
+ @Test
+ public void getDefaultChartWidthTest() {
+ assertEquals(Globals.getDefaultChartWidth(), 700);
+ }
+
+ @Test
+ public void getDefaultChartHeightTest() {
+ assertEquals(Globals.getDefaultChartHeight(), 420);
+ }
+
+ @Test
+ public void getSkipChartLabelsLimitTest() {
+ assertEquals(Globals.getSkipChartLabelsLimit(), 30);
+ }
+
+ @Test
+ public void getRestrictTablesByRoleTest() {
+ assertTrue(Globals.getRestrictTablesByRole());
+ }
+
+ @Test
+ public void getJavaTimeFormatTest() {
+ assertEquals(Globals.getJavaTimeFormat(), "MM/dd/yyyy h:m:s a");
+ }
+
+ @Test
+ public void getRaptorVersionTest() {
+ assertEquals(Globals.getRaptorVersion(), "10.5.1");
+ }
+
+ @Test
+ public void getDisplayAllUsersTest() {
+ assertTrue(Globals.getDisplayAllUsers());
+ }
+
+ @Test
+ public void getUserColDefTest() {
+ Globals.getUserColDef();
+ }
+
+ @Test
+ public void getSheetNameTest() {
+ assertEquals(Globals.getSheetName(), "Raptor Reports");
+ }
+
+ @Test
+ public void getFlatFileLowerLimitTest() {
+ assertEquals(Globals.getFlatFileLowerLimit(), 0);
+ }
+
+ @Test
+ public void getFlatFileUpperLimitTest() {
+ assertEquals(Globals.getFlatFileUpperLimit(), 0);
+ }
+
+ @Test
+ public void getShellScriptDirest() {
+ assertEquals(Globals.getShellScriptDir(), "");
+ }
+
+ @Test
+ public void getQueryFolderTest() {
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getTempFolderPath()).thenReturn("test");
+ Globals.getQueryFolder();
+ }
+
+ @Test
+ public void getRequestParamsTest() {
+ assertEquals(Globals.getRequestParams(), "");
+ }
+
+ @Test
+ public void getSessionParamsTest() {
+ assertEquals(Globals.getSessionParams(), "");
+ }
+
+ @Test
+ public void getPrintFooterInDownloadTest() {
+ Globals.getPrintFooterInDownload();
+ }
+
+ @Test
+ public void getFooterFirstLineTest() {
+ Globals.getFooterFirstLine();
+ }
+
+ @Test
+ public void getFooterSecondLineTest() {
+ Globals.getFooterSecondLine();
+ }
+
+ @Test
+ public void getReportsInPoPUpWindowTest() {
+ assertEquals(Globals.getReportsInPoPUpWindow(), false);
+ }
+
+ @Test
+ public void getPoPUpInNewWindowTest() {
+ assertEquals(Globals.getPoPUpInNewWindow(), false);
+ }
+
+ @Test
+ public void getPassRequestParamInDrilldownTest() {
+ Globals.getPassRequestParamInDrilldown();
+ }
+
+ @Test
+ public void getDataFontSizeTest() {
+ assertEquals(Globals.getDataFontSize(), 10, 0);
+ }
+
+ @Test
+ public void getDataFontSizeOffsetTest() {
+ assertEquals(Globals.getDataFontSizeOffset(), 9, 0);
+ }
+
+ @Test
+ public void getFooterFontSizeTest() {
+ assertEquals(Globals.getFooterFontSize(), 9, 0);
+ }
+
+ @Test
+ public void getPageNumberPositionTest() {
+ assertEquals(Globals.getPageNumberPosition(), 1);
+ }
+
+ @Test
+ public void getDataFontFamilyTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_font_family")).thenReturn(null);
+ assertEquals(Globals.getDataFontFamily(), "Arial");
+ }
+
+ @Test
+ public void getDataFontFamily1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_font_family")).thenReturn("test");
+ assertEquals(Globals.getDataFontFamily(), "test");
+ }
+
+ @Test
+ public void getFooterFontFamilyTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_footer_font_family")).thenReturn(null);
+ assertEquals(Globals.getFooterFontFamily(), "Arial");
+ }
+
+ @Test
+ public void getFooterFontFamily1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_footer_font_family")).thenReturn("test");
+ assertEquals(Globals.getFooterFontFamily(), "test");
+ }
+
+ @Test
+ public void isCoverPageNeededTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("display_cover_page")).thenReturn(null);
+ assertTrue(Globals.isCoverPageNeeded());
+ }
+
+ @Test
+ public void isCoverPageNeeded1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("display_cover_page")).thenReturn("test");
+ assertFalse(Globals.isCoverPageNeeded());
+ }
+
+ @Test
+ public void isDataAlternateColorTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_alternate_color")).thenReturn(null);
+ assertTrue(Globals.isDataAlternateColor());
+ }
+
+ @Test
+ public void isDataAlternateColor1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_alternate_color")).thenReturn("test");
+ assertFalse(Globals.isDataAlternateColor());
+ }
+
+ @Test
+ public void getPDFFooterTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_footer")).thenReturn(null);
+ assertEquals(Globals.getPDFFooter(), "");
+ }
+
+ @Test
+ public void getPDFFooter1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_footer")).thenReturn("test");
+ assertEquals(Globals.getPDFFooter(), "test");
+ }
+
+ @Test
+ public void isCreatedOwnerInfoNeededTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("display_create_owner_info")).thenReturn(null);
+ assertTrue(Globals.isCreatedOwnerInfoNeeded());
+ }
+
+ @Test
+ public void isCreatedOwnerInfoNeeded1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("display_create_owner_info")).thenReturn("test");
+ assertFalse(Globals.isCreatedOwnerInfoNeeded());
+ }
+
+ // @Test
+ // public void displayFormFieldInfoTest() {
+ //
+ // Properties properties= PowerMockito.mock(Properties.class);
+ // Globals.setRaptorPdfProperties(properties);
+ // Mockito.when(properties.getProperty("display_formfield_info")).thenReturn(null);
+ // Globals.displayFormFieldInfo();
+ // }
+ //
+ // @Test
+ // public void displayFormFieldInfo1Test() {
+ //
+ // Properties properties= PowerMockito.mock(Properties.class);
+ // Globals.setRaptorPdfProperties(properties);
+ // Mockito.when(properties.getProperty("display_formfield_info")).thenReturn("test");
+ // Globals.displayFormFieldInfo();
+ // }
+ //
+ //
+ // @Test
+ // public void customizeFormFieldInfoTest() {
+ //
+ // Properties properties= PowerMockito.mock(Properties.class);
+ // Globals.setRaptorPdfProperties(properties);
+ // Mockito.when(properties.getProperty("customize_formfield_info")).thenReturn(null);
+ // assertFalse(Globals.customizeFormFieldInfo());
+ // }
+ //
+ // @Test
+ // public void customizeFormFieldInfo1Test() {
+ //
+ // Properties properties= PowerMockito.mock(Properties.class);
+ // Globals.setRaptorPdfProperties(properties);
+ // Mockito.when(properties.getProperty("customize_formfield_info")).thenReturn("test");
+ // assertFalse(Globals.customizeFormFieldInfo());
+ // }
+
+ @Test
+ public void getSessionInfoForTheCoverPageTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("session_info")).thenReturn(null);
+ assertEquals(Globals.getSessionInfoForTheCoverPage(), "");
+ }
+
+ @Test
+ public void getSessionInfoForTheCoverPage1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("session_info")).thenReturn("test");
+ assertEquals(Globals.getSessionInfoForTheCoverPage(), "test");
+ }
+
+ @Test
+ public void getDatePatternTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_date_pattern")).thenReturn(null);
+ assertEquals(Globals.getDatePattern(), "MM/dd/yyyy hh:mm:ss a");
+ }
+
+ @Test
+ public void getDatePattern1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_date_pattern")).thenReturn("test");
+ assertEquals(Globals.getDatePattern(), "test");
+ }
+
+ @Test
+ public void getTimeZoneTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_date_timezone")).thenReturn(null);
+ assertEquals(Globals.getTimeZone(), "EST");
+ }
+
+ @Test
+ public void getTimeZone1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_date_timezone")).thenReturn("test");
+ assertEquals(Globals.getTimeZone(), "test");
+ }
+
+ @Test
+ public void getWordBeforePageNumberTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_word_before_page_number")).thenReturn(null);
+ assertEquals(Globals.getWordBeforePageNumber(), "");
+ }
+
+ @Test
+ public void getWordBeforePageNumber1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_word_before_page_number")).thenReturn("test");
+ assertEquals(Globals.getWordBeforePageNumber(), "test");
+ }
+
+ @Test
+ public void getWordAfterPageNumberTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_word_after_page_number")).thenReturn(null);
+ assertEquals(Globals.getWordAfterPageNumber(), "");
+ }
+
+ @Test
+ public void getWordAfterPageNumber1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_word_after_page_number")).thenReturn("test");
+ assertEquals(Globals.getWordAfterPageNumber(), "test");
+ }
+
+ @Test
+ public void getPDFFooterFontSizeTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_footer_font_size")).thenReturn("1");
+ assertEquals(Globals.getPDFFooterFontSize(), 1, 0);
+ }
+
+ @Test
+ public void getPDFFooterFontSize1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_footer_font_size")).thenReturn(null);
+ assertEquals(Globals.getPDFFooterFontSize(), 7, 0);
+ }
+
+ @Test
+ public void getDataBackgroundAlternateHexCodeTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_background_alternate_hex_code")).thenReturn(null);
+ assertEquals(Globals.getDataBackgroundAlternateHexCode(), "#FFFFFF");
+ }
+
+ @Test
+ public void getDataBackgroundAlternateHexCode1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_background_alternate_hex_code")).thenReturn("test");
+ assertEquals(Globals.getDataBackgroundAlternateHexCode(), "test");
+ }
+
+ @Test
+ public void getDataDefaultBackgroundHexCodeTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_default_background_hex_code")).thenReturn(null);
+ assertEquals(Globals.getDataDefaultBackgroundHexCode(), "#FFFFFF");
+ }
+
+ @Test
+ public void getDataDefaultBackgroundHexCode1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_default_background_hex_code")).thenReturn("test");
+ assertEquals(Globals.getDataDefaultBackgroundHexCode(), "test");
+ }
+
+ @Test
+ public void getDataTableHeaderFontColorTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_table_header_font_hex_code")).thenReturn(null);
+ assertEquals(Globals.getDataTableHeaderFontColor(), "#FFFFFF");
+ }
+
+ @Test
+ public void getDataTableHeaderFontColor1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_table_header_font_hex_code")).thenReturn("test");
+ assertEquals(Globals.getDataTableHeaderFontColor(), "test");
+ }
+
+ @Test
+ public void getDataTableHeaderBackgroundFontColorTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_table_header_background_hex_code")).thenReturn(null);
+ assertEquals(Globals.getDataTableHeaderBackgroundFontColor(), "#8A9BB3");
+ }
+
+ @Test
+ public void getDataTableHeaderBackgroundFontColor1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_data_table_header_background_hex_code")).thenReturn("test");
+ assertEquals(Globals.getDataTableHeaderBackgroundFontColor(), "test");
+ }
+
+ // @Test
+ // public void isFolderTreeAllowedTest() {
+ // Globals.setRaptorPdfProperties(properties);
+ // Mockito.when(properties.getProperty("show_folder_tree")).thenReturn(null);
+ // assertEquals(Globals.isFolderTreeAllowed(), true);
+ // }
+ //
+ // @Test
+ // public void isFolderTreeAllowed1Test() {
+ // Globals.setRaptorPdfProperties(properties);
+ // Mockito.when(properties.getProperty("show_folder_tree")).thenReturn("test");
+ // assertEquals(Globals.isFolderTreeAllowed(), true);
+ // }
+ //
+ // @Test
+ // public void isFolderTreeAllowed2Test() {
+ // Globals.setRaptorPdfProperties(properties);
+ // Mockito.when(properties.getProperty("show_folder_tree")).thenReturn("YES");
+ // assertEquals(Globals.isFolderTreeAllowed(), true);
+ // }
+ @Test
+ public void getCoverPageFirstColumnSizeTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_coverpage_firstcolumn_size")).thenReturn("1");
+ assertEquals(Globals.getCoverPageFirstColumnSize(), 1, 0);
+ }
+
+ @Test
+ public void getCoverPageFirstColumnSize1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_coverpage_firstcolumn_size")).thenReturn(null);
+ assertEquals(Globals.getCoverPageFirstColumnSize(), 0, 3);
+ }
+
+ @Test
+ public void isImageAutoRotateTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_image_auto_rotate")).thenReturn(null);
+ assertFalse(Globals.isImageAutoRotate());
+ }
+
+ @Test
+ public void isImageAutoRotate1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("pdf_image_auto_rotate")).thenReturn("true");
+ assertTrue(Globals.isImageAutoRotate());
+ }
+
+ @Test
+ public void isShowPDFDownloadIconTest() {
+ assertFalse(Globals.isShowPDFDownloadIcon());
+ }
+
+ @Test
+ public void setShowPDFDownloadIconTest() {
+ Globals.setShowPDFDownloadIcon(false);
+ }
+
+ @Test
+ public void getScheduleLimitTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("schedule_limit")).thenReturn("1");
+ assertEquals(Globals.getScheduleLimit(), 1000);
+ }
+
+ @Test
+ public void getScheduleLimit1Test() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("schedule_limit")).thenReturn("");
+ assertEquals(Globals.getScheduleLimit(), 1000);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getScheduleLimitExceptionTest() {
+ Globals.setRaptorPdfProperties(properties);
+ Mockito.when(properties.getProperty("schedule_limit")).thenThrow(NullPointerException.class);
+ assertEquals(Globals.getScheduleLimit(), 1000);
+ }
+
+ // @Test
+ // public void getCustomizedScheduleQueryForUsers1Test()
+ // {
+ // Globals.setRaptorPdfProperties(properties);
+ // Mockito.when(properties.getProperty("schedule_custom_query_for_users")).thenReturn("test");
+ // assertEquals(Globals.getCustomizedScheduleQueryForUsers(), "");
+ // }
+
+ // @Test
+ // public void getTimeFormatTest()
+ // {
+ // Globals.setRaptorPdfProperties(properties);
+ // Mockito.when(properties.getProperty("time_format")).thenReturn("1");
+ // assertEquals(Globals.getTimeFormat(), 1000);
+ // }
+
+ @Test
+ public void getRequestParametersMapTest() {
+ HashMap paramsMap = new HashMap<>();
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+
+ }
+
+ @Test
+ public void getRequestParametersMap1Test() throws Exception {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("formField", "test");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+
+ }
+
+ @Test
+ public void getRequestParametersMap11Test() throws Exception {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("formField", "test");
+ paramsMap.put("test", "test");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_HR");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+
+ }
+
+ @Test
+ public void getRequestParametersMap10Test() throws Exception {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("formField", "test");
+ paramsMap.put("test", "test");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_MIN");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParametersMap5Test() throws Exception {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("formField", "test");
+ paramsMap.put("test", "test");
+ paramsMap.put("test_auto", "test_auto");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_SEC");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParametersMap6Test() throws Exception {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "test_auto");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_SEC");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParametersMap7Test() throws Exception {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "test_auto");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_MIN");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParametersMap8Test() throws Exception {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "test_auto");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_HR");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParametersMap9Test() throws Exception {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_HR");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+
+ }
+
+ @Test
+ public void getRequestParametersMap4Test() throws Exception {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("formField", "");
+ paramsMap.put("test", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_MIN");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParamtersMapTest() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("formField", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_MIN");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParamtersMap1Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test", "test");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_MIN");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParamtersMap2Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test", "test");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_SEC");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParamtersMap3Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test", "test");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_HR");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParamtersMap4Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "test");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_HR");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParamtersMap8Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_MIN");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getRequestParamtersMap9Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_SEC");
+ Globals.getRequestParametersMap(mockedRequest, paramsMap);
+ }
+
+ @Test
+ public void getRequestParamtersMap6Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_SEC");
+ Globals.getRequestParamtersMap(mockedRequest, false);
+ }
+
+ @Test
+ public void getRequestParamtersMap17Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_SEC");
+ Globals.getRequestParamtersMap(mockedRequest, false);
+ }
+
+ @Test
+ public void getRequestParamtersMap16Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_SEC");
+ Mockito.when(mockedRequest.getParameterValues("test")).thenReturn((new String[] { "testSelected" }));
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getRequestFlag(Matchers.any(HttpServletRequest.class), Matchers.anyString()))
+ .thenReturn(false);
+ Globals.getRequestParamtersMap(mockedRequest, false);
+ }
+
+ @Test
+ public void getRequestParamtersMap12Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_SEC");
+ Mockito.when(mockedRequest.getParameterValues("test")).thenReturn((new String[] { "testSelected" }));
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getRequestFlag(Matchers.any(HttpServletRequest.class), Matchers.anyString()))
+ .thenReturn(true);
+ Hashtable ht = new Hashtable();
+ ht.put("test", "test");
+ ReportParamValues ReportParamValues = PowerMockito.mock(ReportParamValues.class);
+ Mockito.when(rr.getReportParamValues()).thenReturn(ReportParamValues);
+ Globals.getRequestParamtersMap(mockedRequest, true);
+ }
+
+ @Test
+ public void getRequestParamtersMap15Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX1");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_SEC");
+ Mockito.when(mockedRequest.getParameterValues("test")).thenReturn((new String[] { "testSelected" }));
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getRequestFlag(Matchers.any(HttpServletRequest.class), Matchers.anyString()))
+ .thenReturn(false);
+ Globals.getRequestParamtersMap(mockedRequest, false);
+ }
+
+ @Test
+ public void getRequestParamtersMap13Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX1");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_SEC");
+ Mockito.when(mockedRequest.getParameterValues("test")).thenReturn((new String[] { "testSelected" }));
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getRequestFlag(Matchers.any(HttpServletRequest.class), Matchers.anyString()))
+ .thenReturn(false);
+ Mockito.when(mockedRequest.getParameter("test")).thenReturn("test");
+ Globals.getRequestParamtersMap(mockedRequest, false);
+ }
+
+ @Test
+ public void getRequestParamtersMap14Test() {
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getReportType()).thenReturn("Dashboard");
+
+ Mockito.when(mockedRequest.getSession().getAttribute("FirstDashReport")).thenReturn(rr);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ HashMap paramsMap = new HashMap<>();
+ paramsMap.put("test_auto", "");
+ ReportWrapper reportWrapper = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = PowerMockito.mock(ReportFormFields.class);
+ Mockito.when(reportFormFields.size()).thenReturn(1);
+ Mockito.when(rr.getReportFormFields()).thenReturn(reportFormFields);
+ FormField ff = PowerMockito.mock(FormField.class);
+ Mockito.when(reportFormFields.getFormField(0)).thenReturn(ff);
+ Mockito.when(ff.getFieldName()).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("CHECK_BOX1");
+ Mockito.when(rr.getReportDefType()).thenReturn("test");
+ Mockito.when(ff.getValidationType()).thenReturn("TIMESTAMP_SEC");
+ Mockito.when(mockedRequest.getParameterValues("test")).thenReturn((new String[] { "testSelected" }));
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getRequestFlag(Matchers.any(HttpServletRequest.class), Matchers.anyString()))
+ .thenReturn(false);
+ Mockito.when(mockedRequest.getParameter("test")).thenReturn("test");
+ Mockito.when(ff.getFieldType()).thenReturn("TEXTAREA");
+ Mockito.when(rr.getReportDefType()).thenReturn("SQL-based");
+ Globals.getRequestParamtersMap(mockedRequest, false);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportDataTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportDataTest.java
new file mode 100644
index 00000000..0052a89f
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportDataTest.java
@@ -0,0 +1,762 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.assertEquals;
+
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.model.DataCache;
+import org.onap.portalsdk.analytics.model.ReportLoader;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.definition.ReportDefinition;
+import org.onap.portalsdk.analytics.model.runtime.FormatProcessor;
+import org.onap.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.onap.portalsdk.analytics.model.runtime.VisualManager;
+import org.onap.portalsdk.analytics.system.AppUtils;
+import org.onap.portalsdk.analytics.system.ConnectionUtils;
+import org.onap.portalsdk.analytics.system.DbUtils;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.onap.portalsdk.analytics.util.Utils;
+import org.onap.portalsdk.analytics.util.XSSFilter;
+import org.onap.portalsdk.analytics.view.ColumnHeader;
+import org.onap.portalsdk.analytics.view.ColumnHeaderRow;
+import org.onap.portalsdk.analytics.view.ColumnVisual;
+import org.onap.portalsdk.analytics.view.CrossTabOrderManager;
+import org.onap.portalsdk.analytics.view.CrossTabTotalValue;
+import org.onap.portalsdk.analytics.view.DataRow;
+import org.onap.portalsdk.analytics.view.DataValue;
+import org.onap.portalsdk.analytics.view.ReportColumnHeaderRows;
+import org.onap.portalsdk.analytics.view.ReportData;
+import org.onap.portalsdk.analytics.view.ReportDataRows;
+import org.onap.portalsdk.analytics.view.ReportRowHeaderCols;
+import org.onap.portalsdk.analytics.view.RowHeader;
+import org.onap.portalsdk.analytics.view.RowHeaderCol;
+import org.onap.portalsdk.core.util.SecurityCodecUtil;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.owasp.esapi.ESAPI;
+import org.owasp.esapi.codecs.Codec;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ AppConstants.class, Globals.class, AppUtils.class, ReportWrapper.class, DataCache.class,
+ DbUtils.class, DataSet.class, ReportLoader.class, ReportRuntime.class, Utils.class, ESAPI.class, Codec.class,
+ SecurityCodecUtil.class, ConnectionUtils.class, XSSFilter.class, ReportDefinition.class, UserUtils.class })
+public class ReportDataTest {
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ public ReportData mockReportData() {
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ReportDataRows reportDataRows = new ReportDataRows();
+
+ DataRow dataRow = new DataRow();
+ reportDataRows.addDataRow(dataRow);
+ ArrayList list = new ArrayList<>();
+ list.add("test");
+ dataRow.setDataValueList(list);
+ ReportData reportData = new ReportData(1, true);
+ ReportRowHeaderCols reportRowHeaderCols = new ReportRowHeaderCols();
+ RowHeaderCol rowHeaderCol = new RowHeaderCol();
+ rowHeaderCol.add("test");
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.reportTotalRowHeaderCols = reportRowHeaderCols;
+ reportData.reportDataRows = reportDataRows;
+
+ Vector vc = new Vector<>();
+ ColumnVisual col = new ColumnVisual("colId", "colDisplay", true, "sortType");
+ vc.add(col);
+ reportData.setColumnVisuals(vc);
+ return reportData;
+ }
+
+ @Test
+ public void getDataRowCountTest() {
+ ReportData reportData = mockReportData();
+ reportData.getDataRowCount();
+ }
+
+ public ReportRuntime mockReportRunTime1() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ ResultSet rs = PowerMockito.mock(ResultSet.class);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ // datset = new DataSet(rs);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
+ CustomReportType customReportType = new CustomReportType();
+ DataSourceList dataSourceList = new DataSourceList();
+ List<DataSourceType> list = new ArrayList<>();
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("[test");
+ dataColumnType.setColOnChart("LEGEND");
+ dataColumnType.setDisplayName("testLEGEND");
+ dataColumnType.setColId("1");
+ dataColumnType.setTableId("1");
+ dataColumnType.setColType("DATE");
+ dataColumnType.setDependsOnFormField("tes[t");
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setReportTitle("test");
+ customReportType.setChartMultiSeries("Y");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setChartMultiSeries("Y");
+ customReportType.setChartRightAxisLabel("test");
+ customReportType.setChartLeftAxisLabel("test");
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ List<FormFieldType> formFields = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldId("test");
+ formFieldType.setColId("1");
+ formFieldType.setFieldName("test");
+ formFieldType.setFieldType("type");
+ formFieldType.setValidationType("validation");
+ formFieldType.setMandatory("Y");
+ formFieldType.setDefaultValue("test");
+ formFields.add(formFieldType);
+ formFieldList.formField = formFields;
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(Globals.getRequestParams()).thenReturn("test");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test");
+ Mockito.when(Globals.getSessionParamsForScheduling()).thenReturn("test");
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ ReportRuntime rr = new ReportRuntime(reportWrapper, mockedRequest);
+ rr.setLegendLabelAngle("test");
+ rr.setMultiSeries(false);
+ rr.setChartType("test");
+ return rr;
+ }
+
+ @Test
+ public void setColumnDataTotalsCrossTabTest() throws Exception {
+ ReportData reportData = mockReportData();
+ Vector vc = new Vector<>();
+ CrossTabTotalValue crossTabTotalValue = new CrossTabTotalValue();
+ vc.add(crossTabTotalValue);
+ ReportRuntime rr = mockReportRunTime1();
+ CrossTabOrderManager crossTabOrderManager = new CrossTabOrderManager(rr, "test12", mockedRequest);
+ List list = new ArrayList<>();
+
+ ReportRowHeaderCols reportRowHeaderCols = new ReportRowHeaderCols();
+ RowHeaderCol rowHeaderCol = new RowHeaderCol();
+ rowHeaderCol.add("test");
+ RowHeaderCol rowHeaderCol1 = new RowHeaderCol();
+ rowHeaderCol1.add("test1");
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol);
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol1);
+
+ reportData.reportRowHeaderCols = reportRowHeaderCols;
+ reportData.setColumnDataTotalsCrossTab(vc, "totalsAlignment", "colDisplayTotal", crossTabOrderManager, list);
+ }
+
+ @Test
+ public void setRowDataTotalsCrossTabTest() throws Exception {
+ ReportData reportData = mockReportData();
+ Vector vc = new Vector<>();
+ CrossTabTotalValue crossTabTotalValue = new CrossTabTotalValue();
+ Vector<DataValue> headerValues = new Vector<>();
+ DataValue dataValue = new DataValue();
+ headerValues.add(dataValue);
+ crossTabTotalValue.setHeaderValues(headerValues);
+ CrossTabTotalValue CrossTabTotalValue1 = new CrossTabTotalValue();
+ Vector<DataValue> headerValues1 = new Vector<>();
+ DataValue dataValue1 = new DataValue();
+ headerValues.add(dataValue);
+ CrossTabTotalValue1.setHeaderValues(headerValues);
+ vc.add(crossTabTotalValue);
+ vc.add(CrossTabTotalValue1);
+ ReportRuntime rr = mockReportRunTime1();
+ CrossTabOrderManager crossTabOrderManager = new CrossTabOrderManager(rr, "test12", mockedRequest);
+ List list = new ArrayList<>();
+ ReportRowHeaderCols reportRowHeaderCols = new ReportRowHeaderCols();
+ RowHeaderCol rowHeaderCol = new RowHeaderCol();
+ RowHeader rowHeader = new RowHeader();
+ rowHeader.setRowTitle("test");
+ rowHeaderCol.add(rowHeader);
+ RowHeaderCol rowHeaderCol1 = new RowHeaderCol();
+ RowHeader rowHeader1 = new RowHeader();
+ rowHeader1.setRowTitle("test1");
+ rowHeaderCol1.add(rowHeader1);
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol);
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol1);
+ reportData.reportRowHeaderCols = reportRowHeaderCols;
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.setRowDataTotalsCrossTab(vc, "test", "test", crossTabOrderManager, list);
+ }
+
+ @Test
+ public void setGrandTotalCrossTabTest() {
+ List list = new ArrayList<>();
+ ReportData reportData = mockReportData();
+ DataRow dataRow = new DataRow();
+ list.add(dataRow);
+ reportData.setGrandTotalCrossTab("totalValue", "totalAlignment", "displayTotal", list);
+ }
+
+ @Test
+ public void ReportListTest() {
+ ReportData reportData = mockReportData();
+ List list = new ArrayList<>();
+ reportData.setReportDataList(list);
+ assertEquals(reportData.getReportDataList().size(), 0);
+ assertEquals(reportData.getDataColumnCount(), 1);
+ assertEquals(reportData.getPageNo(), 1);
+ assertEquals(reportData.getPageSetNo(), -1);
+ assertEquals(reportData.getHeaderRowCount(), 0);
+ assertEquals(reportData.getTotalRowCount(), 1);
+ assertEquals(reportData.getHeaderColumnCount(), 0);
+ assertEquals(reportData.getTotalColumnCount(), 1);
+ }
+
+ public ReportData mockReportData1() throws Exception {
+
+ ReportData reportData = mockReportData();
+ Vector vc = new Vector<>();
+ CrossTabTotalValue crossTabTotalValue = new CrossTabTotalValue();
+ Vector<DataValue> headerValues = new Vector<>();
+ DataValue dataValue = new DataValue();
+ headerValues.add(dataValue);
+ crossTabTotalValue.setHeaderValues(headerValues);
+ CrossTabTotalValue CrossTabTotalValue1 = new CrossTabTotalValue();
+ Vector<DataValue> headerValues1 = new Vector<>();
+ DataValue dataValue1 = new DataValue();
+ headerValues.add(dataValue);
+ CrossTabTotalValue1.setHeaderValues(headerValues);
+ vc.add(crossTabTotalValue);
+ vc.add(CrossTabTotalValue1);
+ ReportRuntime rr = mockReportRunTime1();
+ CrossTabOrderManager crossTabOrderManager = new CrossTabOrderManager(rr, "test12", mockedRequest);
+ List list = new ArrayList<>();
+ ReportRowHeaderCols reportRowHeaderCols = new ReportRowHeaderCols();
+ RowHeaderCol rowHeaderCol = new RowHeaderCol();
+ RowHeader rowHeader = new RowHeader();
+ rowHeader.setRowTitle("test");
+ rowHeaderCol.add(rowHeader);
+ RowHeaderCol rowHeaderCol1 = new RowHeaderCol();
+ RowHeader rowHeader1 = new RowHeader();
+ rowHeader1.setRowTitle("test1");
+ rowHeaderCol1.add(rowHeader1);
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol);
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol1);
+ reportData.reportRowHeaderCols = reportRowHeaderCols;
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ List list1 = new ArrayList<>();
+ // DataRow dataRow = new DataRow();
+ // list1.add(dataRow);
+ ColumnHeaderRow columnHeaderRow1 = new ColumnHeaderRow();
+ reportColumnHeaderRows.add(columnHeaderRow1);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ return reportData;
+
+ }
+
+ @Test
+ public void setCrossTabColumnTotalLabelTest() throws Exception {
+ ReportData reportData = mockReportData1();
+ reportData.setCrossTabColumnTotalLabel("test");
+ }
+
+ @Test
+ public void setCrossTabColumnTotalLabel1Test() throws Exception {
+ ReportData reportData = mockReportData1();
+ reportData.setCrossTabColumnTotalLabel(1, "test");
+ }
+
+ @Test
+ public void setColumnDataTotalsLinearTest() throws Exception {
+ ReportData reportData = mockReportData1();
+ DataRow dataRow = new DataRow();
+ reportData.setColumnDataTotalsLinear(dataRow, "test");
+
+ }
+
+ @Test
+ public void getNextVisualTest() throws Exception {
+ ReportData reportData = mockReportData1();
+ Vector vc = new Vector<>();
+ ColumnVisual columnVisual = new ColumnVisual("test", "test", false, "test");
+ reportData.getNextVisual();
+ }
+
+ @Test
+ public void consolidateColumnHeadersTest() throws Exception {
+ ReportData reportData = mockReportData1();
+ VisualManager visualManager = new VisualManager();
+ reportData.consolidateColumnHeaders(visualManager);
+ }
+
+ @Test
+ public void consolidateRowHeaders4Test() throws Exception {
+ ReportData reportData = mockReportData1();
+ reportData.consolidateRowHeaders();
+
+ }
+
+ @Test
+ public void truncateDataTest() throws Exception {
+ ReportData reportData = mockReportData1();
+ reportData.truncateData(1, 1);
+ }
+
+ @Test
+ public void createColumnTest() throws Exception {
+ ReportData reportData = mockReportData1();
+ reportData.createColumn("colId", "displayName", "displayWidthInPxls", "alignment", false, "currentSort", false,
+ 1, 1, 1, false);
+ }
+
+ @Test
+ public void columnVisualShowHideTest() throws Exception {
+ ReportData reportData = mockReportData1();
+ reportData.columnVisualShowHide("test", false);
+ }
+
+ public ReportData mockReportData2() throws Exception {
+
+ ReportData reportData = mockReportData();
+ Vector vc = new Vector<>();
+ CrossTabTotalValue crossTabTotalValue = new CrossTabTotalValue();
+ Vector<DataValue> headerValues = new Vector<>();
+ DataValue dataValue = new DataValue();
+ dataValue.setHidden(true);
+ headerValues.add(dataValue);
+ crossTabTotalValue.setHeaderValues(headerValues);
+ CrossTabTotalValue CrossTabTotalValue1 = new CrossTabTotalValue();
+ Vector<DataValue> headerValues1 = new Vector<>();
+ DataValue dataValue1 = new DataValue();
+ headerValues.add(dataValue);
+ CrossTabTotalValue1.setHeaderValues(headerValues);
+ vc.add(crossTabTotalValue);
+ vc.add(CrossTabTotalValue1);
+ ReportRuntime rr = mockReportRunTime1();
+
+ CrossTabOrderManager crossTabOrderManager = new CrossTabOrderManager(rr, "test12", mockedRequest);
+ List list = new ArrayList<>();
+ ReportRowHeaderCols reportRowHeaderCols = new ReportRowHeaderCols();
+ RowHeaderCol rowHeaderCol = new RowHeaderCol();
+ RowHeader rowHeader = new RowHeader();
+ rowHeader.setRowTitle("test");
+ rowHeaderCol.add(rowHeader);
+ RowHeaderCol rowHeaderCol1 = new RowHeaderCol();
+ RowHeader rowHeader1 = new RowHeader();
+ rowHeader1.setRowTitle("test1");
+ rowHeaderCol1.add(rowHeader1);
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol);
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol1);
+ reportData.reportRowHeaderCols = reportRowHeaderCols;
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+
+ ColumnHeader columnHeader1 = new ColumnHeader();
+ columnHeader1.setRowSpan(1);
+ columnHeaderRow.add(columnHeader1);
+
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ List list1 = new ArrayList<>();
+ // DataRow dataRow = new DataRow();
+ // list1.add(dataRow);
+ ColumnHeaderRow columnHeaderRow1 = new ColumnHeaderRow();
+ reportColumnHeaderRows.add(columnHeaderRow1);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ Vector vc1 = new Vector<>();
+ ColumnVisual col = new ColumnVisual("colId", "colDisplay", true, "sortType");
+ vc1.add(col);
+ reportData.setColumnVisuals(vc1);
+
+ ReportDataRows reportDataRows = new ReportDataRows();
+ DataRow dataRow = new DataRow();
+ DataValue value = new DataValue();
+ dataRow.addDataValue(value);
+ reportDataRows.addDataRow(dataRow);
+ reportDataRows.add(dataRow);
+
+ reportData.reportDataRows = reportDataRows;
+ return reportData;
+
+ }
+
+ @Test
+ public void columnVisualShowHide1Test() throws Exception {
+ ReportData reportData = mockReportData2();
+ Vector vc1 = new Vector<>();
+ ColumnVisual col = new ColumnVisual("test", "colDisplay", true, "sortType");
+ vc1.add(col);
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ ColumnHeader columnHeader1 = new ColumnHeader();
+ columnHeader1.setRowSpan(1);
+ columnHeaderRow.add(columnHeader1);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.setColumnVisuals(vc1);
+ reportData.columnVisualShowHide("test", false);
+ }
+
+ @Test
+ public void applyVisibilityTest() throws Exception {
+ ReportData reportData = mockReportData2();
+ Vector vc1 = new Vector<>();
+ ColumnVisual col = new ColumnVisual("test", "colDisplay", true, "sortType");
+ vc1.add(col);
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ ColumnHeader columnHeader1 = new ColumnHeader();
+ columnHeader1.setRowSpan(1);
+ columnHeaderRow.add(columnHeader1);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.setColumnVisuals(vc1);
+ reportData.applyVisibility();
+ }
+
+ @Test
+ public void resetVisualSettingsTest() throws Exception {
+ ReportData reportData = mockReportData2();
+ Vector vc1 = new Vector<>();
+ ColumnVisual col = new ColumnVisual("test", "colDisplay", true, "sortType");
+ vc1.add(col);
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ ColumnHeader columnHeader1 = new ColumnHeader();
+ columnHeader1.setRowSpan(1);
+ columnHeaderRow.add(columnHeader1);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.setColumnVisuals(vc1);
+ reportData.resetVisualSettings();
+ }
+
+ @Test
+ public void getNextHiddenColLinksTest() throws Exception {
+ ReportData reportData = mockReportData2();
+ Vector vc1 = new Vector<>();
+ ColumnVisual col = new ColumnVisual("test", "colDisplay", true, "sortType");
+ vc1.add(col);
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ ColumnHeader columnHeader1 = new ColumnHeader();
+ columnHeader1.setRowSpan(1);
+ columnHeaderRow.add(columnHeader1);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.setColumnVisuals(vc1);
+ reportData.getNextHiddenColLinks();
+ }
+
+ @Test
+ public void getNextHiddenColLinks1Test() throws Exception {
+ ReportData reportData = mockReportData2();
+ Vector vc1 = new Vector<>();
+ ColumnVisual col = new ColumnVisual("test", "colDisplay", false, "sortType");
+ col.setColDisplay("hidden");
+ vc1.add(col);
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ ColumnHeader columnHeader1 = new ColumnHeader();
+ columnHeader1.setRowSpan(1);
+ columnHeaderRow.add(columnHeader1);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.setColumnVisuals(vc1);
+ reportData.getNextHiddenColLinks();
+ }
+
+ @Test
+ public void getNextHiddenColLinks2Test() throws Exception {
+ ReportData reportData = mockReportData2();
+ Vector vc1 = new Vector<>();
+ ColumnVisual col = new ColumnVisual("test", "colDisplay", false, "sortType");
+ col.setColDisplay("hidden");
+ vc1.add(col);
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ ColumnHeader columnHeader1 = new ColumnHeader();
+ columnHeader1.setRowSpan(1);
+ columnHeaderRow.add(columnHeader1);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.setColumnVisuals(vc1);
+ reportData.getNextHiddenColLinks(1);
+ }
+
+ @Test
+ public void getNextVisual2Test() throws Exception {
+ ReportData reportData = mockReportData2();
+ Vector vc1 = new Vector<>();
+ ColumnVisual col = new ColumnVisual("test", "colDisplay", false, "sortType");
+ col.setColDisplay("hidden");
+ vc1.add(col);
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ ColumnHeader columnHeader1 = new ColumnHeader();
+ columnHeader1.setRowSpan(1);
+ columnHeaderRow.add(columnHeader1);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.setColumnVisuals(vc1);
+ reportData.getNextVisual();
+ }
+
+ @Test
+ public void getNextVisual3Test() throws Exception {
+ ReportData reportData = mockReportData2();
+ Vector vc1 = new Vector<>();
+ ColumnVisual col = new ColumnVisual("test", "colDisplay", true, "sortType");
+ col.setColDisplay("hidden1");
+ vc1.add(col);
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ ColumnHeader columnHeader1 = new ColumnHeader();
+ columnHeader1.setRowSpan(1);
+ columnHeaderRow.add(columnHeader1);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.setColumnVisuals(vc1);
+ reportData.getNextVisual();
+ }
+
+ @Test
+ public void getNextVisual4Test() throws Exception {
+ ReportData reportData = mockReportData2();
+ Vector vc1 = new Vector<>();
+ ColumnVisual col = new ColumnVisual("test", "colDisplay", true, "ASC");
+ col.setColDisplay("ASC");
+ vc1.add(col);
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ ColumnHeader columnHeader1 = new ColumnHeader();
+ columnHeader1.setRowSpan(1);
+ columnHeaderRow.add(columnHeader1);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.setColumnVisuals(vc1);
+ reportData.getNextVisual();
+ reportData.getColumnVisuals();
+ }
+
+ @Test
+ public void setDatavalueTest() throws Exception {
+ ReportData reportData = mockReportData2();
+ Vector vc1 = new Vector<>();
+ ColumnVisual col = new ColumnVisual("test", "colDisplay", true, "ASC");
+ col.setColDisplay("ASC");
+ vc1.add(col);
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ ColumnHeader columnHeader1 = new ColumnHeader();
+ columnHeader1.setRowSpan(1);
+ columnHeaderRow.add(columnHeader1);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.setColumnVisuals(vc1);
+ reportData.getNextVisual();
+
+ Vector<DataValue> rowNameValues = new Vector<>();
+ DataValue dataValue = new DataValue();
+ dataValue.setDisplayName("ASC");
+ dataValue.setDisplayValue("test");
+ rowNameValues.add(dataValue);
+
+ Vector<DataValue> colNameValues = new Vector<>();
+ DataValue dataValue1 = new DataValue();
+ dataValue1.setDisplayName("ASC");
+ colNameValues.add(dataValue1);
+ Vector<DataValue> colNameSortValues = new Vector<>();
+ DataValue dataValue2 = new DataValue();
+ dataValue2.setDisplayName("ASC");
+ dataValue2.setDisplayValue("1");
+ colNameSortValues.add(dataValue2);
+ SemaphoreType sem = new SemaphoreType();
+ // FormatProcessor formatProcessor = new FormatProcessor(sem, "test",
+ // "test", false);
+ FormatProcessor formatProcessor = PowerMockito.mock(FormatProcessor.class);
+ ReportRuntime rr = mockReportRunTime1();
+ CrossTabOrderManager crossTabOrderManager = new CrossTabOrderManager(rr, "test12", mockedRequest);
+ List dataList = new ArrayList<>();
+ DataRow roe = new DataRow();
+ roe.addDataValue(dataValue1);
+ dataList.add(roe);
+ reportData.setDataValue(rowNameValues, colNameValues, colNameSortValues, dataValue2, formatProcessor,
+ crossTabOrderManager, dataList);
+ }
+
+ @Test
+ public void consolidateColumnHeaders1Test() throws Exception {
+ ReportData reportData = mockReportData2();
+ VisualManager visualManager = new VisualManager();
+ ReportColumnHeaderRows reportColumnHeaderRows = new ReportColumnHeaderRows();
+ ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow();
+ ColumnHeader columnHeader = new ColumnHeader();
+ columnHeaderRow.add(columnHeader);
+ reportColumnHeaderRows.add(columnHeaderRow);
+ reportData.reportColumnHeaderRows = reportColumnHeaderRows;
+ reportData.consolidateColumnHeaders(visualManager);
+ }
+
+ @Test
+ public void consolidateColumnHeaders3Test() throws Exception {
+ ReportData reportData = mockReportData2();
+ VisualManager visualManager = new VisualManager();
+ reportData.consolidateColumnHeaders(visualManager);
+ }
+
+ @Test
+ public void consolidateRowHeadersTest() throws Exception {
+ ReportData reportData = mockReportData2();
+ ReportRowHeaderCols reportRowHeaderCols = new ReportRowHeaderCols();
+ RowHeaderCol rowHeaderCol = new RowHeaderCol();
+ RowHeader rowHeader = new RowHeader();
+ rowHeaderCol.add(rowHeader);
+ RowHeader rowHeader1 = new RowHeader();
+ rowHeaderCol.add(rowHeader1);
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol);
+ RowHeaderCol rowHeaderCol1 = new RowHeaderCol();
+ RowHeader rowHeader2 = new RowHeader();
+ rowHeaderCol1.add(rowHeader2);
+ RowHeader rowHeader3 = new RowHeader();
+ RowHeader rowHeader6 = new RowHeader();
+ rowHeaderCol1.add(rowHeader3);
+ rowHeaderCol1.add(rowHeader6);
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol1);
+ RowHeaderCol rowHeaderCol2 = new RowHeaderCol();
+ RowHeader rowHeader5 = new RowHeader();
+ RowHeader rowHeader4 = new RowHeader();
+ rowHeaderCol2.add(rowHeader5);
+ rowHeaderCol2.add(rowHeader4);
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol2);
+ reportData.reportTotalRowHeaderCols = reportRowHeaderCols;
+ reportData.consolidateRowHeaders();
+ }
+
+ @Test
+ public void addRowNumbersTest() throws Exception {
+ ReportData reportData = mockReportData2();
+ List dataList = new ArrayList<>();
+ DataRow roe = new DataRow();
+ DataValue dataValue1 = new DataValue();
+ dataValue1.setDisplayName("ASC");
+ roe.addDataValue(dataValue1);
+ dataList.add(roe);
+ reportData.addRowNumbers(1, dataList);
+ }
+}