summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics
diff options
context:
space:
mode:
authorKotta, Shireesha (sk434m) <sk434m@att.com>2018-03-06 09:44:53 -0500
committerKotta, Shireesha (sk434m) <sk434m@att.com>2018-03-06 17:43:16 -0500
commitcfb69f44f841338e1f208225ec006388e986bd2c (patch)
treee8b7e982637a5b27f3383a793fcdcee50f7e0057 /ecomp-sdk/epsdk-analytics
parent724ff8f8b22d6503ce5070ebc13f6f5fbc48c8cf (diff)
Added Junits & AAF attributes Support
Issue-ID: PORTAL-136 Includes JUNITS, AAF attributes support Change-Id: Id4cc9f64268017665d7245d0a10369c9b498ba2f Signed-off-by: Kotta, Shireesha (sk434m) <sk434m@att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
-rw-r--r--ecomp-sdk/epsdk-analytics/pom.xml36
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/line/LineTest.java59
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSONTest.java82
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnJSONTest.java53
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSONTest.java104
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSONTest.java84
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/IdNameBooleanJSONTest.java55
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ImportJSONTest.java56
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ListJSONTest.java53
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/NameBooleanJSONTest.java65
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryJSONTest.java55
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryResultJSONTest.java65
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorResponseTest.java54
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSONTest.java57
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java628
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/CR_ReportTest.java97
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/QuickLinkTest.java65
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/RaptorSearchTest.java85
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/ReportInfoTest.java78
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartAdditionalOptionsTest.java209
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartDrillFormfieldTest.java65
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartDrillOptionsTest.java72
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartJSONHelperTest.java492
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ColFilterListTest.java54
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ColFilterTypeTest.java85
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/CustomReportTypeTest.java206
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardEditorListTest.java52
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardEditorReportTest.java67
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardReportsNewTest.java63
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardReportsTest.java53
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataColumnListTest.java51
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataColumnTypeTest.java164
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataSourceTypeTest.java81
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataminingOptionsTest.java69
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormFieldListTest.java54
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormFieldTypeTest.java97
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormatListTest.java54
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormatTypeTest.java95
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/IteratorEnumeration.java60
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/JavascriptItemTypeTest.java63
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/JavascriptListTest.java53
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MarkerTest.java65
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MockRunTimeReport.java119
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MockitoTestSuite.java89
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ObjectFactoryTest.java237
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/PDFAdditionalOptionsTest.java76
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/PredefinedValueListTest.java53
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorControllerAsyncNewTest.java1388
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorServiceImplTest.java85
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportDefinitionTest.java2178
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportHandlerTest.java122
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportMapTest.java82
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportsTest.java54
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/SemaphoreListTest.java53
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/SemaphoreTypeTest.java63
55 files changed, 8726 insertions, 28 deletions
diff --git a/ecomp-sdk/epsdk-analytics/pom.xml b/ecomp-sdk/epsdk-analytics/pom.xml
index 414c6f7d..5f10690d 100644
--- a/ecomp-sdk/epsdk-analytics/pom.xml
+++ b/ecomp-sdk/epsdk-analytics/pom.xml
@@ -19,31 +19,6 @@
<!-- properties are inherited from parent -->
<!-- repositories are inherited from parent -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <!-- version managed by oparent ${jacocoVersion}</version> -->
- <executions>
- <execution>
- <id>portal-offline-instrument</id>
- <phase>none</phase>
- <goals>
- <goal>instrument</goal>
- </goals>
- </execution>
- <execution>
- <id>portal-restore-instrumented-classes</id>
- <phase>none</phase>
- <goals>
- <goal>restore-instrumented-classes</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
-</build>
<dependencies>
<!-- sdk-core -->
@@ -56,17 +31,17 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
- <version>2.6.3</version>
+ <version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
- <version>2.6.3</version>
+ <version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
- <version>2.6.3</version>
+ <version>2.9.2</version>
</dependency>
<!-- Raptor required Libraries -->
<!-- for static charts -->
@@ -191,6 +166,11 @@
<version>${jacoco.version}</version>
<classifier>runtime</classifier>
</dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.3.3</version>
+ </dependency>
</dependencies>
</project>
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/line/LineTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/line/LineTest.java
new file mode 100644
index 00000000..97910be0
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/line/LineTest.java
@@ -0,0 +1,59 @@
+/*
+ * ============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.gmap.line;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.gmap.map.NovaMap;
+
+public class LineTest {
+
+ public Line mockLineTest()
+ {
+ NovaMap novaMap= new NovaMap();
+ novaMap.setDataLoaded("dataLoaded");
+ Line line = new Line(novaMap);
+ return line;
+ }
+
+ @Test
+ public void lineExistTest()
+ {
+ Line line = mockLineTest();
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSONTest.java
new file mode 100644
index 00000000..7aee9e9d
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSONTest.java
@@ -0,0 +1,82 @@
+/*
+ * ============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.definition.wizard;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ColumnEditJSONTest {
+
+ public ColumnEditJSON mockColumnEditJSONTest() {
+ ColumnEditJSON columnEditJSON = new ColumnEditJSON();
+ columnEditJSON.setTabId("tabId");
+ columnEditJSON.setTabName("tabName");
+ columnEditJSON.setColId("colId");
+ columnEditJSON.setColName("colName");
+ columnEditJSON.setDisplayAlignment("displayAlignment");
+ columnEditJSON.setDisplayHeaderAlignment("displayHeaderAlignment");
+ columnEditJSON.setSortable(false);
+ columnEditJSON.setVisible(false);
+ columnEditJSON.setDrilldownURL("drilldownURL");
+ columnEditJSON.setDrilldownParams("drilldownParams");
+ columnEditJSON.setDrilldownType("drilldownType");
+ columnEditJSON.setErrorMessage("errorMessage");
+ columnEditJSON.setErrorStackTrace("errorStackTrace");
+ return columnEditJSON;
+ }
+
+ @Test
+ public void columnEditJSONTest() {
+ ColumnEditJSON columnEditJSON = mockColumnEditJSONTest();
+ ColumnEditJSON columnEditJSON1 = mockColumnEditJSONTest();
+ assertEquals(columnEditJSON.getTabId(), columnEditJSON1.getTabId());
+ assertEquals(columnEditJSON.getTabName(), columnEditJSON1.getTabName());
+ assertEquals(columnEditJSON.getColId(), columnEditJSON1.getColId());
+ assertEquals(columnEditJSON.getColName(), columnEditJSON1.getColName());
+ assertEquals(columnEditJSON.getDisplayAlignment(), columnEditJSON1.getDisplayAlignment());
+ assertEquals(columnEditJSON.getDisplayHeaderAlignment(), columnEditJSON1.getDisplayHeaderAlignment());
+ assertFalse(columnEditJSON.isSortable());
+ assertFalse(columnEditJSON.isVisible());
+ assertEquals(columnEditJSON.getDrilldownURL(), columnEditJSON1.getDrilldownURL());
+ assertEquals(columnEditJSON.getDrilldownParams(), columnEditJSON1.getDrilldownParams());
+ assertEquals(columnEditJSON.getDrilldownType(), columnEditJSON1.getDrilldownType());
+ assertEquals(columnEditJSON.getErrorMessage(), columnEditJSON1.getErrorMessage());
+ assertEquals(columnEditJSON.getErrorStackTrace(), columnEditJSON1.getErrorStackTrace());
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnJSONTest.java
new file mode 100644
index 00000000..473ec720
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnJSONTest.java
@@ -0,0 +1,53 @@
+/*
+ * ============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.definition.wizard;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ColumnJSONTest {
+ @Test
+ public void mockColumnJSONTest() {
+ ColumnJSON columnJSON = new ColumnJSON();
+ columnJSON.setId("id");
+ columnJSON.setName("name");
+ assertEquals(columnJSON.getId(), "id");
+ assertEquals(columnJSON.getName(), "name");
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSONTest.java
new file mode 100644
index 00000000..5eb75390
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSONTest.java
@@ -0,0 +1,104 @@
+/*
+ * ============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.definition.wizard;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class DefinitionJSONTest {
+
+ public DefinitionJSON mockDefinitionJSONTest()
+ {
+ DefinitionJSON definitionJSON= new DefinitionJSON();
+ definitionJSON.setTabName("tabName");
+ definitionJSON.setTabId("tabId");
+ definitionJSON.setReportId("reportId");
+ definitionJSON.setReportName("reportName");
+ definitionJSON.setReportDescr("reportDescr");
+ definitionJSON.setReportType("reportType");
+ definitionJSON.setDbInfo("dbInfo");
+ definitionJSON.setFormHelpText("formHelpText");
+ definitionJSON.setPageSize(null);
+ definitionJSON.setDisplayArea(null);
+ definitionJSON.setHideFormFieldsAfterRun(false);
+ definitionJSON.setMaxRowsInExcelCSVDownload(1);
+ definitionJSON.setFrozenColumns(1);
+ definitionJSON.setDataGridAlign("dataGridAlign");
+ definitionJSON.setEmptyMessage("emptyMessage");
+ definitionJSON.setDataContainerHeight("dataContainerHeight");
+ definitionJSON.setDataContainerWidth("dataContainerWidth");
+ definitionJSON.setDisplayOptions(null);
+ definitionJSON.setRuntimeColSortDisabled(false);
+ definitionJSON.setNumFormCols(1);
+ definitionJSON.setReportTitle("title");
+ definitionJSON.setReportSubTitle("reportSubTitle");
+ return definitionJSON;
+ }
+ @Test
+ public void definitionJSONTest()
+ {
+ DefinitionJSON definitionJSON = mockDefinitionJSONTest();
+ assertEquals(definitionJSON.getTabName(),"tabName");
+ assertEquals(definitionJSON.getTabId(),"tabId");
+ assertEquals(definitionJSON.getReportId(),"reportId");
+ assertEquals(definitionJSON.getReportName(),"reportName");
+ assertEquals(definitionJSON.getReportDescr(),"reportDescr");
+ assertEquals(definitionJSON.getReportType(),"reportType");
+ assertEquals(definitionJSON.getDbInfo(),"dbInfo");
+ assertEquals(definitionJSON.getFormHelpText(),"formHelpText");
+ assertNull(definitionJSON.getPageSize());
+ assertNull(definitionJSON.getDisplayArea());
+ assertFalse(definitionJSON.getHideFormFieldsAfterRun());
+ assertTrue(definitionJSON.getMaxRowsInExcelCSVDownload() == 1);
+ assertTrue(definitionJSON.getFrozenColumns()== 1);
+ assertEquals(definitionJSON.getDataGridAlign(),"dataGridAlign");
+ assertEquals(definitionJSON.getEmptyMessage(),"emptyMessage");
+ assertEquals(definitionJSON.getDataContainerHeight(),"dataContainerHeight");
+ assertEquals(definitionJSON.getDataContainerWidth(),"dataContainerWidth");
+ assertNull(definitionJSON.getDisplayOptions());
+ assertFalse(definitionJSON.getRuntimeColSortDisabled());
+ assertTrue(definitionJSON.getNumFormCols()== 1);
+ assertEquals(definitionJSON.getReportTitle(),"title");
+ assertEquals(definitionJSON.getReportSubTitle(),"reportSubTitle");
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSONTest.java
new file mode 100644
index 00000000..ad003726
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSONTest.java
@@ -0,0 +1,84 @@
+/*
+ * ============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.definition.wizard;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class FormEditJSONTest {
+
+ public FormEditJSON mockFormEditJSON() {
+ FormEditJSON formEditJSON = new FormEditJSON();
+ formEditJSON.setTabId("tabId");
+ formEditJSON.setTabName("tabName");
+ formEditJSON.setFieldId("fieldId");
+ formEditJSON.setFieldType("fieldType");
+ formEditJSON.setVisible(false);
+ formEditJSON.setDefaultValue("defaultValue");
+ formEditJSON.setFieldDefaultSQL("fieldDefaultSQL");
+ formEditJSON.setFieldSQL("fieldSQL");
+ formEditJSON.setValidationType("validationType");
+ formEditJSON.setPredefinedValueList(null);
+ formEditJSON.setMessage("message");
+ formEditJSON.setErrorMessage("errorMessage");
+ formEditJSON.setErrorStackTrace("errorStackTrace");
+ formEditJSON.setFieldName("fieldName");
+ return formEditJSON;
+ }
+
+ @Test
+ public void formEditJSONTest()
+ {
+ FormEditJSON formEditJSON = mockFormEditJSON();
+ assertEquals(formEditJSON.getTabId(),"tabId");
+ assertEquals(formEditJSON.getTabName(),"tabName");
+ assertEquals(formEditJSON.getFieldId(),"fieldId");
+ assertEquals(formEditJSON.getFieldType(),"fieldType");
+ assertFalse(formEditJSON.isVisible());
+ assertEquals(formEditJSON.getDefaultValue(),"defaultValue");
+ assertEquals(formEditJSON.getFieldDefaultSQL(),"fieldDefaultSQL");
+ assertEquals(formEditJSON.getFieldSQL(),"fieldSQL");
+ assertEquals(formEditJSON.getValidationType(),"validationType");
+ assertNull(formEditJSON.getPredefinedValueList());
+ assertEquals(formEditJSON.getMessage(),"message");
+ assertEquals(formEditJSON.getErrorMessage(),"errorMessage");
+ assertEquals(formEditJSON.getErrorStackTrace(),"errorStackTrace");
+ assertEquals(formEditJSON.getFieldName(),"fieldName");
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/IdNameBooleanJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/IdNameBooleanJSONTest.java
new file mode 100644
index 00000000..a74e96b7
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/IdNameBooleanJSONTest.java
@@ -0,0 +1,55 @@
+/*
+ * ============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.definition.wizard;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class IdNameBooleanJSONTest {
+ @Test
+ public void mockIdNameBooleanJSON() {
+ IdNameBooleanJSON idNameBooleanJSON = new IdNameBooleanJSON();
+ idNameBooleanJSON.setId("id");
+ idNameBooleanJSON.setName("name");
+ idNameBooleanJSON.setSelected(false);
+ assertEquals(idNameBooleanJSON.getId(), "id");
+ assertEquals(idNameBooleanJSON.getName(), "name");
+ assertFalse(idNameBooleanJSON.isSelected());
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ImportJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ImportJSONTest.java
new file mode 100644
index 00000000..40a5e44a
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ImportJSONTest.java
@@ -0,0 +1,56 @@
+/*
+ * ============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.definition.wizard;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ImportJSONTest {
+ @Test
+ public void mockImportJSONTest() {
+ ImportJSON importJSON = new ImportJSON();
+ importJSON.setTabId("tabId");
+ importJSON.setTabName("name");
+ importJSON.setReportXML(null);
+ assertEquals(importJSON.getTabId(), "tabId");
+ assertEquals(importJSON.getTabName(), "name");
+ assertNull(importJSON.getReportXML());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ListJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ListJSONTest.java
new file mode 100644
index 00000000..3056ad42
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/ListJSONTest.java
@@ -0,0 +1,53 @@
+/*
+ * ============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.definition.wizard;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ListJSONTest {
+
+ @Test
+ public void mockListJSONTest() {
+ ListJSON listJSON = new ListJSON();
+ listJSON.setElements(null);
+ assertNull(listJSON.getElements());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/NameBooleanJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/NameBooleanJSONTest.java
new file mode 100644
index 00000000..83986087
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/NameBooleanJSONTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.model.definition.wizard;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class NameBooleanJSONTest {
+
+ @Test
+ public void mockNameBooleanJSONTest()
+ {
+ NameBooleanJSON nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setName("name");
+ nameBooleanJSON.setSelected(false);
+ assertEquals(nameBooleanJSON.getName(),"name");
+ assertFalse(nameBooleanJSON.isSelected());
+ }
+
+ @Test
+ public void mockMessageJSONTest()
+ {
+ MessageJSON messageJSON = new MessageJSON ();
+ messageJSON.setAnyStacktrace("test");
+ assertEquals(messageJSON.getAnyStacktrace(),"test");
+ }
+
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryJSONTest.java
new file mode 100644
index 00000000..3bb8d098
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryJSONTest.java
@@ -0,0 +1,55 @@
+/*
+ * ============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.definition.wizard;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class QueryJSONTest {
+
+ @Test
+ public void mockQueryJSONTest() {
+ QueryJSON queryJSON = new QueryJSON();
+ queryJSON.setTabId("tabId");
+ queryJSON.setTabName("tabName");
+ assertEquals(queryJSON.getTabId(), "tabId");
+ assertEquals(queryJSON.getTabName(), "tabName");
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryResultJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryResultJSONTest.java
new file mode 100644
index 00000000..f28eaf1b
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryResultJSONTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.model.definition.wizard;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class QueryResultJSONTest {
+
+ @Test
+ public void mockQueryResultJSONTest() {
+ QueryResultJSON queryResultJSON = new QueryResultJSON();
+ queryResultJSON.setTotalRows(1);
+ String str = "test";
+ ArrayList<String> list = new ArrayList<>();
+ list.add(str);
+ queryResultJSON.setReportDataColumns(list);
+ ArrayList<Map<String, String>> rowList = new ArrayList<>();
+ queryResultJSON.setReportDataRows(rowList);
+ queryResultJSON.setQuery("test");
+ assertEquals(queryResultJSON.getQuery(), "test");
+ assertEquals(queryResultJSON.getTotalRows(), 1);
+ assertEquals(queryResultJSON.getReportDataColumns().size(), 1);
+ assertEquals(queryResultJSON.getReportDataRows().size(), 0);
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorResponseTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorResponseTest.java
new file mode 100644
index 00000000..8a213acc
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorResponseTest.java
@@ -0,0 +1,54 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.model.definition.wizard;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class RaptorResponseTest {
+ @Test
+ public void mockRaptorResponseTest() {
+ RaptorResponse raptorResponse = new RaptorResponse();
+ assertEquals(raptorResponse.getData().getClass(), String.class);
+ assertEquals(raptorResponse.getError().getClass(), String.class);
+ assertEquals(raptorResponse.data().getClass(), org.json.JSONObject.class);
+ assertEquals(raptorResponse.error().getClass(), org.json.JSONObject.class);
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSONTest.java
new file mode 100644
index 00000000..9fc0a36a
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSONTest.java
@@ -0,0 +1,57 @@
+/*
+ * ============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.definition.wizard;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class SearchFieldJSONTest {
+ @Test
+ public void mockSearchFieldJSONTest()
+ {
+ SearchFieldJSON searchFieldJSON = new SearchFieldJSON();
+ searchFieldJSON.setName("name");
+ searchFieldJSON.setId("id");
+ assertEquals(searchFieldJSON.getName(),"name");
+ assertEquals(searchFieldJSON.getId(),"id");
+
+ }
+
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java
new file mode 100644
index 00000000..c28d8bf9
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java
@@ -0,0 +1,628 @@
+/*
+ * ============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 static org.junit.Assert.assertEquals;
+
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.controller.Action;
+import org.onap.portalsdk.analytics.controller.ActionMapping;
+import org.onap.portalsdk.analytics.controller.ErrorHandler;
+import org.onap.portalsdk.analytics.error.RaptorException;
+import org.onap.portalsdk.analytics.model.DataCache;
+import org.onap.portalsdk.analytics.model.ReportHandler;
+import org.onap.portalsdk.analytics.model.ReportLoader;
+import org.onap.portalsdk.analytics.model.base.IdNameValue;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.definition.ReportDefinition;
+import org.onap.portalsdk.analytics.model.definition.wizard.ColumnJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.DefinitionJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.ImportJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.MessageJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.QueryJSON;
+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.system.fusion.web.RaptorControllerAsync;
+import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.onap.portalsdk.analytics.util.Utils;
+import org.onap.portalsdk.analytics.util.XSSFilter;
+import org.onap.portalsdk.analytics.view.ReportData;
+import org.onap.portalsdk.analytics.xmlobj.ChartAdditionalOptions;
+import org.onap.portalsdk.analytics.xmlobj.CustomReportType;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnList;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnType;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceList;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceType;
+import org.onap.portalsdk.analytics.xmlobj.FormFieldList;
+import org.onap.portalsdk.analytics.xmlobj.FormFieldType;
+import org.onap.portalsdk.analytics.xmlobj.MockRunTimeReport;
+import org.onap.portalsdk.analytics.xmlobj.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.service.DataAccessService;
+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;
+import org.powermock.reflect.exceptions.MethodInvocationException;
+
+@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})
+public class RaptorControllerAsyncTest {
+
+ @InjectMocks
+ RaptorControllerAsync raptorControllerAsync = new RaptorControllerAsync();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Mock
+ DataAccessService dataAccessService;
+
+ @Mock
+ AppConstants appConstants;
+
+ @Mock
+ Globals globals;
+ @Mock
+ Action action = new Action("test", "RaptorControllerAsync", "test", "test");
+ @Mock
+ ActionMapping actionMapping = new ActionMapping();
+ @Mock
+ ReportDefinition reportDefinition ;
+
+ @Mock
+ ReportHandler reportHandler = new ReportHandler();
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+ NullPointerException nullPointerException = new NullPointerException();
+
+ MockRunTimeReport mockRunTimeReport = new MockRunTimeReport();
+
+ @Test
+ public void RaptorSearchToDownloadexcel2007Test() throws Exception {
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_ACTION))
+ .thenReturn("report.download.excel2007.session");
+ Mockito.when(mockedRequest.getParameter("action")).thenReturn("report.download.excel2007.session");
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ Mockito.when(mockedRequest.getParameter("parent")).thenReturn("parent_test");
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ ReportRuntime reportRuntime = mockRunTimeReport.mockReportRuntime();
+ ReportData reportData = PowerMockito.mock(ReportData.class);
+ Mockito.when(mockedRequest.getSession().getAttribute("parent_test" + "_rr")).thenReturn(reportRuntime);
+ Mockito.when(mockedRequest.getSession().getAttribute("parent_test" + "_rd")).thenReturn(reportData);
+ OutputStreamWriter outputStreamWriter = PowerMockito.mock(OutputStreamWriter.class);
+ ServletOutputStream ServletOutputStream = PowerMockito.mock(ServletOutputStream.class);
+ Mockito.when(mockedResponse.getOutputStream()).thenReturn(ServletOutputStream);
+ Mockito.doNothing().when(reportHandler).createExcel2007FileContent(Matchers.any(OutputStreamWriter.class), Matchers.any(ReportData.class),
+ Matchers.any(ReportRuntime.class), Matchers.any(HttpServletRequest.class), Matchers.any(HttpServletResponse.class), Matchers.any(String.class), Matchers.anyInt());
+
+ reportRuntime = PowerMockito.mock(ReportRuntime.class);
+ Mockito.when(reportRuntime.getReportDataSQL("test12", 500, mockedRequest)).thenReturn("test");
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ Mockito.when(Globals.getGenerateSubsetSql()).thenReturn("test");
+ Mockito.when(Globals.getReportSqlOnlyFirstPart()).thenReturn("test");
+ raptorControllerAsync.RaptorSearch(mockedRequest, mockedResponse);
+ }
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void RaptorSearchNullActionKeyTest() throws Exception {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ Mockito.when(Globals.getRaptorActionMapping()).thenReturn(actionMapping);
+ Action action1 = new Action("test",
+ "org.onap.portalsdk.analytics.system.fusion.service.RaptorControllerAsyncTest", "test", "test");
+ Mockito.when(actionMapping.getAction(Matchers.anyString())).thenReturn(action1);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ raptorControllerAsync.RaptorSearch(mockedRequest, mockedResponse);
+ }
+
+ public String test(HttpServletRequest request, String str) {
+ return "test";
+ }
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void RaptorSearchClassNotFoundExceptionTest() throws Exception {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ Mockito.when(Globals.getRaptorActionMapping()).thenReturn(actionMapping);
+ Action action1 = new Action("test", "RaptorControllerAsyncTest", "test", "test");
+ Mockito.when(actionMapping.getAction(Matchers.anyString())).thenReturn(action1);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ raptorControllerAsync.RaptorSearch(mockedRequest, mockedResponse);
+ }
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void RaptorSearchMethodNotFoundExceptionTest() throws Exception {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ Mockito.when(Globals.getRaptorActionMapping()).thenReturn(actionMapping);
+ Action action1 = new Action("test",
+ "org.onap.portalsdk.analytics.system.fusion.service.RaptorControllerAsyncTest", "newtest", "test");
+ Mockito.when(actionMapping.getAction(Matchers.anyString())).thenReturn(action1);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ raptorControllerAsync.RaptorSearch(mockedRequest, mockedResponse);
+ }
+
+ public void test1(HttpServletRequest request, String str) {
+ throw new MethodInvocationException("test");
+ }
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void RaptorSearchMethodInvocationFoundExceptionTest() throws Exception {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ Mockito.when(Globals.getRaptorActionMapping()).thenReturn(actionMapping);
+ Action action1 = new Action("test",
+ "org.onap.portalsdk.analytics.system.fusion.service.RaptorControllerAsyncTest", "test1", null);
+ Mockito.when(actionMapping.getAction(Matchers.anyString())).thenReturn(action1);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ raptorControllerAsync.RaptorSearch(mockedRequest, mockedResponse);
+ }
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void RaptorSearchRaptorExceptionTest() throws Exception {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ Mockito.when(Globals.getRaptorActionMapping()).thenReturn(actionMapping);
+ Mockito.when(actionMapping.getAction(Matchers.anyString())).thenReturn(null);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ raptorControllerAsync.RaptorSearch(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void RaptorSearchNoUserTest() throws Exception {
+
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(null);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ Mockito.when(Globals.getRaptorActionMapping()).thenReturn(actionMapping);
+ Action action1 = new Action("test",
+ "org.onap.portalsdk.analytics.system.fusion.service.RaptorControllerAsyncTest", "test1", null);
+ Mockito.when(actionMapping.getAction(Matchers.anyString())).thenReturn(action1);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ raptorControllerAsync.RaptorSearch(mockedRequest, mockedResponse);
+ }
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void RaptorSearchGlobalyTest() throws Exception {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(false);
+ Mockito.when(Globals.getRaptorActionMapping()).thenReturn(actionMapping);
+ Action action1 = new Action("test",
+ "org.onap.portalsdk.analytics.system.fusion.service.RaptorControllerAsyncTest", "test", "test");
+ Mockito.when(actionMapping.getAction(Matchers.anyString())).thenReturn(action1);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ ErrorHandler errorHandler = PowerMockito.mock(ErrorHandler.class);
+ Mockito.when(errorHandler.processFatalErrorJSON(Matchers.any(HttpServletRequest.class), Matchers.any(RaptorException.class))).thenReturn("test");
+
+
+ raptorControllerAsync.setViewName("test");
+ raptorControllerAsync.RaptorSearch(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void listColumnsTest() throws Exception {
+ List<DataColumnType> reportColumnList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setColId("test");
+ dataColumnType.setColName("testname");
+ reportColumnList.add(dataColumnType);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ reportDefinition.setReportName("test");
+ Mockito.when(reportDefinition.getAllColumns()).thenReturn(reportColumnList);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION))
+ .thenReturn(reportDefinition);
+ ArrayList<ColumnJSON> listJSON = new ArrayList<ColumnJSON>();
+ ColumnJSON columnJSON = new ColumnJSON();
+ columnJSON.setId("test");
+ columnJSON.setName("testname");
+ listJSON.add(columnJSON);
+ assertEquals(listJSON.get(0).getId(),
+ raptorControllerAsync.listColumns(mockedRequest, mockedResponse).get(0).getId());
+ }
+
+ @Test
+ public void list_drilldown_reports() 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);
+ 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();
+ customReportType.setReportType("test");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.doNothing().when(reportDefinition).generateWizardSequence(null);
+ reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ PowerMockito.mockStatic(DataCache.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Vector<IdNameValue> reportnames = new Vector<>();
+ IdNameValue idNameValue = new IdNameValue();
+ idNameValue.setId("1");
+ reportnames.add(idNameValue);
+ Mockito.when(DataCache.getPublicReportIdNames()).thenReturn(reportnames);
+ reportDefinition.setReportName("test");
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION))
+ .thenReturn(reportDefinition);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ Vector userRoles = new Vector<>();
+ userRoles.add(idNameValue);
+ Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(userRoles);
+
+ Vector groupReportIdNames = new Vector<>();
+ groupReportIdNames.add(idNameValue);
+ Mockito.when(DataCache.getGroupAccessibleReportIdNames("test12", userRoles)).thenReturn(groupReportIdNames);
+ Mockito.when(DataCache.getPrivateAccessibleReportIdNames("test12", userRoles)).thenReturn(groupReportIdNames);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ assertEquals(3, raptorControllerAsync.list_drilldown_reports(mockedRequest, mockedResponse).size());
+ }
+
+ @Test
+ public void list_drilldown_reportsNull() 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();
+ customReportType.setReportType("test");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.doNothing().when(reportDefinition).generateWizardSequence(null);
+ reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ PowerMockito.mockStatic(DataCache.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Vector<IdNameValue> reportnames = new Vector<>();
+ IdNameValue idNameValue = new IdNameValue();
+ idNameValue.setId("-1");
+ reportnames.add(idNameValue);
+ Mockito.when(DataCache.getPublicReportIdNames()).thenReturn(reportnames);
+ reportDefinition.setReportName("test");
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION))
+ .thenReturn(reportDefinition);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ Vector userRoles = new Vector<>();
+ userRoles.add(idNameValue);
+ Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(userRoles);
+
+ Vector groupReportIdNames = new Vector<>();
+ groupReportIdNames.add(idNameValue);
+ Mockito.when(DataCache.getGroupAccessibleReportIdNames("test12", userRoles)).thenReturn(groupReportIdNames);
+ Mockito.when(DataCache.getPrivateAccessibleReportIdNames("test12", userRoles)).thenReturn(groupReportIdNames);
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ assertEquals(0, raptorControllerAsync.list_drilldown_reports(mockedRequest, mockedResponse).size());
+ }
+
+ @Test
+ public void listFormFields() 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();
+ customReportType.setReportType("test");
+ FormFieldList formFieldList= new FormFieldList();
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.doNothing().when(reportDefinition).generateWizardSequence(null);
+ reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+
+ assertEquals(raptorControllerAsync.listFormFields(mockedRequest, mockedResponse).size(), 0);
+ }
+
+ @Test
+ public void listFormFieldsTest() 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();
+ customReportType.setReportType("test");
+ FormFieldList formFieldList= PowerMockito.mock(FormFieldList.class);
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.doNothing().when(reportDefinition).generateWizardSequence(null);
+ reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ List<FormFieldType> formField = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldId("id");
+ formField.add(formFieldType);
+ Mockito.when(formFieldList.getFormField()).thenReturn(formField);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+ assertEquals(raptorControllerAsync.listFormFields(mockedRequest, mockedResponse).size(), 1);
+ }
+
+ @Test
+ public void listFormFieldsNullTest() 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();
+ customReportType.setReportType("test");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.doNothing().when(reportDefinition).generateWizardSequence(null);
+ reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+ assertEquals(raptorControllerAsync.listFormFields(mockedRequest, mockedResponse).size(),0);
+ }
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void saveDefTabWiseDataIfIdInSessionTest() throws Exception
+ {
+ DefinitionJSON definitionJSON = new DefinitionJSON();
+ definitionJSON.setTabId("1");
+ PowerMockito.mockStatic(ReportLoader.class);
+ Mockito.when(ReportLoader.loadCustomReportXML("1")).thenReturn("test");
+ ReportRuntime rr = PowerMockito.mock(ReportRuntime.class);
+ 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);
+ 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();
+ customReportType.setReportType("test");
+ DataSourceList list = new DataSourceList();
+ customReportType.setDataSourceList(list);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ rr = new ReportRuntime(reportWrapper);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(null);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ raptorControllerAsync.saveDefTabWiseData("test", definitionJSON, mockedRequest, mockedResponse);
+ }
+
+
+ @Test
+ public void reportChartReceiveTest() throws Exception
+ {
+
+ PowerMockito.mockStatic(ReportLoader.class);
+ Mockito.when(ReportLoader.loadCustomReportXML("1")).thenReturn("test");
+ ReportRuntime rr = mockRunTimeReport.mockReportRuntime();
+ 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);
+ 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();
+ customReportType.setReportType("test");
+ DataSourceList list = new DataSourceList();
+ customReportType.setDataSourceList(list);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ Mockito.when( mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ ChartJSON chartJSON = mockChartJSON();
+ raptorControllerAsync.reportChartReceive(chartJSON, mockedRequest, mockedResponse);
+
+ }
+
+
+ public ChartJSON mockChartJSON()
+ {
+ ChartJSON chartJSON = new ChartJSON();
+ chartJSON.setAnimation(false);
+ chartJSON.setWidth("width");
+ chartJSON.setHeight("height");
+ chartJSON.setShowTitle(true);
+ BarChartOptions barChartOptions= new BarChartOptions();
+ chartJSON.setBarChartOptions(barChartOptions);
+ DomainAxisJSON domainAxisJSON= new DomainAxisJSON();
+ domainAxisJSON.setValue("test");
+ chartJSON.setDomainAxisJSON(domainAxisJSON);
+ ArrayList<RangeAxisJSON> rangeAxisJSONList = new ArrayList<>();
+ RangeAxisJSON rangeAxisJSON = new RangeAxisJSON();
+ rangeAxisJSONList.add(rangeAxisJSON);
+ chartJSON.setRangeAxisRemoveList(rangeAxisJSONList);
+ ChartTypeJSON chartTypeJSON = new ChartTypeJSON();
+ chartTypeJSON.setValue("BarChart3D");
+ chartJSON.setChartTypeJSON(chartTypeJSON);
+ chartJSON.setRangeAxisList(rangeAxisJSONList);
+ CommonChartOptions commonChartOptions = new CommonChartOptions();
+ commonChartOptions.setLegendLabelAngle("test");
+ commonChartOptions.setLegendPosition("legendPosition");
+ commonChartOptions.setHideLegend(false);
+ chartJSON.setCommonChartOptions(commonChartOptions);
+ return chartJSON;
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/CR_ReportTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/CR_ReportTest.java
new file mode 100644
index 00000000..e2167a9f
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/CR_ReportTest.java
@@ -0,0 +1,97 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.system.fusion.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class CR_ReportTest {
+
+ public CR_Report mockCR_ReportTest() {
+ CR_Report cR_Report = new CR_Report();
+ cR_Report.setTitle("test");
+ cR_Report.setDescr("descr");
+ cR_Report.setPublic_yn("public_yn");
+ cR_Report.setCreateDate(null);
+ cR_Report.setMaintDate(null);
+ cR_Report.setMenuId(null);
+ cR_Report.setMenuApproved_YN("menuApproved_YN");
+ cR_Report.setOwnerId(null);
+ cR_Report.setFolderId((long) 1);
+ cR_Report.setDashboard_yn("dashboard_yn");
+ cR_Report.setCreated(null);
+ cR_Report.setMaintId(null);
+ cR_Report.setDashboard_type_YN(null);
+ cR_Report.setCreateId(null);
+ return cR_Report;
+ }
+ @Test
+ public void cR_ReportTest()
+ {
+ CR_Report cR_Report = mockCR_ReportTest();
+ CR_Report cR_Report1 = mockCR_ReportTest();
+ assertEquals(cR_Report.getTitle(), cR_Report1.getTitle());
+ assertEquals(cR_Report.getDescr(), cR_Report1.getDescr());
+ assertEquals(cR_Report.getPublic_yn(), cR_Report1.getPublic_yn());
+ assertEquals(cR_Report.getCreateDate(), cR_Report1.getCreateDate());
+ assertEquals(cR_Report.getMaintDate(), cR_Report1.getMaintDate());
+ assertEquals(cR_Report.getMenuId(), cR_Report1.getMenuId());
+ assertEquals(cR_Report.getMenuApproved_YN(), cR_Report1.getMenuApproved_YN());
+ assertEquals(cR_Report.getOwnerId(), cR_Report1.getOwnerId());
+ assertEquals(cR_Report.getFolderId(), cR_Report1.getFolderId());
+ assertEquals(cR_Report.getDashboard_yn(), cR_Report1.getDashboard_yn());
+ assertEquals(cR_Report.getCreated(), cR_Report1.getCreated());
+ assertEquals(cR_Report.getMaintId(), cR_Report1.getMaintId());
+ assertEquals(cR_Report.getCreateId(), cR_Report1.getCreateId());
+ assertNull(cR_Report.getDashboard_type_YN());
+ assertNull(cR_Report.getCreated());
+
+ }
+ @Test
+ public void compareToTest()
+ {
+ CR_Report cR_Report = mockCR_ReportTest();
+ CR_Report cR_Report1 = mockCR_ReportTest();
+ cR_Report1.setTitle(null);
+ assertEquals(cR_Report.compareTo(cR_Report1),1);
+ assertEquals(cR_Report1.compareTo(cR_Report),1);
+ cR_Report1.setTitle("test");
+ assertEquals(cR_Report1.compareTo(cR_Report),0);
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/QuickLinkTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/QuickLinkTest.java
new file mode 100644
index 00000000..2622fd54
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/QuickLinkTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.system.fusion.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class QuickLinkTest {
+
+ public QuickLink mockQuickLink()
+ {
+ QuickLink quickLink= new QuickLink();
+ quickLink.setReportName("reportName");
+ quickLink.setReportDescr("desc");
+ quickLink.setReportURL("url");
+ quickLink.setShowDescr(false);
+ return quickLink;
+ }
+ @Test
+ public void quickLinkTest()
+ {
+ QuickLink quickLink= mockQuickLink();
+ assertEquals(quickLink.getReportName(),"reportName");
+ assertEquals(quickLink.getReportDescr(), "desc");
+ assertEquals(quickLink.getReportURL(),"url");
+ assertFalse(quickLink.getShowDescr());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/RaptorSearchTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/RaptorSearchTest.java
new file mode 100644
index 00000000..0514d6e7
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/RaptorSearchTest.java
@@ -0,0 +1,85 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.system.fusion.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class RaptorSearchTest {
+
+ public RaptorSearch mockRaptorSearch() {
+ RaptorSearch raptorSearch = new RaptorSearch();
+ raptorSearch.setRepId((long) 1);
+ raptorSearch.setTitle("title");
+ raptorSearch.setDescr("descr");
+ raptorSearch.setOwnerName("ownerName");
+ raptorSearch.setCreated(null);
+ raptorSearch.setCanEdit("Y");
+ raptorSearch.setReadOnly("readOnly");
+ raptorSearch.setSchedule("schedule");
+ raptorSearch.setCreateDate(null);
+ return raptorSearch;
+ }
+
+ @Test
+ public void raptorSearchTest() {
+ RaptorSearch raptorSearch = mockRaptorSearch();
+ RaptorSearch raptorSearch1 = mockRaptorSearch();
+ assertEquals(raptorSearch.getRepId(), raptorSearch1.getRepId());
+ assertEquals(raptorSearch.getTitle(), raptorSearch1.getTitle());
+ assertEquals(raptorSearch.getDescr(), raptorSearch1.getDescr());
+ assertEquals(raptorSearch.getOwnerName(), raptorSearch1.getOwnerName());
+ assertEquals(raptorSearch.getCreated(), raptorSearch1.getCreated());
+ assertEquals(raptorSearch.getCanEdit(), raptorSearch1.getCanEdit());
+ assertEquals(raptorSearch.getReadOnly(), raptorSearch1.getReadOnly());
+ assertEquals(raptorSearch.getSchedule(), raptorSearch1.getSchedule());
+ assertTrue(raptorSearch.canDelete());
+ assertNull(raptorSearch.getCreateDate());
+ assertTrue(raptorSearch.canCopy());
+ raptorSearch.setReadOnly("Y");
+ assertTrue(raptorSearch.canCopy());
+ raptorSearch.setReadOnly("N");
+ assertTrue(raptorSearch.canCopy());
+ raptorSearch.setReadOnly(null);
+ assertTrue(raptorSearch.canCopy());
+ raptorSearch.setCanEdit(null);
+ assertFalse(raptorSearch.canDelete());
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/ReportInfoTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/ReportInfoTest.java
new file mode 100644
index 00000000..fe9ffff5
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/domain/ReportInfoTest.java
@@ -0,0 +1,78 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.system.fusion.domain;
+
+import static org.junit.Assert.*;
+
+import java.util.Date;
+
+import org.junit.Test;
+
+public class ReportInfoTest {
+
+ public ReportInfo mockReportInfo() {
+ ReportInfo reportInfo = new ReportInfo();
+ reportInfo.setRepId((long) 1);
+ reportInfo.setTitle("title");
+ reportInfo.setCreateUser("user");
+ reportInfo.setOwnerName("ownerName");
+ reportInfo.setCreateDate(null);
+ reportInfo.setLastAccessed(null);
+ reportInfo.setLastWeekAccess((long) 1);
+ reportInfo.setLastMonthAccess((long) 1);
+ reportInfo.setLastYearAccess((long) 1);
+ reportInfo.setUserAccessCount((long) 1);
+ return reportInfo;
+ }
+ @Test
+ public void reportInfoTest() {
+ ReportInfo reportInfo = mockReportInfo();
+ ReportInfo reportInfo1 = mockReportInfo();
+ assertEquals(reportInfo.getRepId(),reportInfo1.getRepId());
+ assertEquals(reportInfo.getTitle(),reportInfo1.getTitle());
+ assertEquals(reportInfo.getCreateUser(),reportInfo1.getCreateUser());
+ assertEquals(reportInfo.getOwnerName(),reportInfo1.getOwnerName());
+ assertEquals(reportInfo.getLastAccessed(),reportInfo1.getLastAccessed());
+ assertEquals(reportInfo.getLastWeekAccess(),reportInfo1.getLastWeekAccess());
+ assertEquals(reportInfo.getLastMonthAccess(),reportInfo1.getLastMonthAccess());
+ assertEquals(reportInfo.getLastYearAccess(),reportInfo1.getLastYearAccess());
+ assertEquals(reportInfo.getUserAccessCount(),reportInfo1.getUserAccessCount());
+ assertNull(reportInfo.getCreateDate());
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartAdditionalOptionsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartAdditionalOptionsTest.java
new file mode 100644
index 00000000..0d617288
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartAdditionalOptionsTest.java
@@ -0,0 +1,209 @@
+
+/*
+ * ============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 javax.xml.bind.annotation.XmlElement;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.ChartAdditionalOptions;
+
+public class ChartAdditionalOptionsTest {
+
+ @XmlElement(defaultValue = "false")
+ protected Boolean showXAxisLabel;
+ @XmlElement(defaultValue = "false")
+ protected Boolean addXAxisTickers;
+ protected Integer zoomIn;
+ protected String timeAxisType;
+ @XmlElement(defaultValue = "false")
+ protected Boolean logScale;
+ protected Integer topMargin;
+ protected Integer bottomMargin;
+ protected Integer rightMargin;
+ protected Integer leftMargin;
+
+ public ChartAdditionalOptions mockChartAdditionalOptions() {
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setChartMultiplePieOrder("test");
+ chartAdditionalOptions.setChartMultiplePieLabelDisplay("test");
+ chartAdditionalOptions.setChartOrientation("test");
+ chartAdditionalOptions.setSecondaryChartRenderer("test");
+ chartAdditionalOptions.setChartDisplay("test");
+ chartAdditionalOptions.setHideToolTips("test");
+ chartAdditionalOptions.setHidechartLegend("test");
+ chartAdditionalOptions.setLegendPosition("test");
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setIntervalFromdate("test");
+ chartAdditionalOptions.setIntervalTodate("test");
+ chartAdditionalOptions.setIntervalLabel("test");
+ chartAdditionalOptions.setLastSeriesALineChart("test");
+ chartAdditionalOptions.setLastSeriesABarChart("test");
+ chartAdditionalOptions.setMaxLabelsInDomainAxis("test");
+ chartAdditionalOptions.setLinearRegression("test");
+ chartAdditionalOptions.setLinearRegressionColor("test");
+ chartAdditionalOptions.setExponentialRegressionColor("test");
+ chartAdditionalOptions.setMaxRegression("test");
+ chartAdditionalOptions.setRangeAxisUpperLimit(null);
+ chartAdditionalOptions.setRangeAxisLowerLimit(null);
+ chartAdditionalOptions.setOverlayItemValueOnStackBar("test");
+ chartAdditionalOptions.setAnimate(false);
+ chartAdditionalOptions.setAnimateAnimatedChart(false);
+ chartAdditionalOptions.setKeepDomainAxisValueAsString("test");
+ chartAdditionalOptions.setStacked(false);
+ chartAdditionalOptions.setBarControls(false);
+ chartAdditionalOptions.setXAxisDateType(false);
+ chartAdditionalOptions.setLessXaxisTickers(false);
+ chartAdditionalOptions.setMultiSeries(false);
+ chartAdditionalOptions.setShowXAxisLabel(false);
+ chartAdditionalOptions.setAddXAxisTickers(false);
+ chartAdditionalOptions.setZoomIn(1);
+ chartAdditionalOptions.setTimeAxisType("test");
+ chartAdditionalOptions.setLogScale(false);
+ chartAdditionalOptions.setTopMargin(1);
+ chartAdditionalOptions.setBottomMargin(1);
+ chartAdditionalOptions.setRightMargin(1);
+ chartAdditionalOptions.setLeftMargin(1);
+ chartAdditionalOptions.setTimeAxis(false);
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ return chartAdditionalOptions;
+
+ }
+
+ @Test
+ public void chartAdditionalOptionsTest() {
+ ChartAdditionalOptions chartAdditionalOptions1 = mockChartAdditionalOptions();
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setChartMultiplePieOrder("test");
+ chartAdditionalOptions.setChartMultiplePieLabelDisplay("test");
+ chartAdditionalOptions.setChartOrientation("test");
+ chartAdditionalOptions.setSecondaryChartRenderer("test");
+ chartAdditionalOptions.setChartDisplay("test");
+ chartAdditionalOptions.setHideToolTips("test");
+ chartAdditionalOptions.setHidechartLegend("test");
+ chartAdditionalOptions.setLegendPosition("test");
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setIntervalFromdate("test");
+ chartAdditionalOptions.setIntervalTodate("test");
+ chartAdditionalOptions.setIntervalLabel("test");
+ chartAdditionalOptions.setLastSeriesALineChart("test");
+ chartAdditionalOptions.setLastSeriesABarChart("test");
+ chartAdditionalOptions.setMaxLabelsInDomainAxis("test");
+ chartAdditionalOptions.setLinearRegression("test");
+ chartAdditionalOptions.setLinearRegressionColor("test");
+ chartAdditionalOptions.setExponentialRegressionColor("test");
+ chartAdditionalOptions.setMaxRegression("test");
+ chartAdditionalOptions.setRangeAxisUpperLimit(null);
+ chartAdditionalOptions.setRangeAxisLowerLimit(null);
+ chartAdditionalOptions.setOverlayItemValueOnStackBar("test");
+ chartAdditionalOptions.setAnimate(false);
+ chartAdditionalOptions.setAnimateAnimatedChart(false);
+ chartAdditionalOptions.setKeepDomainAxisValueAsString("test");
+ chartAdditionalOptions.setStacked(false);
+ chartAdditionalOptions.setBarControls(false);
+ chartAdditionalOptions.setXAxisDateType(false);
+ chartAdditionalOptions.setLessXaxisTickers(false);
+ chartAdditionalOptions.setMultiSeries(false);
+ chartAdditionalOptions.setShowXAxisLabel(false);
+ chartAdditionalOptions.setAddXAxisTickers(false);
+ chartAdditionalOptions.setZoomIn(1);
+ chartAdditionalOptions.setTimeAxisType("test");
+ chartAdditionalOptions.setLogScale(false);
+ chartAdditionalOptions.setTopMargin(1);
+ chartAdditionalOptions.setBottomMargin(1);
+ chartAdditionalOptions.setRightMargin(1);
+ chartAdditionalOptions.setLeftMargin(1);
+ chartAdditionalOptions.setTimeAxis(false);
+ chartAdditionalOptions.setTimeSeriesRender("test");
+
+ assertEquals(chartAdditionalOptions.getChartMultiplePieOrder(),
+ chartAdditionalOptions1.getChartMultiplePieOrder());
+ assertEquals(chartAdditionalOptions.getChartMultiplePieLabelDisplay(),
+ chartAdditionalOptions1.getChartMultiplePieLabelDisplay());
+ assertEquals(chartAdditionalOptions.getChartOrientation(), chartAdditionalOptions1.getChartOrientation());
+ assertEquals(chartAdditionalOptions.getSecondaryChartRenderer(),
+ chartAdditionalOptions1.getSecondaryChartRenderer());
+ assertEquals(chartAdditionalOptions.getChartDisplay(), chartAdditionalOptions1.getChartDisplay());
+ assertEquals(chartAdditionalOptions.getHideToolTips(), chartAdditionalOptions1.getHideToolTips());
+ assertEquals(chartAdditionalOptions.getHidechartLegend(), chartAdditionalOptions1.getHidechartLegend());
+ assertEquals(chartAdditionalOptions.getLegendPosition(), chartAdditionalOptions1.getLegendPosition());
+ assertEquals(chartAdditionalOptions.getLabelAngle(), chartAdditionalOptions1.getLabelAngle());
+ assertEquals(chartAdditionalOptions.getIntervalFromdate(), chartAdditionalOptions1.getIntervalFromdate());
+ assertEquals(chartAdditionalOptions.getIntervalTodate(), chartAdditionalOptions1.getIntervalTodate());
+ assertEquals(chartAdditionalOptions.getIntervalLabel(), chartAdditionalOptions1.getIntervalLabel());
+ assertEquals(chartAdditionalOptions.getLastSeriesALineChart(),
+ chartAdditionalOptions1.getLastSeriesALineChart());
+ assertEquals(chartAdditionalOptions.getLastSeriesABarChart(), chartAdditionalOptions1.getLastSeriesABarChart());
+ assertEquals(chartAdditionalOptions.getMaxLabelsInDomainAxis(),
+ chartAdditionalOptions1.getMaxLabelsInDomainAxis());
+ assertEquals(chartAdditionalOptions.getLinearRegression(), chartAdditionalOptions1.getLinearRegression());
+ assertEquals(chartAdditionalOptions.getExponentialRegressionColor(),
+ chartAdditionalOptions1.getExponentialRegressionColor());
+ assertEquals(chartAdditionalOptions.getMaxRegression(), chartAdditionalOptions1.getMaxRegression());
+ assertEquals(chartAdditionalOptions.getRangeAxisUpperLimit(), chartAdditionalOptions1.getRangeAxisUpperLimit());
+ assertEquals(chartAdditionalOptions.getRangeAxisLowerLimit(), chartAdditionalOptions1.getRangeAxisLowerLimit());
+ assertEquals(chartAdditionalOptions.getOverlayItemValueOnStackBar(),
+ chartAdditionalOptions1.getOverlayItemValueOnStackBar());
+ assertEquals(chartAdditionalOptions.isAnimate(), chartAdditionalOptions1.isAnimate());
+ assertEquals(chartAdditionalOptions.isAnimateAnimatedChart(), chartAdditionalOptions1.isAnimateAnimatedChart());
+ assertEquals(chartAdditionalOptions.getKeepDomainAxisValueAsString(),
+ chartAdditionalOptions1.getKeepDomainAxisValueAsString());
+ assertEquals(chartAdditionalOptions.isStacked(), chartAdditionalOptions1.isStacked());
+ assertEquals(chartAdditionalOptions.isBarControls(), chartAdditionalOptions1.isBarControls());
+ assertEquals(chartAdditionalOptions.isXAxisDateType(), chartAdditionalOptions1.isXAxisDateType());
+ assertEquals(chartAdditionalOptions.isLessXaxisTickers(), chartAdditionalOptions1.isLessXaxisTickers());
+ assertEquals(chartAdditionalOptions.isMultiSeries(), chartAdditionalOptions1.isMultiSeries());
+ assertEquals(chartAdditionalOptions.isShowXAxisLabel(), chartAdditionalOptions1.isShowXAxisLabel());
+ assertEquals(chartAdditionalOptions.isAddXAxisTickers(), chartAdditionalOptions1.isAddXAxisTickers());
+ assertEquals(chartAdditionalOptions.getZoomIn(), chartAdditionalOptions1.getZoomIn());
+ assertEquals(chartAdditionalOptions.getTimeAxisType(), chartAdditionalOptions1.getTimeAxisType());
+ assertEquals(chartAdditionalOptions.isLogScale(), chartAdditionalOptions1.isLogScale());
+ assertEquals(chartAdditionalOptions.getTopMargin(), chartAdditionalOptions1.getTopMargin());
+ assertEquals(chartAdditionalOptions.getBottomMargin(), chartAdditionalOptions1.getBottomMargin());
+ assertEquals(chartAdditionalOptions.getLeftMargin(), chartAdditionalOptions1.getLeftMargin());
+ assertEquals(chartAdditionalOptions.getRightMargin(), chartAdditionalOptions1.getRightMargin());
+ assertEquals(chartAdditionalOptions.getLinearRegressionColor(), chartAdditionalOptions1.getLinearRegressionColor());
+ assertEquals(chartAdditionalOptions.isTimeAxis(), chartAdditionalOptions1.isTimeAxis());
+ assertEquals(chartAdditionalOptions.getTimeSeriesRender(), chartAdditionalOptions1.getTimeSeriesRender());
+
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartDrillFormfieldTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartDrillFormfieldTest.java
new file mode 100644
index 00000000..c5075b59
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartDrillFormfieldTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.ChartDrillFormfield;
+
+public class ChartDrillFormfieldTest {
+
+ public ChartDrillFormfield mockChartDrillFormfield()
+ {
+ ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
+ chartDrillFormfield.setFormfield("test");
+ return chartDrillFormfield;
+ }
+
+ @Test
+ public void chartDrillFormfieldTest()
+ {
+ ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
+ chartDrillFormfield.setFormfield("test1");
+
+ ChartDrillFormfield chartDrillFormfield1 = mockChartDrillFormfield();
+
+ assertNotEquals(chartDrillFormfield1.getFormfield(), chartDrillFormfield.getFormfield());
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartDrillOptionsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartDrillOptionsTest.java
new file mode 100644
index 00000000..1621612e
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartDrillOptionsTest.java
@@ -0,0 +1,72 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.ChartDrillOptions;
+
+public class ChartDrillOptionsTest {
+
+ public ChartDrillOptions mockChartDrillOptionsTest() {
+ ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
+ chartDrillOptions.setDrillReportId("testId");
+ chartDrillOptions.setDrillXAxisFormField("testX");
+ chartDrillOptions.setDrillYAxisFormField("testY");
+ chartDrillOptions.setDrillSeriesFormField("testDrill");
+ return chartDrillOptions;
+ }
+
+ @Test
+ public void chartDrillOptionsTest() {
+ ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
+ chartDrillOptions.setDrillReportId("testId");
+ chartDrillOptions.setDrillXAxisFormField("testX");
+ chartDrillOptions.setDrillYAxisFormField("testY");
+ chartDrillOptions.setDrillSeriesFormField("testDrill");
+ ChartDrillOptions chartDrillOptions1 = mockChartDrillOptionsTest();
+
+ assertEquals(chartDrillOptions.getDrillReportId(), chartDrillOptions1.getDrillReportId());
+ assertEquals(chartDrillOptions.getDrillXAxisFormField(), chartDrillOptions1.getDrillXAxisFormField());
+ assertEquals(chartDrillOptions.getDrillYAxisFormField(), chartDrillOptions1.getDrillYAxisFormField());
+ assertEquals(chartDrillOptions.getDrillSeriesFormField(), chartDrillOptions1.getDrillSeriesFormField());
+ assertEquals(chartDrillOptions.getTargetFormfield().size(), 0);
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartJSONHelperTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartJSONHelperTest.java
new file mode 100644
index 00000000..1e40cf3b
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ChartJSONHelperTest.java
@@ -0,0 +1,492 @@
+/*
+ * ============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 javax.xml.namespace.QName;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.Writer;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.hibernate.Session;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.error.RaptorException;
+import org.onap.portalsdk.analytics.model.ReportLoader;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.runtime.ChartJSONHelper;
+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.DbUtils;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.onap.portalsdk.analytics.xmlobj.CustomReportType;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.restful.domain.EcompRole;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({UserUtils.class,AppUtils.class, DbUtils.class, ReportRuntime.class, Globals.class, UserUtils.class,ReportLoader.class})
+public class ChartJSONHelperTest {
+
+ @InjectMocks
+ ChartJSONHelper chartJSONHelper= new ChartJSONHelper();
+
+ @Mock
+ Connection connection;
+ @Mock
+ PreparedStatement stmt;
+ @Mock
+ ResultSet rs ;
+ @Mock
+ java.sql.Clob clob;
+ @Mock
+ InputStream in;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+
+ @Test(expected = java.lang.ClassCastException.class)
+ public void generateJSONTest() throws RaptorException, Exception
+ {
+ EcompRole role = new EcompRole();
+ mockedRequest.getSession().setAttribute("test", role);
+ Set<String> set = new HashSet<String>();
+ set.add("test");
+ Enumeration<String> x = new IteratorEnumeration<String>(set.iterator());
+ Mockito.when(mockedRequest.getSession().getAttributeNames()).thenReturn(x);
+
+ User user = new User();
+ user.setOrgUserId("test12");
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(3);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_REFRESH)).thenReturn("yes");
+ Mockito.when(AppUtils.getRequestFlag(mockedRequest,"display_content")).thenReturn(true);
+ Mockito.when(AppUtils.getRequestFlag(mockedRequest, "noFormFields")).thenReturn(true);
+ PowerMockito.mockStatic(ReportLoader.class);
+ String str = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><CustomReportType xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xsi:type=\"xs:string\"><reportName>name</reportName><reportDescr>desc</reportDescr><chartType>type</chartType><showChartTitle>false</showChartTitle><public>false</public><createId>id</createId><pageNav>false</pageNav></CustomReportType>";
+ Mockito.when(ReportLoader.loadCustomReportXML("1")).thenReturn(str);
+
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setChartType("BarChart3D");
+ rr.setMultiSeries(true);
+ rr.setDashboardType(true);
+ Mockito.when(mockedRequest.getSession().getAttribute("report_runtime")).thenReturn(rr);
+
+ 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);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
+ Mockito.when(DbUtils.getConnection()).thenReturn(connection);
+ Mockito.when(Globals.getLoadCustomReportXml()).thenReturn("java.lang.String");
+ Mockito.when(connection.prepareStatement("test")).thenReturn(stmt);
+ Mockito.when(stmt.executeQuery()).thenReturn(rs);
+ Mockito.when(Globals.isWeblogicServer()).thenReturn(true);
+ Mockito.when(rs.getClob(1)).thenReturn(clob);
+ Mockito.when(rs.next()).thenReturn(true);
+ Mockito.when(clob.getAsciiStream()).thenReturn(in);
+ Mockito.when(in.read(Matchers.any())).thenReturn(1);
+// PowerMockito.mockStatic(ReportRuntime.class);
+ Mockito.when(ReportRuntime.unmarshal(str, "1", mockedRequest)).thenReturn(rr);
+ Mockito.when(AppUtils.getRequestNvlValue(mockedRequest, "pdfAttachmentKey")).thenReturn("test");
+ Mockito.when(AppUtils.nvl(rr.getLegendLabelAngle())).thenReturn("standard");
+ Mockito.when(AppUtils.getRequestNvlValue(Matchers.any(), Matchers.anyString())).thenReturn("test");
+ Mockito.when(AppUtils.nvl("Y")).thenReturn("Y");
+ Mockito.when(AppUtils.nvl("bottom")).thenReturn("Y");
+ Mockito.when(AppUtils.nvl("test")).thenReturn("test|");
+ Mockito.when(AppUtils.getRequestValue(mockedRequest, "c_dashboard")).thenReturn("1");
+ Mockito.when(ReportLoader.isDashboardType("-1")).thenReturn(false);
+ assertEquals(chartJSONHelper.generateJSON("1", mockedRequest, false).getClass(), String.class);
+ }
+
+
+ @Test(expected = java.lang.NullPointerException.class)
+ public void generateJSONTest1() throws RaptorException, Exception
+ {
+ EcompRole role = new EcompRole();
+ mockedRequest.getSession().setAttribute("test", role);
+
+ Set<String> set = new HashSet<String>();
+ Enumeration<String> x = new IteratorEnumeration<String>(set.iterator());
+ Mockito.when(mockedRequest.getSession().getAttributeNames()).thenReturn(x);
+ User user = new User();
+ user.setOrgUserId("test12");
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(3);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_REFRESH)).thenReturn("yes");
+ Mockito.when(AppUtils.getRequestFlag(mockedRequest,AppConstants.RI_DISPLAY_CONTENT)).thenReturn(true);
+ Mockito.when(AppUtils.getRequestFlag(mockedRequest, "noFormFields")).thenReturn(false);
+ PowerMockito.mockStatic(ReportLoader.class);
+ ReportRuntime rr = mockReportRunTime();
+ 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);
+ 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();
+ Mockito.when(DbUtils.getConnection()).thenReturn(connection);
+ Mockito.when(Globals.getLoadCustomReportXml()).thenReturn("test");
+ Mockito.when(connection.prepareStatement("test")).thenReturn(stmt);
+ Mockito.when(stmt.executeQuery()).thenReturn(rs);
+ Mockito.when(Globals.isWeblogicServer()).thenReturn(false);
+ Mockito.when(Globals.isPostgreSQL()).thenReturn(true);
+ Mockito.when(rs.getClob(1)).thenReturn(clob);
+ Mockito.when(rs.next()).thenReturn(true);
+ Mockito.when(clob.getAsciiStream()).thenReturn(in);
+ Mockito.when(in.read(Matchers.any())).thenReturn(1);
+ Mockito.when(AppUtils.getRequestValue(mockedRequest, AppConstants.RI_DASHBOARD_ID)).thenReturn("test");
+ mockedRequest.getSession().setAttribute("report_runtime", rr);
+ chartJSONHelper.generateJSON("1", mockedRequest, false);
+ }
+
+ @Test
+ public void generateJSON1Test() throws RaptorException, 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);
+ 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");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setDataSourceList(dataSourceList);
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ FormFieldList formFieldList = PowerMockito.mock(FormFieldList.class);
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1", "1", true);
+ PowerMockito.mockStatic(UserUtils.class);
+ ReportRuntime rr = new ReportRuntime(reportWrapper, mockedRequest);
+ rr.setLegendLabelAngle("test");
+ rr.setMultiSeries(false);
+ rr.setChartType("test");
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ Mockito.when(AppUtils.nvl("test")).thenReturn("test");
+ Mockito.when(AppUtils.nvl("N")).thenReturn("Y");
+ Mockito.when(AppUtils.nvl("bottom")).thenReturn("Y");
+ Mockito.when(UserUtils.getUserId(mockedRequest)).thenReturn(1);
+ assertEquals(chartJSONHelper.generateJSON(rr, mockedRequest, false).getClass(), String.class);
+ }
+
+
+
+ public ReportRuntime mockReportRunTime() 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");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("test");
+ dataColumnType.setColOnChart("test");
+ dataColumnType.setDisplayName("test");
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setDataSourceList(dataSourceList);
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ FormFieldList formFieldList = PowerMockito.mock(FormFieldList.class);
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1", "1", true);
+ PowerMockito.mockStatic(UserUtils.class);
+ ReportRuntime rr = new ReportRuntime(reportWrapper, mockedRequest);
+ rr.setLegendLabelAngle("test");
+ rr.setMultiSeries(false);
+ rr.setChartType("test");
+ return rr;
+ }
+
+ 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("chart_total");
+ dataColumnType.setColId("1");
+ dataColumnType.setTableId("1");
+ dataColumnType.setColType("DATE");
+ 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.setDataSourceList(dataSourceList);
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ List<FormFieldType> formFields = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldId("test");
+ formFieldType.setColId("1");
+ formFieldType.setFieldName("test");
+ formFieldType.setFieldType("type");
+ formFieldType.setValidationType("validation");
+ formFieldType.setMandatory("Y");
+ formFieldType.setDefaultValue("test");
+ formFields.add(formFieldType);
+ formFieldList.formField = formFields;
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1", "1", true);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(Globals.getRequestParams()).thenReturn("test");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test");
+ Mockito.when(Globals.getSessionParamsForScheduling()).thenReturn("test");
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ ReportRuntime rr = new ReportRuntime(reportWrapper, mockedRequest);
+ rr.setLegendLabelAngle("test");
+ rr.setMultiSeries(false);
+ rr.setChartType("test");
+ return rr;
+ }
+
+ @Test
+ public void getFlagFromDateStrTest()
+ {
+ assertEquals(chartJSONHelper.getFlagFromDateStr("11/11/2000"),3);
+ assertEquals(chartJSONHelper.getFlagFromDateStr("111, 11/11/2000"),0);
+ assertEquals(chartJSONHelper.getFlagFromDateStr("00/00/0000"),3);
+ }
+
+ @Test
+ public void getDateFromDateStrTest()
+ {
+ Date date = new Date("Sat Nov 11 00:00:00 EST 2000");
+ assertNull(chartJSONHelper.getDateFromDateStr("111, 11/11/2000"));
+ }
+
+ @Test
+ public void generateChartSQLTest() throws Exception
+ {
+ ReportRuntime rr = mockReportRunTime();
+ rr.setWholeSQL("select * from test");
+ chartJSONHelper = new ChartJSONHelper(rr);
+ assertEquals(chartJSONHelper.generateChartSQL("test", mockedRequest),"SELECT 1 a, 1 a_1, 1 FROM test ORDER BY 1");
+ }
+
+ @Test
+ public void generateChartSQL1Test() throws Exception
+ {
+ ReportRuntime rr = mockReportRunTime1();
+ rr.setWholeSQL("select * from test");
+ rr.setReportType("Hive");
+ chartJSONHelper = new ChartJSONHelper(rr);
+ assertEquals(chartJSONHelper.generateChartSQL("test", mockedRequest),"SELECT TO_CHAR([test, '%m/%d/%Y') 1, TO_CHAR([test, '%m/%d/%Y') 1_1, chart_total chart_total, 1 FROM test ");
+ }
+
+ public static void main(String[] args) throws Exception {
+ CustomReportType t = new CustomReportType();
+ t.setPageNav(false);
+ t.setReportName("name");
+ t.setReportDescr("desc");
+ t.setChartType("type");
+ t.setCreateId("id");
+ t.setCreateDate(null);
+
+ ObjectMapper mapper = new ObjectMapper();
+
+
+ EcompRole role = new EcompRole();
+ role.setName("test");
+ role.setId((long) 1);
+ role.setRoleFunctions(null);
+
+ System.out.println(mapper.writeValueAsString(role));
+ JAXBContext jc = JAXBContext.newInstance("org.onap.portalsdk.analytics.xmlobj");
+ JAXBElement<CustomReportType> jaxbElement =
+ new JAXBElement(new QName("CustomReportType"),
+ CustomReportType.class,t);
+ Unmarshaller u = jc.createUnmarshaller();
+ StringReader rs = new java.io.StringReader(
+ mapper.writeValueAsString(role));
+ System.out.println(rs);
+
+ Marshaller jaxbMarshaller = jc.createMarshaller();
+ jaxbMarshaller.marshal(jaxbElement, System.out);
+ String str = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><CustomReportType xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xsi:type=\"xs:string\"><reportName>name</reportName><reportDescr>desc</reportDescr><chartType>type</chartType><showChartTitle>false</showChartTitle><public>false</public><createId>id</createId><pageNav>false</pageNav></CustomReportType>";
+
+ javax.xml.bind.JAXBElement<CustomReportType> doc = (javax.xml.bind.JAXBElement<CustomReportType>) u.unmarshal(new java.io.StringReader(
+ str));
+ System.out.println(doc.getValue());
+
+ }
+
+
+}
+
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ColFilterListTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ColFilterListTest.java
new file mode 100644
index 00000000..de0ea3d8
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ColFilterListTest.java
@@ -0,0 +1,54 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.ColFilterList;
+
+public class ColFilterListTest {
+
+ @Test
+ public void colFilterListTest()
+ {
+ ColFilterList colFilterList = new ColFilterList();
+ assertEquals(colFilterList.getColFilter().size(),0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ColFilterTypeTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ColFilterTypeTest.java
new file mode 100644
index 00000000..4db105a2
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ColFilterTypeTest.java
@@ -0,0 +1,85 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.ColFilterType;
+
+public class ColFilterTypeTest {
+
+ public ColFilterType mockColFilterType() {
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setColId("test");
+ colFilterType.setFilterSeq(0);
+ colFilterType.setJoinCondition("test");
+ colFilterType.setOpenBrackets("test");
+ colFilterType.setExpression("test");
+ colFilterType.setArgType("test");
+ colFilterType.setArgValue("test");
+ colFilterType.setCloseBrackets("test");
+ colFilterType.setComment("test");
+ return colFilterType;
+ }
+
+ @Test
+ public void colFilterTypeTest() {
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setColId("test");
+ colFilterType.setFilterSeq(0);
+ colFilterType.setJoinCondition("test");
+ colFilterType.setOpenBrackets("test");
+ colFilterType.setExpression("test");
+ colFilterType.setArgType("test");
+ colFilterType.setArgValue("test");
+ colFilterType.setCloseBrackets("test");
+ colFilterType.setComment("test");
+ ColFilterType colFilterType1 = mockColFilterType();
+
+ assertEquals(colFilterType.getColId(), colFilterType1.getColId());
+ assertEquals(colFilterType.getFilterSeq(), colFilterType1.getFilterSeq());
+ assertEquals(colFilterType.getJoinCondition(), colFilterType1.getJoinCondition());
+ assertEquals(colFilterType.getOpenBrackets(), colFilterType1.getOpenBrackets());
+ assertEquals(colFilterType.getExpression(), colFilterType1.getExpression());
+ assertEquals(colFilterType.getArgType(), colFilterType1.getArgType());
+ assertEquals(colFilterType.getArgValue(), colFilterType1.getArgValue());
+ assertEquals(colFilterType.getCloseBrackets(), colFilterType1.getCloseBrackets());
+ assertEquals(colFilterType.getComment(), colFilterType1.getComment());
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/CustomReportTypeTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/CustomReportTypeTest.java
new file mode 100644
index 00000000..c6256b0e
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/CustomReportTypeTest.java
@@ -0,0 +1,206 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.CustomReportType;
+import org.onap.portalsdk.analytics.xmlobj.PDFAdditionalOptions;
+
+public class CustomReportTypeTest {
+
+ public CustomReportType mockCustomReportType()
+ {
+ CustomReportType customReportType = new CustomReportType();
+ customReportType.setReportName("test");
+ customReportType.setReportDescr("desc");
+ customReportType.setNumDashCols("testcols");
+ customReportType.setDashboardLayoutHTML("layout");
+ customReportType.setDbInfo("db");
+ customReportType.setDbType("testType");
+ customReportType.setChartType("chartType");
+ customReportType.setChartTypeFixed("fixed");
+ customReportType.setChartMultiSeries("series");
+ customReportType.setChartLeftAxisLabel("leftAxis");
+ customReportType.setChartRightAxisLabel("rightAxis");
+ customReportType.setChartWidth("width");
+ customReportType.setChartHeight("height");
+ customReportType.setShowChartTitle(false);
+ customReportType.setPublic(false);
+ customReportType.setHideFormFieldAfterRun(false);
+ customReportType.setCreateId("id");
+ customReportType.setCreateDate(null);
+ customReportType.setReportSQL("report");
+ customReportType.setReportTitle("title");
+ customReportType.setReportSubTitle("subtitle");
+ customReportType.setReportHeader("header");
+ customReportType.setFrozenColumns(1);
+ customReportType.setPdfImgLogo("logo");
+ customReportType.setEmptyMessage("message");
+ customReportType.setWidthNoColumn("widthNoColumn");
+ customReportType.setDataGridAlign("grid");
+ customReportType.setReportFooter("footer");
+ customReportType.setNumFormCols("numForm");
+ customReportType.setDisplayOptions("dsiplay");
+ customReportType.setJumpTo(1);
+ customReportType.setSearchPageSize(1);
+ customReportType.setNavPosition("position");
+ customReportType.setToggleLayout(false);
+ customReportType.setPageNav(false);
+ customReportType.setShowPageSize(false);
+ customReportType.setShowNavPos(false);
+ customReportType.setShowGotoOption(false);
+ customReportType.setDataContainerHeight("containerHeight");
+ customReportType.setDataContainerWidth("containerWidth");
+ customReportType.setAllowSchedule("schedule");
+ customReportType.setMultiGroupColumn("multiGroups");
+ customReportType.setTopDown("topDown");
+ customReportType.setSizedByContent("content");
+ customReportType.setComment("comment");
+ customReportType.setDataSourceList(null);
+ customReportType.setFormFieldList(null);
+ customReportType.setJavascriptList(null);
+ customReportType.setSemaphoreList(null);
+ customReportType.setDashboardOptions("dashboardOptions");
+ customReportType.setDashboardType(false);
+ customReportType.setReportInNewWindow(false);
+ customReportType.setDisplayFolderTree(false);
+ customReportType.setMaxRowsInExcelDownload(1);
+ customReportType.setDashBoardReports(null);
+ customReportType.setDashBoardReportsNew(null);
+ customReportType.setChartAdditionalOptions(null);
+ customReportType.setPdfAdditionalOptions(null);
+ customReportType.setChartDrillOptions(null);
+ customReportType.setDataminingOptions(null);
+ customReportType.setJavascriptElement("js");
+ customReportType.setFolderId("folderId");
+ customReportType.setDrillURLInPoPUpPresent(false);
+ customReportType.setIsOneTimeScheduleAllowed("false");
+ customReportType.setIsHourlyScheduleAllowed("no");
+ customReportType.setIsDailyScheduleAllowed("no");
+ customReportType.setIsDailyMFScheduleAllowed("no");
+ customReportType.setIsWeeklyScheduleAllowed("no");
+ customReportType.setIsMonthlyScheduleAllowed("no");
+ customReportType.setReportMap(null);
+ customReportType.setPageSize(1);
+ customReportType.setReportType("test");
+ return customReportType;
+ }
+
+ @Test
+ public void customReportTypeTest()
+ {
+ CustomReportType customReportType = mockCustomReportType();
+
+ assertEquals(customReportType.getReportName(),"test");
+ assertEquals(customReportType.getReportDescr(),"desc");
+ assertEquals(customReportType.getNumDashCols(),"testcols");
+ assertEquals(customReportType.getDashboardLayoutHTML(),"layout");
+ assertEquals(customReportType.getDbInfo(),"db");
+ assertEquals(customReportType.getDbType(),"testType");
+ assertEquals(customReportType.getChartType(),"chartType");
+ assertEquals(customReportType.getChartTypeFixed(),"fixed");
+ assertEquals(customReportType.getChartMultiSeries(),"series");
+ assertEquals(customReportType.getChartLeftAxisLabel(),"leftAxis");
+ assertEquals(customReportType.getChartRightAxisLabel(),"rightAxis");
+ assertEquals(customReportType.getChartWidth(),"width");
+ assertEquals(customReportType.getChartHeight(),"height");
+ assertEquals(customReportType.isShowChartTitle(), false);
+ assertEquals(customReportType.isPublic(),false);
+ assertEquals(customReportType.isHideFormFieldAfterRun(),false);
+ assertEquals(customReportType.getCreateId(),"id");
+ assertEquals(customReportType.getCreateDate(),null);
+ assertEquals(customReportType.getReportSQL(),"report");
+ assertEquals(customReportType.getReportTitle(),"title");
+ assertEquals(customReportType.getReportSubTitle(),"subtitle");
+ assertEquals(customReportType.getReportHeader(),"header");
+ assertTrue(customReportType.getFrozenColumns() == 1);
+ assertEquals(customReportType.getPdfImgLogo(),"logo");
+ assertEquals(customReportType.getEmptyMessage(),"message");
+ assertEquals(customReportType.getWidthNoColumn(),"widthNoColumn");
+ assertEquals(customReportType.getDataGridAlign(),"grid");
+ assertEquals(customReportType.getReportFooter(),"footer");
+ assertEquals(customReportType.getNumFormCols(),"numForm");
+ assertEquals(customReportType.getDisplayOptions(),"dsiplay");
+ assertTrue(customReportType.getJumpTo()==1);
+ assertTrue(customReportType.getSearchPageSize()==1);
+ assertEquals(customReportType.getNavPosition(),"position");
+ assertEquals(customReportType.isToggleLayout(),false);
+ assertEquals(customReportType.isPageNav(),false);
+ assertEquals(customReportType.isShowPageSize(),false);
+ assertEquals(customReportType.isShowNavPos(),false);
+ assertEquals(customReportType.isShowGotoOption(),false);
+ assertEquals(customReportType.getDataContainerHeight(),"containerHeight");
+ assertEquals(customReportType.getDataContainerWidth(),"containerWidth");
+ assertEquals(customReportType.getAllowSchedule(),"schedule");
+ assertEquals(customReportType.getMultiGroupColumn(),"multiGroups");
+ assertEquals(customReportType.getTopDown(),"topDown");
+ assertEquals(customReportType.getSizedByContent(),"content");
+ assertEquals(customReportType.getComment(),"comment");
+ assertEquals(customReportType.getDataSourceList(),null);
+ assertEquals(customReportType.getFormFieldList(),null);
+ assertEquals(customReportType.getJavascriptList(),null);
+ assertEquals(customReportType.getSemaphoreList(),null);
+ assertEquals(customReportType.getDashboardOptions(),"dashboardOptions");
+ assertEquals(customReportType.isDashboardType(),false);
+ assertEquals(customReportType.isReportInNewWindow(),false);
+ assertEquals(customReportType.isDisplayFolderTree(),false);
+ assertTrue(customReportType.getMaxRowsInExcelDownload() ==1);
+ assertEquals(customReportType.getDashBoardReports(),null);
+ assertEquals(customReportType.getDashBoardReportsNew(),null);
+ assertEquals(customReportType.getChartAdditionalOptions(),null);
+ assertEquals(customReportType.getChartDrillOptions(),null);
+ assertEquals(customReportType.getDataminingOptions(),null);
+ assertEquals(customReportType.getJavascriptElement(),"js");
+ assertEquals(customReportType.getFolderId(),"folderId");
+ assertEquals(customReportType.isDrillURLInPoPUpPresent(),false);
+ assertEquals(customReportType.getIsOneTimeScheduleAllowed(),"false");
+ assertEquals(customReportType.getIsHourlyScheduleAllowed(),"no");
+ assertEquals(customReportType.getIsDailyScheduleAllowed(),"no");
+ assertEquals(customReportType.getIsDailyMFScheduleAllowed(),"no");
+ assertEquals(customReportType.getIsWeeklyScheduleAllowed(),"no");
+ assertEquals(customReportType.getIsMonthlyScheduleAllowed(),"no");
+ assertEquals(customReportType.getReportMap(),null);
+ assertTrue(customReportType.getPageSize()==1);
+ assertEquals(customReportType.getReportType(),"test");
+ PDFAdditionalOptions pDFAdditionalOptions = customReportType.getPdfAdditionalOptions();
+ assertNull(pDFAdditionalOptions);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardEditorListTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardEditorListTest.java
new file mode 100644
index 00000000..6f9d7328
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardEditorListTest.java
@@ -0,0 +1,52 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.DashboardEditorList;
+
+public class DashboardEditorListTest {
+
+ @Test
+ public void dashboardEditorList() {
+ DashboardEditorList dashboardEditorList = new DashboardEditorList();
+ assertEquals(dashboardEditorList.getEditorList().size(), 0);
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardEditorReportTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardEditorReportTest.java
new file mode 100644
index 00000000..c04a00b1
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardEditorReportTest.java
@@ -0,0 +1,67 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.DashboardEditorReport;
+
+public class DashboardEditorReportTest {
+
+ public DashboardEditorReport mockDashboardEditorReport()
+ {
+ DashboardEditorReport dashboardEditorReport = new DashboardEditorReport();
+ dashboardEditorReport.setReportId("id");
+ dashboardEditorReport.setReportName("name");
+ dashboardEditorReport.setDataType("type");
+ dashboardEditorReport.setPosition("position");
+ return dashboardEditorReport;
+ }
+
+ @Test
+ public void dashboardEditorReportTest()
+ {
+ DashboardEditorReport dashboardEditorReport = mockDashboardEditorReport();
+ assertEquals(dashboardEditorReport.getReportId(),"id");
+ assertEquals(dashboardEditorReport.getReportName(),"name");
+ assertEquals(dashboardEditorReport.getDataType(),"type");
+ assertEquals(dashboardEditorReport.getPosition(),"position");
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardReportsNewTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardReportsNewTest.java
new file mode 100644
index 00000000..46ea0ede
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardReportsNewTest.java
@@ -0,0 +1,63 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.DashboardReportsNew;
+
+public class DashboardReportsNewTest {
+
+ public DashboardReportsNew mockDashboardReportsNew() {
+ DashboardReportsNew dashboardReportsNew = new DashboardReportsNew();
+ dashboardReportsNew.setDashboardEditor("editor");
+ dashboardReportsNew.setDashboardEditorList(null);
+ return dashboardReportsNew;
+ }
+
+ @Test
+ public void dashboardReportsNewTest() {
+ DashboardReportsNew dashboardReportsNew = mockDashboardReportsNew();
+ assertEquals(dashboardReportsNew.getDashboardEditor(), "editor");
+ assertNull(dashboardReportsNew.getDashboardEditorList());
+ assertEquals(dashboardReportsNew.getReportsList().size(),0);
+
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardReportsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardReportsTest.java
new file mode 100644
index 00000000..28aa6302
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DashboardReportsTest.java
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.DashboardReports;
+
+public class DashboardReportsTest {
+
+ @Test
+ public void dashboardReportsListTest() {
+ DashboardReports dashboardReports = new DashboardReports();
+ assertEquals(dashboardReports.getReportsList().size(), 0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataColumnListTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataColumnListTest.java
new file mode 100644
index 00000000..e671461c
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataColumnListTest.java
@@ -0,0 +1,51 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnList;
+
+public class DataColumnListTest {
+ @Test
+ public void DataColumnListList() {
+ DataColumnList dataColumnList = new DataColumnList();
+ assertEquals(dataColumnList.getDataColumn().size(), 0);
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataColumnTypeTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataColumnTypeTest.java
new file mode 100644
index 00000000..23175734
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataColumnTypeTest.java
@@ -0,0 +1,164 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnType;
+
+public class DataColumnTypeTest {
+
+ public DataColumnType mockDataColumnType() {
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setTableId("id");
+ dataColumnType.setDbColName("dbColumName");
+ dataColumnType.setCrossTabValue("crossTabValue");
+ dataColumnType.setColName("name");
+ dataColumnType.setDisplayWidth(1);
+ dataColumnType.setDisplayWidthInPxls("width");
+ dataColumnType.setDisplayAlignment("alignment");
+ dataColumnType.setDisplayHeaderAlignment("headerAlignment");
+ dataColumnType.setOrderSeq(1);
+ dataColumnType.setVisible(false);
+ dataColumnType.setCalculated(false);
+ dataColumnType.setColType("colType");
+ dataColumnType.setHyperlinkURL("hlURL");
+ dataColumnType.setHyperlinkType("hlType");
+ dataColumnType.setActionImg("image");
+ dataColumnType.setGroupByPos(1);
+ dataColumnType.setSubTotalCustomText("customtetext");
+ dataColumnType.setHideRepeatedKey(false);
+ dataColumnType.setColFormat("format");
+ dataColumnType.setGroupBreak(false);
+ dataColumnType.setOrderBySeq(1);
+ dataColumnType.setOrderByAscDesc("order");
+ dataColumnType.setDisplayTotal("displayTotal");
+ dataColumnType.setColOnChart("chart");
+ dataColumnType.setChartSeq(1);
+ dataColumnType.setChartColor("color");
+ dataColumnType.setChartLineType("line");
+ dataColumnType.setChartSeries(false);
+ dataColumnType.setIsRangeAxisFilled(false);
+ dataColumnType.setIsSortable(false);
+ dataColumnType.setCreateInNewChart(false);
+ dataColumnType.setDrillDownType("type");
+ dataColumnType.setDrillinPoPUp(false);
+ dataColumnType.setDrillDownURL("url");
+ dataColumnType.setDrillDownParams("params");
+ dataColumnType.setComment("comment");
+ dataColumnType.setColFilterList(null);
+ dataColumnType.setSemaphoreId("semId");
+ dataColumnType.setChartGroup("group");
+ dataColumnType.setYAxis("Yaxis");
+ dataColumnType.setDependsOnFormField("fileds");
+ dataColumnType.setNowrap("nowRap");
+ dataColumnType.setDbColType("type");
+ dataColumnType.setIndentation(1);
+ dataColumnType.setEnhancedPagination(false);
+ dataColumnType.setLevel(1);
+ dataColumnType.setStart(1);
+ dataColumnType.setColspan(1);
+ dataColumnType.setDataMiningCol("dataMiningCol");
+ dataColumnType.setColId("colId");
+ dataColumnType.setDisplayName("test");
+ dataColumnType.setPdfDisplayWidthInPxls("test");
+ return dataColumnType;
+ }
+
+ @Test
+ public void dataColumnTypeTest()
+ {
+ DataColumnType dataColumnType = mockDataColumnType();
+
+ DataColumnType dataColumnType1 = mockDataColumnType();
+
+ assertEquals(dataColumnType.getTableId(),"id");
+ assertEquals(dataColumnType.getDbColName(),"dbColumName");
+ assertEquals(dataColumnType.getCrossTabValue(),"crossTabValue");
+ assertEquals(dataColumnType.getColName(),"name");
+ assertTrue(dataColumnType.getDisplayWidth() == 1);
+ assertEquals(dataColumnType.getDisplayWidthInPxls(),"width");
+ assertEquals(dataColumnType.getDisplayAlignment(),"alignment");
+ assertEquals(dataColumnType.getDisplayHeaderAlignment(),"headerAlignment");
+ assertTrue(dataColumnType.getOrderSeq()==1);
+ assertEquals(dataColumnType.isVisible(),false);
+ assertEquals(dataColumnType.isCalculated(),false);
+ assertEquals(dataColumnType.getColType(),"colType");
+ assertEquals(dataColumnType.getHyperlinkURL(),"hlURL");
+ assertEquals(dataColumnType.getHyperlinkType(),"hlType");
+ assertEquals(dataColumnType.getActionImg(),"image");
+ assertTrue(dataColumnType.getGroupByPos()==1);
+ assertEquals(dataColumnType.getSubTotalCustomText(),"customtetext");
+ assertEquals(dataColumnType.isHideRepeatedKey(),false);
+ assertEquals(dataColumnType.getColFormat(),"format");
+ assertEquals(dataColumnType.isGroupBreak(),false);
+ assertTrue(dataColumnType.getOrderBySeq()==1);
+ assertEquals(dataColumnType.getOrderByAscDesc(),"order");
+ assertEquals(dataColumnType.getDisplayTotal(),"displayTotal");
+ assertEquals(dataColumnType.getColOnChart(),"chart");
+ assertTrue(dataColumnType.getChartSeq()==1);
+ assertEquals(dataColumnType.getChartColor(),"color");
+ assertEquals(dataColumnType.getChartLineType(),"line");
+ assertEquals(dataColumnType.isChartSeries(),false);
+ assertEquals(dataColumnType.isIsRangeAxisFilled(),false);
+ assertEquals(dataColumnType.isIsSortable(),false);
+ assertEquals(dataColumnType.isCreateInNewChart(),false);
+ assertEquals(dataColumnType.getDrillDownType(),"type");
+ assertEquals(dataColumnType.isDrillinPoPUp(),false);
+ assertEquals(dataColumnType.getDrillDownURL(),"url");
+ assertEquals(dataColumnType.getDrillDownParams(),"params");
+ assertEquals(dataColumnType.getComment(),"comment");
+ assertNull(dataColumnType.getColFilterList());
+ assertEquals(dataColumnType.getSemaphoreId(),"semId");
+ assertEquals(dataColumnType.getChartGroup(),"group");
+ assertEquals(dataColumnType.getYAxis(),"Yaxis");
+ assertEquals(dataColumnType.getDependsOnFormField(),"fileds");
+ assertEquals(dataColumnType.getNowrap(),"nowRap");
+ assertEquals(dataColumnType.getDbColType(),"type");
+ assertTrue(dataColumnType.getIndentation()==1);
+ assertEquals(dataColumnType.isEnhancedPagination(),false);
+ assertTrue(dataColumnType.getLevel()==1);
+ assertTrue(dataColumnType.getStart()==1);
+ assertTrue(dataColumnType.getColspan()==1);
+ assertEquals(dataColumnType.getDataMiningCol(),"dataMiningCol");
+ assertEquals(dataColumnType.getColId(),"colId");
+ assertEquals(dataColumnType.getDisplayName(),"test");
+ assertEquals(dataColumnType.getPdfDisplayWidthInPxls(),"test");
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataSourceTypeTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataSourceTypeTest.java
new file mode 100644
index 00000000..55813b5e
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataSourceTypeTest.java
@@ -0,0 +1,81 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceType;
+
+public class DataSourceTypeTest {
+
+ public DataSourceType mockDataSourceType() {
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("tableName");
+ dataSourceType.setTablePK("tablePK");
+ dataSourceType.setDisplayName("displayName");
+ dataSourceType.setRefTableId("refTableId");
+ dataSourceType.setRefDefinition("refDefinition");
+ dataSourceType.setComment("comment");
+ dataSourceType.setDataColumnList(null);
+ dataSourceType.setTableId("tableId");
+ return dataSourceType;
+ }
+
+ @Test
+ public void dataSourceTypeTest() {
+ DataSourceType dataSourceType1 = mockDataSourceType();
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("tableName");
+ dataSourceType.setTablePK("tablePK");
+ dataSourceType.setDisplayName("displayName");
+ dataSourceType.setRefTableId("refTableId");
+ dataSourceType.setRefDefinition("refDefinition");
+ dataSourceType.setComment("comment");
+ dataSourceType.setDataColumnList(null);
+ dataSourceType.setTableId("tableId");
+ assertEquals(dataSourceType.getTableName(), dataSourceType1.getTableName());
+ assertEquals(dataSourceType.getTablePK(), dataSourceType1.getTablePK());
+ assertEquals(dataSourceType.getDisplayName(), dataSourceType1.getDisplayName());
+ assertEquals(dataSourceType.getRefTableId(), dataSourceType1.getRefTableId());
+ assertEquals(dataSourceType.getRefDefinition(), dataSourceType1.getRefDefinition());
+ assertEquals(dataSourceType.getComment(), dataSourceType1.getComment());
+ assertEquals(dataSourceType.getDataColumnList(), dataSourceType1.getDataColumnList());
+ assertEquals(dataSourceType.getTableId(), dataSourceType1.getTableId());
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataminingOptionsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataminingOptionsTest.java
new file mode 100644
index 00000000..3c8f6947
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/DataminingOptionsTest.java
@@ -0,0 +1,69 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.DataminingOptions;
+
+public class DataminingOptionsTest {
+
+ public DataminingOptions mockDataminingOptions() {
+ DataminingOptions dataminingOptions = new DataminingOptions();
+ dataminingOptions.setClassifier("classifier");
+ dataminingOptions.setTimeAttribute("timeattribute");
+ dataminingOptions.setTimeformat("timeformat");
+ dataminingOptions.setForecastingUnits("forecastingUnits");
+ return dataminingOptions;
+ }
+
+ @Test
+ public void dataminingOptionsTest() {
+ DataminingOptions dataminingOptions1 = mockDataminingOptions();
+ DataminingOptions dataminingOptions = new DataminingOptions();
+ dataminingOptions.setClassifier("classifier");
+ dataminingOptions.setTimeAttribute("timeattribute");
+ dataminingOptions.setTimeformat("timeformat");
+ dataminingOptions.setForecastingUnits("forecastingUnits");
+ assertEquals(dataminingOptions.getClassifier(), dataminingOptions1.getClassifier());
+ assertEquals(dataminingOptions.getTimeAttribute(), dataminingOptions1.getTimeAttribute());
+ assertEquals(dataminingOptions.getTimeformat(), dataminingOptions1.getTimeformat());
+ assertEquals(dataminingOptions.getForecastingUnits(), dataminingOptions1.getForecastingUnits());
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormFieldListTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormFieldListTest.java
new file mode 100644
index 00000000..5aea9788
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormFieldListTest.java
@@ -0,0 +1,54 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.FormFieldList;
+
+public class FormFieldListTest {
+
+ @Test
+ public void mockFormFieldListTest() {
+ FormFieldList FormFieldList = new FormFieldList();
+ FormFieldList.setComment("comment");
+ assertEquals(FormFieldList.getComment(), "comment");
+ assertEquals(FormFieldList.getFormField().size(), 0);
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormFieldTypeTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormFieldTypeTest.java
new file mode 100644
index 00000000..dfa811c9
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormFieldTypeTest.java
@@ -0,0 +1,97 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.FormFieldType;
+
+public class FormFieldTypeTest {
+
+ public FormFieldType mockFormFieldType() {
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setColId("colId");
+ formFieldType.setFieldName("name");
+ formFieldType.setFieldType("type");
+ formFieldType.setVisible("visible");
+ formFieldType.setValidationType("validation");
+ formFieldType.setMandatory("test");
+ formFieldType.setDefaultValue("test");
+ formFieldType.setOrderBySeq(1);
+ formFieldType.setRangeStartDate(null);
+ formFieldType.setRangeEndDate(null);
+ formFieldType.setRangeStartDateSQL(null);
+ formFieldType.setRangeEndDateSQL("endDate");
+ formFieldType.setComment("comment");
+ formFieldType.setPredefinedValueList(null);
+ formFieldType.setDependsOn("dependsOn");
+ formFieldType.setGroupFormField(false);
+ formFieldType.setMultiSelectListSize("test");
+ formFieldType.setFieldId("id");
+ formFieldType.setFieldSQL("test");
+ formFieldType.setFieldDefaultSQL("test");
+ return formFieldType;
+ }
+
+ @Test
+ public void formFieldTypeTest() {
+ FormFieldType formFieldType = mockFormFieldType();
+ assertEquals(formFieldType.getColId(), "colId");
+ assertEquals(formFieldType.getFieldName(), "name");
+ assertEquals(formFieldType.getFieldType(), "type");
+ assertEquals(formFieldType.getVisible(), "visible");
+ assertEquals(formFieldType.getValidationType(), "validation");
+ assertEquals(formFieldType.getMandatory(), "test");
+ assertEquals(formFieldType.getDefaultValue(), "test");
+ assertTrue(formFieldType.getOrderBySeq() == 1);
+ assertNull(formFieldType.getRangeStartDate());
+ assertNull(formFieldType.getRangeEndDate());
+ assertNull(formFieldType.getRangeStartDateSQL());
+ assertEquals(formFieldType.getRangeEndDateSQL(), "endDate");
+ assertEquals(formFieldType.getComment(), "comment");
+ assertNull(formFieldType.getPredefinedValueList());
+ assertEquals(formFieldType.getDependsOn(), "dependsOn");
+ assertEquals(formFieldType.isGroupFormField(), false);
+ assertEquals(formFieldType.getMultiSelectListSize(), "test");
+ assertEquals(formFieldType.getFieldId(), "id");
+ assertEquals(formFieldType.getFieldSQL(),"test");
+ assertEquals(formFieldType.getFieldDefaultSQL(),"test");
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormatListTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormatListTest.java
new file mode 100644
index 00000000..467f1a6f
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormatListTest.java
@@ -0,0 +1,54 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.FormatList;
+
+public class FormatListTest {
+
+ @Test
+ public void formatListTest()
+ {
+ FormatList formatList = new FormatList();
+ assertEquals(formatList.getFormat().size(),0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormatTypeTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormatTypeTest.java
new file mode 100644
index 00000000..ac767c3c
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/FormatTypeTest.java
@@ -0,0 +1,95 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.FormatType;
+
+public class FormatTypeTest {
+
+ public FormatType mockFormatType() {
+ FormatType formatType = new FormatType();
+ formatType.setLessThanValue("lessThanValue");
+ formatType.setExpression("expression");
+ formatType.setBold(false);
+ formatType.setItalic(false);
+ formatType.setUnderline(false);
+ formatType.setBgColor("bgColor");
+ formatType.setFontColor("fontColor");
+ formatType.setFontFace("fontFace");
+ formatType.setFontSize("fontSize");
+ formatType.setAlignment("alignment");
+ formatType.setComment("comment");
+ formatType.setFormatId("formatId");
+ return formatType;
+ }
+
+ @Test
+ public void formatTypeTest() {
+ FormatType formatType1 = mockFormatType();
+ FormatType formatType = new FormatType();
+ formatType.setLessThanValue("lessThanValue");
+ formatType.setExpression("expression");
+ formatType.setBold(false);
+ formatType.setItalic(false);
+ formatType.setUnderline(false);
+ formatType.setBgColor("bgColor");
+ formatType.setFontColor("fontColor");
+ formatType.setFontFace("fontFace");
+ formatType.setFontSize("fontSize");
+ formatType.setAlignment("alignment");
+ formatType.setComment("comment");
+ formatType.setFormatId("formatId");
+
+ assertEquals(formatType.getLessThanValue(), formatType1.getLessThanValue());
+ assertEquals(formatType.getExpression(), formatType1.getExpression());
+ assertEquals(formatType.isBold(), formatType.isBold());
+ assertEquals(formatType.isItalic(), formatType.isItalic());
+ assertEquals(formatType.getBgColor(), formatType.getBgColor());
+ assertEquals(formatType.getFontColor(), formatType.getFontColor());
+ assertEquals(formatType.getFontFace(), formatType.getFontFace());
+ assertEquals(formatType.getFontSize(), formatType.getFontSize());
+ assertEquals(formatType.getAlignment(), formatType.getAlignment());
+ assertEquals(formatType.getComment(), formatType.getComment());
+ assertEquals(formatType.getFormatId(), formatType.getFormatId());
+ assertEquals(formatType.isUnderline(), formatType.isUnderline());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/IteratorEnumeration.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/IteratorEnumeration.java
new file mode 100644
index 00000000..b6fec733
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/IteratorEnumeration.java
@@ -0,0 +1,60 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+
+public class IteratorEnumeration<E> implements Enumeration<E>{
+
+ private final Iterator<E> iterator;
+
+ public IteratorEnumeration(Iterator<E> iterator)
+ {
+ this.iterator = iterator;
+ }
+ public E nextElement() {
+ return iterator.next();
+ }
+
+ public boolean hasMoreElements() {
+ return iterator.hasNext();
+ }
+
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/JavascriptItemTypeTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/JavascriptItemTypeTest.java
new file mode 100644
index 00000000..ee3f6e59
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/JavascriptItemTypeTest.java
@@ -0,0 +1,63 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.JavascriptItemType;
+
+public class JavascriptItemTypeTest {
+
+ public JavascriptItemType mockJavascriptItemType() {
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setId("id");
+ javascriptItemType.setFieldId("fieldId");
+ javascriptItemType.setCallText("callText");
+ return javascriptItemType;
+ }
+
+ @Test
+ public void javascriptItemTypeTest() {
+ JavascriptItemType javascriptItemType = mockJavascriptItemType();
+ assertEquals(javascriptItemType.getId(), "id");
+ assertEquals(javascriptItemType.getFieldId(), "fieldId");
+ assertEquals(javascriptItemType.getCallText(), "callText");
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/JavascriptListTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/JavascriptListTest.java
new file mode 100644
index 00000000..e82cd814
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/JavascriptListTest.java
@@ -0,0 +1,53 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.JavascriptList;
+
+public class JavascriptListTest {
+
+ @Test
+ public void javascriptListTest() {
+ JavascriptList javascriptList = new JavascriptList();
+ assertEquals(javascriptList.getJavascriptItem().size(), 0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MarkerTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MarkerTest.java
new file mode 100644
index 00000000..8422a795
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MarkerTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.Marker;
+
+public class MarkerTest {
+
+ public Marker mockMarker() {
+ Marker marker = new Marker();
+ marker.setMarkerColor("markerColor");
+ marker.setDataHeader("dataHeader");
+ marker.setAddressColumn("addressColumn");
+ marker.setDataColumn("dataColumn");
+ return marker;
+ }
+
+ @Test
+ public void markerTest() {
+ Marker marker = mockMarker();
+ assertEquals(marker.getMarkerColor(), "markerColor");
+ assertEquals(marker.getDataHeader(), "dataHeader");
+ assertEquals(marker.getAddressColumn(), "addressColumn");
+ assertEquals(marker.getDataColumn(), "dataColumn");
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MockRunTimeReport.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MockRunTimeReport.java
new file mode 100644
index 00000000..84b5ec22
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MockRunTimeReport.java
@@ -0,0 +1,119 @@
+/*
+ * ============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.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.onap.portalsdk.analytics.system.DbUtils;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+
+public class MockRunTimeReport {
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+
+ public ReportRuntime mockReportRuntime() 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");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("test");
+ dataColumnType.setColOnChart("test");
+ dataColumnType.setDisplayName("test");
+ dataColumnType.setColId("test");
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setDbInfo("test");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setDbType("dbtype");
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ FormFieldList formFieldList = PowerMockito.mock(FormFieldList.class);
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1", "1", true);
+ reportWrapper.setWholeSQL("select * from test;");
+ PowerMockito.mockStatic(UserUtils.class);
+ ReportRuntime rr = new ReportRuntime(reportWrapper, mockedRequest);
+ rr.setWholeSQL("select * from test;");
+ rr.setLegendLabelAngle("test");
+ rr.setMultiSeries(false);
+ rr.setChartType("test");
+ return rr;
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MockitoTestSuite.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MockitoTestSuite.java
new file mode 100644
index 00000000..4a3d7d92
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/MockitoTestSuite.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class MockitoTestSuite {
+
+
+ public MockHttpServletRequestWrapper mockedRequest = new MockHttpServletRequestWrapper(
+ Mockito.mock(HttpServletRequest.class));
+ public HttpServletResponse mockedResponse = Mockito.mock(HttpServletResponse.class);
+
+ public MockHttpServletRequestWrapper getMockedRequest() {
+ return mockedRequest;
+ }
+
+ public HttpServletResponse getMockedResponse() {
+ return mockedResponse;
+ }
+
+ public class MockHttpServletRequestWrapper extends HttpServletRequestWrapper {
+
+ HttpSession session = Mockito.mock(HttpSession.class);
+
+ public MockHttpServletRequestWrapper(HttpServletRequest request) {
+ super(request);
+
+ }
+
+ @Override
+ public HttpSession getSession() {
+
+ return session;
+ }
+
+ @Override
+ public HttpSession getSession(boolean create) {
+
+ return session;
+ }
+
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ObjectFactoryTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ObjectFactoryTest.java
new file mode 100644
index 00000000..170e58ed
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ObjectFactoryTest.java
@@ -0,0 +1,237 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.bind.JAXBElement;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.xmlobj.ChartDrillFormfield;
+import org.onap.portalsdk.analytics.xmlobj.ChartDrillOptions;
+import org.onap.portalsdk.analytics.xmlobj.ColFilterList;
+import org.onap.portalsdk.analytics.xmlobj.ColFilterType;
+import org.onap.portalsdk.analytics.xmlobj.CustomReportType;
+import org.onap.portalsdk.analytics.xmlobj.DashboardEditorList;
+import org.onap.portalsdk.analytics.xmlobj.DashboardEditorReport;
+import org.onap.portalsdk.analytics.xmlobj.DashboardReports;
+import org.onap.portalsdk.analytics.xmlobj.DashboardReportsNew;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnList;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnType;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceList;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceType;
+import org.onap.portalsdk.analytics.xmlobj.DataminingOptions;
+import org.onap.portalsdk.analytics.xmlobj.FormFieldList;
+import org.onap.portalsdk.analytics.xmlobj.FormFieldType;
+import org.onap.portalsdk.analytics.xmlobj.FormatList;
+import org.onap.portalsdk.analytics.xmlobj.FormatType;
+import org.onap.portalsdk.analytics.xmlobj.JavascriptItemType;
+import org.onap.portalsdk.analytics.xmlobj.JavascriptList;
+import org.onap.portalsdk.analytics.xmlobj.Marker;
+import org.onap.portalsdk.analytics.xmlobj.ObjectFactory;
+import org.onap.portalsdk.analytics.xmlobj.PDFAdditionalOptions;
+import org.onap.portalsdk.analytics.xmlobj.PredefinedValueList;
+import org.onap.portalsdk.analytics.xmlobj.ReportMap;
+import org.onap.portalsdk.analytics.xmlobj.Reports;
+import org.onap.portalsdk.analytics.xmlobj.SemaphoreList;
+import org.onap.portalsdk.analytics.xmlobj.SemaphoreType;
+
+public class ObjectFactoryTest {
+ @InjectMocks
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+ NullPointerException nullPointerException = new NullPointerException();
+
+ @Test
+ public void createCustomReportTypeTest() {
+ assertEquals(objectFactory.createCustomReportType().getClass(), CustomReportType.class);
+ }
+
+ @Test
+ public void createDataminingOptionsTest() {
+ assertEquals(objectFactory.createDataminingOptions().getClass(), DataminingOptions.class);
+ }
+
+ @Test
+ public void createFormFieldTypeTest() {
+ assertEquals(objectFactory.createFormFieldType().getClass(), FormFieldType.class);
+ }
+
+ @Test
+ public void createPredefinedValueListTest() {
+ assertEquals(objectFactory.createPredefinedValueList().getClass(), PredefinedValueList.class);
+ }
+
+ @Test
+ public void createDashboardEditorReportTest() {
+ assertEquals(objectFactory.createDashboardEditorReport().getClass(), DashboardEditorReport.class);
+ }
+
+ @Test
+ public void createDataSourceListTest() {
+ assertEquals(objectFactory.createDataSourceList().getClass(), DataSourceList.class);
+ }
+
+ @Test
+ public void createDashboardReportsTest() {
+ assertEquals(objectFactory.createDashboardReports().getClass(), DashboardReports.class);
+ }
+
+ @Test
+ public void createReportMapTest() {
+ assertEquals(objectFactory.createReportMap().getClass(), ReportMap.class);
+ }
+
+ @Test
+ public void createFormatListTest() {
+ assertEquals(objectFactory.createFormatList().getClass(), FormatList.class);
+ }
+
+ @Test
+ public void createJavascriptListTest() {
+ assertEquals(objectFactory.createJavascriptList().getClass(), JavascriptList.class);
+ }
+
+ @Test
+ public void createJavascriptItemTypeTest() {
+ assertEquals(objectFactory.createJavascriptItemType().getClass(), JavascriptItemType.class);
+ }
+
+ @Test
+ public void createDataColumnTypeTest() {
+ assertEquals(objectFactory.createDataColumnType().getClass(), DataColumnType.class);
+ }
+
+ @Test
+ public void createDataSourceTypeTest() {
+ assertEquals(objectFactory.createDataSourceType().getClass(), DataSourceType.class);
+ }
+
+ @Test
+ public void createDashboardEditorListTest() {
+ assertEquals(objectFactory.createDashboardEditorList().getClass(), DashboardEditorList.class);
+ }
+
+ @Test
+ public void createSemaphoreListTest() {
+ assertEquals(objectFactory.createSemaphoreList().getClass(), SemaphoreList.class);
+ }
+
+ @Test
+ public void createColFilterTypeTest() {
+ assertEquals(objectFactory.createColFilterType().getClass(), ColFilterType.class);
+ }
+
+ @Test
+ public void createChartDrillOptionsTest() {
+ assertEquals(objectFactory.createChartDrillOptions().getClass(), ChartDrillOptions.class);
+ }
+
+ @Test
+ public void createDashboardReportsNewTest() {
+ assertEquals(objectFactory.createDashboardReportsNew().getClass(), DashboardReportsNew.class);
+ }
+
+ @Test
+ public void createChartDrillFormfieldTest() {
+ assertEquals(objectFactory.createChartDrillFormfield().getClass(), ChartDrillFormfield.class);
+ }
+
+ @Test
+ public void createPDFAdditionalOptionsTest() {
+ assertEquals(objectFactory.createPDFAdditionalOptions().getClass(), PDFAdditionalOptions.class);
+ }
+
+ @Test
+ public void createReportsTest() {
+ assertEquals(objectFactory.createReports().getClass(), Reports.class);
+ }
+
+ @Test
+ public void createMarkerTest() {
+ assertEquals(objectFactory.createMarker().getClass(), Marker.class);
+ }
+
+ @Test
+ public void createFormatTypeTest() {
+ assertEquals(objectFactory.createFormatType().getClass(), FormatType.class);
+ }
+
+ @Test
+ public void createDataColumnListTest() {
+ assertEquals(objectFactory.createDataColumnList().getClass(), DataColumnList.class);
+ }
+
+ @Test
+ public void createFormFieldListTest() {
+ assertEquals(objectFactory.createFormFieldList().getClass(), FormFieldList.class);
+ }
+
+ @Test
+ public void createSemaphoreTypeTest() {
+ assertEquals(objectFactory.createSemaphoreType().getClass(), SemaphoreType.class);
+ }
+
+ @Test
+ public void createColFilterListTest() {
+ assertEquals(objectFactory.createColFilterList().getClass(), ColFilterList.class);
+ }
+
+ @Test
+ public void createCustomReportTest() {
+ assertEquals(objectFactory.createCustomReport(null).getClass(), JAXBElement.class);
+ }
+
+ @Test
+ public void createCommentTest() {
+ assertEquals(objectFactory.createComment(null).getClass(), JAXBElement.class);
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/PDFAdditionalOptionsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/PDFAdditionalOptionsTest.java
new file mode 100644
index 00000000..a8d89dcf
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/PDFAdditionalOptionsTest.java
@@ -0,0 +1,76 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.PDFAdditionalOptions;
+
+public class PDFAdditionalOptionsTest {
+
+ public PDFAdditionalOptions mockPDFAdditionalOptions() {
+ PDFAdditionalOptions pDFAdditionalOptions = new PDFAdditionalOptions();
+ pDFAdditionalOptions.setPDFFont("pdfFont");
+ pDFAdditionalOptions.setPDFFontSize(1);
+ pDFAdditionalOptions.setPDFOrientation("pdfOrientation");
+ pDFAdditionalOptions.setPDFLogo1("pdfLogo1");
+ pDFAdditionalOptions.setPDFLogo2("pdfLogo2");
+ pDFAdditionalOptions.setPDFLogo1Size(1);
+ pDFAdditionalOptions.setPDFLogo2Size(1);
+ pDFAdditionalOptions.setPDFCoverPage(false);
+ pDFAdditionalOptions.setPDFFooter1("pdfFooter1");
+ pDFAdditionalOptions.setPDFFooter2("pdfFooter2");
+ return pDFAdditionalOptions;
+ }
+
+ @Test
+ public void pDFAdditionalOptionsTest() {
+ PDFAdditionalOptions pDFAdditionalOptions = mockPDFAdditionalOptions();
+ assertEquals(pDFAdditionalOptions.getPDFFont(), "pdfFont");
+ assertTrue(pDFAdditionalOptions.getPDFFontSize() == 1);
+ assertEquals(pDFAdditionalOptions.getPDFOrientation(), "pdfOrientation");
+ assertEquals(pDFAdditionalOptions.getPDFLogo1(), "pdfLogo1");
+ assertEquals(pDFAdditionalOptions.getPDFLogo2(), "pdfLogo2");
+ assertTrue(pDFAdditionalOptions.getPDFLogo1Size() == 1);
+ assertTrue(pDFAdditionalOptions.getPDFLogo2Size() == 1);
+ assertFalse(pDFAdditionalOptions.isPDFCoverPage());
+ assertEquals(pDFAdditionalOptions.getPDFFooter1(), "pdfFooter1");
+ assertEquals(pDFAdditionalOptions.getPDFFooter2(), "pdfFooter2");
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/PredefinedValueListTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/PredefinedValueListTest.java
new file mode 100644
index 00000000..6dd623fa
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/PredefinedValueListTest.java
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.PredefinedValueList;
+
+public class PredefinedValueListTest {
+
+ @Test
+ public void predefinedValueList() {
+ PredefinedValueList predefinedValueList = new PredefinedValueList();
+ assertEquals(predefinedValueList.getPredefinedValue().size(), 0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorControllerAsyncNewTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorControllerAsyncNewTest.java
new file mode 100644
index 00000000..13fc9ed4
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorControllerAsyncNewTest.java
@@ -0,0 +1,1388 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.controller.Action;
+import org.onap.portalsdk.analytics.controller.ActionMapping;
+import org.onap.portalsdk.analytics.error.RaptorException;
+import org.onap.portalsdk.analytics.error.ReportSQLException;
+import org.onap.portalsdk.analytics.model.DataCache;
+import org.onap.portalsdk.analytics.model.ReportHandler;
+import org.onap.portalsdk.analytics.model.ReportLoader;
+import org.onap.portalsdk.analytics.model.base.IdNameValue;
+import org.onap.portalsdk.analytics.model.base.ReportUserRole;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.definition.ReportDefinition;
+import org.onap.portalsdk.analytics.model.definition.SecurityEntry;
+import org.onap.portalsdk.analytics.model.definition.wizard.ColumnEditJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.DefinitionJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.FormEditJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.IdNameBooleanJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.ImportJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.MessageJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.NameBooleanJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.QueryJSON;
+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.system.fusion.web.RaptorControllerAsync;
+import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.onap.portalsdk.analytics.util.Utils;
+import org.onap.portalsdk.analytics.util.XSSFilter;
+import org.onap.portalsdk.core.service.DataAccessService;
+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})
+public class RaptorControllerAsyncNewTest {
+
+ @InjectMocks
+ RaptorControllerAsync raptorControllerAsync = new RaptorControllerAsync();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Mock
+ DataAccessService dataAccessService;
+
+ @Mock
+ AppConstants appConstants;
+
+ @Mock
+ Globals globals;
+ @Mock
+ Action action = new Action("test", "RaptorControllerAsync", "test", "test");
+ @Mock
+ ActionMapping actionMapping = new ActionMapping();
+ @Mock
+ ReportDefinition reportDefinition ;
+
+ @Mock
+ ReportHandler reportHandler = new ReportHandler();
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+ NullPointerException nullPointerException = new NullPointerException();
+
+ MockRunTimeReport mockRunTimeReport = new MockRunTimeReport();
+
+ @Test(expected = org.onap.portalsdk.analytics.error.ValidationException.class)
+ public void retrieveDataForGivenQueryTest() throws Exception
+ {
+ QueryJSON queryJSON = new QueryJSON();
+ queryJSON.setQuery("select * from test");
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ PowerMockito.mockStatic(ReportRuntime.class);
+
+ 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);
+ 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");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("test");
+ dataColumnType.setColOnChart("test");
+ dataColumnType.setDisplayName("test");
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setDbInfo("test");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setDbType("dbtype");
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ FormFieldList formFieldList = PowerMockito.mock(FormFieldList.class);
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1", "1", true);
+ reportWrapper.setWholeSQL("select * from test;");
+ ReportDefinition rdf = new ReportDefinition(reportWrapper, mockedRequest);
+ Mockito.when(mockedRequest.getSession().getAttribute("report_definition")).thenReturn(rdf);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ PowerMockito.mockStatic(Utils.class);
+ Mockito.when(Utils.replaceInString(Matchers.anyString(), Matchers.anyString(), Matchers.anyString())).thenReturn("test");
+ Mockito.when(Globals.getRequestParams()).thenReturn("test,2");
+ Mockito.when(Globals.getSessionParams()).thenReturn("session,2");
+ Mockito.when(mockedRequest.getParameter("test")).thenReturn("test");
+ 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 *");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ DataSet set = new DataSet();
+ Mockito.when(ConnectionUtils.getDataSet("test", "local", true)).thenReturn(set);
+ PowerMockito.mockStatic(XSSFilter.class);
+ Mockito.when(XSSFilter.filterRequestOnlyScript(Matchers.anyString())).thenReturn("select distinct from test");
+ raptorControllerAsync.retrieveDataForGivenQuery(false, queryJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void importReportTest() throws Exception
+ {
+ QueryJSON queryJSON = new QueryJSON();
+ queryJSON.setQuery("select * from test");
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ PowerMockito.mockStatic(ReportRuntime.class);
+
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.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);
+ 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");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("test");
+ dataColumnType.setColOnChart("test");
+ dataColumnType.setDisplayName("test");
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setDbInfo("test");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setDbType("dbtype");
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ FormFieldList formFieldList = PowerMockito.mock(FormFieldList.class);
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1", "1", true);
+ reportWrapper.setWholeSQL("select * from test;");
+// ReportDefinition rdf = new ReportDefinition(reportWrapper, mockedRequest);
+ ReportDefinition rdf = PowerMockito.mock(ReportDefinition.class);
+ ImportJSON importJSON = new ImportJSON();
+ importJSON.setReportXML("test");
+ PowerMockito.whenNew(ReportDefinition.class).withArguments(Matchers.any(ReportWrapper.class), Matchers.any(HttpServletRequest.class)).thenReturn(rdf);
+ PowerMockito.mockStatic(ReportDefinition.class);
+ PowerMockito.when(ReportDefinition.unmarshal(Mockito.anyString(), Mockito.anyString(), Mockito.anyObject())).thenReturn(rdf);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ assertEquals(raptorControllerAsync.importReport(importJSON, mockedRequest, mockedResponse).getClass(), MessageJSON.class);
+ }
+
+ @Test(expected = org.onap.portalsdk.analytics.error.RaptorException.class)
+ public void listChildReportColsTest() throws Exception
+ {
+// PowerMockito.mockStatic(ReportRuntime.class);
+
+ 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);
+ 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");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("test");
+ dataColumnType.setColOnChart("test");
+ dataColumnType.setDisplayName("test");
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setDbInfo("test");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setDbType("dbtype");
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ FormFieldList formFieldList = PowerMockito.mock(FormFieldList.class);
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1", "1", true);
+ reportWrapper.setWholeSQL("select * from test;");
+ PowerMockito.mockStatic(UserUtils.class);
+ ReportRuntime rr = mockRunTimeReport.mockReportRuntime();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr);
+ Mockito.when(ReportRuntime.unmarshal("test", "1", mockedRequest)).thenReturn(rr);
+ ReportHandler reportHandler = PowerMockito.mock(ReportHandler.class);
+ Mockito.when(reportHandler.loadReportRuntime(Matchers.any(HttpServletRequest.class), Matchers.anyString(), Matchers.anyBoolean())).thenReturn(rr);
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_REFRESH)).thenReturn("test");
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getRequestFlag(mockedRequest,"display_content")).thenReturn(true);
+ Mockito.when(AppUtils.getRequestFlag(mockedRequest, "noFormFields")).thenReturn(false);
+ Mockito.when( mockedRequest.getSession().getAttribute("report_runtime")).thenReturn(rr);
+ Mockito.when(AppUtils.getRequestFlag(mockedRequest, "N")).thenReturn(true);
+ PowerMockito.mockStatic(ReportLoader.class);
+ Mockito.when(ReportLoader.loadCustomReportXML(Matchers.anyString())).thenReturn("test");
+ Mockito.when(AppUtils.getRequestNvlValue(mockedRequest, "pdfAttachmentKey")).thenReturn("test");
+ assertEquals(raptorControllerAsync.listChildReportCols("1", mockedRequest, mockedResponse).size(),1);
+ }
+
+ @Test
+ public void copyReportTest() throws Exception
+ {
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_ACTION)).thenReturn("test");
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_WIZARD_ACTION)).thenReturn("Wizard");
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ReportLoader.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);
+ 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();
+ customReportType.setReportType("test");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ PowerMockito.mock(ReportDefinition.class);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.doNothing().when(reportDefinition).generateWizardSequence(null);
+ Mockito.doNothing().when(reportDefinition).setAsCopy(mockedRequest);
+ reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+
+ Mockito.when(mockedRequest.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+ Mockito.when(ReportLoader.loadCustomReportXML(Matchers.anyString())).thenReturn("test");
+ raptorControllerAsync.copyReport("-1", mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void copyReport1Test() throws Exception
+ {
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ReportLoader.class);
+ PowerMockito.mock(ReportDefinition.class);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.doNothing().when(reportDefinition).generateWizardSequence(null);
+ Mockito.doNothing().when(reportDefinition).setAsCopy(mockedRequest);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+
+ Mockito.when(mockedRequest.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+ Mockito.when(ReportLoader.loadCustomReportXML(Matchers.anyString())).thenReturn("test");
+ raptorControllerAsync.copyReport("-1", mockedRequest, mockedResponse);
+ }
+ @Test
+ public void saveFFTabWiseDataTest() throws Exception
+ {
+ FormEditJSON formEditJSON= new FormEditJSON();
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+ raptorControllerAsync.saveFFTabWiseData(formEditJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveFFTabWiseDataExceptionTest() throws Exception
+ {
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_ACTION)).thenReturn("test");
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_WIZARD_ACTION)).thenReturn("Wizard");
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ReportLoader.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);
+ 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();
+ customReportType.setReportType("test");
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ List<FormFieldType> formField = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formField.add(formFieldType);
+ formFieldList.formField = formField;
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ FormEditJSON formEditJSON= new FormEditJSON();
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+ raptorControllerAsync.saveFFTabWiseData(formEditJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveFFTabWiseData1Test() throws Exception
+ {
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_ACTION)).thenReturn("test");
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_WIZARD_ACTION)).thenReturn("Wizard");
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ReportLoader.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);
+ 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();
+ customReportType.setReportType("test");
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ List<FormFieldType> formField = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldId("test");
+ formField.add(formFieldType);
+ formFieldList.formField = formField;
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ FormEditJSON formEditJSON= new FormEditJSON();
+ formEditJSON.setFieldId("test");
+ List<IdNameBooleanJSON> list = new ArrayList<>();
+ IdNameBooleanJSON idNameBooleanJSON = new IdNameBooleanJSON();
+ list.add(idNameBooleanJSON);
+ formEditJSON.setPredefinedValueList(list);
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+ raptorControllerAsync.saveFFTabWiseData(formEditJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveFFTabWiseData2Test() throws Exception
+ {
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_ACTION)).thenReturn("test");
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_WIZARD_ACTION)).thenReturn("Wizard");
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ReportLoader.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);
+ 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();
+ customReportType.setReportType("test");
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ List<FormFieldType> formField = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldId("test");
+
+ List<String> predefinedValue = new ArrayList<>();
+ predefinedValue.add("test");
+ PredefinedValueList predefinedValueList = new PredefinedValueList();
+ predefinedValueList.predefinedValue = predefinedValue;
+ formFieldType.setPredefinedValueList(predefinedValueList);
+ formField.add(formFieldType);
+ formFieldList.formField = formField;
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ FormEditJSON formEditJSON= new FormEditJSON();
+ formEditJSON.setFieldId("test");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+ raptorControllerAsync.saveFFTabWiseData(formEditJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveColTabWiseDataTest() throws Exception
+ {
+ ColumnEditJSON columnEditJSON = new ColumnEditJSON();
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+ raptorControllerAsync.saveColTabWiseData(columnEditJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveColTabWiseData5Test() throws Exception
+ {
+ ColumnEditJSON columnEditJSON = new ColumnEditJSON();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(null);
+ raptorControllerAsync.saveColTabWiseData(columnEditJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveColTabWiseData2Test() throws Exception
+ {
+ ColumnEditJSON columnEditJSON = new ColumnEditJSON();
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_ACTION)).thenReturn("test");
+ Mockito.when(mockedRequest.getParameter(AppConstants.RI_WIZARD_ACTION)).thenReturn("Wizard");
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ReportLoader.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);
+ 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();
+ customReportType.setReportType("test");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+ raptorControllerAsync.saveColTabWiseData(columnEditJSON, mockedRequest, mockedResponse);
+ }
+
+
+ @Test
+ public void saveColTabWiseData1Test() throws Exception
+ {
+ ColumnEditJSON columnEditJSON = new ColumnEditJSON();
+ columnEditJSON.setColId("test");
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.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);
+ 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");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("test");
+ dataColumnType.setColOnChart("test");
+ dataColumnType.setDisplayName("test");
+ dataColumnType.setColId("test");
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setDbInfo("test");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setDbType("dbtype");
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ FormFieldList formFieldList = PowerMockito.mock(FormFieldList.class);
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1", "1", true);
+ reportWrapper.setWholeSQL("select * from test;");
+ ReportDefinition rdf = new ReportDefinition(reportWrapper, mockedRequest);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf);
+ raptorControllerAsync.saveColTabWiseData(columnEditJSON, mockedRequest, mockedResponse);
+ }
+ @Test
+ public void saveDefTabWiseDataExceptionTest() throws Exception
+ {
+ DefinitionJSON definitionJSON= new DefinitionJSON();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(null);
+ raptorControllerAsync.saveDefTabWiseData("InSession", definitionJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveDefTabWiseDataTest() throws Exception
+ {
+ DefinitionJSON definitionJSON= new DefinitionJSON();
+ definitionJSON.setPageSize(1);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+
+ List<IdNameBooleanJSON> list = new ArrayList<>();
+ IdNameBooleanJSON idNameBooleanJSON = new IdNameBooleanJSON();
+ list.add(idNameBooleanJSON);
+ List<NameBooleanJSON> list1 = new ArrayList<>();
+ NameBooleanJSON nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setSelected(true);
+ nameBooleanJSON.setName("HideFormFields");
+ list1.add(nameBooleanJSON);
+ list.add(idNameBooleanJSON);
+ definitionJSON.setDisplayArea(list);
+ definitionJSON.setHideFormFieldsAfterRun(false);
+ definitionJSON.setMaxRowsInExcelCSVDownload(4);
+ definitionJSON.setFrozenColumns(4);
+ definitionJSON.setRuntimeColSortDisabled(false);
+ definitionJSON.setNumFormCols(4);
+ definitionJSON.setDisplayOptions(list1);
+ raptorControllerAsync.saveDefTabWiseData("InSession", definitionJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveDefTabWiseData1Test() throws Exception
+ {
+ DefinitionJSON definitionJSON= new DefinitionJSON();
+ definitionJSON.setPageSize(1);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+
+ List<IdNameBooleanJSON> list = new ArrayList<>();
+ IdNameBooleanJSON idNameBooleanJSON = new IdNameBooleanJSON();
+ list.add(idNameBooleanJSON);
+ List<NameBooleanJSON> list1 = new ArrayList<>();
+ NameBooleanJSON nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setSelected(true);
+ nameBooleanJSON.setName("HideChart");
+ list1.add(nameBooleanJSON);
+ list.add(idNameBooleanJSON);
+ definitionJSON.setDisplayArea(list);
+ definitionJSON.setHideFormFieldsAfterRun(false);
+ definitionJSON.setMaxRowsInExcelCSVDownload(4);
+ definitionJSON.setFrozenColumns(4);
+ definitionJSON.setRuntimeColSortDisabled(false);
+ definitionJSON.setNumFormCols(4);
+ definitionJSON.setDisplayOptions(list1);
+ raptorControllerAsync.saveDefTabWiseData("InSession", definitionJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveDefTabWiseData2Test() throws Exception
+ {
+ DefinitionJSON definitionJSON= new DefinitionJSON();
+ definitionJSON.setPageSize(1);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+
+ List<IdNameBooleanJSON> list = new ArrayList<>();
+ IdNameBooleanJSON idNameBooleanJSON = new IdNameBooleanJSON();
+ list.add(idNameBooleanJSON);
+ List<NameBooleanJSON> list1 = new ArrayList<>();
+ NameBooleanJSON nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setSelected(true);
+ nameBooleanJSON.setName("HideReportData");
+ list1.add(nameBooleanJSON);
+ list.add(idNameBooleanJSON);
+ definitionJSON.setDisplayArea(list);
+ definitionJSON.setHideFormFieldsAfterRun(false);
+ definitionJSON.setMaxRowsInExcelCSVDownload(4);
+ definitionJSON.setFrozenColumns(4);
+ definitionJSON.setRuntimeColSortDisabled(false);
+ definitionJSON.setNumFormCols(4);
+ definitionJSON.setDisplayOptions(list1);
+ raptorControllerAsync.saveDefTabWiseData("InSession", definitionJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveDefTabWiseData3Test() throws Exception
+ {
+ DefinitionJSON definitionJSON= new DefinitionJSON();
+ definitionJSON.setPageSize(1);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+
+ List<IdNameBooleanJSON> list = new ArrayList<>();
+ IdNameBooleanJSON idNameBooleanJSON = new IdNameBooleanJSON();
+ list.add(idNameBooleanJSON);
+ List<NameBooleanJSON> list1 = new ArrayList<>();
+ NameBooleanJSON nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setSelected(true);
+ nameBooleanJSON.setName("HideExcel");
+ list1.add(nameBooleanJSON);
+ list.add(idNameBooleanJSON);
+ definitionJSON.setDisplayArea(list);
+ definitionJSON.setHideFormFieldsAfterRun(false);
+ definitionJSON.setMaxRowsInExcelCSVDownload(4);
+ definitionJSON.setFrozenColumns(4);
+ definitionJSON.setRuntimeColSortDisabled(false);
+ definitionJSON.setNumFormCols(4);
+ definitionJSON.setDisplayOptions(list1);
+ raptorControllerAsync.saveDefTabWiseData("InSession", definitionJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveDefTabWiseData4Test() throws Exception
+ {
+ DefinitionJSON definitionJSON= new DefinitionJSON();
+ definitionJSON.setPageSize(1);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+
+ List<IdNameBooleanJSON> list = new ArrayList<>();
+ IdNameBooleanJSON idNameBooleanJSON = new IdNameBooleanJSON();
+ list.add(idNameBooleanJSON);
+ List<NameBooleanJSON> list1 = new ArrayList<>();
+ NameBooleanJSON nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setSelected(true);
+ nameBooleanJSON.setName("HidePdf");
+ list1.add(nameBooleanJSON);
+ list.add(idNameBooleanJSON);
+ definitionJSON.setDisplayArea(list);
+ definitionJSON.setHideFormFieldsAfterRun(false);
+ definitionJSON.setMaxRowsInExcelCSVDownload(4);
+ definitionJSON.setFrozenColumns(4);
+ definitionJSON.setRuntimeColSortDisabled(false);
+ definitionJSON.setNumFormCols(4);
+ definitionJSON.setDisplayOptions(list1);
+ raptorControllerAsync.saveDefTabWiseData("InSession", definitionJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveDefTabWiseDataIfIdCrateTest() throws Exception
+ {
+ DefinitionJSON definitionJSON= new DefinitionJSON();
+ definitionJSON.setPageSize(1);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
+
+ List<IdNameBooleanJSON> list = new ArrayList<>();
+ IdNameBooleanJSON idNameBooleanJSON = new IdNameBooleanJSON();
+ list.add(idNameBooleanJSON);
+ List<NameBooleanJSON> list1 = new ArrayList<>();
+ NameBooleanJSON nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setSelected(true);
+ nameBooleanJSON.setName("HidePdf");
+ list1.add(nameBooleanJSON);
+ list.add(idNameBooleanJSON);
+ definitionJSON.setDisplayArea(list);
+ definitionJSON.setHideFormFieldsAfterRun(false);
+ definitionJSON.setMaxRowsInExcelCSVDownload(4);
+ definitionJSON.setFrozenColumns(4);
+ definitionJSON.setRuntimeColSortDisabled(false);
+ definitionJSON.setNumFormCols(4);
+ definitionJSON.setDisplayOptions(list1);
+ Set<String> set = new HashSet<String>();
+ set.add("test");
+ Enumeration<String> x = new IteratorEnumeration<String>(set.iterator());
+ Mockito.when(mockedRequest.getSession().getAttributeNames()).thenReturn(x);
+ raptorControllerAsync.saveDefTabWiseData("Create", definitionJSON, mockedRequest, mockedResponse);
+ }
+ @Test
+ public void retrieveFormTabWiseDataTest() throws Exception {
+ Map<String, String> map = new HashMap<>();
+ map.put("test", "test");
+ map.put("id", "add");
+ map.put("action", "delete");
+
+ QueryJSON queryJSON = new QueryJSON();
+ queryJSON.setQuery("select * from test");
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ PowerMockito.mockStatic(ReportRuntime.class);
+
+ 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);
+ 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");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("test");
+ dataColumnType.setColOnChart("test");
+ dataColumnType.setDisplayName("test");
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setDbInfo("test");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setDbType("dbtype");
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ List<FormFieldType> formField = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldId("test");
+ formFieldType.setVisible("yes");
+ List<String> predefinedValue = new ArrayList<>();
+ predefinedValue.add("test");
+ PredefinedValueList predefinedValueList = new PredefinedValueList();
+ predefinedValueList.predefinedValue = predefinedValue;
+ formFieldType.setPredefinedValueList(predefinedValueList);
+ formField.add(formFieldType);
+ formFieldList.formField = formField;
+ customReportType.setFormFieldList(formFieldList);
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setWholeSQL("select * from test;");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION))
+ .thenReturn(reportDefinition);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+
+ raptorControllerAsync.retrieveFormTabWiseData(map, mockedRequest, mockedResponse);
+ }
+
+
+ @Test
+ public void saveDefTabWiseDataIfIdCrateExceptionTest() throws Exception
+ {
+ DefinitionJSON definitionJSON= new DefinitionJSON();
+ definitionJSON.setPageSize(1);
+ ReportDefinition reportDefinition = PowerMockito.mock(ReportDefinition.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenThrow(nullPointerException);
+
+ List<IdNameBooleanJSON> list = new ArrayList<>();
+ IdNameBooleanJSON idNameBooleanJSON = new IdNameBooleanJSON();
+ list.add(idNameBooleanJSON);
+ List<NameBooleanJSON> list1 = new ArrayList<>();
+ NameBooleanJSON nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setSelected(true);
+ nameBooleanJSON.setName("HidePdf");
+ list1.add(nameBooleanJSON);
+ list.add(idNameBooleanJSON);
+ definitionJSON.setDisplayArea(list);
+ definitionJSON.setHideFormFieldsAfterRun(false);
+ definitionJSON.setMaxRowsInExcelCSVDownload(4);
+ definitionJSON.setFrozenColumns(4);
+ definitionJSON.setRuntimeColSortDisabled(false);
+ definitionJSON.setNumFormCols(4);
+ definitionJSON.setDisplayOptions(list1);
+ Set<String> set = new HashSet<String>();
+ set.add("test");
+ Enumeration<String> x = new IteratorEnumeration<String>(set.iterator());
+ Mockito.when(mockedRequest.getSession().getAttributeNames()).thenReturn(x);
+ raptorControllerAsync.saveDefTabWiseData("InSession", definitionJSON, mockedRequest, mockedResponse);
+ }
+
+
+ public ReportDefinition mockReportDefinition() throws Exception
+ {
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ PowerMockito.mockStatic(ReportRuntime.class);
+
+ 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);
+ 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");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("test");
+ dataColumnType.setColOnChart("test");
+ dataColumnType.setDisplayName("test");
+ dataColumnTypeList.add(dataColumnType);
+ dataColumnType.setColId("test");
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setDbInfo("test");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setDbType("dbtype");
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ List<FormFieldType> formField = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setFieldId("test");
+ formFieldType.setVisible("yes");
+ List<String> predefinedValue = new ArrayList<>();
+ predefinedValue.add("test");
+ PredefinedValueList predefinedValueList = new PredefinedValueList();
+ predefinedValueList.predefinedValue = predefinedValue;
+ formFieldType.setPredefinedValueList(predefinedValueList);
+ formField.add(formFieldType);
+ formFieldList.formField = formField;
+ customReportType.setFormFieldList(formFieldList);
+ ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
+ chartAdditionalOptions.setLabelAngle("test");
+ chartAdditionalOptions.setTimeSeriesRender("test");
+ chartAdditionalOptions.setMultiSeries(false);
+ customReportType.setChartAdditionalOptions(chartAdditionalOptions);
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setWholeSQL("select * from test;");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ return reportDefinition;
+ }
+ @Test
+ public void retrieveColTabWiseDataTest() throws Exception
+ {
+ Map<String, String> map = new HashMap<>();
+ map.put("test", "test");
+ map.put("id", "add");
+ map.put("action", "delete");
+ Mockito.when((ReportDefinition) mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(null);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(false);
+ assertEquals(raptorControllerAsync.retrieveColTabWiseData(map, mockedRequest, mockedResponse).getClass(), ColumnEditJSON.class);
+ }
+
+ @Test
+ public void retrieveColTabWiseData1Test() throws Exception
+ {
+ Map<String, String> map = new HashMap<>();
+ map.put("test", "test");
+ map.put("id", "test");
+ map.put("action", "delete");
+ ReportDefinition rdf = mockReportDefinition();
+ Mockito.when((ReportDefinition) mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(false);
+ assertEquals(raptorControllerAsync.retrieveColTabWiseData(map, mockedRequest, mockedResponse).getClass(), ColumnEditJSON.class);
+ }
+
+ @Test
+ public void retrieveSqlTabWiseDataTest() throws Exception
+ {
+ Map<String, String> map = new HashMap<>();
+ map.put("test", "test");
+ map.put("id", "test");
+ map.put("action", "delete");
+ Mockito.when((ReportDefinition) mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(null);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(false);
+ PowerMockito.mockStatic(ReportLoader.class);
+ Mockito.when(ReportLoader.loadCustomReportXML("1")).thenReturn("test");
+ ReportDefinition rdf = PowerMockito.mock(ReportDefinition.class);
+ PowerMockito.whenNew(ReportDefinition.class).withArguments(Matchers.any(ReportWrapper.class), Matchers.any(HttpServletRequest.class)).thenReturn(rdf);
+ PowerMockito.mockStatic(ReportDefinition.class);
+ PowerMockito.when(ReportDefinition.unmarshal(Mockito.anyString(), Mockito.anyString(), Mockito.anyObject())).thenReturn(rdf);
+ assertEquals(raptorControllerAsync.retrieveSqlTabWiseData(map, mockedRequest, mockedResponse).getClass(), QueryJSON.class);
+ }
+
+ @Test
+ public void retrieveSqlTabWiseData1Test() throws Exception
+ {
+ Map<String, String> map = new HashMap<>();
+ map.put("test", "test");
+ map.put("id", "test");
+ map.put("detailId", "detailId");
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when((ReportDefinition) mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(false);
+ PowerMockito.mockStatic(ReportLoader.class);
+ Mockito.when(ReportLoader.loadCustomReportXML("1")).thenReturn("test");
+ ReportDefinition rdf = PowerMockito.mock(ReportDefinition.class);
+ PowerMockito.whenNew(ReportDefinition.class).withArguments(Matchers.any(ReportWrapper.class), Matchers.any(HttpServletRequest.class)).thenReturn(rdf);
+ PowerMockito.mockStatic(ReportDefinition.class);
+ PowerMockito.when(ReportDefinition.unmarshal(Mockito.anyString(), Mockito.anyString(), Mockito.anyObject())).thenReturn(rdf);
+ Set<String> set = new HashSet<String>();
+ set.add("test");
+ Enumeration<String> x = new IteratorEnumeration<String>(set.iterator());
+ Mockito.when(mockedRequest.getSession().getAttributeNames()).thenReturn(x);
+ assertEquals(raptorControllerAsync.retrieveSqlTabWiseData(map, mockedRequest, mockedResponse).getClass(), QueryJSON.class);
+ }
+ @Test
+ public void getReportUserListTest() throws Exception
+ {
+ Vector<SecurityEntry> entity = new Vector<>();
+ SecurityEntry SecurityEntry = new SecurityEntry();
+ entity.add(SecurityEntry);
+ ReportDefinition rdf1 = PowerMockito.mock(ReportDefinition.class);
+ Mockito.when(rdf1.getReportUsers(mockedRequest)).thenReturn(entity);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ raptorControllerAsync.getReportUserList(mockedRequest);
+
+ }
+
+ @Test
+ public void getReportRoleListTest() throws Exception
+ {
+ PowerMockito.mockStatic(Utils.class);
+ Vector<IdNameValue> entity = new Vector<>();
+ IdNameValue SecurityEntry = new IdNameValue();
+ entity.add(SecurityEntry);
+ ReportDefinition rdf1 = PowerMockito.mock(ReportDefinition.class);
+ Mockito.when(rdf1.getReportUsers(mockedRequest)).thenReturn(entity);
+ Mockito.when(Utils.getRolesNotInList(Matchers.any(Vector.class),Matchers.any(HttpServletRequest.class))).thenReturn(entity);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ raptorControllerAsync.getReportRoleList(mockedRequest);
+
+ }
+
+ @Test
+ public void getReportUserListQueryTest() throws Exception
+ {
+ PowerMockito.mockStatic(Utils.class);
+ Vector<IdNameValue> entity = new Vector<>();
+ IdNameValue SecurityEntry = new IdNameValue();
+ entity.add(SecurityEntry);
+ ReportDefinition rdf1 = mockReportDefinition();
+// Mockito.when(rdf1.getReportUsers(mockedRequest)).thenReturn(entity);
+ Mockito.when(Utils.getRolesNotInList(Matchers.any(Vector.class),Matchers.any(HttpServletRequest.class))).thenReturn(entity);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ List<ReportUserRole> queriedUserList = new ArrayList<>();
+ ReportUserRole reportUserRole = new ReportUserRole();
+ reportUserRole.setRoleId((long) 1);
+ reportUserRole.setOrderNo((long) 1);
+ reportUserRole.setUserId((long) 1);
+ queriedUserList.add(reportUserRole);
+ Mockito.when(dataAccessService.executeNamedQuery(Matchers.anyString(), Matchers.anyMap(), Matchers.anyMap())).thenReturn(queriedUserList);
+ raptorControllerAsync.getReportUserListQuery(mockedRequest);
+
+ }
+
+ @Test
+ public void addSelectedReportUserExceptionTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ raptorControllerAsync.addSelectedReportUser("test", mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void addSelectedReportUserTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ Mockito.when(Globals.getAddUserAccess()).thenReturn("[reportID]");
+ Mockito.when(DbUtils.executeUpdate(Matchers.anyString())).thenReturn(1);
+ raptorControllerAsync.addSelectedReportUser("test", mockedRequest, mockedResponse);
+ }
+ @Test
+ public void removeSelectedReportUserTest() throws Exception{
+ PowerMockito.mockStatic(Globals.class);
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ Mockito.when(Globals.getRemoveUserAccess()).thenReturn("[reportID]");
+ raptorControllerAsync.removeSelectedReportUser("test", mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void removeSelectedReportUserExceptionTest() throws Exception{
+ PowerMockito.mockStatic(Globals.class);
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ Mockito.when(Globals.getRemoveUserAccess()).thenReturn("[reportID]");
+ raptorControllerAsync.removeSelectedReportUser(null, mockedRequest, mockedResponse);
+ }
+ @Test
+ public void addSelectedReportRoleTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.getAddRoleAccess()).thenReturn("[roleID]");
+ raptorControllerAsync.addSelectedReportRole("test", mockedRequest, mockedResponse);
+
+ }
+
+ @Test
+ public void addSelectedReportRole1Test() throws Exception {
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.getAddRoleAccess()).thenReturn("[reportID]");
+ raptorControllerAsync.addSelectedReportRole("test", mockedRequest, mockedResponse);
+
+ }
+ @Test
+ public void addSelectedReportRoleExceptionTest() throws Exception {
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ assertNull(raptorControllerAsync.addSelectedReportRole("test", mockedRequest, mockedResponse));
+
+ }
+
+ @Test
+ public void removeSelectedReportRoleExceptionTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ assertNull(raptorControllerAsync.removeSelectedReportRole("test", mockedRequest, mockedResponse));
+ }
+
+
+ @Test
+ public void removeSelectedReportRoleTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.getRemoveRoleAccess()).thenReturn("[reportID]");
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ raptorControllerAsync.removeSelectedReportRole("test", mockedRequest, mockedResponse);
+ }
+
+
+ @Test
+ public void updateReportSecurityInfoExceptionTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ Map<String,String> map = new HashMap<>();
+
+ assertNull(raptorControllerAsync.updateReportSecurityInfo(map, mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void updateReportSecurityInfoTest() throws Exception {
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ Map<String, String> map = new HashMap<>();
+ map.put("isPublic", "isPublic");
+
+ assertEquals(raptorControllerAsync.updateReportSecurityInfo(map, mockedRequest, mockedResponse).getClass(),
+ HashMap.class);
+ }
+ @Test
+ public void toggleUserEditAccessExceptionTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ assertNull(raptorControllerAsync.toggleUserEditAccess("test", "readOnly", mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void toggleUserEditAccessTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ Mockito.when(Globals.getUpdateUserAccess()).thenReturn("[userID]");
+ assertEquals(raptorControllerAsync.toggleUserEditAccess("test", "N", mockedRequest, mockedResponse).getClass(), HashMap.class);
+ }
+ @Test
+ public void toggleRoleEditAccessExceptionTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ assertNull(raptorControllerAsync.toggleUserEditAccess("test", "readOnly", mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void toggleRoleEditAccessTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ Mockito.when(Globals.getUpdateRoleAccess()).thenReturn("[userID]");
+ assertEquals(raptorControllerAsync.toggleRoleEditAccess("test", "N", mockedRequest, mockedResponse).getClass(), HashMap.class);
+ }
+ @Test
+ public void getReportOwnerInListTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(Globals.getCustomizedScheduleQueryForUsers()).thenReturn("test");
+ Mockito.when(AppUtils.getUserBackdoorLoginId(mockedRequest)).thenReturn("test");
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ Vector<IdNameValue> entity = new Vector<>();
+ IdNameValue SecurityEntry = new IdNameValue();
+ entity.add(SecurityEntry);
+ Mockito.when(Globals.getSessionParams()).thenReturn("session,2");
+ Mockito.when(AppUtils.getAllUsers(Matchers.anyString(), Matchers.anyString(), Matchers.anyBoolean())).thenReturn(entity);
+ assertEquals(raptorControllerAsync.getReportOwnerInList(mockedRequest).getClass(), ArrayList.class);
+ }
+ @Test
+ public void getReportSecurityInfoTest() throws Exception
+ {
+ ReportDefinition rdf1 = mockReportDefinition();
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ Mockito.when(AppUtils.getUserName(Matchers.anyString())).thenReturn("test");
+ assertEquals(raptorControllerAsync.getReportSecurityInfo(mockedRequest).getClass(), HashMap.class);
+ }
+ @Test(expected = RaptorException.class)
+ public void retrieveDefTabWiseDataTest() throws Exception
+ {
+ Map<String, String> map = new HashMap<>();
+ map.put("id", "test");
+ map.put("detailId", "test");
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ ReportDefinition rdf1 = mockReportDefinition();
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(null);
+ Set<String> set = new HashSet<String>();
+ set.add("test");
+ Enumeration<String> x = new IteratorEnumeration<String>(set.iterator());
+ Mockito.when(mockedRequest.getSession().getAttributeNames()).thenReturn(x);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ PowerMockito.mockStatic(ReportLoader.class);
+ Mockito.when(ReportLoader.loadCustomReportXML(Matchers.anyString())).thenReturn("test");
+ PowerMockito.whenNew(ReportDefinition.class)
+ .withArguments(Matchers.any(ReportWrapper.class), Matchers.any(HttpServletRequest.class))
+ .thenReturn(rdf1);
+// PowerMockito.mockStatic(ReportDefinition.class);
+ Mockito.when(AppUtils.nvl(Matchers.anyString())).thenReturn("test");
+ PowerMockito.when(ReportDefinition.unmarshal(Mockito.anyString(), Mockito.anyString(), Mockito.anyObject()))
+ .thenReturn(rdf1);
+ Vector vc = new Vector<>();
+ vc.add("test");
+ Mockito.when(AppUtils.getQuickLinksMenuIDs()).thenReturn(vc);
+ assertEquals(raptorControllerAsync.retrieveDefTabWiseData(map, mockedRequest, mockedResponse).getClass(), DefinitionJSON.class);
+ }
+ @Test
+ public void retrieveDataForGivenQuery3Test() throws Exception
+ {
+ QueryJSON queryJSON = new QueryJSON();
+ queryJSON.setQuery("test");
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ ReportDefinition rdf1 = PowerMockito.mock(ReportDefinition.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ raptorControllerAsync.retrieveDataForGivenQuery(false, queryJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void retrieveDataForGivenQuery1Test() throws Exception
+ {
+ QueryJSON queryJSON = new QueryJSON();
+ queryJSON.setQuery("test");
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ ReportDefinition rdf1 = PowerMockito.mock(ReportDefinition.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(null);
+ raptorControllerAsync.retrieveDataForGivenQuery(false, queryJSON, mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void retrieveDataForGivenQuery2Test() throws Exception
+ {
+ QueryJSON queryJSON = new QueryJSON();
+ queryJSON.setQuery("select");
+ ServletContext servletContext = PowerMockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
+ ReportDefinition rdf1 = PowerMockito.mock(ReportDefinition.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(Globals.isSystemInitialized()).thenReturn(true);
+ Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(rdf1);
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(ESAPI.class);
+ PowerMockito.mockStatic(Utils.class);
+ PowerMockito.mockStatic(SecurityCodecUtil.class);
+
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ Mockito.when(Globals.getRequestParams()).thenReturn("test,2");
+ Mockito.when(Globals.getSessionParams()).thenReturn("session,2");
+ Codec codec = PowerMockito.mock(Codec.class);
+ Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec);
+
+
+ PowerMockito.mockStatic(ESAPI.class);
+ Encoder encoder = PowerMockito.mock(Encoder.class);
+ Mockito.when(ESAPI.encoder()).thenReturn(encoder);
+ Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class),Matchers.anyString())).thenReturn("select *");
+ PowerMockito.mockStatic(ConnectionUtils.class);
+ Mockito.when(Utils.replaceInString(Matchers.anyString(), Matchers.anyString(), Matchers.anyString())).thenReturn("test");
+
+ DataSet set = new DataSet();
+ Mockito.when(ConnectionUtils.getDataSet("test", "local", true)).thenReturn(set);
+ PowerMockito.mockStatic(XSSFilter.class);
+ Mockito.when(XSSFilter.filterRequestOnlyScript(Matchers.anyString())).thenReturn("select distinct from test");
+ raptorControllerAsync.setViewName("test");
+ assertEquals(raptorControllerAsync.getViewName(),"test");
+ assertEquals(raptorControllerAsync.nvl(null),"");
+ assertEquals(raptorControllerAsync.nvl("test"),"test");
+ assertEquals(raptorControllerAsync.nvl("","default"),"default");
+ assertEquals(raptorControllerAsync.nvl("test","default"),"test");
+
+
+ raptorControllerAsync.retrieveDataForGivenQuery(false, queryJSON, mockedRequest, mockedResponse);
+ }
+
+
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorServiceImplTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorServiceImplTest.java
new file mode 100644
index 00000000..061b954c
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorServiceImplTest.java
@@ -0,0 +1,85 @@
+/*
+ * ============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.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.system.fusion.service.RaptorServiceImpl;
+import org.onap.portalsdk.core.service.DataAccessService;
+
+
+public class RaptorServiceImplTest {
+
+ @InjectMocks
+ RaptorServiceImpl raptorServiceImpl = new RaptorServiceImpl();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+ @Mock
+ DataAccessService dataAccessService;
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+ NullPointerException nullPointerException = new NullPointerException();
+
+ @Test
+ public void executeGridQueryTest(){
+ List expectedResult = new ArrayList<>();
+ Mockito.when(dataAccessService.executeNamedQuery(Matchers.anyString(), Matchers.anyMap(), Matchers.anyInt(),Matchers.anyInt(),Matchers.any())).thenReturn(expectedResult);
+ List actualResult = raptorServiceImpl.executeGridQuery("test", new HashMap<>(), 1, 1);
+ assertEquals(expectedResult.size(), actualResult.size());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportDefinitionTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportDefinitionTest.java
new file mode 100644
index 00000000..c0484039
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportDefinitionTest.java
@@ -0,0 +1,2178 @@
+/*
+ * ============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.Connection;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+import java.util.concurrent.Semaphore;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.bind.JAXBException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.controller.WizardSequence;
+import org.onap.portalsdk.analytics.error.RaptorException;
+import org.onap.portalsdk.analytics.error.ReportSQLException;
+import org.onap.portalsdk.analytics.error.UserAccessException;
+import org.onap.portalsdk.analytics.error.ValidationException;
+import org.onap.portalsdk.analytics.model.DataCache;
+import org.onap.portalsdk.analytics.model.ReportLoader;
+import org.onap.portalsdk.analytics.model.base.IdNameValue;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.definition.DBColumnInfo;
+import org.onap.portalsdk.analytics.model.definition.ReportDefinition;
+import org.onap.portalsdk.analytics.model.definition.ReportSchedule;
+import org.onap.portalsdk.analytics.system.AppUtils;
+import org.onap.portalsdk.analytics.system.DbUtils;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.util.DataSet;
+import org.onap.portalsdk.analytics.util.Utils;
+import org.onap.portalsdk.analytics.xmlobj.CustomReportType;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnList;
+import org.onap.portalsdk.analytics.xmlobj.DataColumnType;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceList;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceType;
+import org.onap.portalsdk.analytics.xmlobj.FormFieldList;
+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, DataSet.class, DataCache.class, DbUtils.class, AppUtils.class,
+ ReportLoader.class, Utils.class })
+public class ReportDefinitionTest {
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ public ReportDefinition mockReportDefinition() throws RaptorException {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = new CustomReportType();
+ customReportType.setReportType("test");
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ customReportType.setPublic(true);
+ DataSourceList dataSourceList = new DataSourceList();
+
+ List<DataSourceType> list = new ArrayList<>();
+ DataSourceType dataSourceType = new DataSourceType();
+ // dataSourceType.setTableName("test");
+ // dataSourceType.setRefTableId("1");
+ // dataSourceType.setTableId("1");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ // DataColumnType dataColumnType = new DataColumnType();
+ // dataColumnType.setChartGroup("test");
+ // dataColumnType.setYAxis("test");
+ // dataColumnType.setColName("[test");
+ // dataColumnType.setColOnChart("LEGEND");
+ // dataColumnType.setDisplayName("chart_total");
+ // dataColumnType.setColId("1");
+ // dataColumnType.setTableId("1");
+ // dataColumnType.setColType("DATE");
+ // dataColumnTypeList.add(dataColumnType);
+ DataColumnList dataColumnList = new DataColumnList();
+ // dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("test");
+ customReportType.setReportTitle("test");
+ customReportType.setDataSourceList(dataSourceList);
+
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+
+ return reportDefinition;
+ }
+
+ @Test(expected = UserAccessException.class)
+ public void setAsCopyException() throws Exception {
+ ReportDefinition reportDefinition = mockReportDefinition();
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ Mockito.when(Globals.getAllowSQLBasedReports()).thenReturn(false);
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(false);
+ Mockito.when(AppUtils.getUserName(mockedRequest)).thenReturn("test");
+ reportDefinition.setAsCopy(mockedRequest);
+ }
+
+ @Test
+ public void setAsCopyRaptorExceptionTest() throws Exception {
+ ReportDefinition reportDefinition = mockReportDefinition();
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ Mockito.when(Globals.getAllowSQLBasedReports()).thenReturn(true);
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ Mockito.when(AppUtils.getUserName(mockedRequest)).thenReturn("test");
+ reportDefinition.setAsCopy(mockedRequest);
+ }
+
+ @Test
+ public void setAsCopyTest() throws Exception {
+ ReportDefinition reportDefinition = mockReportDefinition();
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(Globals.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ Mockito.when(Globals.getAllowSQLBasedReports()).thenReturn(true);
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ Mockito.when(AppUtils.getUserName(mockedRequest)).thenReturn("test");
+ reportDefinition.setAsCopy(mockedRequest);
+ }
+
+ @Test
+ public void getWizardSequenceTest() throws Exception {
+ ReportDefinition reportDefinition = mockReportDefinition();
+ assertEquals(reportDefinition.getWizardSequence().getClass(), WizardSequence.class);
+ }
+
+ @Test
+ public void generateWizardSequenceIfReportTypeLinear() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ reportDefinition.generateWizardSequence(mockedRequest);
+ }
+
+ @Test
+ public void generateWizardSequenceIfReportTypeSQLbased() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Linear");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based_Datamining");
+ reportWrapper.setReportDefType("SQL-based");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ reportDefinition.generateWizardSequence(mockedRequest);
+ }
+
+ @Test
+ public void generateWizardSequenceIfReportTypeSQLbasedDatamining() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Linear");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based_Datamining");
+ reportWrapper.setReportDefType("SQL-based_Datamining");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ reportDefinition.generateWizardSequence(mockedRequest);
+ }
+
+ @Test
+ public void generateWizardSequenceIfReportTypeCrossTab() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Cross-Tab");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based");
+ reportWrapper.setReportDefType("SQL-based");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ reportDefinition.generateWizardSequence(mockedRequest);
+ }
+
+ @Test
+ public void generateWizardSequenceIfReportTypeCrossTab1() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Cross-Tab");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ reportDefinition.generateWizardSequence(mockedRequest);
+ }
+
+ @Test
+ public void generateWizardSequenceIfReportTypeDAshboard() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Dashboard");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ reportDefinition.generateWizardSequence(mockedRequest);
+ }
+
+ @Test
+ public void generateWizardSequenceIfReportTypeHive() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12");
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ reportDefinition.generateWizardSequence(mockedRequest);
+ }
+
+ @Test
+ public void persistReportExceptionTest() throws Exception {
+ ReportDefinition reportDefinition = mockReportDefinition();
+ reportDefinition.persistReport(mockedRequest);
+ }
+
+ @Test
+ public void persistReportTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(Utils.class);
+
+ PowerMockito.mockStatic(ReportLoader.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ Mockito.when(Globals.getNewReportData()).thenReturn("test");
+
+ Connection connection = PowerMockito.mock(Connection.class);
+ Mockito.when(DbUtils.startTransaction()).thenReturn(connection);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Cross-Tab");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based_Datamining");
+ reportWrapper.setReportDefType("SQL-based");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ Mockito.when(DbUtils.executeQuery(Matchers.any(Connection.class), Matchers.anyString())).thenReturn(datset);
+ PowerMockito.doNothing().when(ReportLoader.class);
+ ReportLoader.createCustomReportRec(Matchers.any(Connection.class), Matchers.any(ReportWrapper.class),
+ Matchers.anyString());
+ ReportLoader.createReportLogEntry(Matchers.any(Connection.class), Matchers.anyString(), Matchers.anyString(),
+ Matchers.anyString(), Matchers.anyString(), Matchers.anyString());
+ Mockito.when(Utils.getCurrentDateTime()).thenReturn("test");
+ ReportSchedule reportSchedule = reportDefinition.getReportSchedule();
+ reportSchedule = PowerMockito.mock(ReportSchedule.class);
+ Mockito.doNothing().when(reportSchedule).persistScheduleData(Matchers.any(Connection.class),
+ Matchers.any(HttpServletRequest.class));
+ reportDefinition.persistReport(mockedRequest);
+ }
+
+ @Test
+ public void persistReport1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(Utils.class);
+
+ PowerMockito.mockStatic(ReportLoader.class);
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ Mockito.when(Globals.getNewReportData()).thenReturn("test");
+
+ Connection connection = PowerMockito.mock(Connection.class);
+ Mockito.when(DbUtils.startTransaction()).thenReturn(connection);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Cross-Tab");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based_Datamining");
+ reportWrapper.setReportDefType("SQL-based");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ Mockito.when(DbUtils.executeQuery(Matchers.any(Connection.class), Matchers.anyString())).thenReturn(datset);
+ PowerMockito.doNothing().when(ReportLoader.class);
+ ReportLoader.updateCustomReportRec(Matchers.any(Connection.class), Matchers.any(ReportWrapper.class),
+ Matchers.anyString());
+ Mockito.when(Utils.getCurrentDateTime()).thenReturn("test");
+ ReportSchedule reportSchedule = reportDefinition.getReportSchedule();
+ reportSchedule = PowerMockito.mock(ReportSchedule.class);
+ Mockito.doNothing().when(reportSchedule).persistScheduleData(Matchers.any(Connection.class),
+ Matchers.any(HttpServletRequest.class));
+ Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test");
+ Mockito.when(Globals.getAllowSQLBasedReports()).thenReturn(true);
+ Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true);
+ Mockito.when(AppUtils.getUserName(mockedRequest)).thenReturn("test");
+ reportDefinition.persistReport(mockedRequest);
+ }
+
+ public CustomReportType mockcustomReport() {
+ CustomReportType customReportType = new CustomReportType();
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ customReportType.setFormFieldList(formFieldList);
+ customReportType.setPublic(true);
+ DataSourceList dataSourceList = new DataSourceList();
+ List<DataSourceType> list = new ArrayList<>();
+ DataSourceType dataSourceType = new DataSourceType();
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnList dataColumnList = new DataColumnList();
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("Linear");
+ customReportType.setReportTitle("test");
+ customReportType.setDataSourceList(dataSourceList);
+ return customReportType;
+
+ }
+
+ public CustomReportType mockcustomReportwithDataSource() {
+ CustomReportType customReportType = new CustomReportType();
+ List<FormFieldType> formfild = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setColId("1");
+ formfild.add(formFieldType);
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ formFieldList.formField = formfild;
+ JavascriptList javascriptList = new JavascriptList();
+ customReportType.setJavascriptList(javascriptList);
+ customReportType.setFormFieldList(formFieldList);
+ customReportType.setPublic(true);
+ DataSourceList dataSourceList = new DataSourceList();
+
+ List<DataSourceType> list = new ArrayList<>();
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("[test");
+ dataColumnType.setColOnChart("LEGEND");
+ dataColumnType.setDisplayName("chart_total");
+ dataColumnType.setColId("1");
+ dataColumnType.setTableId("1");
+ dataColumnType.setColType("DATE");
+ dataColumnType.setOrderBySeq(1);
+ dataColumnType.setCrossTabValue("ROW");
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnType dataColumnType1 = new DataColumnType();
+ dataColumnType1.setCrossTabValue("COLUMN");
+ dataColumnType1.setColId("1");
+ dataColumnType1.setOrderBySeq(1);
+ dataColumnTypeList.add(dataColumnType1);
+ DataColumnType dataColumnType2 = new DataColumnType();
+ dataColumnType2.setCrossTabValue("VALUE");
+ dataColumnType2.setColId("1");
+ dataColumnType2.setOrderBySeq(2);
+ dataColumnTypeList.add(dataColumnType2);
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("Linear");
+ customReportType.setReportTitle("test");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setFormFieldList(formFieldList);
+ return customReportType;
+
+ }
+
+ public FormatList mockFormatList() {
+ FormatList formatList = new FormatList();
+ List<FormatType> format = new ArrayList<>();
+ FormatType formatType = new FormatType();
+ formatType.setFormatId("null_fmt1");
+ FormatType formatType1 = new FormatType();
+ formatType1.setFormatId("1");
+ format.add(formatType);
+ format.add(formatType1);
+ formatList.format = format;
+ return formatList;
+ }
+
+ public JavascriptList mockJavascriptList() {
+ JavascriptList javascriptList = new JavascriptList();
+
+ List<JavascriptItemType> list1 = new ArrayList<>();
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setFieldId("1");
+ javascriptItemType.setId("1");
+ list1.add(javascriptItemType);
+ javascriptList.javascriptItem = list1;
+ return javascriptList;
+ }
+
+ public ColFilterList mockColFilterList() {
+ ColFilterList colFilterList = new ColFilterList();
+ List<ColFilterType> colFilter = new ArrayList<>();
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setColId("1");
+ colFilterType.setArgType("FORM");
+ colFilterType.setArgValue("test");
+ colFilter.add(colFilterType);
+ colFilterList.colFilter = colFilter;
+ return colFilterList;
+
+ }
+
+ public CustomReportType mockcustomReportwithDataSource1() {
+ CustomReportType customReportType = new CustomReportType();
+ List<FormFieldType> formfild = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setColId("1");
+ formFieldType.setFieldId("ff1");
+ formFieldType.setOrderBySeq(4);
+ formfild.add(formFieldType);
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ formFieldList.formField = formfild;
+ JavascriptList javascriptList = mockJavascriptList();
+ customReportType.setJavascriptList(javascriptList);
+ customReportType.setFormFieldList(formFieldList);
+ customReportType.setPublic(true);
+ List<SemaphoreType> semList = new ArrayList<>();
+ SemaphoreList semaphoreList = new SemaphoreList();
+ SemaphoreType semaphore = new SemaphoreType();
+ semaphore.setSemaphoreId("1");
+ semaphore.setFormatList(mockFormatList());
+ SemaphoreType semaphore1 = new SemaphoreType();
+ semaphore1.setSemaphoreId("sem1");
+ semaphore1.setFormatList(mockFormatList());
+ semList.add(semaphore);
+ semList.add(semaphore1);
+ semaphoreList.semaphore = semList;
+ customReportType.setSemaphoreList(semaphoreList);
+ DataSourceList dataSourceList = new DataSourceList();
+
+ List<DataSourceType> list = new ArrayList<>();
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ List<DataColumnType> dataColumnTypeList = new ArrayList<>();
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("[test");
+ dataColumnType.setColOnChart("LEGEND");
+ dataColumnType.setDisplayName("chart_total");
+ dataColumnType.setColId("1");
+ dataColumnType.setTableId("1");
+ dataColumnType.setColType("DATE");
+ dataColumnType.setCrossTabValue("ROW");
+ dataColumnType.setCalculated(true);
+ dataColumnType.setColFilterList(mockColFilterList());
+ dataColumnTypeList.add(dataColumnType);
+ DataColumnType dataColumnType1 = new DataColumnType();
+ dataColumnType1.setCrossTabValue("COLUMN");
+ dataColumnType1.setColId("1");
+ dataColumnTypeList.add(dataColumnType1);
+
+ DataColumnType dataColumnType2 = new DataColumnType();
+ dataColumnType2.setCrossTabValue("VALUE");
+ dataColumnType2.setColId("1");
+
+ dataColumnTypeList.add(dataColumnType2);
+
+ DataColumnList dataColumnList = new DataColumnList();
+ dataColumnList.dataColumn = dataColumnTypeList;
+ dataSourceType.setDataColumnList(dataColumnList);
+ list.add(dataSourceType);
+ dataSourceList.dataSource = list;
+ dataSourceList.dataSource = list;
+ customReportType.setReportType("Linear");
+ customReportType.setReportTitle("test");
+ customReportType.setDataSourceList(dataSourceList);
+ customReportType.setFormFieldList(formFieldList);
+ return customReportType;
+
+ }
+
+ @Test
+ public void getCrossTabDisplayValueROWTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ assertEquals(reportDefinition.getCrossTabDisplayValue("ROW"), "Row headings");
+ }
+
+ @Test
+ public void getCrossTabDisplayValueCOLUMNTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ assertEquals(reportDefinition.getCrossTabDisplayValue("COLUMN"), "Column headings");
+ }
+
+ @Test
+ public void getCrossTabDisplayValueTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ assertEquals(reportDefinition.getCrossTabDisplayValue("VALUE"), "Report values");
+ }
+
+ @Test
+ public void getCrossTabDisplayTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ assertEquals(reportDefinition.getCrossTabDisplayValue("Test"), "Invisible/Filter");
+ }
+
+ @Test
+ public void getCrossTabDisplayValue() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ DataColumnType dataColumnType1 = new DataColumnType();
+ dataColumnType1.setCrossTabValue("COLUMN");
+ assertEquals(reportDefinition.getCrossTabDisplayValue(dataColumnType1), "Column headings");
+ }
+
+ @Test
+ public void getColumnLabelTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ DataColumnType dataColumnType1 = new DataColumnType();
+ dataColumnType1.setCrossTabValue("COLUMN");
+ dataColumnType1.setTableId("1");
+ Vector vector = PowerMockito.mock(Vector.class);
+ PowerMockito.mockStatic(DataCache.class);
+
+ Mockito.when(DataCache.getReportTableDbColumns(Matchers.anyString(), Matchers.anyString())).thenReturn(vector);
+ assertEquals(reportDefinition.getColumnLabel(dataColumnType1), "");
+ }
+
+ @Test
+ public void getColumnLabelNewTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ DataColumnType dataColumnType1 = new DataColumnType();
+ dataColumnType1.setCrossTabValue("COLUMN");
+ dataColumnType1.setTableId("1");
+ dataColumnType1.setDbColName("test");
+ Vector vector = new Vector<>();
+ DBColumnInfo DBColumnInfo = new DBColumnInfo("test", "test", "test", "test");
+ vector.add(DBColumnInfo);
+ PowerMockito.mockStatic(DataCache.class);
+
+ Mockito.when(DataCache.getReportTableDbColumns(Matchers.anyString(), Matchers.anyString())).thenReturn(vector);
+ assertEquals(reportDefinition.getColumnLabel(dataColumnType1), "test");
+ }
+
+ @Test
+ public void getFilterLabelTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setExpression("test");
+ assertEquals(reportDefinition.getFilterLabel(colFilterType), "test ");
+ }
+
+ @Test
+ public void getFilterLabel1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setExpression("test");
+ colFilterType.setArgType("FORMULA");
+ assertEquals(reportDefinition.getFilterLabel(colFilterType), "test [null]");
+ }
+
+ @Test
+ public void getFilterLabel2Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setExpression("test");
+ colFilterType.setArgType("VALUE");
+ assertEquals(reportDefinition.getFilterLabel(colFilterType), "test null");
+ }
+
+ @Test
+ public void getFilterLabel3Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setExpression("test");
+ colFilterType.setArgType("LIST");
+ assertEquals(reportDefinition.getFilterLabel(colFilterType), "test (null)");
+ }
+
+ @Test
+ public void getFilterLabel4Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setExpression("test");
+ colFilterType.setArgType("LIST");
+ assertEquals(reportDefinition.getFilterLabel(colFilterType), "test (null)");
+ }
+
+ @Test
+ public void getFilterLabel5Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setExpression("test");
+ colFilterType.setArgType("COLUMN");
+ colFilterType.setArgValue("1");
+ assertEquals(reportDefinition.getFilterLabel(colFilterType), "test [chart_total]");
+ }
+
+ @Test
+ public void getFilterLabel6Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setExpression("test");
+ colFilterType.setArgType("FORM");
+ colFilterType.setArgValue("1");
+ assertEquals(reportDefinition.getFilterLabel(colFilterType), "test [Form Field]");
+ }
+
+ @Test
+ public void getReportUsersTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ Mockito.when(Globals.getCustomizedScheduleQueryForUsers()).thenReturn("test");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test,1");
+ Mockito.when(AppUtils.getUserBackdoorLoginId(mockedRequest)).thenReturn("test");
+ Vector vc = new Vector<>();
+ IdNameValue idNameValue = new IdNameValue();
+ idNameValue.setId("1");
+ vc.add(idNameValue);
+ Mockito.when(AppUtils.getAllUsers(Mockito.anyString(), Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn(vc);
+ assertEquals(reportDefinition.getReportUsers(mockedRequest).getClass(), Vector.class);
+ }
+
+ @Test
+ public void getReportRolesTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ Mockito.when(Globals.getCustomizedScheduleQueryForUsers()).thenReturn("test");
+ Mockito.when(Globals.getSessionParams()).thenReturn("test,1");
+ Mockito.when(AppUtils.getUserBackdoorLoginId(mockedRequest)).thenReturn("test");
+ Vector vc = new Vector<>();
+ IdNameValue idNameValue = new IdNameValue();
+ idNameValue.setId("1");
+ vc.add(idNameValue);
+ Mockito.when(AppUtils.getAllRoles(Mockito.anyString(), Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn(vc);
+ assertEquals(reportDefinition.getReportRoles(mockedRequest).getClass(), Vector.class);
+ }
+
+ @Test
+ public void clearAllDrillDownsTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.clearAllDrillDowns();
+
+ }
+
+ @Test
+ public void setOuterJoinTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ reportDefinition.setOuterJoin(dataSourceType, "test");
+ }
+
+ @Test
+ public void setOuterJoin1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ dataSourceType.setRefDefinition("test= (+)1=");
+ reportDefinition.setOuterJoin(dataSourceType, "test");
+ }
+
+ @Test
+ public void setOuterJoin2Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ dataSourceType.setRefDefinition("test= (+)1=");
+ reportDefinition.setOuterJoin(dataSourceType, "CURRENT");
+ }
+
+ @Test
+ public void setOuterJoin3Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ dataSourceType.setRefDefinition("test= (+)1=");
+ reportDefinition.setOuterJoin(dataSourceType, "JOINED");
+ }
+
+ @Test
+ public void setOuterJoin4Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ dataSourceType.setRefDefinition("tes1t= (+)1=");
+ reportDefinition.setOuterJoin(dataSourceType, "JOINED");
+ }
+
+ @Test
+ public void setOuterJoin5Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ dataSourceType.setRefDefinition("tes1t= (+)1=");
+ reportDefinition.setOuterJoin(dataSourceType, "CURRENT");
+ }
+
+ @Test
+ public void addDataSourceTypeTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ dataSourceType.setRefDefinition("tes1t= (+)1=");
+ Mockito.when(objectFactory.createDataSourceType()).thenReturn(dataSourceType);
+ reportDefinition.addDataSourceType(objectFactory, "1", "test", "test", "test", "2", "test", "comment");
+ }
+
+ @Test
+ public void addDataSourceType1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ DataSourceType dataSourceType = new DataSourceType();
+ dataSourceType.setTableName("test");
+ dataSourceType.setRefTableId("1");
+ dataSourceType.setTableId("1");
+ dataSourceType.setRefDefinition("tes1t= (+)1=");
+ Mockito.when(objectFactory.createDataSourceType()).thenReturn(dataSourceType);
+ reportDefinition.addDataSourceType(objectFactory, "1", "test", "test", "test", "", "", "");
+ }
+
+ @Test
+ public void deleteDataSourceTypeTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.deleteDataSourceType("1");
+
+ }
+
+ @Test
+ public void getUniqueColumnIdTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ assertEquals(reportDefinition.getUniqueColumnId("test"), "te4");
+
+ }
+
+ @Test
+ public void addDataColumnTypeTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("[test");
+ dataColumnType.setColOnChart("LEGEND");
+ dataColumnType.setDisplayName("chart_total");
+ dataColumnType.setColId("1");
+ dataColumnType.setTableId("1");
+ dataColumnType.setColType("DATE");
+ Mockito.when(objectFactory.createDataColumnType()).thenReturn(dataColumnType);
+
+ assertEquals(reportDefinition
+ .addDataColumnType(objectFactory, "1", "1", "test", "test", "test", "test", 1, "test", 1, false, false,
+ "test", "comment", false, 1, "test", "test", "test", 1, "test", "test", "test", "test", "test")
+ .getClass(), DataColumnType.class);
+ }
+
+ @Test
+ public void addDataColumnType1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ DataColumnType dataColumnType = new DataColumnType();
+ dataColumnType.setChartGroup("test");
+ dataColumnType.setYAxis("test");
+ dataColumnType.setColName("[test");
+ dataColumnType.setColOnChart("LEGEND");
+ dataColumnType.setDisplayName("chart_total");
+ dataColumnType.setColId("1");
+ dataColumnType.setTableId("1");
+ dataColumnType.setColType("DATE");
+ Mockito.when(objectFactory.createDataColumnType()).thenReturn(dataColumnType);
+
+ assertEquals(reportDefinition.addDataColumnType(objectFactory, "", "1", "", "", "", "", 1, "", 1, false, false,
+ "", "", false, 1, "", "", "", 1, "", "", "", "", "").getClass(), DataColumnType.class);
+ }
+
+ @Test
+ public void deleteDataColumnTypeTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.deleteDataColumnType("1");
+ }
+
+ @Test
+ public void shiftColumnOrderUpTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.shiftColumnOrderUp("1");
+ }
+
+ @Test
+ public void shiftColumnOrderDownTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.shiftColumnOrderDown("1");
+ }
+
+ @Test
+ public void resetColumnOrderValuesTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.resetColumnOrderValues();
+ }
+
+ @Test
+ public void addColFilterTypeTest() throws Exception {
+
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setExpression("test");
+ Mockito.when(objectFactory.createColFilterType()).thenReturn(colFilterType);
+ reportDefinition.addColFilterType(objectFactory, "", "", "", "", "", "", "", "");
+
+ }
+
+ @Test
+ public void addColFilterType1Test() throws Exception {
+
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ ColFilterType colFilterType = new ColFilterType();
+ colFilterType.setExpression("test");
+ Mockito.when(objectFactory.createColFilterType()).thenReturn(colFilterType);
+ ColFilterList list = new ColFilterList();
+ Mockito.when(objectFactory.createColFilterList()).thenReturn(list);
+ reportDefinition.addColFilterType(objectFactory, "1", "1", "test", "test", "test", "test", "test", "test");
+
+ }
+
+ @Test
+ public void removeColumnFilterTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.removeColumnFilter("1", 1);
+ }
+
+ @Test
+ public void removeColumnFilter1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource1();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.removeColumnFilter("1", 1);
+ }
+
+ @Test
+ public void addColumnSortTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.addColumnSort("1", "test");
+
+ }
+
+ @Test
+ public void removeColumnSortTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.removeColumnSort("1");
+
+ }
+
+ @Test
+ public void shiftColumnSortUpTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.shiftColumnSortUp("test");
+
+ }
+
+ @Test
+ public void shiftColumnSortDownTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.shiftColumnSortDown("1");
+
+ }
+
+ @Test
+ public void shiftColumnSortDown1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.shiftColumnSortDown("test");
+
+ }
+
+ @Test
+ public void generateNewSemaphoreIdTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource1();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ assertEquals(reportDefinition.generateNewSemaphoreId(), "sem2");
+
+ }
+
+ @Test
+ public void addSemaphoreTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource1();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ SemaphoreList semaphoreList = new SemaphoreList();
+ SemaphoreType semaphore = new SemaphoreType();
+ semaphore.setSemaphoreId("123");
+ List<SemaphoreType> semList = new ArrayList<>();
+ semList.add(semaphore);
+ semaphoreList.semaphore = semList;
+ Mockito.when(objectFactory.createSemaphoreList()).thenReturn(semaphoreList);
+ Mockito.when(objectFactory.createSemaphoreType()).thenReturn(semaphore);
+ assertEquals(reportDefinition.addSemaphore(objectFactory, semaphore).getClass(), SemaphoreType.class);
+ }
+
+ @Test
+ public void addSemaphore1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ SemaphoreList semaphoreList = new SemaphoreList();
+ SemaphoreType semaphore = new SemaphoreType();
+ semaphore.setSemaphoreId("123");
+ semaphore.setSemaphoreName("test1");
+ List<SemaphoreType> semList = new ArrayList<>();
+ semList.add(semaphore);
+ semaphoreList.semaphore = semList;
+ Mockito.when(objectFactory.createSemaphoreList()).thenReturn(semaphoreList);
+ Mockito.when(objectFactory.createSemaphoreType()).thenReturn(semaphore);
+ assertEquals(reportDefinition.addSemaphore(objectFactory, semaphore).getClass(), SemaphoreType.class);
+ }
+
+ @Test(expected = RaptorException.class)
+ public void addSemaphoreExceptionTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ SemaphoreList semaphoreList = new SemaphoreList();
+ SemaphoreType semaphore = new SemaphoreType();
+ semaphore.setSemaphoreId("123");
+ semaphore.setSemaphoreName("test1");
+ List<SemaphoreType> semList = new ArrayList<>();
+ semList.add(semaphore);
+ semaphoreList.semaphore = semList;
+ Mockito.when(objectFactory.createSemaphoreList()).thenThrow(JAXBException.class);
+ Mockito.when(objectFactory.createSemaphoreType()).thenReturn(semaphore);
+ reportDefinition.addSemaphore(objectFactory, semaphore);
+ }
+
+ @Test
+ public void addSemaphoreTypeTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource1();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ SemaphoreList semaphoreList = new SemaphoreList();
+ SemaphoreType semaphore = new SemaphoreType();
+ semaphore.setSemaphoreId("123");
+ semaphore.setSemaphoreName("sem1");
+ List<SemaphoreType> semList = new ArrayList<>();
+ semList.add(semaphore);
+ semaphoreList.semaphore = semList;
+ Mockito.when(objectFactory.createSemaphoreType()).thenReturn(semaphore);
+ assertEquals(reportDefinition.addSemaphoreType(objectFactory, "test", "test", "test").getClass(),
+ SemaphoreType.class);
+ }
+
+ @Test
+ public void addSemaphoreType1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ SemaphoreList semaphoreList = new SemaphoreList();
+ SemaphoreType semaphore = new SemaphoreType();
+ semaphore.setSemaphoreId("123");
+ semaphore.setSemaphoreName("sem1");
+ List<SemaphoreType> semList = new ArrayList<>();
+ semList.add(semaphore);
+ semaphoreList.semaphore = semList;
+ Mockito.when(objectFactory.createSemaphoreType()).thenReturn(semaphore);
+ Mockito.when(objectFactory.createSemaphoreList()).thenReturn(semaphoreList);
+ assertEquals(reportDefinition.addSemaphoreType(objectFactory, "test", "test", "").getClass(),
+ SemaphoreType.class);
+ }
+
+ @Test
+ public void getNextIdForJavaScriptElementTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ JavascriptList javascriptList = new JavascriptList();
+
+ List<JavascriptItemType> list = new ArrayList<>();
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setFieldId("1");
+ list.add(javascriptItemType);
+ javascriptList.javascriptItem = list;
+ Mockito.when(objectFactory.createJavascriptList()).thenReturn(javascriptList);
+ assertEquals(reportDefinition.getNextIdForJavaScriptElement(objectFactory, "1"), "1|1");
+ }
+
+ @Test
+ public void getNextIdForJavaScriptElement1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource1();
+ JavascriptList javascriptList1 = new JavascriptList();
+ customReportType.setJavascriptList(javascriptList1);
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ List<JavascriptItemType> list = new ArrayList<>();
+ JavascriptList javascriptList = new JavascriptList();
+
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setFieldId("1");
+ list.add(javascriptItemType);
+ javascriptList.javascriptItem = list;
+ Mockito.when(objectFactory.createJavascriptList()).thenReturn(javascriptList);
+ assertEquals(reportDefinition.getNextIdForJavaScriptElement(objectFactory, "1"), "1|1");
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void addJavascriptTypeTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+ JavascriptList javascriptList1 = new JavascriptList();
+ customReportType.setJavascriptList(javascriptList1);
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ assertEquals(reportDefinition.addJavascriptType(objectFactory, "1").getClass(), JavascriptItemType.class);
+ }
+
+ @Test
+ public void addJavascriptTypeT1est() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource1();
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ assertEquals(reportDefinition.addJavascriptType(objectFactory, "1").getClass(), JavascriptItemType.class);
+ }
+
+ @Test
+ public void deleteJavascriptTypeTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+
+ JavascriptList javascriptList = new JavascriptList();
+
+ List<JavascriptItemType> list1 = new ArrayList<>();
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setFieldId("1");
+ javascriptItemType.setId("23");
+ list1.add(javascriptItemType);
+ javascriptList.javascriptItem = list1;
+
+ customReportType.setJavascriptList(javascriptList);
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ assertTrue(reportDefinition.deleteJavascriptType("23"));
+ }
+
+ @Test
+ public void deleteJavascriptTypeFalseTest() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+
+ JavascriptList javascriptList = new JavascriptList();
+
+ List<JavascriptItemType> list1 = new ArrayList<>();
+ JavascriptItemType javascriptItemType = new JavascriptItemType();
+ javascriptItemType.setFieldId("1");
+ javascriptItemType.setId("23");
+ list1.add(javascriptItemType);
+ javascriptList.javascriptItem = list1;
+
+ customReportType.setJavascriptList(javascriptList);
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ assertFalse(reportDefinition.deleteJavascriptType("234"));
+ }
+
+ @Test
+ public void deleteJavascriptTypeNull() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource();
+
+ customReportType.setJavascriptList(null);
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ assertTrue(reportDefinition.deleteJavascriptType("234"));
+ }
+
+ @Test
+ public void addEmptyFormatTypeTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ SemaphoreType semaphore = new SemaphoreType();
+ semaphore.setFormatList(mockFormatList());
+ FormatType fmt = new FormatType();
+ Mockito.when(objectFactory.createFormatType()).thenReturn(fmt);
+ reportDefinition.addEmptyFormatType(objectFactory, semaphore);
+ }
+
+ @Test
+ public void deleteFormatTypeTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ SemaphoreType semaphore = new SemaphoreType();
+ semaphore.setFormatList(mockFormatList());
+ reportDefinition.deleteFormatType(semaphore, "1");
+ }
+
+ public ReportDefinition mockRdf() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource1();
+ customReportType.setReportType("Hive");
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ return reportDefinition;
+ }
+
+ @Test
+ public void addFormFieldTypeTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setColId("1");
+ formFieldType.setFieldId("ff1");
+ Mockito.when(objectFactory.createFormFieldType()).thenReturn(formFieldType);
+ assertEquals(reportDefinition
+ .addFormFieldType(objectFactory, "fieldName", "colId", "fieldType", "validationType", "mandatory",
+ "defaultValue", "fieldSQL", "comment", null, null, "rangeStartDateSQL", "rangeEndDateSQL")
+ .getClass(), FormFieldType.class);
+ }
+
+ @Test
+ public void addCustomizedTextForParametersTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ reportDefinition.addCustomizedTextForParameters("test");
+ }
+
+ @Test
+ public void addFormFieldBlankTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setColId("1");
+ formFieldType.setFieldId("ff1");
+ Mockito.when(objectFactory.createFormFieldType()).thenReturn(formFieldType);
+ assertEquals(reportDefinition.addFormFieldBlank(objectFactory).getClass(), FormFieldType.class);
+ }
+
+ @Test
+ public void replaceFormFieldReferencesTest() throws Exception {
+ PowerMockito.mockStatic(Utils.class);
+ ReportDefinition reportDefinition = mockRdf();
+ Mockito.when(Utils.replaceInString(Matchers.anyString(), Matchers.anyString(), Matchers.anyString()))
+ .thenReturn("test");
+ reportDefinition.replaceFormFieldReferences("test", "test12");
+ }
+
+ @Test
+ public void replaceFormFieldReferences1Test() throws Exception {
+ PowerMockito.mockStatic(Utils.class);
+ ReportDefinition reportDefinition = mockReportDefinition();
+ Mockito.when(Utils.replaceInString(Matchers.anyString(), Matchers.anyString(), Matchers.anyString()))
+ .thenReturn("test");
+ reportDefinition.replaceFormFieldReferences("test", "test12");
+ }
+
+ @Test
+ public void replaceFormFieldReferences2Test() throws Exception {
+ PowerMockito.mockStatic(Utils.class);
+ ReportDefinition reportDefinition = mockReportDefinition();
+ Mockito.when(Utils.replaceInString(Matchers.anyString(), Matchers.anyString(), Matchers.anyString()))
+ .thenReturn("test");
+ reportDefinition.replaceFormFieldReferences("test", "test");
+ }
+
+ @Test
+ public void deleteFormFieldTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ reportDefinition.deleteFormField("test");
+ }
+
+ @Test
+ public void deleteFormField1Test() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ reportDefinition.deleteFormField("ff1");
+ }
+
+ @Test
+ public void shiftFormFieldUpTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ reportDefinition.shiftFormFieldUp("1");
+ }
+
+ @Test
+ public void shiftFormFieldUp1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource1();
+ List<FormFieldType> formfild = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setColId("1");
+ formFieldType.setFieldId("test");
+ formFieldType.setOrderBySeq(4);
+ formfild.add(formFieldType);
+ FormFieldType formFieldType1 = new FormFieldType();
+
+ formFieldType1.setColId("1");
+ formFieldType1.setFieldId("ff1");
+ formFieldType1.setOrderBySeq(4);
+
+ formfild.add(formFieldType1);
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ formFieldList.formField = formfild;
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.shiftFormFieldUp("ff1");
+ }
+
+ @Test
+ public void shiftFormFieldUp3Test() throws Exception {
+ ReportDefinition reportDefinition = mockReportDefinition();
+ reportDefinition.getCustomReport().setFormFieldList(null);
+ reportDefinition.shiftFormFieldUp("1");
+ }
+
+ @Test
+ public void shiftFormFieldDown4Test() throws Exception {
+ ReportDefinition reportDefinition = mockReportDefinition();
+ reportDefinition.getCustomReport().setFormFieldList(null);
+ reportDefinition.shiftFormFieldDown("1");
+ }
+
+ @Test
+ public void shiftFormFieldDown1Test() throws Exception {
+ PowerMockito.mockStatic(Globals.class);
+ PowerMockito.mockStatic(DbUtils.class);
+ Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+ DataSet datset = PowerMockito.mock(DataSet.class);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
+ CustomReportType customReportType = mockcustomReportwithDataSource1();
+ List<FormFieldType> formfild = new ArrayList<>();
+ FormFieldType formFieldType = new FormFieldType();
+ formFieldType.setColId("1");
+ formFieldType.setFieldId("ff1");
+ formFieldType.setOrderBySeq(4);
+ formfild.add(formFieldType);
+ FormFieldType formFieldType1 = new FormFieldType();
+
+ formFieldType1.setColId("1");
+ formFieldType1.setFieldId("test");
+ formFieldType1.setOrderBySeq(4);
+
+ formfild.add(formFieldType1);
+ FormFieldList formFieldList = new FormFieldList();
+ formFieldList.setComment("test");
+ formFieldList.formField = formfild;
+ customReportType.setFormFieldList(formFieldList);
+ ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+ "1", true);
+ reportWrapper.setReportDefType("SQL-based1");
+ reportWrapper.setReportDefType("SQL-based1");
+ ReportDefinition reportDefinition = new ReportDefinition(reportWrapper, mockedRequest);
+ reportDefinition.shiftFormFieldDown("ff1");
+ }
+
+ @Test
+ public void shiftFormFieldDownTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ reportDefinition.shiftFormFieldDown("1");
+ }
+
+ @Test
+ public void shiftFormFieldDown2Test() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ FormFieldType formFieldType = new FormFieldType();
+ PredefinedValueList predefinedValueList = new PredefinedValueList();
+ List<String> predefinedValue = new ArrayList<>();
+ predefinedValue.add("test");
+ predefinedValueList.predefinedValue = predefinedValue;
+ formFieldType.setPredefinedValueList(predefinedValueList);
+ formFieldType.setColId("1");
+ reportDefinition.addFormFieldPredefinedValue(objectFactory, formFieldType, "test");
+ }
+
+ @Test
+ public void shiftFormFieldDown3Test() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ FormFieldType formFieldType = new FormFieldType();
+ PredefinedValueList predefinedValueList = new PredefinedValueList();
+ List<String> predefinedValue = new ArrayList<>();
+ predefinedValue.add("test");
+ predefinedValueList.predefinedValue = predefinedValue;
+ formFieldType.setPredefinedValueList(null);
+ formFieldType.setColId("1");
+ reportDefinition.addFormFieldPredefinedValue(objectFactory, formFieldType, "");
+ }
+
+ @Test
+ public void deleteFormFieldPredefinedValueTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ FormFieldType formFieldType = new FormFieldType();
+ PredefinedValueList predefinedValueList = new PredefinedValueList();
+ List<String> predefinedValue = new ArrayList<>();
+ predefinedValue.add("test");
+ predefinedValueList.predefinedValue = predefinedValue;
+ formFieldType.setPredefinedValueList(predefinedValueList);
+ formFieldType.setColId("1");
+ reportDefinition.deleteFormFieldPredefinedValue(formFieldType, "test");
+ }
+
+ @Test
+ public void deleteFormFieldPredefinedValue2Test() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ FormFieldType formFieldType = new FormFieldType();
+ PredefinedValueList predefinedValueList = new PredefinedValueList();
+ List<String> predefinedValue = new ArrayList<>();
+ predefinedValue.add("test");
+ predefinedValueList.predefinedValue = predefinedValue;
+ formFieldType.setPredefinedValueList(predefinedValueList);
+ formFieldType.setColId("1");
+ reportDefinition.deleteFormFieldPredefinedValue(formFieldType, "test1");
+ }
+
+ @Test
+ public void deleteFormFieldPredefinedValue1Test() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ FormFieldType formFieldType = new FormFieldType();
+ PredefinedValueList predefinedValueList = new PredefinedValueList();
+ List<String> predefinedValue = new ArrayList<>();
+ predefinedValue.add("test");
+ predefinedValueList.predefinedValue = predefinedValue;
+ formFieldType.setPredefinedValueList(null);
+ formFieldType.setColId("1");
+ reportDefinition.deleteFormFieldPredefinedValue(formFieldType, "");
+ }
+
+ @Test(expected = ValidationException.class)
+ public void parseReportSQLTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ reportDefinition.parseReportSQL("test");
+ }
+
+ @Test(expected = ValidationException.class)
+ public void parseReportSQL1Test() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ reportDefinition.parseReportSQL("select * ");
+ }
+
+ @Test(expected = ValidationException.class)
+ public void parseReportSQL2Test() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ reportDefinition.getCustomReport().setDbInfo("test");
+ reportDefinition.parseReportSQL("select from distinct");
+ }
+
+ @Test
+ public void parseReportSQL3Test() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ reportDefinition.getCustomReport().setDbInfo("test");
+ reportDefinition.parseReportSQL("select distinct roleID from");
+ }
+
+ @Test
+ public void addChartAdditionalOptionsTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ ChartAdditionalOptions chartOptions = new ChartAdditionalOptions();
+ Mockito.when(objectFactory.createChartAdditionalOptions()).thenReturn(chartOptions);
+ reportDefinition.addChartAdditionalOptions(objectFactory);
+ }
+
+ @Test
+ public void addChartDrillOptionsTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ ChartDrillOptions chartOptions = new ChartDrillOptions();
+ Mockito.when(objectFactory.createChartDrillOptions()).thenReturn(chartOptions);
+ reportDefinition.addChartDrillOptions(objectFactory);
+ }
+
+ @Test
+ public void addDataminingOptionsTest() throws Exception {
+ ReportDefinition reportDefinition = mockRdf();
+ ObjectFactory objectFactory = PowerMockito.mock(ObjectFactory.class);
+ DataminingOptions dataminingOptions = new DataminingOptions();
+ Mockito.when(objectFactory.createDataminingOptions()).thenReturn(dataminingOptions);
+ reportDefinition.addDataminingOptions(objectFactory);
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportHandlerTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportHandlerTest.java
new file mode 100644
index 00000000..bb31dbce
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportHandlerTest.java
@@ -0,0 +1,122 @@
+/*
+ * ============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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.analytics.error.ReportSQLException;
+import org.onap.portalsdk.analytics.model.ReportHandler;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.onap.portalsdk.analytics.system.DbUtils;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.view.ReportData;
+import org.onap.portalsdk.analytics.xmlobj.CustomReportType;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceList;
+import org.onap.portalsdk.analytics.xmlobj.DataSourceType;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+//@RunWith(PowerMockRunner.class)
+//@PrepareForTest(Globals.class)
+public class ReportHandlerTest {
+
+
+// @InjectMocks
+// ReportHandler reportHandler = new ReportHandler();
+//
+// @Before
+// public void setup() {
+// MockitoAnnotations.initMocks(this);
+// }
+//
+// MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+// HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+// HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+// NullPointerException nullPointerException = new NullPointerException();
+//
+
+// @Test
+// public void loadStylesTest() throws RaptorException, Exception
+// {
+// ReportData rd = new ReportData(1, true);
+// List reportParamNameValues = new ArrayList<>();
+// PowerMockito.mockStatic(Globals.class);
+//
+// PowerMockito.mockStatic(Globals.class);
+// PowerMockito.mockStatic(DbUtils.class);
+//
+// Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
+// ResultSet rs = PowerMockito.mock(ResultSet.class);
+// 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();
+// customReportType.setReportType("test");
+// ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1",
+// "1", true);
+// ReportRuntime reportRuntime = new ReportRuntime(reportWrapper);
+//
+//
+// DataSourceType type = new DataSourceType();
+// type.setDisplayName("test");
+// DataSourceList list = new DataSourceList();
+// reportRuntime.setDataSourceList(list);
+// Mockito.when(mockedRequest.getAttribute(
+// AppConstants.SI_REPORT_RUNTIME)).thenReturn(reportRuntime);
+// reportHandler.saveAsExcelFile(mockedRequest, rd, (ArrayList) reportParamNameValues, "test", "test" , 1);
+// }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportMapTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportMapTest.java
new file mode 100644
index 00000000..7906ffda
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportMapTest.java
@@ -0,0 +1,82 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.ReportMap;
+
+public class ReportMapTest {
+
+ public ReportMap mockReportMap() {
+ ReportMap reportMap = new ReportMap();
+ reportMap.setMarkerColor("test");
+ reportMap.setUseDefaultSize("size");
+ reportMap.setHeight("height");
+ reportMap.setWidth("width");
+ reportMap.setIsMapAllowedYN("isMapAllowedYN");
+ reportMap.setAddAddressInDataYN("addAddressInDataYN");
+ reportMap.setAddressColumn("column");
+ reportMap.setDataColumn("data");
+ reportMap.setDefaultMapType("dafaultType");
+ reportMap.setLatColumn("latColumn");
+ reportMap.setLongColumn("longColumn");
+ reportMap.setColorColumn("colorColumn");
+ reportMap.setLegendColumn("legendColumn");
+ return reportMap;
+ }
+
+ @Test
+ public void reportMapTest() {
+ ReportMap reportMap = mockReportMap();
+ assertEquals(reportMap.getMarkerColor(), "test");
+ assertEquals(reportMap.getUseDefaultSize(), "size");
+ assertEquals(reportMap.getHeight(), "height");
+ assertEquals(reportMap.getWidth(), "width");
+ assertEquals(reportMap.getIsMapAllowedYN(), "isMapAllowedYN");
+ assertEquals(reportMap.getAddAddressInDataYN(), "addAddressInDataYN");
+ assertEquals(reportMap.getAddressColumn(), "column");
+ assertEquals(reportMap.getDataColumn(), "data");
+ assertEquals(reportMap.getDefaultMapType(), "dafaultType");
+ assertEquals(reportMap.getLatColumn(), "latColumn");
+ assertEquals(reportMap.getLongColumn(), "longColumn");
+ assertEquals(reportMap.getColorColumn(), "colorColumn");
+ assertEquals(reportMap.getLegendColumn(), "legendColumn");
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportsTest.java
new file mode 100644
index 00000000..fba401df
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportsTest.java
@@ -0,0 +1,54 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.Reports;
+
+public class ReportsTest {
+ @Test
+ public void reportsTest() {
+ Reports reports = new Reports();
+ reports.setBgcolor("bgcolor");
+ reports.setReportId("reportId");
+ assertEquals(reports.getBgcolor(), "bgcolor");
+ assertEquals(reports.getBgcolor(), "bgcolor");
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/SemaphoreListTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/SemaphoreListTest.java
new file mode 100644
index 00000000..c068f293
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/SemaphoreListTest.java
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.analytics.xmlobj;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.SemaphoreList;
+
+public class SemaphoreListTest {
+
+ @Test
+ public void semaphoreListList() {
+ SemaphoreList semaphoreList = new SemaphoreList();
+ assertEquals(semaphoreList.getSemaphore().size(), 0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/SemaphoreTypeTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/SemaphoreTypeTest.java
new file mode 100644
index 00000000..65bd05d5
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/SemaphoreTypeTest.java
@@ -0,0 +1,63 @@
+/*
+ * ============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 org.junit.Test;
+import org.onap.portalsdk.analytics.xmlobj.SemaphoreType;
+
+public class SemaphoreTypeTest {
+
+ @Test
+ public void semaphoreTypeTest() {
+ SemaphoreType semaphoreType = new SemaphoreType();
+ semaphoreType.setSemaphoreName("semaphoreName");
+ semaphoreType.setSemaphoreType("semaphoreType");
+ semaphoreType.setComment("comment");
+ semaphoreType.setTarget("target");
+ semaphoreType.setFormatList(null);
+ semaphoreType.setSemaphoreId("semaphoreId");
+ assertEquals(semaphoreType.getSemaphoreName(), "semaphoreName");
+ assertEquals(semaphoreType.getSemaphoreType(), "semaphoreType");
+ assertEquals(semaphoreType.getComment(), "comment");
+ assertEquals(semaphoreType.getTarget(), "target");
+ assertNull(semaphoreType.getFormatList());
+ assertEquals(semaphoreType.getSemaphoreId(), "semaphoreId");
+ }
+}