diff options
author | Kotta, Shireesha (sk434m) <sk434m@att.com> | 2018-03-13 12:36:39 -0400 |
---|---|---|
committer | Kotta, Shireesha (sk434m) <sk434m@att.com> | 2018-03-13 12:50:10 -0400 |
commit | 8b514a087e96594dc982a95a866d654faccd6e0a (patch) | |
tree | 1d5e6bd285783699ea2e50e0f5526224856032d8 /ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view | |
parent | 5322b5e5d0f49f1ce7db8ebe28e7f28328180c9a (diff) |
Added Junits
Issue-ID: PORTAL-136
Includes JUNITS
Change-Id: Ie278f9d362e6c9fba0ecdb4a493d8f88a2768fc0
Signed-off-by: Kotta, Shireesha (sk434m) <sk434m@att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view')
12 files changed, 948 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderRowTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderRowTest.java new file mode 100644 index 00000000..bb4a1176 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderRowTest.java @@ -0,0 +1,75 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.view; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ColumnHeaderRowTest { + + public ColumnHeaderRow mockColumnHeaderRow() { + ColumnHeaderRow columnHeaderRow = new ColumnHeaderRow(); + columnHeaderRow.setAlignment("alignment"); + columnHeaderRow.setRowHeight("rowHeight"); + columnHeaderRow.setDisplayWidth("displayWidth"); + columnHeaderRow.resetNext(1); + return columnHeaderRow; + } + + @Test + public void columnHeaderRowTest() { + ColumnHeaderRow columnHeaderRow = mockColumnHeaderRow(); + assertEquals(columnHeaderRow.getAlignment(), "alignment"); + assertEquals(columnHeaderRow.getRowHeight(), "rowHeight"); + assertEquals(columnHeaderRow.getDisplayWidth(), "displayWidth"); + assertFalse(columnHeaderRow.hasNext()); + columnHeaderRow.resetNext(); + columnHeaderRow.getNext(); + ColumnHeader columnHeader = new ColumnHeader(); + columnHeaderRow.add(columnHeader); + columnHeaderRow.getNext(); + assertEquals(columnHeaderRow.getRowHeightHtml()," height=rowHeight"); + columnHeaderRow.setRowHeight(""); + assertEquals(columnHeaderRow.getRowHeightHtml(),""); + columnHeaderRow.setAlignment(null); + assertEquals(columnHeaderRow.getAlignment(), "alignment"); + + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderTest.java new file mode 100644 index 00000000..7ada6cb8 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnHeaderTest.java @@ -0,0 +1,98 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.view; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ColumnHeaderTest { + + public ColumnHeader mockColumnHeader() { + ColumnHeader columnHeader = new ColumnHeader(); + columnHeader.setColId("colId"); + columnHeader.setAlignment("alignment"); + columnHeader.setColumnTitle("columnTitle"); + columnHeader.setColumnWidth("columnWidth"); + columnHeader.setRowSpan(1); + columnHeader.setVisible(true); + columnHeader.setLinkColId("linkColId"); + columnHeader.setGroupLevel(2); + columnHeader.setStartGroup(1); + columnHeader.setColSpan(1); + columnHeader.setSortable(true); + return columnHeader; + } + + @Test + public void columnHeader1Test() { + ColumnHeader columnHeader = new ColumnHeader("columnTitle"); + assertEquals(columnHeader.getColumnTitle(), "columnTitle"); + ColumnHeader columnHeader1 = new ColumnHeader("columnTitle", 1); + assertEquals(columnHeader1.getColumnSort(), 1); + ColumnHeader columnHeader2 = new ColumnHeader("columnTitle", "columnWidth"); + assertEquals(columnHeader2.getColumnWidth(), "columnWidth"); + ColumnHeader columnHeader3 = new ColumnHeader("columnTitle", "columnWidth", 1); + assertEquals(columnHeader3.getColSpan(), 1); + ColumnHeader columnHeader4 = new ColumnHeader("columnTitle", "columnWidth", 1, 1); + assertEquals(columnHeader4.getRowSpan(), 1); + ColumnHeader columnHeader5 = new ColumnHeader("columnTitle", "columnWidth", "alignment", 1, "linkColId"); + assertEquals(columnHeader5.getAlignment(), "alignment"); + assertEquals(columnHeader5.getLinkColId(), "linkColId"); + ColumnHeader columnHeader6 = mockColumnHeader(); + assertTrue(columnHeader6.isSortable()); + assertTrue(columnHeader6.isVisible()); + assertEquals(columnHeader6.getColId(), "colId"); + assertEquals(columnHeader6.getGroupLevel(), 2); + assertEquals(columnHeader6.getColumnWidthHtml(), " width=columnWidth"); + columnHeader6.setColumnWidth(""); + assertEquals(columnHeader6.getColumnWidthHtml(), ""); + assertEquals(columnHeader6.getRowSpanHtml(), ""); + columnHeader6.setRowSpan(2); + assertEquals(columnHeader6.getRowSpanHtml(), " rowspan=2"); + assertEquals(columnHeader6.getColSpanHtml(), ""); + columnHeader6.setVisible(false); + assertEquals(columnHeader6.getColSpanHtml(), " colspan=0"); + columnHeader6.getColumnTitleHtml(); + columnHeader6.setLinkColId(null); + columnHeader6.getColumnTitleHtml(); + assertEquals(columnHeader6.getStartGroup(), 1); + assertEquals(columnHeader6.getColSpanGroup(), 0); + columnHeader6.setAlignment(""); + } +} diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnVisualTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnVisualTest.java new file mode 100644 index 00000000..24693446 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ColumnVisualTest.java @@ -0,0 +1,54 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.view; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ColumnVisualTest { + @Test + public void mockColumnVisualTest() { + ColumnVisual ColumnVisual = new ColumnVisual("colId", "colDisplay", false, "sortType"); + assertEquals(ColumnVisual.getColId(), "colId"); + assertEquals(ColumnVisual.getColDisplay(), "colDisplay"); + assertEquals(ColumnVisual.getSortType(), "sortType"); + assertFalse(ColumnVisual.isVisible()); + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabColumnValuesTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabColumnValuesTest.java new file mode 100644 index 00000000..2a01b252 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabColumnValuesTest.java @@ -0,0 +1,67 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.view; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Matchers; +import org.mockito.Mockito; +import org.onap.portalsdk.analytics.system.ConnectionUtils; +import org.onap.portalsdk.analytics.util.DataSet; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(ConnectionUtils.class) +public class CrossTabColumnValuesTest { + + @Test + public void mockCrossTabColumnValuesTest() throws Exception + { + DataSet set = new DataSet(); + PowerMockito.mockStatic(ConnectionUtils.class); + Mockito.when(ConnectionUtils.getDataSet(Matchers.anyString(), Matchers.anyString())).thenReturn(set); + CrossTabColumnValues crossTabColumnValues= new CrossTabColumnValues("colId", "loadValuesSQL", "dbInfo"); + assertEquals(crossTabColumnValues.getColId(),"colId"); + assertEquals(crossTabColumnValues.getColumnValues().size(), 0); + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabOrderManagerTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabOrderManagerTest.java new file mode 100644 index 00000000..71d7dbca --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabOrderManagerTest.java @@ -0,0 +1,144 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.view; + +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Matchers; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.onap.portalsdk.analytics.controller.ActionHandler; +import org.onap.portalsdk.analytics.error.RaptorException; +import org.onap.portalsdk.analytics.model.base.ReportWrapper; +import org.onap.portalsdk.analytics.model.runtime.ReportRuntime; +import org.onap.portalsdk.analytics.system.AppUtils; +import org.onap.portalsdk.analytics.system.ConnectionUtils; +import org.onap.portalsdk.analytics.system.DbUtils; +import org.onap.portalsdk.analytics.system.Globals; +import org.onap.portalsdk.analytics.util.DataSet; +import org.onap.portalsdk.analytics.xmlobj.ChartAdditionalOptions; +import org.onap.portalsdk.analytics.xmlobj.CustomReportType; +import org.onap.portalsdk.analytics.xmlobj.DataColumnType; +import org.onap.portalsdk.analytics.xmlobj.DataSourceList; +import org.onap.portalsdk.analytics.xmlobj.DataSourceType; +import org.onap.portalsdk.analytics.xmlobj.MockitoTestSuite; +import org.onap.portalsdk.core.web.support.UserUtils; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({Globals.class,DbUtils.class, UserUtils.class, AppUtils.class} ) +public class CrossTabOrderManagerTest { + + @InjectMocks + ActionHandler actionHandler = new ActionHandler(); + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); + HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); + HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); + + @Test + public void mockCrossTabOrderManagerTest() throws Exception + { + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getReportUserAccess()).thenReturn("test"); + ResultSet rs = PowerMockito.mock(ResultSet.class); + ResultSetMetaData rsmd = PowerMockito.mock(ResultSetMetaData.class); + Mockito.when(rsmd.getColumnCount()).thenReturn(1); + Mockito.when(rs.getMetaData()).thenReturn(rsmd); + DataSet datset = PowerMockito.mock(DataSet.class); + // datset = new DataSet(rs); + Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset); + Mockito.when(Globals.getNewScheduleData()).thenReturn("test"); + CustomReportType customReportType = new CustomReportType(); + DataSourceList dataSourceList = new DataSourceList(); + List<DataSourceType> list = new ArrayList<>(); + DataSourceType dataSourceType = new DataSourceType(); + dataSourceType.setTableName("test"); + dataSourceType.setRefTableId("1"); + dataSourceType.setTableId("1"); + List<DataColumnType> dataColumnTypeList = new ArrayList<>(); + DataColumnType dataColumnType = new DataColumnType(); + dataColumnType.setChartGroup("test"); + dataColumnType.setYAxis("test"); + dataColumnType.setColName("[test"); + dataColumnType.setColOnChart("LEGEND"); + dataColumnType.setDisplayName("chart_total"); + dataColumnType.setColId("1"); + dataColumnType.setTableId("1"); + dataColumnType.setColType("DATE"); + dataColumnTypeList.add(dataColumnType); + customReportType.setReportType("test"); + customReportType.setReportTitle("test"); + customReportType.setDataSourceList(dataSourceList); + ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions(); + chartAdditionalOptions.setLabelAngle("test"); + chartAdditionalOptions.setTimeSeriesRender("test"); + chartAdditionalOptions.setMultiSeries(false); + customReportType.setChartAdditionalOptions(chartAdditionalOptions); + ReportWrapper reportWrapper = new ReportWrapper(customReportType, "-1", "test", "testId", "test", "test", "1", + "1", true); + PowerMockito.mockStatic(UserUtils.class); + Mockito.when(Globals.getRequestParams()).thenReturn("test"); + Mockito.when(Globals.getSessionParams()).thenReturn("test"); + Mockito.when(Globals.getSessionParamsForScheduling()).thenReturn("test"); + PowerMockito.mockStatic(AppUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test12"); + ReportRuntime rr = new ReportRuntime(reportWrapper, mockedRequest); + CrossTabOrderManager crossTabOrderManager= new CrossTabOrderManager(rr,"test",mockedRequest); + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabTotalValueTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabTotalValueTest.java new file mode 100644 index 00000000..69994c23 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/CrossTabTotalValueTest.java @@ -0,0 +1,49 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.view; + +import org.junit.Test; + +public class CrossTabTotalValueTest { + @Test + public void mockCrossTabTotalValueTest() + { + CrossTabTotalValue crossTabTotalValue = new CrossTabTotalValue(); + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataRowTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataRowTest.java new file mode 100644 index 00000000..05c5512b --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataRowTest.java @@ -0,0 +1,65 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.view; + +import static org.junit.Assert.*; + +import java.util.Vector; + +import org.junit.Test; + +public class DataRowTest { + + @Test + public void mockDataRowTest() { + DataRow dataRow = new DataRow(); + + DataValue dataValue = new DataValue(); + dataRow.setRowFormat(false); + HtmlFormatter formatter = new HtmlFormatter(); + dataRow.setRowFormatter(formatter); + dataRow.setRowNum(1); + Vector vc = new Vector<>(); + vc.add(dataRow); + dataRow.setRowValues(vc); + dataRow.setFormatId("test"); + assertEquals(dataRow.getFormatId(), "test"); + assertEquals(dataRow.getRowNum(), 1); + assertEquals(dataRow.getRowValues(), vc); + } +} diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java new file mode 100644 index 00000000..21197368 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java @@ -0,0 +1,90 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.view; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class DataValueTest { + + @Test + public void mockDataValueTest() { + DataValue dataValue = new DataValue(); + dataValue.setDisplayName("displayName"); + dataValue.setDisplayCalculatedValue("displayCalculatedValue"); + dataValue.setDrillDownURL("drillDownURL"); + dataValue.setDrillDowninPoPUp(false); + dataValue.setIndentation("indentation"); + dataValue.setAlignment("alignment"); + dataValue.setVisible(false); + dataValue.setHidden(false); + HtmlFormatter formatter = new HtmlFormatter(); + dataValue.setCellFormatter(formatter); + dataValue.setBold(false); + dataValue.setRowFormatter(formatter); + dataValue.setFormatId("formatId"); + dataValue.setCellFormat(false); + dataValue.setColId("colId"); + dataValue.setDisplayName("displayName"); + dataValue.setNowrap("nowrap"); + dataValue.setHyperlinkURL("hyperlinkURL"); + dataValue.setDisplayType("displayType"); + dataValue.setActionImg("actionImg"); + + assertEquals(dataValue.getDisplayName(), "displayName"); + assertEquals(dataValue.getDisplayCalculatedValue(), "displayCalculatedValue"); + assertEquals(dataValue.getDrillDownURL(), "drillDownURL"); + assertFalse(dataValue.isDrillDowninPoPUp()); + assertEquals(dataValue.getIndentation(), "indentation"); + assertEquals(dataValue.getAlignment(), "alignment"); + assertFalse(dataValue.isVisible()); + assertFalse(dataValue.isHidden()); + assertEquals(dataValue.getCellFormatter(), formatter); + assertEquals(dataValue.getRowFormatter(), formatter); + assertEquals(dataValue.getFormatId(), "formatId"); + assertFalse(dataValue.isBold()); + assertEquals(dataValue.getColId(), "colId"); + assertEquals(dataValue.getDisplayName(), "displayName"); + assertEquals(dataValue.getNowrap(), "nowrap"); + assertEquals(dataValue.getHyperlinkURL(), "hyperlinkURL"); + assertEquals(dataValue.getDisplayType(), "displayType"); + assertEquals(dataValue.getActionImg(), "actionImg"); + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/HtmlFormatterTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/HtmlFormatterTest.java new file mode 100644 index 00000000..a5a838a3 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/HtmlFormatterTest.java @@ -0,0 +1,117 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.view; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class HtmlFormatterTest { + + @Test + public void mockHtmlFormatterTest() { + HtmlFormatter HtmlFormatter = new HtmlFormatter(); + HtmlFormatter.setBold(false); + HtmlFormatter.setItalic(false); + HtmlFormatter.setUnderline(false); + HtmlFormatter.setBgColor("bgColor"); + HtmlFormatter.setFontColor("fontColor"); + HtmlFormatter.setFontFace("fontFace"); + HtmlFormatter.setFontSize("fontSize"); + HtmlFormatter.setAlignment("alignment"); + HtmlFormatter.setFormatId("formatId"); + + assertFalse(HtmlFormatter.isBold()); + assertFalse(HtmlFormatter.isItalic()); + assertFalse(HtmlFormatter.isUnderline()); + assertEquals(HtmlFormatter.getBgColor(), "bgColor"); + assertEquals(HtmlFormatter.getFontColor(), "fontColor"); + assertEquals(HtmlFormatter.getFontFace(), "fontFace"); + assertEquals(HtmlFormatter.getFontSize(), "fontSize"); + assertEquals(HtmlFormatter.getAlignment(), "alignment"); + assertEquals(HtmlFormatter.getFormatId(), "formatId"); + + } + + @Test + public void formatValueTest() { + HtmlFormatter HtmlFormatter1 = new HtmlFormatter(false, false, false, "bgColor", "fontColor", "fontFace", + "fontSize"); + HtmlFormatter1.formatValue("test"); + } + + @Test + public void formatValue1Test() { + HtmlFormatter htmlFormatter2 = new HtmlFormatter(true, true, true, "bgColor", "fontColor", "fontFace", + "fontSize", "alignment"); + htmlFormatter2.formatValue("test"); + } + + @Test + public void formatValue2Test() { + HtmlFormatter htmlFormatter2 = new HtmlFormatter(false, false, false, "", "", "", ""); + htmlFormatter2.formatValue("test"); + } + + @Test + public void formatLinkTest() { + HtmlFormatter htmlFormatter2 = new HtmlFormatter(false, false, false, "", "", "", ""); + htmlFormatter2.formatLink("test", "url", false); + } + + @Test + public void formatLink1Test() { + HtmlFormatter htmlFormatter2 = new HtmlFormatter(false, false, false, "", "", "", ""); + htmlFormatter2.formatLink("test", "url", true); + } + + @Test + public void generateStyleForZKTest() { + HtmlFormatter htmlFormatter2 = new HtmlFormatter(true, true, true, "bgColor", "fontColor", "fontFace", + "fontSize", "alignment"); + htmlFormatter2.generateStyleForZK(); + + } + + @Test + public void generateStyleForZK1Test() { + HtmlFormatter htmlFormatter2 = new HtmlFormatter(false, false, false, "", "", "", ""); + htmlFormatter2.generateStyleForZK(); + + } +} diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ReportColumnHeaderRowsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ReportColumnHeaderRowsTest.java new file mode 100644 index 00000000..e6b98298 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/ReportColumnHeaderRowsTest.java @@ -0,0 +1,54 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.view; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ReportColumnHeaderRowsTest { + + @Test + public void ReportColumnHeaderRowsTest() + { + ReportColumnHeaderRows reportColumnHeaderRows= new ReportColumnHeaderRows(); + reportColumnHeaderRows.resetNext(1); + assertFalse(reportColumnHeaderRows.hasNext()); + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java new file mode 100644 index 00000000..48dc5e12 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java @@ -0,0 +1,75 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.view; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class RowHeaderColTest { + + @Test + public void mockRowHeaderColTest() { + RowHeaderCol rowHeaderCol = new RowHeaderCol(); + rowHeaderCol.setColumnTitle("columnTitle"); + rowHeaderCol.setColumnWidth("columnWidth"); + rowHeaderCol.setAlignment("alignment"); + rowHeaderCol.setColId("colId"); + rowHeaderCol.setDisplayHeaderAlignment(null); + assertNull(rowHeaderCol.getDisplayHeaderAlignment()); + assertEquals(rowHeaderCol.getColId(), "colId"); + assertEquals(rowHeaderCol.getColumnTitle(), "columnTitle"); + assertEquals(rowHeaderCol.getColumnWidth(), "columnWidth"); + assertEquals(rowHeaderCol.getAlignment(), "alignment"); + assertEquals(rowHeaderCol.getColumnTitleHtml(), "columnTitle"); + assertEquals(rowHeaderCol.getColumnWidthHtml(), " width=columnWidth"); + assertEquals(rowHeaderCol.getAlignmentHtml(), " align=alignment"); + rowHeaderCol.resetNext(); + RowHeader rowHeader = new RowHeader(); + rowHeaderCol.addRowHeader(rowHeader); + rowHeaderCol.addRowHeader(1, rowHeader); + rowHeaderCol.setColumnTitle(""); + rowHeaderCol.setColumnWidth(""); + rowHeaderCol.setAlignment(""); + assertEquals(rowHeaderCol.getColumnTitleHtml(), " "); + assertEquals(rowHeaderCol.getColumnWidthHtml(), ""); + assertEquals(rowHeaderCol.getAlignmentHtml(), " align=center"); + + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java new file mode 100644 index 00000000..2cc01aba --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java @@ -0,0 +1,60 @@ + +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */package org.onap.portalsdk.analytics.view; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class RowHeaderTest { + + @Test + public void mockRowHeaderTest() { + RowHeader rowHeader = new RowHeader(); + rowHeader.setRowTitle("rowTitle"); + rowHeader.setRowHeight("rowHeight"); + rowHeader.setRowSpan(1); + rowHeader.setColSpan(1); + rowHeader.setBold(false); + assertEquals(rowHeader.getRowTitle(), "rowTitle"); + assertEquals(rowHeader.getRowHeight(), "rowHeight"); + assertEquals(rowHeader.getRowSpan(), 1); + assertEquals(rowHeader.getColSpan(), 1); + assertFalse(rowHeader.isBold()); + } +} |