c6256b0e4d65379fa126026445e8e79897eca967
[portal/sdk.git] /
1 /*
2  * ============LICENSE_START==========================================
3  * ONAP Portal SDK
4  * ===================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the "License");
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
37  */
38 package org.onap.portalsdk.analytics.xmlobj;
39
40 import static org.junit.Assert.*;
41
42 import org.junit.Test;
43 import org.onap.portalsdk.analytics.xmlobj.CustomReportType;
44 import org.onap.portalsdk.analytics.xmlobj.PDFAdditionalOptions;
45
46 public class CustomReportTypeTest {
47
48         public CustomReportType mockCustomReportType()
49         {
50                 CustomReportType customReportType = new CustomReportType();
51                 customReportType.setReportName("test");
52                 customReportType.setReportDescr("desc");
53                 customReportType.setNumDashCols("testcols");
54                 customReportType.setDashboardLayoutHTML("layout");
55                 customReportType.setDbInfo("db");
56                 customReportType.setDbType("testType");
57                 customReportType.setChartType("chartType");
58                 customReportType.setChartTypeFixed("fixed");
59                 customReportType.setChartMultiSeries("series");
60                 customReportType.setChartLeftAxisLabel("leftAxis");
61                 customReportType.setChartRightAxisLabel("rightAxis");
62                 customReportType.setChartWidth("width");
63                 customReportType.setChartHeight("height");
64                 customReportType.setShowChartTitle(false);
65                 customReportType.setPublic(false);
66                 customReportType.setHideFormFieldAfterRun(false);
67                 customReportType.setCreateId("id");
68                 customReportType.setCreateDate(null);
69                 customReportType.setReportSQL("report");
70                 customReportType.setReportTitle("title");
71                 customReportType.setReportSubTitle("subtitle");
72                 customReportType.setReportHeader("header");
73                 customReportType.setFrozenColumns(1);
74                 customReportType.setPdfImgLogo("logo");
75                 customReportType.setEmptyMessage("message");
76                 customReportType.setWidthNoColumn("widthNoColumn");
77                 customReportType.setDataGridAlign("grid");
78                 customReportType.setReportFooter("footer");
79                 customReportType.setNumFormCols("numForm");
80                 customReportType.setDisplayOptions("dsiplay");
81                 customReportType.setJumpTo(1);
82                 customReportType.setSearchPageSize(1);
83                 customReportType.setNavPosition("position");
84                 customReportType.setToggleLayout(false);
85                 customReportType.setPageNav(false);
86                 customReportType.setShowPageSize(false);
87                 customReportType.setShowNavPos(false);
88                 customReportType.setShowGotoOption(false);
89                 customReportType.setDataContainerHeight("containerHeight");
90                 customReportType.setDataContainerWidth("containerWidth");
91                 customReportType.setAllowSchedule("schedule");
92                 customReportType.setMultiGroupColumn("multiGroups");
93                 customReportType.setTopDown("topDown");
94                 customReportType.setSizedByContent("content");
95                 customReportType.setComment("comment");
96                 customReportType.setDataSourceList(null);
97                 customReportType.setFormFieldList(null);
98                 customReportType.setJavascriptList(null);
99                 customReportType.setSemaphoreList(null);
100                 customReportType.setDashboardOptions("dashboardOptions");
101                 customReportType.setDashboardType(false);
102                 customReportType.setReportInNewWindow(false);
103                 customReportType.setDisplayFolderTree(false);
104                 customReportType.setMaxRowsInExcelDownload(1);
105                 customReportType.setDashBoardReports(null);
106                 customReportType.setDashBoardReportsNew(null);
107                 customReportType.setChartAdditionalOptions(null);
108                 customReportType.setPdfAdditionalOptions(null);
109                 customReportType.setChartDrillOptions(null);
110                 customReportType.setDataminingOptions(null);
111                 customReportType.setJavascriptElement("js");
112                 customReportType.setFolderId("folderId");    
113             customReportType.setDrillURLInPoPUpPresent(false);
114             customReportType.setIsOneTimeScheduleAllowed("false");
115             customReportType.setIsHourlyScheduleAllowed("no");
116             customReportType.setIsDailyScheduleAllowed("no");
117             customReportType.setIsDailyMFScheduleAllowed("no");
118             customReportType.setIsWeeklyScheduleAllowed("no");
119             customReportType.setIsMonthlyScheduleAllowed("no");
120             customReportType.setReportMap(null);
121             customReportType.setPageSize(1);
122             customReportType.setReportType("test");
123                 return customReportType;
124         }
125         
126         @Test
127         public void customReportTypeTest()
128         {
129                 CustomReportType customReportType = mockCustomReportType();
130
131        assertEquals(customReportType.getReportName(),"test");
132        assertEquals(customReportType.getReportDescr(),"desc");
133        assertEquals(customReportType.getNumDashCols(),"testcols");
134        assertEquals(customReportType.getDashboardLayoutHTML(),"layout");
135        assertEquals(customReportType.getDbInfo(),"db");
136        assertEquals(customReportType.getDbType(),"testType");
137        assertEquals(customReportType.getChartType(),"chartType");
138        assertEquals(customReportType.getChartTypeFixed(),"fixed");
139        assertEquals(customReportType.getChartMultiSeries(),"series");
140        assertEquals(customReportType.getChartLeftAxisLabel(),"leftAxis");
141        assertEquals(customReportType.getChartRightAxisLabel(),"rightAxis");
142        assertEquals(customReportType.getChartWidth(),"width");
143        assertEquals(customReportType.getChartHeight(),"height");
144        assertEquals(customReportType.isShowChartTitle(), false);
145        assertEquals(customReportType.isPublic(),false);
146        assertEquals(customReportType.isHideFormFieldAfterRun(),false);
147        assertEquals(customReportType.getCreateId(),"id");
148        assertEquals(customReportType.getCreateDate(),null);
149        assertEquals(customReportType.getReportSQL(),"report");
150        assertEquals(customReportType.getReportTitle(),"title");
151        assertEquals(customReportType.getReportSubTitle(),"subtitle");
152        assertEquals(customReportType.getReportHeader(),"header");
153        assertTrue(customReportType.getFrozenColumns() == 1);
154        assertEquals(customReportType.getPdfImgLogo(),"logo");
155        assertEquals(customReportType.getEmptyMessage(),"message");
156        assertEquals(customReportType.getWidthNoColumn(),"widthNoColumn");
157        assertEquals(customReportType.getDataGridAlign(),"grid");
158        assertEquals(customReportType.getReportFooter(),"footer");
159        assertEquals(customReportType.getNumFormCols(),"numForm");
160        assertEquals(customReportType.getDisplayOptions(),"dsiplay");
161        assertTrue(customReportType.getJumpTo()==1);
162        assertTrue(customReportType.getSearchPageSize()==1);
163        assertEquals(customReportType.getNavPosition(),"position");
164        assertEquals(customReportType.isToggleLayout(),false);
165        assertEquals(customReportType.isPageNav(),false);
166        assertEquals(customReportType.isShowPageSize(),false);
167        assertEquals(customReportType.isShowNavPos(),false);
168        assertEquals(customReportType.isShowGotoOption(),false);
169        assertEquals(customReportType.getDataContainerHeight(),"containerHeight");
170        assertEquals(customReportType.getDataContainerWidth(),"containerWidth");
171        assertEquals(customReportType.getAllowSchedule(),"schedule");
172        assertEquals(customReportType.getMultiGroupColumn(),"multiGroups");
173        assertEquals(customReportType.getTopDown(),"topDown");
174        assertEquals(customReportType.getSizedByContent(),"content");
175        assertEquals(customReportType.getComment(),"comment");
176        assertEquals(customReportType.getDataSourceList(),null);
177        assertEquals(customReportType.getFormFieldList(),null);
178        assertEquals(customReportType.getJavascriptList(),null);
179        assertEquals(customReportType.getSemaphoreList(),null);
180        assertEquals(customReportType.getDashboardOptions(),"dashboardOptions");
181        assertEquals(customReportType.isDashboardType(),false);
182        assertEquals(customReportType.isReportInNewWindow(),false);
183        assertEquals(customReportType.isDisplayFolderTree(),false);
184        assertTrue(customReportType.getMaxRowsInExcelDownload() ==1);
185        assertEquals(customReportType.getDashBoardReports(),null);
186        assertEquals(customReportType.getDashBoardReportsNew(),null);
187        assertEquals(customReportType.getChartAdditionalOptions(),null);
188        assertEquals(customReportType.getChartDrillOptions(),null);
189        assertEquals(customReportType.getDataminingOptions(),null);
190        assertEquals(customReportType.getJavascriptElement(),"js");
191        assertEquals(customReportType.getFolderId(),"folderId");    
192        assertEquals(customReportType.isDrillURLInPoPUpPresent(),false);
193        assertEquals(customReportType.getIsOneTimeScheduleAllowed(),"false");
194        assertEquals(customReportType.getIsHourlyScheduleAllowed(),"no");
195        assertEquals(customReportType.getIsDailyScheduleAllowed(),"no");
196        assertEquals(customReportType.getIsDailyMFScheduleAllowed(),"no");
197        assertEquals(customReportType.getIsWeeklyScheduleAllowed(),"no");
198        assertEquals(customReportType.getIsMonthlyScheduleAllowed(),"no");
199        assertEquals(customReportType.getReportMap(),null);
200        assertTrue(customReportType.getPageSize()==1);
201        assertEquals(customReportType.getReportType(),"test");
202        PDFAdditionalOptions  pDFAdditionalOptions = customReportType.getPdfAdditionalOptions();
203        assertNull(pDFAdditionalOptions);
204         }
205
206 }