summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src/test/java
diff options
context:
space:
mode:
authorKotta, Shireesha (sk434m) <sk434m@att.com>2018-03-16 15:23:36 -0400
committerKotta, Shireesha (sk434m) <sk434m@att.com>2018-03-16 16:00:12 -0400
commit826eea3037d2251539a7be3dafe829bc7d371e76 (patch)
tree9d327357b4b6e569373c15e50290e7d35e12741b /ecomp-sdk/epsdk-analytics/src/test/java
parent1e827d0b631a11fad2f5dcdf4e5feb8ad1eb214e (diff)
Added Junits
Issue-ID: PORTAL-136 Includes JUNITS, Analytics module Change-Id: Ib3053782fad98b6d6b2048bac1b9506c5cd8f42f Signed-off-by: Kotta, Shireesha (sk434m) <sk434m@att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/test/java')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/FormFieldTest.java1300
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/AppUtilsTest.java746
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/DbUtilsTest.java627
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportRuntimeTest.java915
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportWrapperTest.java1149
5 files changed, 4524 insertions, 213 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/FormFieldTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/FormFieldTest.java
new file mode 100644
index 00000000..a8dacaec
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/FormFieldTest.java
@@ -0,0 +1,1300 @@
+/*
+ * ============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.runtime;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.onap.portalsdk.analytics.model.ReportHandler;
+import org.onap.portalsdk.analytics.model.base.IdNameList;
+import org.onap.portalsdk.analytics.model.base.IdNameSql;
+import org.onap.portalsdk.analytics.system.AppUtils;
+import org.onap.portalsdk.analytics.system.ConnectionUtils;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.onap.portalsdk.analytics.xmlobj.JavascriptItemType;
+import org.onap.portalsdk.analytics.xmlobj.JavascriptList;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import static org.powermock.api.mockito.PowerMockito.whenNew;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ AppUtils.class, Globals.class, ConnectionUtils.class, IdNameSql.class })
+public class FormFieldTest {
+
+ @Test
+ public void getAjaxHtmlTest() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+
+ HashMap formValues = new HashMap<>();
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, false);
+ }
+
+ @Test
+ public void getAjaxHtml1Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, false);
+ }
+
+ @Test
+ public void getAjaxHtml2Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, false);
+ }
+
+ @Test
+ public void getAjaxHtml3Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, true);
+ }
+
+ @Test
+ public void getAjaxHtml4Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, true);
+ }
+
+ @Test
+ public void getAjaxHtml5Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, false);
+ }
+
+ @Test
+ public void getAjaxHtml11Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, false);
+ }
+
+ @Test
+ public void getAjaxHtml10Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+
+ formField.setLookupList(idNameSql);
+
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, true);
+ }
+
+ @Test
+ public void getAjaxHtml12Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "TIMESTAMPTEST:test:test1",
+ true, "", "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ Mockito.when(lookupList.getBaseSQL()).thenReturn("baseSQL");
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ Mockito.when(idNameSql.getBaseWholeSQL()).thenReturn("testff_readonly");
+ Mockito.when(idNameSql.getBaseWholeReadonlySQL()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ idNameSql.setSQL("test");
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ formField.getAjaxHtml("test", formValues, rr, true);
+
+ }
+
+ @Test
+ public void getAjaxHtml9Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "HIDDEN", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+
+ formField.setLookupList(idNameSql);
+
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, true);
+ }
+
+ @Test
+ public void getAjaxHtml6Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT", "validationType", false, "defaultValue",
+ "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL", "rangeEndDateSQL",
+ "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+
+ formField.setLookupList(idNameSql);
+
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, true);
+ }
+
+ @Test
+ public void getAjaxHtml7Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXTAREA", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+
+ formField.setLookupList(idNameSql);
+
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, true);
+ }
+
+ @Test
+ public void getAjaxHtml8Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+
+ formField.setLookupList(idNameSql);
+
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getAjaxHtml("test", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtmlTest() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ formField.getHtml("test", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml1Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "validationType", true,
+ "defaultValue", "helpText", predefinedValues, true, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ formField.setLookupList(lookupList);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ formField.getHtml("test", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml2Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT", "validationType", true, "defaultValue",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "rangeStartDateSQL", "rangeEndDateSQL",
+ "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ formField.setLookupList(lookupList);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ formField.getHtml("test", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml3Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT", "TIMESTAMPTEST:test", true,
+ "defaultValue", "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ formField.getHtml("test", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml4Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT", "TIMESTAMPTEST:test:test1", true, "",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml5Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT", "DATE", true, "", "helpText",
+ predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL", "selectrangeEndDateSQL",
+ "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml6Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT", "TIMESTAMP_HR", true, "", "helpText",
+ predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL", "selectrangeEndDateSQL",
+ "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml7Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT", "TIMESTAMP_MIN", true, "", "helpText",
+ predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL", "selectrangeEndDateSQL",
+ "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml8Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT", "TIMESTAMP_SEC", true, "", "helpText",
+ predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL", "selectrangeEndDateSQL",
+ "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml9Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT", "TIMESTAMP_SEC", true, "", "helpText",
+ predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL", "selectrangeEndDateSQL",
+ "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml10Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXTAREA", "TIMESTAMP_SEC", true, "",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml11Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXTAREA", "TIMESTAMP_SEC", true, "Test",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml14Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "TIMESTAMP_SEC", true, "Test",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml15Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "TIMESTAMP_SEC", false, "Test",
+ "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml13Test1() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_BOX", "TIMESTAMP_SEC", true, "Test",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml13Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_BOX", "TIMESTAMP_SEC", false, "Test",
+ "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml16Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "HIDDEN", "TIMESTAMP_SEC", false, "Test",
+ "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml17Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "RADIO_BTN", "TIMESTAMP_SEC", false, "Test",
+ "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml18Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "RADIO_BTN", "TIMESTAMP_SEC", true, "Test",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml20Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "CHECK_BOX", "TIMESTAMP_SEC", true, "Test",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ lookupList.add(lookupList);
+ lookupList.resetNext();
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ formField.setLookupList(lookupList);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml23Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "CHECK_BOX", "TIMESTAMP_SEC", false, "Test",
+ "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ lookupList.add(lookupList);
+ lookupList.resetNext();
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ formField.setLookupList(lookupList);
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml21Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "TIMESTAMP_SEC", false,
+ "Test", "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ lookupList.add(lookupList);
+ lookupList.resetNext();
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ Mockito.when(idNameSql.getSql()).thenReturn("url");
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml22Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "TIMESTAMP_SEC", true,
+ "Test", "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ lookupList.add(lookupList);
+ lookupList.resetNext();
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ Mockito.when(idNameSql.getSql()).thenReturn("url");
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getHtml24Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "BLANK", "TIMESTAMP_SEC", true, "Test",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ IdNameList lookupList = PowerMockito.mock(IdNameList.class);
+ lookupList.add(lookupList);
+ lookupList.resetNext();
+ IdNameSql idNameSql = PowerMockito.mock(IdNameSql.class);
+ Mockito.when(idNameSql.getSql()).thenReturn("testff_readonly");
+ lookupList.add(idNameSql);
+ formField.setLookupList(idNameSql);
+ Mockito.when(idNameSql.getSql()).thenReturn("url");
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ formValues.put("fieldDisplayName", "test");
+ formValues.put("new", "");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test");
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ Mockito.when(ds.getString(0, 1)).thenReturn("dsTest");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1990-11-11 11:11:11");
+ Mockito.when(Globals.isScheduleDateParamAutoIncr()).thenReturn(false);
+ formField.getHtml("", formValues, rr, true);
+ }
+
+ @Test
+ public void getValidateJavaScriptTest() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "TIMESTAMP_SEC", true,
+ "Test", "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ PowerMockito.mockStatic(Globals.class);
+
+ Mockito.when(Globals.getCalendarOutputDateFormat()).thenReturn("test");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript1Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "INTEGER", true, "Test",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript2Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "POSITIVE_INTEGER", true,
+ "Test", "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript3Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "NON_NEGATIVE_INTEGER", true,
+ "Test", "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript4Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "FLOAT", true, "Test",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.setHasPredefinedList(false);
+ formField.setFieldDefaultSQL("test");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript5Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "POSITIVE_FLOAT", true,
+ "Test", "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript6Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT_WITH_POPUP", "NON_NEGATIVE_FLOAT", true,
+ "Test", "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript7Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXT", "NON_NEGATIVE_FLOAT", true, "Test",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript8Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXTAREA", "NON_NEGATIVE_FLOAT", true, "Test",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript9Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "CHECK_BOX", "NON_NEGATIVE_FLOAT", true, "Test",
+ "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript10Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "CHECK_BOX", "NON_NEGATIVE_FLOAT", false,
+ "Test", "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript11Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "NON_NEGATIVE_FLOAT", true,
+ "Test", "helpText", predefinedValues, true, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getValidateJavaScript12Test() throws Exception {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "NON_NEGATIVE_FLOAT",
+ false, "Test", "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ formField.getValidateJavaScript();
+ }
+
+ @Test
+ public void getCallableAfterChainingJavascriptTest() {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "NON_NEGATIVE_FLOAT",
+ false, "Test", "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ JavascriptList list = new JavascriptList();
+ List<JavascriptItemType> javalist = new ArrayList<>();
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setFieldId("test");
+ javascriptItemType.setCallText("afterchaining");
+ javalist.add(javascriptItemType);
+ list.setJavascriptItem(javalist);
+ Mockito.when(rr.getJavascriptList()).thenReturn(list);
+ formField.getCallableAfterChainingJavascript("test", rr);
+ }
+
+ @Test
+ public void getCallableAfterChainingJavascript1Test() {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "NON_NEGATIVE_FLOAT",
+ false, "Test", "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ JavascriptList list = new JavascriptList();
+ List<JavascriptItemType> javalist = new ArrayList<>();
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setFieldId("test");
+ javascriptItemType.setCallText("testafterchaining");
+ javalist.add(javascriptItemType);
+ list.setJavascriptItem(javalist);
+ Mockito.when(rr.getJavascriptList()).thenReturn(list);
+ formField.getCallableAfterChainingJavascript("test", rr);
+ }
+
+ @Test
+ public void getCallableJavascriptTest() {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "NON_NEGATIVE_FLOAT",
+ false, "Test", "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ JavascriptList list = new JavascriptList();
+ List<JavascriptItemType> javalist = new ArrayList<>();
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setFieldId("test");
+ javascriptItemType.setCallText("afterchaining");
+ javalist.add(javascriptItemType);
+ list.setJavascriptItem(javalist);
+ Mockito.when(rr.getJavascriptList()).thenReturn(list);
+ formField.getCallableJavascript("test", rr);
+ }
+
+ @Test
+ public void getCallableJavascript1Test() {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "NON_NEGATIVE_FLOAT",
+ false, "Test", "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ JavascriptList list = new JavascriptList();
+ List<JavascriptItemType> javalist = new ArrayList<>();
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setFieldId("test");
+ javascriptItemType.setCallText("testafterchaining");
+ javalist.add(javascriptItemType);
+ list.setJavascriptItem(javalist);
+ Mockito.when(rr.getJavascriptList()).thenReturn(list);
+ formField.getCallableJavascript("test", rr);
+ }
+
+ @Test
+ public void getCallableOnChangeJavascriptTest() {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "NON_NEGATIVE_FLOAT",
+ false, "Test", "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ JavascriptList list = new JavascriptList();
+ List<JavascriptItemType> javalist = new ArrayList<>();
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setFieldId("test");
+ javascriptItemType.setCallText("afterchaining");
+ javalist.add(javascriptItemType);
+ list.setJavascriptItem(javalist);
+ Mockito.when(rr.getJavascriptList()).thenReturn(list);
+ formField.getCallableOnChangeJavascript("test", rr);
+ }
+
+ @Test
+ public void getCallableOnChangeJavascript1Test() {
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "LIST_MULTI_SELECT", "NON_NEGATIVE_FLOAT",
+ false, "Test", "helpText", predefinedValues, false, "dependsOn", null, null, "selectrangeStartDateSQL",
+ "selectrangeEndDateSQL", "multiSelectListSize");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ JavascriptList list = new JavascriptList();
+ List<JavascriptItemType> javalist = new ArrayList<>();
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setFieldId("test");
+ javascriptItemType.setCallText("testafterchainingonchange.");
+ javalist.add(javascriptItemType);
+ list.setJavascriptItem(javalist);
+ Mockito.when(rr.getJavascriptList()).thenReturn(list);
+ formField.getCallableOnChangeJavascript("test", rr);
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/AppUtilsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/AppUtilsTest.java
new file mode 100644
index 00000000..ed6103a7
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/AppUtilsTest.java
@@ -0,0 +1,746 @@
+/*
+ * ============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.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+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.xmlobj.MockitoTestSuite;
+import org.onap.portalsdk.core.util.SecurityCodecUtil;
+import org.owasp.esapi.ESAPI;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.owasp.esapi.Encoder;
+import org.owasp.esapi.codecs.Codec;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ Globals.class, ESAPI.class, Codec.class, SecurityCodecUtil.class })
+public class AppUtilsTest {
+
+ @InjectMocks
+ AppUtils appUtils;
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void generateFileNameTest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ assertEquals(appUtils.generateFileName(mockedRequest, "test"), "cr_test12test");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void generateUniqueFileNameTest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ assertEquals(appUtils.generateUniqueFileName(mockedRequest, "test", "test").getClass(), String.class);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getRequestValueTest() {
+ Mockito.when(mockedRequest.getAttribute(Matchers.anyString())).thenReturn(null);
+ PowerMockito.mockStatic(ESAPI.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ Mockito.when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *");
+ assertEquals(appUtils.getRequestValue(mockedRequest, "test"), "select *");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getRequestNvlValueTest() {
+ Mockito.when(mockedRequest.getAttribute(Matchers.anyString())).thenReturn(null);
+ PowerMockito.mockStatic(ESAPI.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ Mockito.when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *");
+ assertEquals(appUtils.getRequestNvlValue(mockedRequest, "test"), "select *");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getRequestFlagTest() {
+ Mockito.when(mockedRequest.getAttribute(Matchers.anyString())).thenReturn(null);
+ PowerMockito.mockStatic(ESAPI.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ Mockito.when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("yes");
+ assertTrue(appUtils.getRequestFlag(mockedRequest, "test"));
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getRequestFlag1Test() {
+ Mockito.when(mockedRequest.getAttribute(Matchers.anyString())).thenReturn(null);
+ PowerMockito.mockStatic(ESAPI.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ Mockito.when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("true");
+ assertTrue(appUtils.getRequestFlag(mockedRequest, "test"));
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getRequestFlag2Test() {
+ Mockito.when(mockedRequest.getAttribute(Matchers.anyString())).thenReturn(null);
+ PowerMockito.mockStatic(ESAPI.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ Mockito.when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *");
+ assertFalse(appUtils.getRequestFlag(mockedRequest, "test"));
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUserIDTest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ assertEquals(appUtils.getUserID(mockedRequest), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUserNameest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUserName(mockedRequest)).thenReturn("test12");
+ assertEquals(appUtils.getUserName(mockedRequest), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUserName1Test() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUserName("test12")).thenReturn("test12");
+ assertEquals(appUtils.getUserName("test12"), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUserEmailTest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUserEmail("test12")).thenReturn("test12@test.com");
+ assertEquals(appUtils.getUserEmail("test12"), "test12@test.com");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUserEmail1est() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUserEmail(mockedRequest)).thenReturn("test12@test.com");
+ assertEquals(appUtils.getUserEmail(mockedRequest), "test12@test.com");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUserLoginIdTest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUserLoginId(mockedRequest)).thenReturn("test12");
+ assertEquals(appUtils.getUserLoginId(mockedRequest), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUserLoginId1Test() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUserLoginId("test12")).thenReturn("test12");
+ assertEquals(appUtils.getUserLoginId("test12"), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUserBackdoorLoginIdTest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUserBackdoorLoginId(mockedRequest)).thenReturn("test12");
+ assertEquals(appUtils.getUserBackdoorLoginId(mockedRequest), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getAllUsersTest() {
+ Vector vc = new Vector<>();
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getAllUsers("test", "test", false)).thenReturn(vc);
+ appUtils.getAllUsers("test", "test", false);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getRoleNameTest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getRoleName("test12")).thenReturn("test12");
+ assertEquals(appUtils.getRoleName("test12"), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getAllRolesTest() {
+ Vector vc = new Vector<>();
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getAllRoles("test", "test", false)).thenReturn(vc);
+ appUtils.getAllRoles("test", "test", false);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void isUserInRoleTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.isUserInRole(mockedRequest, "1")).thenReturn(false);
+ assertFalse(appUtils.isUserInRole(mockedRequest, "1"));
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUserRolesTest() throws Exception {
+ Vector vc = new Vector<>();
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUserRoles("test")).thenReturn(vc);
+ appUtils.getUserRoles("test");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void resetUserCacheTest() throws Exception {
+ Vector vc = new Vector<>();
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.doNothing().when(iAppUtils).resetUserCache();
+ appUtils.resetUserCache();
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getSuperRoleIDTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getSuperRoleID()).thenReturn("test");
+ assertEquals(appUtils.getSuperRoleID(), "test");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getAdminRoleIDsTest() throws Exception {
+ Vector vc = new Vector<>();
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getAdminRoleIDs()).thenReturn(vc);
+ appUtils.getAdminRoleIDs();
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void isSuperUserTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isAdminRoleEquivalenttoSuperRole()).thenReturn(false);
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getSuperRoleID()).thenReturn("test");
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.isUserInRole(mockedRequest, "1")).thenReturn(false);
+ assertFalse(appUtils.isSuperUser(mockedRequest));
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void isAdminUserTst() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isAdminRoleEquivalenttoSuperRole()).thenReturn(false);
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getSuperRoleID()).thenReturn("test");
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.isUserInRole(mockedRequest, "1")).thenReturn(true);
+
+ Vector vc = new Vector<>();
+ Mockito.when(iAppUtils.getAdminRoleIDs()).thenReturn(vc);
+
+ assertFalse(appUtils.isAdminUser(mockedRequest));
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void isAdminUser1Tst() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isAdminRoleEquivalenttoSuperRole()).thenReturn(false);
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getSuperRoleID()).thenReturn("test");
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.isUserInRole(mockedRequest, "1")).thenReturn(true);
+
+ Vector vc = new Vector<>();
+ vc.add("test");
+ Mockito.when(iAppUtils.getAdminRoleIDs()).thenReturn(vc);
+ Mockito.when(iAppUtils.isUserInRole(Matchers.any(HttpServletRequest.class), Matchers.anyString()))
+ .thenReturn(true);
+
+ assertTrue(appUtils.isAdminUser(mockedRequest));
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void isAdminUser2Tst() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isAdminRoleEquivalenttoSuperRole()).thenReturn(false);
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getSuperRoleID()).thenReturn("test");
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.isUserInRole(mockedRequest, "1")).thenReturn(true);
+
+ Vector vc = new Vector<>();
+ vc.add("test");
+ Mockito.when(iAppUtils.getAdminRoleIDs()).thenReturn(vc);
+ Mockito.when(iAppUtils.isUserInRole(mockedRequest, "test")).thenReturn(false);
+
+ assertFalse(appUtils.isAdminUser(mockedRequest));
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getTempFolderPathTest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getTempFolderPath()).thenReturn("test12");
+ appUtils.getTempFolderPath();
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getTempFolderPath1Test() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getTempFolderPath()).thenReturn("test12\\");
+ appUtils.getTempFolderPath();
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getTempFolderPath2Test() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getTempFolderPath()).thenReturn("test12/");
+ appUtils.getTempFolderPath();
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUploadFolderPathTest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUploadFolderPath()).thenReturn("test12");
+ appUtils.getUploadFolderPath();
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUploadFolderPath1Test() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUploadFolderPath()).thenReturn("test12\\");
+ appUtils.getUploadFolderPath();
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getTempFolderURLTest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getTempFolderURL()).thenReturn("test12");
+ assertEquals(appUtils.getTempFolderURL(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getUploadFolderURLTest() {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getUploadFolderURL()).thenReturn("test12");
+ assertEquals(appUtils.getUploadFolderURL(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getSMTPServerTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getSMTPServer()).thenReturn("test12");
+ assertEquals(appUtils.getSMTPServer(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getDefaultEmailSenderTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getDefaultEmailSender()).thenReturn("test12");
+ assertEquals(appUtils.getDefaultEmailSender(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getErrorPageTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getErrorPage()).thenReturn("test12");
+
+ Mockito.when(iAppUtils.getJspContextPath()).thenReturn("test12");
+ assertEquals(appUtils.getErrorPage(), "test12test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getJspContextPathTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getJspContextPath()).thenReturn("test12");
+ assertEquals(appUtils.getJspContextPath(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getImgFolderURLTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getImgFolderURL()).thenReturn("test12");
+ assertEquals(appUtils.getImgFolderURL(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getBaseFolderURLTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getBaseFolderURL()).thenReturn("test12");
+ assertEquals(appUtils.getBaseFolderURL(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getChartScriptsPathTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getBaseFolderURL()).thenReturn("test12");
+ Mockito.when(iAppUtils.getFolderPathAdj()).thenReturn("test12");
+ assertEquals(appUtils.getChartScriptsPath(), "test12test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getChartScriptsPath1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getBaseFolderURL()).thenReturn("test12");
+ assertEquals(appUtils.getChartScriptsPath("test"), "testtest12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getFolderPathAdjTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getFolderPathAdj()).thenReturn("test12");
+ assertEquals(appUtils.getFolderPathAdj(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getDirectAccessURLTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getDirectAccessURL()).thenReturn("test12");
+ assertEquals(appUtils.getDirectAccessURL(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getBaseURLLTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getBaseActionURL()).thenReturn("test12");
+ assertEquals(appUtils.getBaseURL(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getBaseURLL1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getBaseActionURL()).thenReturn("test12?");
+ assertEquals(appUtils.getBaseURL(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getBaseActionURLTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getBaseActionURL()).thenReturn("test12");
+ assertEquals(appUtils.getBaseActionURL(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getDrillActionURLTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getDrillActionURL()).thenReturn("test12");
+ assertEquals(appUtils.getDrillActionURL(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getRaptorActionURLTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getBaseActionURL()).thenReturn("test12");
+ assertEquals(appUtils.getRaptorActionURL(), "test12raptor&r_action=");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getRaptorActionURLNGTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getBaseActionURLNG()).thenReturn("test12");
+ assertEquals(appUtils.getRaptorActionURLNG(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getReportExecuteActionURLTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getBaseActionURLNG()).thenReturn("test12");
+ assertEquals(appUtils.getReportExecuteActionURL(), "nullraptor&r_action=report.run.container&c_master=");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getReportExecuteActionURLNGTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getBaseActionURLNG()).thenReturn("test12");
+ assertEquals(appUtils.getReportExecuteActionURLNG(), "test12report_run/");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getBaseActionParamTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getBaseActionParam()).thenReturn("test12");
+ assertEquals(appUtils.getBaseActionParam(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getQuickLinksMenuIDsTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Vector vc = new Vector<>();
+ Mockito.when(iAppUtils.getQuickLinksMenuIDs()).thenReturn(vc);
+ appUtils.getQuickLinksMenuIDs();
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getMenuLabelTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getMenuLabel("test")).thenReturn("test12");
+ assertEquals(appUtils.getMenuLabel("test"), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getReportDbColsMaskSQLTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getReportDbColsMaskSQL()).thenReturn("test12");
+ assertEquals(appUtils.getReportDbColsMaskSQL(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getReportDbLookupsSQLTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getReportDbLookupsSQL()).thenReturn("test12");
+ assertEquals(appUtils.getReportDbLookupsSQL(), "test12");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void processErrorNotificationTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.doNothing().when(iAppUtils).processErrorNotification(Matchers.any(HttpServletRequest.class),
+ Matchers.any(RaptorException.class));
+ appUtils.processErrorNotification(mockedRequest, new RaptorException("test"));
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getExcelTemplatePathTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getExcelTemplatePath()).thenReturn("test12");
+ appUtils.getExcelTemplatePath();
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getExcelTemplatePath1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ IAppUtils iAppUtils = PowerMockito.mock(IAppUtils.class);
+ Mockito.when(Globals.getAppUtils()).thenReturn(iAppUtils);
+ Mockito.when(iAppUtils.getExcelTemplatePath()).thenReturn("test12\\");
+ appUtils.getExcelTemplatePath();
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void nvlTest() {
+ assertEquals(appUtils.nvl(null), "");
+ assertEquals(appUtils.nvl("test"), "test");
+ assertEquals(appUtils.isNotEmpty(""), false);
+ assertEquals(appUtils.isNotEmpty("test"), true);
+ assertEquals(appUtils.nvls("test", "test1"), "test");
+ assertEquals(appUtils.nvls(null, "test1"), "test1");
+ }
+}
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
index 664e27c7..10e1d9e1 100644
--- 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
@@ -36,10 +36,14 @@
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.portalsdk.analytics.system;
-import static org.junit.Assert.*;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import java.sql.CallableStatement;
import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
@@ -55,298 +59,495 @@ 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.analytics.model.runtime.ReportRuntime;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnType;
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})
+@PrepareForTest({ AppUtils.class, Globals.class, Runtime.class, ConnectionUtils.class })
public class DbUtilsTest {
@Mock
DataSource dataSource;
-
+
@InjectMocks
DbUtils dbUtils = new DbUtils();
-
+
@Mock
Connection connection;
@Mock
CallableStatement stmt;
-
+
@Mock
Statement statement;
-
+
+ @Mock
+ ResultSet rs;
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
}
-
+
@SuppressWarnings("static-access")
@Test
- public void getConnectionTest() throws Exception
- {
+ 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
- {
+ 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 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")
- @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 = 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", "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")
- @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", "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
- 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 = 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(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
+ // 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(expected = RaptorException.class)
+ public void rollbackTransactionExceptionTest() throws Exception {
+ Mockito.doThrow(SQLException.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(expected = Exception.class)
+ public void rollbackTransactionException2Test() throws Exception {
+ Mockito.doThrow(Exception.class).when(connection).rollback();
+ dbUtils.rollbackTransaction(connection);
+ }
- @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")
+ @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");
+ }
- @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 executeQueryTest() 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.createStatement()).thenReturn(statement);
+ Mockito.when(statement.executeQuery("test")).thenReturn(rs);
+ PowerMockito.mockStatic(Runtime.class);
+ Mockito.when(Runtime.getRuntime()).thenReturn(null);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rsmd.getColumnLabel(0)).thenReturn("test");
+ Mockito.when(rsmd.getColumnTypeName(0)).thenReturn("test");
+ dbUtils.executeQuery(connection, "test");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = ReportSQLException.class)
+ public void executeQuery1Test() 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.createStatement()).thenThrow(SQLException.class);
+ Mockito.when(statement.executeQuery("test")).thenReturn(rs);
+ PowerMockito.mockStatic(Runtime.class);
+ Mockito.when(Runtime.getRuntime()).thenReturn(null);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rsmd.getColumnLabel(0)).thenReturn("test");
+ Mockito.when(rsmd.getColumnTypeName(0)).thenReturn("test");
+ dbUtils.executeQuery(connection, "test");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = ReportSQLException.class)
+ public void executeQuery2Test() throws Exception
+ {
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getDatasource()).thenReturn(dataSource);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.when(connection.isClosed()).thenReturn(false);
+ Mockito.when(connection.createStatement()).thenThrow(SQLException.class);
+ Mockito.when(statement.executeQuery("test")).thenReturn(rs);
+ PowerMockito.mockStatic(Runtime.class);
+ Mockito.when(Runtime.getRuntime()).thenReturn(null);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rsmd.getColumnLabel(0)).thenReturn("test");
+ Mockito.when(rsmd.getColumnTypeName(0)).thenReturn("test");
+ dbUtils.executeQuery(connection, "test");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test(expected = ReportSQLException.class)
+ public void executeQuery3Test() throws Exception
+ {
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getDatasource()).thenReturn(dataSource);
+ Mockito.when(dataSource.getConnection()).thenReturn(connection);
+ Mockito.when(connection.isClosed()).thenReturn(false);
+ Mockito.when(connection.createStatement()).thenThrow(SQLException.class);
+ Mockito.when(statement.executeQuery("test")).thenReturn(rs);
+ PowerMockito.mockStatic(Runtime.class);
+ Mockito.when(Runtime.getRuntime()).thenReturn(null);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rsmd.getColumnLabel(0)).thenReturn("test");
+ Mockito.when(rsmd.getColumnTypeName(0)).thenReturn("test");
+ dbUtils.executeQuery(connection, "test", 1);
+ }
+
+
@SuppressWarnings("static-access")
@Test
- public void executeCall3Test() throws Exception
- {
+ public void executeQuery4Test() 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");
+ Mockito.when(statement.executeQuery("test")).thenReturn(rs);
+ PowerMockito.mockStatic(Runtime.class);
+ Mockito.when(Runtime.getRuntime()).thenReturn(null);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rsmd.getColumnLabel(0)).thenReturn("test");
+ Mockito.when(rsmd.getColumnTypeName(0)).thenReturn("test");
+ dbUtils.executeQuery("test", 1);
}
+
@SuppressWarnings("static-access")
@Test
- public void executeUpdate2Test() throws Exception
- {
+ public void executeQuery5Test() 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");
+ Mockito.when(statement.executeQuery("test")).thenReturn(rs);
+ PowerMockito.mockStatic(Runtime.class);
+ Mockito.when(Runtime.getRuntime()).thenReturn(null);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rsmd.getColumnLabel(0)).thenReturn("test");
+ Mockito.when(rsmd.getColumnTypeName(0)).thenReturn("test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getDBInfo()).thenReturn("test");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getConnection(Matchers.anyString())).thenReturn(connection);
+ Mockito.when(rr.getWholeSQL()).thenReturn("test");
+ DataColumnType dc = PowerMockito.mock(DataColumnType.class);
+ Mockito.when(rr.getColumnWhichNeedEnhancedPagination()).thenReturn(dc);
+ Mockito.when(dc.getColId()).thenReturn("test");
+ Mockito.when(dc.getColFormat()).thenReturn("test");
+ dbUtils.executeQuery(rr, 1);
}
-
+
@SuppressWarnings("static-access")
@Test
- public void executeUpdate3Test() throws Exception
- {
+ public void executeQuery6Test() 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");
+ Mockito.when(statement.executeQuery("test")).thenReturn(rs);
+ PowerMockito.mockStatic(Runtime.class);
+ Mockito.when(Runtime.getRuntime()).thenReturn(null);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rsmd.getColumnLabel(0)).thenReturn("test");
+ Mockito.when(rsmd.getColumnTypeName(0)).thenReturn("test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getDBInfo()).thenReturn("test");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getConnection(Matchers.anyString())).thenReturn(connection);
+ Mockito.when(rr.getWholeSQL()).thenReturn("test");
+ DataColumnType dc = PowerMockito.mock(DataColumnType.class);
+ Mockito.when(rr.getColumnWhichNeedEnhancedPagination()).thenReturn(dc);
+ Mockito.when(dc.getColId()).thenReturn("test");
+ Mockito.when(dc.getColFormat()).thenReturn("test");
+ dbUtils.executeQuery(rr, 2);
}
-
-
+
@SuppressWarnings("static-access")
- @Test(expected = RaptorException.class)
- public void executeUpdate4Test() throws Exception
- {
+ @Test
+ public void executeQuery7Test() 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");
+ Mockito.when(statement.executeQuery("test")).thenReturn(rs);
+ PowerMockito.mockStatic(Runtime.class);
+ Mockito.when(Runtime.getRuntime()).thenReturn(null);
+ ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class);
+ Mockito.when(rs.getMetaData()).thenReturn(rsmd);
+ Mockito.when(rsmd.getColumnCount()).thenReturn(1);
+ Mockito.when(rsmd.getColumnLabel(0)).thenReturn("test");
+ Mockito.when(rsmd.getColumnTypeName(0)).thenReturn("test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(rr.getDBInfo()).thenReturn("test");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(ConnectionUtils.getConnection(Matchers.anyString())).thenReturn(connection);
+ Mockito.when(rr.getWholeSQL()).thenReturn("test");
+ DataColumnType dc = PowerMockito.mock(DataColumnType.class);
+ Mockito.when(rr.getColumnWhichNeedEnhancedPagination()).thenReturn(dc);
+ Mockito.when(dc.getColId()).thenReturn("test");
+ Mockito.when(dc.getColFormat()).thenReturn("test");
+ dbUtils.executeQuery(rr, 3);
+ }
+
+ @Test
+ public void nvlTest() {
+ assertEquals(dbUtils.nvl(null), "");
+ assertEquals(dbUtils.nvl("test"), "test");
+ assertEquals(dbUtils.nvls("test"), "test");
+ assertEquals(dbUtils.nvls(null), "");
+ assertEquals(dbUtils.nvl("test", "test1"), "test");
+ assertEquals(dbUtils.nvl(null, "test1"), "test1");
}
-
}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportRuntimeTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportRuntimeTest.java
new file mode 100644
index 00000000..a349eef0
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportRuntimeTest.java
@@ -0,0 +1,915 @@
+/*
+ * ============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.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 javax.servlet.http.HttpSession;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+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.FormField;
+import org.onap.portalsdk.analytics.model.runtime.ReportFormFields;
+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.RemDbInfo;
+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.ReportColumnHeaderRows;
+import org.onap.portalsdk.analytics.view.ReportData;
+import org.onap.portalsdk.analytics.view.ReportRowHeaderCols;
+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.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({ 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,
+ DataCache.class })
+public class ReportRuntimeTest {
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ 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");
+ dataColumnType.setDrillDownParams("drilldown[#]");
+ dataColumnType.setCrossTabValue("VALUE");
+ dataColumnType.setDrillDownURL("url");
+ 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<>(4);
+ 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");
+ formFieldType.setGroupFormField(true);
+ // FormFieldType formFieldType1 = new FormFieldType();
+ formFields.add(formFieldType);
+ // formFields.add(formFieldType1);
+
+ formFieldList.formField = formFields;
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setWholeSQL("test");
+ 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 getParamNameValuePairsTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getParamNameValuePairs();
+ }
+
+ @Test
+ public void getParamNameValuePairsforPDFExcelTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setReportFormFields(null);
+ List predefinedValues = new ArrayList<>();
+ ReportWrapper rw = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = new ReportFormFields(rw, mockedRequest);
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXTAREA", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormField formField1 = new FormField("test", "fieldDisplayName", "TEXTAREA", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormField formField2 = new FormField("test", "fieldDisplayName", "TEXTAREA", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+
+ reportFormFields.add(formField);
+ reportFormFields.add(formField1);
+ reportFormFields.add(formField2);
+ rr.setReportFormFields(null);
+ rr.setReportFormFields(reportFormFields);
+
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.customizeFormFieldInfo()).thenReturn(true);
+ Mockito.when(Globals.getDisplaySessionParamInPDFEXCEL()).thenReturn("test,test");
+ HttpSession session = mockedRequest.getSession();
+ Mockito.when(session.getAttribute("test")).thenReturn("test");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test,test");
+ rr.getParamNameValuePairsforPDFExcel(mockedRequest, 2);
+
+ }
+
+ @Test(expected = java.lang.ArrayIndexOutOfBoundsException.class)
+ public void getParamNameValuePairsforPDFExcel1Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setReportFormFields(null);
+ List predefinedValues = new ArrayList<>();
+ ReportWrapper rw = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = new ReportFormFields(rw, mockedRequest);
+ FormField formField = new FormField("test", "fieldDisplayName", "TEXTAREA", "validationType", true,
+ "defaultValue", "helpText", predefinedValues, true, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormField formField1 = new FormField("test", "fieldDisplayName", "TEXTAREA", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormField formField2 = new FormField("test", "fieldDisplayName", "TEXTAREA", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormField formField3 = PowerMockito.mock(FormField.class);
+
+ reportFormFields.add(formField);
+ reportFormFields.add(formField1);
+ reportFormFields.add(formField2);
+ reportFormFields.add(formField3);
+
+ rr.setReportFormFields(null);
+ rr.setReportFormFields(reportFormFields);
+
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.customizeFormFieldInfo()).thenReturn(true);
+ Mockito.when(Globals.getDisplaySessionParamInPDFEXCEL()).thenReturn("test,test");
+ HttpSession session = mockedRequest.getSession();
+ Mockito.when(session.getAttribute("test")).thenReturn("test");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test,test");
+ rr.getParamNameValuePairsforPDFExcel(mockedRequest, 1);
+
+ }
+
+ @Test
+ public void getFormFieldCommentsTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getCustomReport().getFormFieldList().setComment("");
+ rr.getFormFieldComments(mockedRequest);
+ }
+
+ @Test
+ public void loadChartDataTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getCustomReport().getFormFieldList().setComment("");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ rr.setChartDataCache(ds);
+ rr.loadChartData("test", mockedRequest);
+ }
+
+ @Test
+ public void getReportDataSQLTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getCustomReport().getFormFieldList().setComment("");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ rr.setChartDataCache(ds);
+ rr.setWholeSQL("testFROMORDERBY");
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.getGenerateSubsetSql()).thenReturn("subsetSql");
+ Mockito.when(Globals.getReportSqlOnlyFirstPart()).thenReturn("subsetSql");
+ Mockito.when(Globals.getReportSqlOnlySecondPartA()).thenReturn("secondpartA");
+ Mockito.when(Globals.getReportSqlOnlySecondPartB()).thenReturn("secondpartB");
+ Mockito.when(AppUtils.isNotEmpty(Matchers.anyString())).thenReturn(false);
+ Mockito.when(Globals.getDBType()).thenReturn("db");
+ rr.getReportDataSQL("test", 1, mockedRequest);
+ }
+
+ @Test(expected = java.lang.RuntimeException.class)
+ public void loadReportDataTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getCustomReport().getFormFieldList().setComment("");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ rr.setChartDataCache(ds);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getRequestFlag(mockedRequest, AppConstants.RI_GO_BACK)).thenReturn(false);
+ rr.loadReportData(1, "userId", 1, mockedRequest, false);
+ }
+
+ @Test
+ public void loadReportData1Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getCustomReport().getFormFieldList().setComment("");
+ rr.getCustomReport().setReportType("Linear");
+ rr.setWholeSQL("testFROMORDERBY");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ rr.setChartDataCache(ds);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(AppUtils.getRequestFlag(mockedRequest, AppConstants.RI_GO_BACK)).thenReturn(false);
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_ACTION)).thenReturn("actionsession");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(Globals.getGenerateSubsetSql()).thenReturn("subsetSql");
+ Mockito.when(Globals.getReportSqlOnlyFirstPart()).thenReturn("subsetSql");
+ Mockito.when(Globals.getReportSqlOnlySecondPartA()).thenReturn("secondpartA");
+ Mockito.when(Globals.getReportSqlOnlySecondPartB()).thenReturn("secondpartB");
+ Mockito.when(AppUtils.isNotEmpty(Matchers.anyString())).thenReturn(false);
+ Mockito.when(Globals.getDBType()).thenReturn("db");
+ rr.loadReportData(1, "userId", 1, mockedRequest, false);
+ }
+
+ @Test
+ public void addDataValueTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getCustomReport().getFormFieldList().setComment("");
+ rr.getCustomReport().setReportType("Linear");
+ rr.setWholeSQL("testFROMORDERBY");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ rr.setChartDataCache(ds);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setCrossTabValue("testcrosstab");
+ rr.addDataValue(dataColumnType, "userId");
+ }
+
+ @Test
+ public void doesReportContainsGroupFormFieldTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.doesReportContainsGroupFormField();
+ }
+
+ @Test
+ public void doesReportContainsGroupFormField1Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getFormFieldList().getFormField().get(0).setGroupFormField(null);
+ rr.doesReportContainsGroupFormField();
+ }
+
+ @Test
+ public void loadReportData2Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getCustomReport().getFormFieldList().setComment("");
+ rr.getCustomReport().setReportType("Cross-Tab");
+ rr.setWholeSQL("testFROMORDERBY");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ rr.setChartDataCache(ds);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(AppUtils.getRequestFlag(mockedRequest, AppConstants.RI_GO_BACK)).thenReturn(false);
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_ACTION)).thenReturn("actionsession");
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(Globals.getGenerateSubsetSql()).thenReturn("subsetSql");
+ Mockito.when(Globals.getReportSqlOnlyFirstPart()).thenReturn("subsetSql");
+ Mockito.when(Globals.getReportSqlOnlySecondPartA()).thenReturn("secondpartA");
+ Mockito.when(Globals.getReportSqlOnlySecondPartB()).thenReturn("secondpartB");
+ Mockito.when(AppUtils.isNotEmpty(Matchers.anyString())).thenReturn(false);
+ Mockito.when(Globals.getDBType()).thenReturn("db");
+ PowerMockito.mockStatic(ESAPI.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ Mockito.when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *");
+ Mockito.when(Globals.getLoadCrosstabReportData()).thenReturn("reportdata");
+ ReportData rd = PowerMockito.mock(ReportData.class);
+ PowerMockito.whenNew(ReportData.class).withArguments(Mockito.anyInt(), Mockito.anyBoolean()).thenReturn(rd);
+ 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);
+ rd.reportColumnHeaderRows = reportColumnHeaderRows;
+ ReportRowHeaderCols reportRowHeaderCols = new ReportRowHeaderCols();
+ RowHeaderCol rowHeaderCol = new RowHeaderCol();
+ rowHeaderCol.add("test");
+ RowHeaderCol rowHeaderCol1 = new RowHeaderCol();
+ rowHeaderCol1.add("test1");
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol);
+ reportRowHeaderCols.addRowHeaderCol(rowHeaderCol1);
+ rd.reportRowHeaderCols = reportRowHeaderCols;
+ rr.loadReportData(1, "userId", 1, mockedRequest, false);
+ }
+
+ @Test
+ public void loadHiveLinearReportDataTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getCustomReport().getFormFieldList().setComment("");
+ rr.getCustomReport().setReportType("Cross-Tab");
+ rr.setWholeSQL("testFROMORDERBY");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ rr.setChartDataCache(ds);
+ rr.getAllColumns().get(0).setDrillDownURL("");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isPostgreSQL()).thenReturn(true);
+ Mockito.when(Globals.isMySQL()).thenReturn(false);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1");
+ rr.loadHiveLinearReportData("testSQL", "userId", 1, mockedRequest);
+ }
+
+ @Test
+ public void loadHiveLinearReportData2Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getCustomReport().getFormFieldList().setComment("");
+ rr.getCustomReport().setReportType("Cross-Tab");
+ rr.setWholeSQL("testFROMORDERBY");
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ rr.setChartDataCache(ds);
+ rr.getAllColumns().get(0).setDrillDownURL("");
+ rr.getAllColumns().get(0).setVisible(true);
+ rr.getAllColumns().get(0).setDependsOnFormField("[test]");
+ rr.getAllColumns().get(0).setDisplayWidthInPxls("setpx");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isPostgreSQL()).thenReturn(true);
+ Mockito.when(Globals.isMySQL()).thenReturn(false);
+ Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(ds);
+ Mockito.when(ds.getRowCount()).thenReturn(1);
+ Mockito.when(ds.getString(0, 0)).thenReturn("1");
+ Mockito.when(mockedRequest.getParameter(Matchers.anyString())).thenReturn("test");
+ rr.loadHiveLinearReportData("testSQL", "userId", 1, mockedRequest);
+ }
+
+ @Test
+ public void parseDrillDownURLTest() throws Exception {
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ ReportRuntime rr = mockReportRunTime1();
+ 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");
+ dataColumnType.setDrillDownParams("drilldown[#]");
+ dataColumnType.setCrossTabValue("VALUE");
+ dataColumnType.setDrillDownURL("url");
+ ReportWrapper rw = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = new ReportFormFields(rw, mockedRequest);
+ PowerMockito.mockStatic(DataCache.class);
+ Vector vc = new Vector<>();
+ vc.add("test");
+ Mockito.when(DataCache.getDataViewActions()).thenReturn(vc);
+ Mockito.when(Globals.getPassRequestParamInDrilldown()).thenReturn(true);
+ Mockito.when(Globals.getRequestParams()).thenReturn("FFtest,1");
+ Mockito.when(Globals.getRequestParams()).thenReturn("test,1");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test,2");
+ Mockito.when(Globals.getSessionParams()).thenReturn("FFtest,2");
+
+ Mockito.when(mockedRequest.getParameter(Matchers.anyString())).thenReturn("test");
+ rr.parseDrillDownURL(1, ds, dataColumnType, mockedRequest, reportFormFields);
+ }
+
+ @Test
+ public void parseDrillDownURL1Test() throws Exception {
+ DataSet ds = PowerMockito.mock(DataSet.class);
+ ReportRuntime rr = mockReportRunTime1();
+ 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");
+ dataColumnType.setDrillDownParams("drilldown[#]");
+ dataColumnType.setCrossTabValue("VALUE");
+ dataColumnType.setDrillDownURL("testutilstest");
+ ReportWrapper rw = PowerMockito.mock(ReportWrapper.class);
+ ReportFormFields reportFormFields = new ReportFormFields(rw, mockedRequest);
+ PowerMockito.mockStatic(DataCache.class);
+ PowerMockito.mockStatic(AppUtils.class);
+
+ Vector vc = new Vector<>();
+ vc.add("test");
+ Mockito.when(DataCache.getDataViewActions()).thenReturn(vc);
+ Mockito.when(Globals.getPassRequestParamInDrilldown()).thenReturn(true);
+ Mockito.when(Globals.getRequestParams()).thenReturn("FFtest,1");
+ Mockito.when(Globals.getRequestParams()).thenReturn("test,1");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test,2");
+ Mockito.when(Globals.getSessionParams()).thenReturn("FFtest,2");
+
+ Mockito.when(mockedRequest.getParameter(Matchers.anyString())).thenReturn("test");
+ Mockito.when(AppUtils.getBaseActionURL()).thenReturn("testutils");
+ Mockito.when(AppUtils.getBaseActionParam()).thenReturn("utils");
+ Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn("test");
+ rr.parseDrillDownURL(1, ds, dataColumnType, mockedRequest, reportFormFields);
+ }
+
+ @Test
+ public void parseReportSQLTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.parseReportSQL("select id from test");
+ }
+
+ @Test(expected = org.onap.portalsdk.analytics.error.ValidationException.class)
+ public void parseReportSQL1Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.parseReportSQL("select * from test ORDER BY");
+ }
+
+ @Test(expected = org.onap.portalsdk.analytics.error.ValidationException.class)
+ public void parseReportSQL2Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.parseReportSQL("select DISTINCT from test");
+ }
+
+ @Test(expected = org.onap.portalsdk.analytics.error.ValidationException.class)
+ public void parseReportSQL3Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getCustomReport().setDbInfo("test");
+ rr.parseReportSQL("select * from test");
+ }
+
+ @Test(expected = org.onap.portalsdk.analytics.error.ValidationException.class)
+ public void parseReportSQL4Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.getCustomReport().setDbInfo("DAYTONA");
+ RemDbInfo rdemo = Mockito.mock(RemDbInfo.class);
+ PowerMockito.whenNew(RemDbInfo.class).withNoArguments().thenReturn(rdemo);
+ Mockito.when(rdemo.getDBType(Matchers.anyString())).thenReturn("DAYTONA");
+ rr.parseReportSQL("");
+ }
+
+ @Test
+ public void setDisplayFlagsTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setDisplayFlags(false, false);
+
+ }
+
+ @Test
+ public void setDisplayFlags1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.getIncludeFormWithData()).thenReturn(true);
+ ReportRuntime rr = mockReportRunTime1();
+ Mockito.when(Globals.getDisplayFormBeforeRun()).thenReturn(true);
+ rr.setDisplayFlags(false, false);
+
+ }
+
+ @Test
+ public void setDisplayFlags2Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ ReportRuntime rr = mockReportRunTime1();
+ Mockito.when(Globals.getIncludeFormWithData()).thenReturn(true);
+ rr.setDisplayFlags(false, false);
+ }
+
+ @Test
+ public void setDisplayFlags3Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setDisplayFlags(true, true);
+ }
+
+ @Test
+ public void setDisplayFlags4Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setDisplayFlags(true, false);
+ }
+
+ @Test
+ public void setDisplayFlags5Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.getDisplayFormBeforeRun()).thenReturn(true);
+ rr.setDisplayFlags(true, false);
+ }
+
+ @Test
+ public void formatSelectedItemsTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List list = new ArrayList<>();
+ list.add("test");
+ rr.formatSelectedItems(list, "LIST_MULTI_SELECT");
+ }
+
+ @Test
+ public void formatSelectedItems5Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List list = new ArrayList<>();
+ list.add("test");
+ rr.formatSelectedItems(list, "LIST_BOX");
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValuesTest() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues1Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("COMBO_BOX");
+ formFieldType.setValidationType("DATE");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues2Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("LIST_MULTI_SELECT");
+ formFieldType.setValidationType("DATE");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues3Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("CHECK_BOX");
+ formFieldType.setValidationType("DATE");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues4Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("RADIO_BTN");
+ formFieldType.setValidationType("DATE");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues5Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("RADIO_BTN");
+ formFieldType.setValidationType("DATE");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ Mockito.when(mockedRequest.getParameter(Matchers.anyString())).thenReturn("test");
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues6Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("HIDDEN");
+ formFieldType.setValidationType("DATE");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues7Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("HIDDEN");
+ formFieldType.setValidationType("DATE");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ Mockito.when(mockedRequest.getParameter(Matchers.anyString())).thenReturn("test");
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues8Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("TEXT");
+ formFieldType.setValidationType("DATE1");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues9Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("TEXT");
+ formFieldType.setValidationType("DATE1");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ Mockito.when(mockedRequest.getParameter(Matchers.anyString())).thenReturn("test");
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues10Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("TEXTAREA");
+ formFieldType.setValidationType("DATE1");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues11Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("TEXTAREA");
+ formFieldType.setValidationType("DATE1");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ Mockito.when(mockedRequest.getParameter(Matchers.anyString())).thenReturn("test");
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues12Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("");
+ formFieldType.setValidationType("DATE");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues13Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("");
+ formFieldType.setValidationType("TIMESTAMP_HR");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ Mockito.when(mockedRequest.getParameter(Matchers.anyString())).thenReturn("test");
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues14Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("");
+ formFieldType.setValidationType("TIMESTAMP_MIN");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues15Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("");
+ formFieldType.setValidationType("TIMESTAMP_SEC");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues16Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("TEXT_WITH_POPUP");
+ formFieldType.setValidationType("");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues17Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("TEXT_WITH_POPUP");
+ formFieldType.setValidationType("");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ Mockito.when(mockedRequest.getParameter(Matchers.anyString())).thenReturn("test");
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues18Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("LIST_BOX");
+ formFieldType.setValidationType("");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+ @Test
+ public void parseAndFillWithCurrentValues19Test() throws Exception {
+ ReportRuntime rr = mockReportRunTime1();
+ List predefinedValues = new ArrayList<>();
+ FormField formField = new FormField("test", "fieldDisplayName", "COMBO_BOX", "validationType", false,
+ "defaultValue", "helpText", predefinedValues, false, "dependsOn", null, null, "rangeStartDateSQL",
+ "rangeEndDateSQL", "multiSelectListSize");
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldType("LIST_BOX");
+ formFieldType.setValidationType("");
+ rr.getCustomReport().getFormFieldList().getFormField().set(0, formFieldType);
+ Mockito.when(mockedRequest.getParameterValues(Matchers.anyString())).thenReturn(new String[] { "test" });
+ Mockito.when(mockedRequest.getParameter(Matchers.anyString())).thenReturn("test");
+ rr.parseAndFillWithCurrentValues(mockedRequest, "test", formField);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportWrapperTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportWrapperTest.java
new file mode 100644
index 00000000..a8978714
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportWrapperTest.java
@@ -0,0 +1,1149 @@
+/*
+ * ============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.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Vector;
+
+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.onap.portalsdk.analytics.error.RaptorException;
+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.definition.TableSource;
+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.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.SQLCorrector;
+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.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({ AppConstants.class, Globals.class, AppUtils.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 ReportWrapperTest {
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ public ReportWrapper mockReportWrapper() 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");
+ dataColumnType.setDrillDownParams("drilldown[#]");
+ dataColumnType.setCrossTabValue("VALUE");
+ dataColumnType.setDrillDownURL("url");
+ dataColumnType.setDisplayWidth(1);
+ dataColumnType.setChartSeq(1);
+ 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<>(4);
+ 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");
+ formFieldType.setGroupFormField(true);
+ // FormFieldType formFieldType1 = new FormFieldType();
+ formFields.add(formFieldType);
+ // formFields.add(formFieldType1);
+
+ formFieldList.formField = formFields;
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setWholeSQL("test");
+ return reportWrapper;
+ }
+
+ @Test
+ public void cloneCustomReportTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.cloneCustomReport();
+ }
+
+ @Test
+ public void generateDistinctValuesSQLTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ 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");
+ dataColumnType.setDrillDownParams("drilldown[#]");
+ dataColumnType.setCrossTabValue("VALUE");
+ dataColumnType.setDrillDownURL("url");
+ dataColumnType.setDisplayWidth(1);
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ rw.generateDistinctValuesSQL(paramValues, dataColumnType, "test12", mockedRequest);
+ }
+
+ @Test
+ public void generateDistinctValuesSQL1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ 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");
+ dataColumnType.setDrillDownParams("drilldown[#]");
+ dataColumnType.setCrossTabValue("VALUE");
+ dataColumnType.setDrillDownURL("url");
+ dataColumnType.setDisplayWidth(1);
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ rw.setReportDefType("SQL-based");
+ rw.generateDistinctValuesSQL(paramValues, dataColumnType, "test12", mockedRequest);
+ }
+
+ @Test
+ public void getTableWithoutColumnsTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getTableWithoutColumns();
+ }
+
+ @Test
+ public void cloneCustomReportClearTablesTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.cloneCustomReportClearTables();
+ }
+
+ @Test
+ public void rwTest() throws Exception {
+ ReportWrapper rw = new ReportWrapper(mockReportWrapper());
+ assertEquals(rw.getCustomReport().getClass(), CustomReportType.class);
+ assertEquals(rw.getReportID(), "-1");
+ assertEquals(rw.getMenuID(), "1");
+ assertFalse(rw.checkMenuIDSelected("test"));
+ assertTrue(rw.isMenuApproved());
+ assertEquals(rw.getReportDefType(), "");
+ rw.setMenuID("test");
+ rw.setMenuApproved(false);
+ rw.setReportDefType("test");
+ rw.updateReportDefType();
+ assertEquals(rw.getJavascriptElement(), null);
+ }
+
+ @Test
+ public void getChartColumnColorsListTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getChartColumnColorsList(1, formValues);
+ }
+
+ @Test
+ public void getChartColumnColorsList1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setChartGroup("");
+ HashMap formValues = new HashMap<>();
+ rw.getChartColumnColorsList(1, formValues);
+ }
+
+ @Test
+ public void getChartColumnColorsList2Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setChartGroup("");
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setCreateInNewChart(true);
+ HashMap formValues = new HashMap<>();
+ rw.getChartColumnColorsList(2, formValues);
+ }
+
+ @Test
+ public void getChartValueColumnAxisListTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getChartValueColumnAxisList(1, formValues);
+ }
+
+ @Test
+ public void getChartValueColumnAxisList1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setChartGroup("");
+ HashMap formValues = new HashMap<>();
+ rw.getChartValueColumnAxisList(1, formValues);
+ }
+
+ @Test
+ public void getChartValueColumnAxisList2Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setChartGroup("");
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setCreateInNewChart(true);
+ HashMap formValues = new HashMap<>();
+ rw.getChartValueColumnAxisList(1, formValues);
+ }
+
+ @Test
+ public void getChartValueNewChartListTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getChartValueNewChartList();
+ }
+
+ @Test
+ public void getChartGroupColumnAxisListTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getChartGroupColumnAxisList("testi|test", formValues);
+ }
+
+ @Test
+ public void getChartGroupValueColumnAxisListTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getChartGroupValueColumnAxisList("testi|test", formValues);
+ }
+
+ @Test
+ public void getChartGroupDisplayNamesListTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getChartGroupDisplayNamesList("testi|test", formValues);
+ }
+
+ @Test
+ public void getChartGroupColumnColorsListTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getChartGroupColumnColorsList("testi|test", formValues);
+ }
+
+ @Test
+ public void getCrossTabRowColumnsTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getCrossTabRowColumns();
+ }
+
+ @Test
+ public void getCrossTabRowColumns1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setCrossTabValue("ROW");
+ rw.getCrossTabRowColumns();
+ }
+
+ @Test
+ public void getCrossTabColColumnsTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getCrossTabColColumns();
+ }
+
+ @Test
+ public void getCrossTabColColumns1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setCrossTabValue("COLUMN");
+ rw.getCrossTabColColumns();
+ }
+
+ @Test
+ public void getCrossTabDisplayTotalTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getCrossTabDisplayTotal("test|test");
+ }
+
+ @Test
+ public void getCrossTabDisplayTotal1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setDisplayTotal("test|test");
+
+ rw.getCrossTabDisplayTotal("test|test");
+ }
+
+ @Test
+ public void getCrossTabDisplayTotal2Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setDisplayTotal("test|test");
+ rw.getCrossTabDisplayTotal("ROW");
+ }
+
+ @Test
+ public void getCrossTabDisplayTotal3Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setDisplayTotal("test|test");
+ rw.getCrossTabDisplayTotal("COLUMN");
+ }
+
+ @Test
+ public void getCrossTabValueColumnTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getCrossTabValueColumn();
+ }
+
+ @Test
+ public void getCrossTabValueColumnIndexTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getCrossTabValueColumnIndex();
+ }
+
+ @Test
+ public void getCrossTabValueColumnIndex1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setCrossTabValue("");
+ rw.getCrossTabValueColumnIndex();
+ }
+
+ @Test
+ public void getCrossTabValueColumnIndex2Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setCrossTabValue("");
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setVisible(true);
+ rw.getCrossTabValueColumnIndex();
+ }
+
+ @Test
+ public void getFilterByIdTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getFilterById("test", 0);
+ }
+
+ @Test
+ public void needFormInputTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.needFormInput();
+ }
+
+ @Test
+ public void needFormInput1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterList list = new ColFilterList();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setColFilterList(list);
+ rw.needFormInput();
+ }
+
+ @Test
+ public void needFormInput2Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterList list = new ColFilterList();
+ List<ColFilterType> colList = new ArrayList<>();
+ ColFilterType colFilterType = new ColFilterType();
+ colList.add(colFilterType);
+ list.colFilter = colList;
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setColFilterList(list);
+ rw.needFormInput();
+ }
+
+ @Test
+ public void needFormInput3Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterList list = new ColFilterList();
+ List<ColFilterType> colList = new ArrayList<>();
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setArgType("FORM");
+ colList.add(colFilterType);
+ list.colFilter = colList;
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setColFilterList(list);
+ rw.needFormInput();
+ }
+
+ @Test
+ public void getNumSortColumnsTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getNumSortColumns();
+ }
+
+ @Test
+ public void getNumSortColumns1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setOrderBySeq(1);
+ rw.getNumSortColumns();
+ }
+
+ @Test
+ public void getSemaphoreByIdTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getSemaphoreById("test");
+ }
+
+ @Test
+ public void getSemaphoreById1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ SemaphoreList semaphoreList = new SemaphoreList();
+ List<SemaphoreType> listSemaphoreType = semaphoreList.getSemaphore();
+
+ SemaphoreType st1 = new SemaphoreType();
+ SemaphoreType st2 = new SemaphoreType();
+ st1.setSemaphoreName("Name1");
+ st1.setSemaphoreId("Id1");
+
+ st2.setSemaphoreName("Name2");
+ st2.setSemaphoreId("test");
+
+ listSemaphoreType.add(st1);
+ listSemaphoreType.add(st2);
+ rw.getCustomReport().setSemaphoreList(semaphoreList);
+ rw.getSemaphoreById("test");
+ }
+
+ @Test
+ public void deleteSemaphoreTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ SemaphoreList semaphoreList = new SemaphoreList();
+ List<SemaphoreType> listSemaphoreType = semaphoreList.getSemaphore();
+
+ SemaphoreType st1 = new SemaphoreType();
+ SemaphoreType st2 = new SemaphoreType();
+ st1.setSemaphoreName("Name1");
+ st1.setSemaphoreId("Id1");
+
+ st2.setSemaphoreName("Name2");
+ st2.setSemaphoreId("test");
+
+ listSemaphoreType.add(st1);
+ listSemaphoreType.add(st2);
+ rw.getCustomReport().setSemaphoreList(semaphoreList);
+ rw.deleteSemaphore(st1);
+ }
+
+ @Test
+ public void deleteSemaphore1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ SemaphoreType st1 = new SemaphoreType();
+ rw.deleteSemaphore(st1);
+ }
+
+ @Test
+ public void setSemaphoreTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ SemaphoreType st1 = new SemaphoreType();
+ rw.setSemaphore(st1);
+ }
+
+ @Test
+ public void setSemaphore1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ SemaphoreList semaphoreList = new SemaphoreList();
+ List<SemaphoreType> listSemaphoreType = semaphoreList.getSemaphore();
+ SemaphoreType st1 = new SemaphoreType();
+ SemaphoreType st2 = new SemaphoreType();
+ st1.setSemaphoreName("Name1");
+ st1.setSemaphoreId("Id1");
+ st2.setSemaphoreName("Name2");
+ st2.setSemaphoreId("test");
+ listSemaphoreType.add(st1);
+ listSemaphoreType.add(st2);
+ rw.getCustomReport().setSemaphoreList(semaphoreList);
+ SemaphoreType st3 = new SemaphoreType();
+ rw.setSemaphore(st3);
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getSemaphoreFormatByIdTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ SemaphoreType st1 = new SemaphoreType();
+ FormatList getFormatList = new FormatList();
+ List<FormatType> list = new ArrayList<>();
+ FormatType formatType = new FormatType();
+ formatType.setFormatId("test");
+ list.add(formatType);
+ getFormatList.format = list;
+ st1.setFormatList(getFormatList);
+ rw.getSemaphoreFormatById(st1, "test");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void getSemaphoreFormatById1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getSemaphoreFormatById(null, "test");
+ }
+
+ @Test
+ public void getFormFieldByIdTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getFormFieldById("test");
+ }
+
+ @Test
+ public void getFormFieldByDisplayValueTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getFormFieldByDisplayValue("test");
+ }
+
+ @Test
+ public void getFormFieldByDisplayValue1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getFormFieldByDisplayValue("[test]");
+ }
+
+ @Test
+ public void getFormFieldByDisplayValue2Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getFormFieldByDisplayValue(null);
+ }
+
+ @Test
+ public void resetCacheTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.resetCache(true);
+ }
+
+ @Test
+ public void resetCache1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.resetCache(false);
+ }
+
+ @Test
+ public void getOuterJoinTypeTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ dataSourceType.setRefDefinition("test (+)");
+ rw.getOuterJoinType(dataSourceType);
+ }
+
+ @Test
+ public void getOuterJoinType1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("2");
+ dataSourceType.setRefDefinition("test (+)=");
+ rw.getOuterJoinType(dataSourceType);
+ }
+
+ @Test
+ public void getFormFieldNameTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setArgType("test");
+ rw.getFormFieldName(colFilterType);
+ }
+
+ @Test
+ public void getFormFieldName1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setArgType("FORM");
+ rw.getFormFieldName(colFilterType);
+ }
+
+ @Test
+ public void getFormFieldDisplayNameTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setArgType("FORM");
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ rw.getFormFieldDisplayName(dataColumnType, colFilterType);
+ }
+
+ @Test
+ public void getFormFieldRangeStartTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setArgType("FORM");
+ rw.getFormFieldRangeStart(colFilterType);
+ }
+
+ @Test
+ public void generateSQLSQLBasedTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.getRequestParams()).thenReturn("test,req");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test,session");
+ Mockito.when(Globals.getSessionParamsForScheduling()).thenReturn("test,sessionSche");
+ rw.getCustomReport().setReportSQL("SQL");
+ PowerMockito.mockStatic(ESAPI.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ Mockito.when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *");
+ rw.generateSQLSQLBased(paramValues, "overrideSortByColId", "overrideSortByAscDesc", "userId", mockedRequest);
+ }
+
+ @Test
+ public void generateSQLSQLBased1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.getRequestParams()).thenReturn("test,req");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test,session");
+ Mockito.when(Globals.getSessionParamsForScheduling()).thenReturn("test,sessionSche");
+ rw.getCustomReport().setReportSQL("SQL");
+ PowerMockito.mockStatic(ESAPI.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ Mockito.when(ESAPI.encoder()).thenReturn(encoder);
+ Codec codec = PowerMockito.mock(Codec.class);
+ Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+ Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *");
+ rw.getFormFieldList().formField.get(0).setFieldType("BLANK1");
+ Mockito.when(paramValues.isParameterMultiValue(Matchers.anyString())).thenReturn(true);
+ rw.generateSQLSQLBased(paramValues, "overrideSortByColId", "overrideSortByAscDesc", "userId", mockedRequest);
+ }
+
+ @Test
+ public void generateSQLVisualTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ Vector<String> vc = new Vector<>();
+ vc.add("test");
+ vc.add("test2");
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(DataCache.class);
+ TableSource tableSource = PowerMockito.mock(TableSource.class);
+ Mockito.when(DataCache.getTableSource(Matchers.anyString(), Matchers.anyString(), Matchers.any(Vector.class),
+ Matchers.anyString(), Matchers.any(HttpServletRequest.class))).thenReturn(tableSource);
+ Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc);
+ Vector<String> vc1 = new Vector<>();
+ vc1.add("test");
+ Mockito.when(DataCache.getDataViewActions()).thenReturn(vc1);
+ Mockito.when(AppUtils.getBaseActionURL()).thenReturn("test");
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setOrderBySeq(1);
+ rw.generateSQLVisual(paramValues, "test", "test", "test", mockedRequest);
+
+ }
+
+ @Test
+ public void generateSQLCrossTabVisualTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ Vector<String> vc = new Vector<>();
+ vc.add("test");
+ vc.add("test2");
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc);
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setOrderBySeq(1);
+ rw.generateSQLCrossTabVisual(paramValues, "test", "test", "test", mockedRequest);
+ }
+
+ @Test
+ public void generateChartSQLTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ rw.generateChartSQL(paramValues, "test12", mockedRequest);
+ }
+
+ @Test
+ public void generateChartSQL1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setColOnChart("test");
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setColId("test999");
+ rw.generateChartSQL(paramValues, "test12", mockedRequest);
+ }
+
+ @Test
+ public void generateTotalSQLCrossTabTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ rw.getCustomReport().setDbType("DAYTONA");
+ rw.setReportDefType("SQL-based1");
+ rw.setDBInfo("DAYTONA");
+ rw.generateTotalSQLCrossTab("test From table", "rowColPos", "userId", mockedRequest, paramValues);
+ }
+
+ @Test
+ public void generateTotalSQLCrossTab1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ rw.getCustomReport().setDbType("local");
+ rw.setReportDefType("SQL-based1");
+ rw.setDBInfo("DAYTONA");
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setVisible(true);
+ rw.generateTotalSQLCrossTab("test From table", "rowColPos", "userId", mockedRequest, paramValues);
+ }
+
+ @Test
+ public void generateTotalSQLCrossTab2Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ rw.getCustomReport().setDbType("DAYTONA");
+ rw.setReportDefType("SQL-based1");
+ rw.setDBInfo("DAYTONA");
+ rw.setWholeSQL("test From table");
+ rw.generateTotalSQLCrossTab(paramValues, "rowColPos", "userId", mockedRequest);
+ }
+
+ @Test
+ public void generateTotalSQLCrossTab3Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ rw.getCustomReport().setDbType("local");
+ rw.setReportDefType("SQL-based1");
+ rw.setDBInfo("DAYTONA");
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setVisible(true);
+ rw.setWholeSQL("test From table");
+ rw.generateTotalSQLCrossTab(paramValues, "rowColPos", "userId", mockedRequest);
+ }
+
+ @Test
+ public void generateTotalSQLCrossTab4Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ rw.getCustomReport().setDbType("local");
+ rw.setReportDefType("SQL-based1");
+ rw.setDBInfo("DAYTONA");
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setVisible(true);
+ rw.setWholeSQL("test From table");
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setCrossTabValue("test");
+ rw.generateTotalSQLCrossTab(paramValues, "test", "userId", mockedRequest);
+ }
+
+ @Test
+ public void getFrozenColumnIdTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getFrozenColumnId();
+ }
+
+ @Test
+ public void getFrozenColumnId1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getCustomReport().setFrozenColumns(1);
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setVisible(true);
+ rw.getFrozenColumnId();
+ }
+
+ @Test
+ public void getDependsOnFormFieldFlagTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setDependsOnFormField("tes[t");
+ rw.getDependsOnFormFieldFlag(dataColumnType, formValues);
+ }
+
+ @Test
+ public void getDependsOnFormFieldFlag1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ HashMap formValues = new HashMap<>();
+ formValues.put("test", "test");
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setDependsOnFormField("[test]");
+ rw.getDependsOnFormFieldFlag(dataColumnType, formValues);
+ }
+ @Test
+ public void addZeroTest() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ rw.addZero("1");
+ }
+ @Test
+ public void addZero1Test() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ rw.addZero("11");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void replaceNewLineTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.replaceNewLine("test", "test", "test");
+ }
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void replaceNewLine1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.replaceNewLine("test", "new", "test");
+ }
+
+ @Test
+ public void cloneColFilterTypeTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ObjectFactory objFactory = PowerMockito.mock(ObjectFactory.class);
+ ColFilterType cft = PowerMockito.mock(ColFilterType.class);
+ Mockito.when(objFactory.createColFilterType()).thenReturn(cft);
+ rw.cloneColFilterType(objFactory, cft);
+ }
+
+ @Test
+ public void cloneColFilterType1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ObjectFactory objFactory = PowerMockito.mock(ObjectFactory.class);
+ ColFilterType cft =new ColFilterType();
+ cft.setOpenBrackets("test");
+ cft.setArgType("test");
+ cft.setArgValue("test");
+ cft.setComment("test");
+ cft.setCloseBrackets("test");
+ Mockito.when(objFactory.createColFilterType()).thenReturn(cft);
+ rw.cloneColFilterType(objFactory, cft);
+ }
+
+ @Test
+ public void cloneJavascriptTypeTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ObjectFactory objFactory = PowerMockito.mock(ObjectFactory.class);
+ JavascriptItemType jit = PowerMockito.mock(JavascriptItemType.class);
+ Mockito.when(objFactory.createJavascriptItemType()).thenReturn(jit);
+ rw.cloneJavascriptType(objFactory, jit);
+ }
+
+ @Test
+ public void cloneFormatTypeTest() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ ObjectFactory objFactory = PowerMockito.mock(ObjectFactory.class);
+ FormatType formatType = new FormatType();
+ Mockito.when(objFactory.createFormatType()).thenReturn(formatType);
+ rw.cloneFormatType(objFactory, formatType);
+ }
+
+ @Test
+ public void cloneFormatType1Test() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ ObjectFactory objFactory = PowerMockito.mock(ObjectFactory.class);
+ FormatType formatType = new FormatType();
+ formatType.setBgColor("test");
+ formatType.setFontColor("test");
+ formatType.setFontFace("test");
+ formatType.setFontSize("test");
+ formatType.setAlignment("test");
+ formatType.setComment("test");
+ Mockito.when(objFactory.createFormatType()).thenReturn(formatType);
+ rw.cloneFormatType(objFactory, formatType);
+ }
+
+ @Test
+ public void generateTotalSQLLinearTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ rw.getCustomReport().setDbType("local");
+ rw.getCustomReport().setDbInfo("DAYTONA");
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setDisplayTotal("test");
+ SQLCorrector sqlCorrector = PowerMockito.mock(SQLCorrector.class);
+ PowerMockito.whenNew(SQLCorrector.class).withNoArguments().thenReturn(sqlCorrector);
+ Mockito.when(sqlCorrector.fixSQL(Matchers.any(StringBuffer.class))).thenReturn("test");
+ rw.generateTotalSQLLinear(paramValues, "test", mockedRequest);
+ }
+
+ @Test
+ public void generateTotalSQLLinear1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ReportParamValues paramValues = PowerMockito.mock(ReportParamValues.class);
+ rw.getCustomReport().setDbType("local");
+ rw.getCustomReport().setDbInfo("DAYTONA");
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setDisplayTotal("test");
+ SQLCorrector sqlCorrector = PowerMockito.mock(SQLCorrector.class);
+ PowerMockito.whenNew(SQLCorrector.class).withNoArguments().thenReturn(sqlCorrector);
+ Mockito.when(sqlCorrector.fixSQL(Matchers.any(StringBuffer.class))).thenReturn("test");
+ rw.setWholeSQL("test from test");
+ rw.generateTotalSQLLinear(paramValues, "test", mockedRequest);
+ }
+ @Test
+ public void getFormFieldRangeEndTest() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterType cft =new ColFilterType();
+ cft.setOpenBrackets("test");
+ cft.setArgType("test");
+ rw.getFormFieldRangeEnd(cft);
+ }
+ @Test
+ public void getFormFieldRangeEnd1Test() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterType cft =new ColFilterType();
+ cft.setArgType("FORM");
+ rw.getFormFieldRangeEnd(cft);
+ }
+
+ @Test
+ public void getFormFieldRangeStartSQLTest() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterType cft =new ColFilterType();
+ cft.setArgType("FORM");
+ rw.getFormFieldRangeStartSQL(cft);
+ }
+
+ @Test
+ public void getFormFieldRangeStartSQL1Test() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterType cft =new ColFilterType();
+ cft.setOpenBrackets("test");
+ cft.setArgType("test");
+ rw.getFormFieldRangeStartSQL(cft);
+ }
+
+ @Test
+ public void getFormFieldRangeEndSQLTest() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterType cft =new ColFilterType();
+ cft.setArgType("test");
+ rw.getFormFieldRangeEndSQL(cft);
+ }
+
+ @Test
+ public void getFormFieldRangeEndSQL1Test() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterType cft =new ColFilterType();
+ cft.setArgType("FORM");
+ rw.getFormFieldRangeEndSQL(cft);
+ }
+
+ @Test
+ public void getUniqueTableIdTest() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getUniqueTableId("test");
+ }
+
+ @Test
+ public void getTableByDBNameTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getTableByDBName("test");
+ }
+
+ @Test
+ public void getTableByDBName1Test() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getTableByDBName("new");
+ }
+ @Test
+ public void setRuntimeColSortDisabledTest() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ rw.setRuntimeColSortDisabled(false);
+ }
+ @SuppressWarnings("static-access")
+ @Test
+ public void staticTest() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getSQLBasedFFTColTableName("test.1");
+ rw.getSQLBasedFFTColColumnName("test.1");
+ rw.getSQLBasedFFTColDisplayFormat("test.1");
+ }
+ @Test
+ public void getVisibleColumnCountTest() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getVisibleColumnCount();
+ }
+ @Test
+ public void getAllFiltersTest() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ rw.getAllFilters();
+ }
+
+ @Test
+ public void getAllFiltersTest1() throws Exception {
+ ReportWrapper rw = mockReportWrapper();
+ ColFilterList list = new ColFilterList();
+ List<ColFilterType> colList = new ArrayList<>();
+ ColFilterType colFilterType = new ColFilterType();
+ colList.add(colFilterType);
+ list.colFilter = colList;
+ rw.getCustomReport().getDataSourceList().getDataSource().get(0).getDataColumnList().getDataColumn().get(0)
+ .setColFilterList(list);
+ rw.getAllFilters();
+ }
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void formatListValueTest() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setColType("NUMBER");
+ DataSourceType dataSourceType = new DataSourceType();
+ rw.formatListValue("test", "test", dataColumnType, false, false, dataSourceType, "listBaseSQL");
+ }
+
+ @Test
+ public void formatListValue2Test() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setColType("NUMBER");
+ DataSourceType dataSourceType = new DataSourceType();
+ rw.formatListValue("1.1", "1.1", dataColumnType, false, false, dataSourceType, "listBaseSQL");
+ }
+
+ @Test
+ public void formatListValue4Test() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setColType("DATE");
+ DataSourceType dataSourceType = new DataSourceType();
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.getMonthFormatUseLastDay()).thenReturn(true);
+ rw.formatListValue("1.1", "1.1", dataColumnType, false, false, dataSourceType, "listBaseSQL");
+ }
+
+
+ @Test
+ public void formatListValue1Test() throws Exception
+ {
+ ReportWrapper rw = mockReportWrapper();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setColType("NUMBER");
+ DataSourceType dataSourceType = new DataSourceType();
+ rw.formatListValue("[MAX_VALUE]", "[MAX_VALUE]", dataColumnType, false, false, dataSourceType, "listBaseSQL");
+ }
+} \ No newline at end of file