837c2c32b5535de3cea62701cb9faddb76c08ed4
[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
39 package org.onap.portalsdk.analytics.controller;
40
41
42 import static org.junit.Assert.*;
43 import java.sql.ResultSet;
44 import java.sql.ResultSetMetaData;
45 import java.util.ArrayList;
46 import java.util.List;
47 import javax.servlet.ServletContext;
48 import javax.servlet.http.HttpServletRequest;
49 import javax.servlet.http.HttpSession;
50 import org.onap.portalsdk.analytics.system.fusion.AppUtils;
51
52 import org.junit.Before;
53 import org.junit.Test;
54 import org.junit.runner.RunWith;
55 import org.mockito.Mock;
56 import org.mockito.Mockito;
57 import org.mockito.invocation.InvocationOnMock;
58 import org.mockito.stubbing.Answer;
59 import org.onap.portalsdk.analytics.model.ReportHandler;
60 import org.onap.portalsdk.analytics.model.base.ReportSecurity;
61 import org.onap.portalsdk.analytics.model.definition.ReportDefinition;
62 import org.onap.portalsdk.analytics.model.definition.ReportSchedule;
63 import org.onap.portalsdk.analytics.model.runtime.ReportRuntime;
64 import org.onap.portalsdk.analytics.system.DbUtils;
65 import org.onap.portalsdk.analytics.system.Globals;
66 import org.onap.portalsdk.analytics.system.IAppUtils;
67 import org.onap.portalsdk.analytics.util.AppConstants;
68 import org.onap.portalsdk.analytics.util.DataSet;
69 import org.onap.portalsdk.analytics.xmlobj.ChartAdditionalOptions;
70 import org.onap.portalsdk.analytics.xmlobj.ChartDrillFormfield;
71 import org.onap.portalsdk.analytics.xmlobj.ChartDrillOptions;
72 import org.onap.portalsdk.analytics.xmlobj.ColFilterType;
73 import org.onap.portalsdk.analytics.xmlobj.DataColumnType;
74 import org.onap.portalsdk.analytics.xmlobj.DataSourceType;
75 import org.onap.portalsdk.analytics.xmlobj.FormFieldType;
76 import org.onap.portalsdk.analytics.xmlobj.JavascriptItemType;
77 import org.onap.portalsdk.analytics.xmlobj.ReportMap;
78 import org.onap.portalsdk.analytics.xmlobj.SemaphoreList;
79 import org.onap.portalsdk.analytics.xmlobj.SemaphoreType;
80 import org.onap.portalsdk.core.domain.User;
81 import org.owasp.esapi.ESAPI;
82 import org.owasp.esapi.Encoder;
83 import org.powermock.api.mockito.PowerMockito;
84 import org.powermock.core.classloader.annotations.PrepareForTest;
85 import org.powermock.modules.junit4.PowerMockRunner;
86
87 @RunWith(PowerMockRunner.class)
88 @PrepareForTest({DbUtils.class, Globals.class, IAppUtils.class, WizardProcessor.class, ESAPI.class})
89 public class WizardProcessorTest {
90
91         WizardProcessor wizardProcessor;
92         
93         @Mock
94         HttpServletRequest httpServletRequest;
95         
96         @Mock
97         ServletContext servletContext;
98         
99         @Mock
100         HttpSession httpSession;
101
102         @Mock
103         AppUtils appUtils;
104         
105         @Mock
106         ReportRuntime reportRuntime;
107
108         @Mock 
109         ReportHandler reportHandler;
110         
111         @Mock
112         ReportDefinition reportDefinition;
113
114         @Mock
115         WizardSequence wizardSequence;
116
117         @Mock
118         DataSet dataSet;
119
120         @Mock
121         DataSet dataSet1;
122
123         @Mock
124         DataSet dataSet2;
125         
126         @Mock
127         ResultSet resultSet;
128         
129         @Mock
130         ResultSetMetaData resultSetMetaData;
131         
132         @Mock
133         ReportSchedule reportSchedule;
134         
135         @Mock
136         User user;
137         
138         @Mock
139         ReportSecurity reportSecurity;
140         
141         @Mock
142         Encoder encoder;
143         
144         private String REPORT_ID="1000"; 
145         private String DETAIL_ID="3000";
146
147         @Before
148     public void init() throws Exception {
149                 
150                 PowerMockito.mockStatic(DbUtils.class);
151                 PowerMockito.mockStatic(Globals.class);
152                 PowerMockito.mockStatic(IAppUtils.class);
153                 PowerMockito.mockStatic(ESAPI.class);
154                 
155                 Mockito.when(httpServletRequest.getSession()).thenReturn(httpSession);
156
157                 Mockito.when(httpSession.getAttribute(AppConstants.SI_REPORT_DEFINITION)).thenReturn(reportDefinition);
158                 Mockito.when(httpSession.getAttribute(AppConstants.SI_REPORT_SCHEDULE)).thenReturn(reportSchedule);
159                 Mockito.when(httpSession.getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(reportRuntime);
160                 
161                 PowerMockito.when(ESAPI.encoder()).thenReturn(encoder);
162                 
163                 PowerMockito.whenNew(ReportHandler.class).withNoArguments().thenReturn(reportHandler);
164
165                 PowerMockito.when(Globals.getAppUtils()).thenReturn(appUtils);
166                 
167                 Mockito.when(reportHandler.loadReportDefinition(httpServletRequest, REPORT_ID)).thenReturn(reportDefinition);
168
169                 Mockito.when(reportHandler.loadReportRuntime(httpServletRequest, REPORT_ID, false)).thenReturn(reportRuntime);
170                 
171                 Mockito.when(reportDefinition.getWizardSequence()).thenReturn(wizardSequence);
172                 Mockito.when(reportDefinition.getReportSchedule()).thenReturn(reportSchedule);
173                 
174                 Mockito.when(reportRuntime.getReportID()).thenReturn(REPORT_ID);
175                 
176                 Mockito.when(reportDefinition.getReportID()).thenReturn(REPORT_ID);
177
178                 Mockito.when(appUtils.getUserID(httpServletRequest)).thenReturn("USER1");
179
180                 
181                 wizardProcessor = Mockito.spy(WizardProcessor.class);
182         }
183
184         
185         private void mockHttpAttribute(String attributeName, String attributeValue) {
186                 Mockito.when(httpServletRequest.getAttribute(attributeName)).thenReturn(attributeValue);
187         }
188         
189         private void mockHttpParameter(String parameterName, String parameterValue) {
190                 Mockito.when(httpServletRequest.getParameter(parameterName)).thenReturn(parameterValue);
191         }
192         
193         private void mockHttpParameterValues(String parameterName, String[] parameterValue) {
194                 Mockito.when(httpServletRequest.getParameterValues(parameterName)).thenReturn(parameterValue);
195         }       
196
197         
198         @Test
199         public void testWizardProcessor() {
200                 WizardProcessor wizardProcessorLocal = new WizardProcessor();
201                 assertNotNull(wizardProcessorLocal);
202         }
203
204         
205         @Test(expected=NullPointerException.class)
206         public void testPersistReportDefinition_null_arguments() throws Exception {
207                 wizardProcessor.persistReportDefinition(null, null);
208         }
209
210         @Test(expected=NullPointerException.class)
211         public void testPersistReportDefinition_null_arguments_case1() throws Exception {
212                 wizardProcessor.persistReportDefinition(httpServletRequest, null);
213         }
214
215         @Test(expected=NullPointerException.class)
216         public void testPersistReportDefinition_null_arguments_case2() throws Exception {
217                 wizardProcessor.persistReportDefinition(httpServletRequest, null);
218         }
219
220         @Test(expected=NullPointerException.class)
221         public void testPersistReportDefinition_null_arguments_case3() throws Exception {
222                 wizardProcessor.persistReportDefinition(httpServletRequest, null);
223         }
224
225         @Test
226         public void testPersistReportDefinition_not_null_arguments_case1() throws Exception {
227                 wizardProcessor.persistReportDefinition(httpServletRequest, reportDefinition);
228         }
229         
230         @Test
231         public void testPersistReportDefinition_not_null_arguments_case2() throws Exception {
232                 wizardProcessor.persistReportDefinition(httpServletRequest, reportDefinition);
233         }
234         
235         @Test(expected=NullPointerException.class)
236         public void testProcessWizardStep_null_arguments_case1() throws Exception {
237                 wizardProcessor.processWizardStep(null);
238         }
239         
240         @Test(expected=Exception.class)
241         public void testProcessWizardStep_not_null_arguments_case1() throws Exception {
242                 wizardProcessor.processWizardStep(httpServletRequest);
243         }
244         
245         @Test(expected=Exception.class)
246         public void testProcessWizardStep_not_null_arguments_case2() throws Exception {
247                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION,null);
248                 wizardProcessor.processWizardStep(httpServletRequest);
249         }
250
251         @Test(expected=Exception.class)
252         public void testProcessWizardStep_not_null_arguments_case3() throws Exception {
253                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION,"NA");
254                 wizardProcessor.processWizardStep(httpServletRequest);
255         }
256         
257         @Test
258         public void testProcessWizardStep_not_null_arguments_case4() throws Exception {
259                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.RI_ACTION);
260                 mockHttpAttribute(AppConstants.RI_REPORT_ID, REPORT_ID);
261                 mockHttpAttribute("showDashboardOptions","");
262
263                 setWizardSteps("NA", "NA");
264
265                 wizardProcessor.processWizardStep(httpServletRequest);
266                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
267         }
268         
269         @Test
270         public void testProcessWizardStep_processDefinition_Dashboard_case1() throws Exception {
271                 
272                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.RI_ACTION);
273                 mockHttpAttribute(AppConstants.RI_REPORT_ID, REPORT_ID);
274                 mockHttpAttribute("showDashboardOptions","");
275                 mockHttpAttribute("folder_id","2000");
276                 mockHttpAttribute("reportType",AppConstants.RT_DASHBOARD);
277                 
278                 setWizardSteps(AppConstants.WS_DEFINITION, "NA");
279
280                 mockHttpAttribute("reportName", "Report One");
281                 mockHttpAttribute("reportDescr","Report One help for testing...");
282                 
283                 mockHttpAttribute("allowSchedule","");
284                 mockHttpAttribute("multiGroupColumn","");
285                 mockHttpAttribute("topDown","");
286                 mockHttpAttribute("sizedByContent","");
287                 
288                 mockHttpAttribute("isOneTimeScheduleAllowed","");
289                 mockHttpAttribute("isHourlyScheduleAllowed","");
290                 mockHttpAttribute("isDailyScheduleAllowed","");
291                 mockHttpAttribute("isDailyMFScheduleAllowed","");
292                 mockHttpAttribute("isWeeklyScheduleAllowed","");
293                 mockHttpAttribute("isMonthlyScheduleAllowed","");               
294
295                 mockHttpAttribute("dashboardLayoutHTML","<html>dashboardLayoutHtml</html>");            
296                 mockHttpAttribute("heightContainer","");                
297                 mockHttpAttribute("widthContainer","");         
298                 
299                 wizardProcessor.processWizardStep(httpServletRequest);
300                                 
301                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
302         }
303         
304         
305         @Test
306         public void testProcessWizardStep_processDefinition_Dashboard_case2() throws Exception {
307                 
308                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.RI_ACTION);
309                 mockHttpAttribute(AppConstants.RI_REPORT_ID, REPORT_ID);
310                 mockHttpAttribute("showDashboardOptions","Y");
311                 mockHttpAttribute("folder_id","2000");
312                 mockHttpAttribute("reportType",AppConstants.RT_DASHBOARD);
313                 
314                 setWizardSteps(AppConstants.WS_DEFINITION, "NA");
315
316                 mockHttpAttribute("reportName", "Report One");
317                 
318                 String reportDescr = "Report One help for testing. ";
319                 
320                 while (reportDescr.length() <1000) {
321                         reportDescr += reportDescr;
322                 }
323                 
324                 mockHttpAttribute("reportDescr", reportDescr);
325                 
326                 mockHttpAttribute("allowSchedule","Y");
327                 mockHttpAttribute("multiGroupColumn","Y");
328                 mockHttpAttribute("topDown","Y");
329                 mockHttpAttribute("sizedByContent","Y");
330                 
331                 mockHttpAttribute("isOneTimeScheduleAllowed","Y");
332                 mockHttpAttribute("isHourlyScheduleAllowed","Y");
333                 mockHttpAttribute("isDailyScheduleAllowed","Y");
334                 mockHttpAttribute("isDailyMFScheduleAllowed","Y");
335                 mockHttpAttribute("isWeeklyScheduleAllowed","Y");
336                 mockHttpAttribute("isMonthlyScheduleAllowed","Y");              
337
338                 mockHttpAttribute("dashboardLayoutHTML","<html>dashboardLayoutHtml</html>");            
339                 mockHttpAttribute("heightContainer","auto");            
340                 mockHttpAttribute("widthContainer","auto");             
341                 
342                 wizardProcessor.processWizardStep(httpServletRequest);
343                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
344
345         }
346                 
347         
348         private void setWizardSteps(String currentStep, String currentSubStep) {
349                 Mockito.when(wizardSequence.getCurrentStep()).thenReturn(currentStep);
350                 Mockito.when(wizardSequence.getCurrentSubStep()).thenReturn(currentSubStep);
351         }
352
353         @Test
354         public void testProcessWizardStep_processDefinition_Crosstab_case1() throws Exception {
355                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.RI_ACTION);
356                 mockHttpAttribute(AppConstants.RI_REPORT_ID, REPORT_ID);
357                 mockHttpAttribute("showDashboardOptions","");
358                 mockHttpAttribute("folder_id","2000");
359                 mockHttpAttribute("reportType",AppConstants.RT_CROSSTAB);
360                 
361                 setWizardSteps(AppConstants.WS_DEFINITION, "NA");
362                 
363                 mockHttpAttribute("reportName","Report One");
364                 mockHttpAttribute("reportDescr","Report One help for testing...");
365                 
366                 mockHttpAttribute("allowSchedule","N");
367                 mockHttpAttribute("multiGroupColumn","N");
368                 mockHttpAttribute("topDown","N");
369                 mockHttpAttribute("sizedByContent","N");
370                 
371                 mockHttpAttribute("isOneTimeScheduleAllowed","N");
372                 mockHttpAttribute("isHourlyScheduleAllowed","N");
373                 mockHttpAttribute("isDailyScheduleAllowed","N");
374                 mockHttpAttribute("isDailyMFScheduleAllowed","N");
375                 mockHttpAttribute("isWeeklyScheduleAllowed","N");
376                 mockHttpAttribute("isMonthlyScheduleAllowed","N");              
377
378                 mockHttpAttribute("widthNo","500px");
379                 mockHttpAttribute("dataGridAlign","right");
380                 mockHttpAttribute("pdfImg","/onap-portal/images");
381                 mockHttpAttribute("emptyMessage","empty");
382                 mockHttpAttribute("formHelp","refer help option in onap portal");
383                 mockHttpAttribute("excelDownloadSize","1024");
384                 mockHttpAttribute("reportInNewWindow","N");
385                 
386                 mockHttpAttribute("hideFormFieldsAfterRun","N");
387                 mockHttpAttribute("reportInNewWindow","N");
388                 mockHttpAttribute("displayFolderTree","N");
389                 mockHttpAttribute("pageSize","100");
390                 mockHttpAttribute("menuApproved","N");
391
392                 String [] menuIds = {"30001", "3002", "3003", "3004"};          
393                 
394                 mockHttpParameterValues("menuID", menuIds);
395
396                 mockHttpAttribute("runtimeColSortDisabled","N");
397                 mockHttpAttribute("reportDefType","N");
398                 mockHttpAttribute("heightContainer","N");
399                 mockHttpAttribute("widthContainer","N");
400                 mockHttpAttribute("hideForm","N");
401                 mockHttpAttribute("hideChart","N");
402                 mockHttpAttribute("hideData","N");
403                 mockHttpAttribute("hideBtns","N");
404                 
405                 mockHttpAttribute("hideMap","N");
406                 mockHttpAttribute("hideExcelIcons","N");
407                 mockHttpAttribute("hidePDFIcons","N");
408                 
409                 mockHttpAttribute("dataSource","org.att.onap.DataSource");
410                 
411                 mockHttpAttribute("numFormCols","10");
412                 mockHttpAttribute("reportTitle","ONAP Portal User Report");
413                 mockHttpAttribute("reportSubTitle","");
414                 
415                 mockHttpAttribute("reportHeader","");
416                 mockHttpAttribute("reportFooter","");
417                 mockHttpAttribute("frozenColumns","10");
418                 
419                 PowerMockito.when(Globals.getDBType()).thenReturn("oracle");
420                 
421                 String sql = "SELECT a.SCHEMA_ID, a.SCHEMA_DESC, DATASOURCE_TYPE  FROM SCHEMA_INFO a where schema_id = '[schema_id]'";
422                 PowerMockito.when(Globals.getDBType()).thenReturn("oracle");
423                 PowerMockito.when(Globals.getRemoteDbSchemaSqlWithWhereClause()).thenReturn(sql);
424
425                 PowerMockito.when(DbUtils.executeQuery(Mockito.anyString())).thenReturn(dataSet);
426
427                 Mockito.when(dataSet.getRowCount()).thenReturn(2);
428                 Mockito.when(dataSet.getItem(Mockito.anyInt(), Mockito.anyInt())).thenReturn("oracle12c");
429                 
430                 wizardProcessor.processWizardStep(httpServletRequest);
431
432                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
433         }
434
435         @Test
436         public void testProcessWizardStep_processValidateSQL_case1() throws Exception {
437                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_VALIDATE);
438                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
439                 mockHttpAttribute("showDashboardOptions","Option 1");
440                 mockHttpAttribute("folder_id","2000");
441                 
442                 setWizardSteps(AppConstants.WS_SQL, "NA");
443                 
444                 mockHttpAttribute("reportSQL","SELECT  [colNames.toString()] FROM ( [reportSQL]");
445                 wizardProcessor.processWizardStep(httpServletRequest);
446         }
447
448         @Test
449         public void testProcessWizardStep_processDefinition_processValidateSQL_case2() throws Exception {
450                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_VALIDATE);
451                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
452                 mockHttpAttribute("showDashboardOptions","");
453                 mockHttpAttribute("folder_id","2000");
454                 
455                 setWizardSteps(AppConstants.WS_SQL, "NA");
456                                 
457                 mockHttpAttribute("reportSQL","SELECT  [colNames.toString()] FROM ( [reportSQL]");
458                 wizardProcessor.processWizardStep(httpServletRequest);
459
460                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
461         }
462
463                 
464         @Test
465         public void testProcessWizardStep_processTableAdd_case1() throws Exception {
466                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_VALIDATE);
467                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
468                 mockHttpAttribute("showDashboardOptions","");
469                 mockHttpAttribute("folder_id","20001");
470                 
471                 setWizardSteps(AppConstants.WS_TABLES, AppConstants.WSS_ADD);
472                 
473                 Mockito.when(reportHandler.loadReportDefinition(httpServletRequest, "10001")).thenReturn(reportDefinition);
474
475                 mockHttpAttribute("reportSQL","SELECT  [colNames.toString()] FROM ( [reportSQL]");
476
477                 mockHttpAttribute("tableName","cr_report_access crc");
478                 mockHttpAttribute("joinTableName","cr_report cr");
479                 mockHttpAttribute("joinExpr","crc.rep_id = cr.rep_id");
480                 mockHttpAttribute("tablePK","crc.rep_id");
481                 mockHttpAttribute("displayName","Report Access");
482                 mockHttpAttribute("outerJoin"," ");
483                 
484                 wizardProcessor.processWizardStep(httpServletRequest);
485
486                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
487         }
488
489         @Test
490         public void testProcessWizardStep_processTableAdd_case2() throws Exception {
491                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_VALIDATE);
492                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
493
494                 mockHttpAttribute("showDashboardOptions","");
495                 mockHttpAttribute("folder_id","2000");
496                 
497                 DataSourceType dataSourceType = new DataSourceType();
498                 dataSourceType.setRefTableId("reportaccess");
499                 dataSourceType.setTableName("cr_report_access crc");
500                 
501                 Mockito.when(reportDefinition.getTableById(Mockito.anyString())).thenReturn(dataSourceType);
502                 
503                 setWizardSteps(AppConstants.WS_TABLES, AppConstants.WSS_ADD);
504
505                 
506                 mockHttpAttribute("reportSQL","SELECT  [colNames.toString()] FROM ( [reportSQL]");
507                 mockHttpAttribute("tableName","cr_report_access crc");
508                 mockHttpAttribute("joinTableName","cr_report cr");
509                 mockHttpAttribute("joinExpr","crc.rep_id = cr.rep_id");
510                 mockHttpAttribute("tablePK","crc.rep_id");
511                 mockHttpAttribute("displayName","Report Access");
512                 mockHttpAttribute("outerJoin"," ");
513                 
514                 wizardProcessor.processWizardStep(httpServletRequest);
515
516                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
517         }
518         
519         
520         @Test
521         public void testProcessWizardStep_processTableEdit_case1() throws Exception {
522
523                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_VALIDATE);
524                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
525                 mockHttpAttribute("showDashboardOptions","");
526                 mockHttpAttribute(AppConstants.RI_DETAIL_ID, DETAIL_ID);
527                 
528                 DataSourceType dataSourceType = new DataSourceType();
529                 dataSourceType.setTableId("reportaccess");
530                 dataSourceType.setTableName("cr_report_access crc");
531                 Mockito.when(reportDefinition.getTableById(Mockito.anyString())).thenReturn(dataSourceType);
532
533                 Mockito.when(reportDefinition.getTableByDBName(Mockito.anyString())).thenReturn(dataSourceType);
534
535                 setWizardSteps(AppConstants.WS_TABLES, AppConstants.WSS_EDIT);
536
537                 mockHttpAttribute("reportSQL","SELECT  [colNames.toString()] FROM ( [reportSQL]");
538
539                 mockHttpAttribute("tableName","cr_report_access crc");
540                 mockHttpAttribute("joinTableName","cr_report cr");
541                 mockHttpAttribute("joinExpr","crc.rep_id = cr.rep_id");
542                 mockHttpAttribute("tablePK","crc.rep_id");
543                 mockHttpAttribute("displayName","Report Access");
544                 mockHttpAttribute("outerJoin"," ");
545                                 
546                 wizardProcessor.processWizardStep(httpServletRequest);
547         
548                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);        
549         }
550         
551
552         @Test
553         public void testProcessWizardStep_processTableDelete_case1() throws Exception {
554
555                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_VALIDATE);
556                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
557                 mockHttpAttribute("showDashboardOptions","");
558                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
559
560                 setWizardSteps(AppConstants.WS_TABLES, AppConstants.WA_DELETE);
561
562                 DataSourceType dataSourceType = new DataSourceType();
563                 dataSourceType.setTableId("reportaccess");
564                 dataSourceType.setTableName("cr_report_access crc");
565
566                 Mockito.when(reportDefinition.getTableById(Mockito.anyString())).thenReturn(dataSourceType);
567                 Mockito.when(reportDefinition.getTableByDBName(Mockito.anyString())).thenReturn(dataSourceType);
568
569                 wizardProcessor.processWizardStep(httpServletRequest);
570
571                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
572         }
573
574
575         
576         @Test
577         public void testProcessWizardStep_processColumnAddEdit_case1() throws Exception {
578                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_VALIDATE);
579                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
580                 mockHttpAttribute("showDashboardOptions","");
581                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
582                 
583                 setWizardSteps(AppConstants.WS_COLUMNS, AppConstants.WSS_ADD);
584                 
585                 DataSourceType dataSourceType = new DataSourceType();
586                 dataSourceType.setTableId("reportaccess");
587                 dataSourceType.setTableName("cr_report_access crc");
588
589                 Mockito.when(reportDefinition.getTableById(Mockito.anyString())).thenReturn(dataSourceType);
590                 Mockito.when(reportDefinition.getTableByDBName(Mockito.anyString())).thenReturn(dataSourceType);
591                 
592                 wizardProcessor.processWizardStep(httpServletRequest);
593
594                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
595         }
596         
597         
598
599         @Test
600         public void testProcessWizardStep_processColumnAddEdit_case2() throws Exception {
601                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_VALIDATE);
602                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
603                 mockHttpAttribute("showDashboardOptions","");
604                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
605
606                 setWizardSteps(AppConstants.WS_COLUMNS, AppConstants.WSS_EDIT);
607                 
608                 Mockito.when(reportDefinition.getReportType()).thenReturn(AppConstants.RT_CROSSTAB);
609                 Mockito.when(reportDefinition.getReportDefType()).thenReturn(AppConstants.RD_SQL_BASED);
610                 
611                 DataColumnType dataColumnType = new DataColumnType();
612                 
613                 dataColumnType.setTableId("reportaccess");
614                 dataColumnType.setDbColName("rep_id");
615                 dataColumnType.setColName("rep_id");
616                 dataColumnType.setDbColType("integer");
617                 
618                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
619                 
620                 mockHttpAttribute("columnDetails","reportaccess|rep_id|integer");
621                 mockHttpAttribute("exprFormula","COUNT(*)");
622                 mockHttpAttribute("displayWidth","500");
623                 mockHttpAttribute("drillDownParams"," [this] ");
624                 mockHttpAttribute("visible", "true");
625                 mockHttpAttribute("sortable", "true");
626                 mockHttpAttribute("nowrap", "Yes");
627                 mockHttpAttribute("indentation", "100");
628                 mockHttpAttribute("dependsOnFormField", "100");
629                 mockHttpAttribute("groupBreak", "true");
630                 mockHttpAttribute("groupByPos", "1");
631                 mockHttpAttribute("subTotalCustomText", "");
632                 mockHttpAttribute("hideRepeatedKeys", "true");
633                 mockHttpAttribute("displayTotal", "100");
634                 mockHttpAttribute("widthInPxls", "500");
635                 mockHttpAttribute("crossTabValue", AppConstants.CV_VALUE);
636                 mockHttpAttribute("displayTotalPerRow", "100");
637                 mockHttpAttribute("displayName", "ONAP USER REPORT");
638                 mockHttpAttribute("colType", AppConstants.CT_HYPERLINK);
639                 mockHttpAttribute("hyperlinkURL", "http://onap.readthedocs.io/en/latest");
640                 mockHttpAttribute("anchor", "IMAGE");
641                 mockHttpAttribute("actionImg", "Dummy");
642                 mockHttpAttribute("displayFormat", "HTML");
643                 mockHttpAttribute("displayFormat", "HTML");
644                 mockHttpAttribute("displayAlign", "right");
645                 mockHttpAttribute("displayHeaderAlign", "right");
646                 mockHttpAttribute("drillDownURL", "");
647                 mockHttpAttribute("drillDownSuppress", "");
648                 mockHttpAttribute("drillDownPopUp", "");
649                 mockHttpAttribute("semaphore", "");
650                 mockHttpAttribute("semaphoreTypeHidden", "");
651                 mockHttpAttribute("multiGroupColLevel", "1000");
652                 mockHttpAttribute("startMultiGroup", "");
653                 mockHttpAttribute("colspan", "");
654                 mockHttpAttribute("colDataFormat", "GRID");
655                 mockHttpAttribute("enhancedPagination", "100");
656                 mockHttpAttribute("no_parse_date", "true");
657
658                 wizardProcessor.processWizardStep(httpServletRequest);
659
660                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
661         }
662
663         /***
664                 @Test
665                 public void testProcessWizardStep_processColumnAddEdit_case3() throws Exception {
666         
667                 }
668                 
669                 @Test
670                 public void testProcessWizardStep_processColumnAddEdit_case4() throws Exception {
671         
672                 }
673                 
674                 @Test
675                 public void testProcessWizardStep_processColumnAddEdit_case5() throws Exception {
676         
677                 }
678         
679          ***/
680         
681         @Test
682         public void testProcessWizardStep_processColumnAddMulti_case1() throws Exception {
683                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_VALIDATE);
684                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
685                 mockHttpAttribute("showDashboardOptions","");
686                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
687                 
688                 setWizardSteps(AppConstants.WS_COLUMNS, AppConstants.WSS_ADD_MULTI);
689
690                 String[] addColumn = {"Y", "N", "Y"};
691                 String[] tableId =  {"Id", "N", "Y"};
692                 String[] columnName = {"REP_ID", "ORDER_NO", "ROLE_ID"};
693                 String[] columnType = {"INTEGER", "INTEGER", "INTEGER"};
694                 String[] displayName = {"Report Id", "Order No", "Role Id"};
695                                                 
696                 mockHttpParameterValues("addColumn", addColumn);
697                 mockHttpParameterValues("tableId", tableId);
698                 mockHttpParameterValues("columnName", columnName);
699                 mockHttpParameterValues("columnType", columnType);
700                 mockHttpParameterValues("displayName", displayName);
701                 
702                 
703                 DataColumnType dataColumnType1 = new DataColumnType();
704                 
705                 dataColumnType1.setTableId("reportaccess");
706                 dataColumnType1.setDbColName("REP_ID");
707                 dataColumnType1.setColName("REP_ID");
708                 dataColumnType1.setDbColType("INTEGER");
709                 dataColumnType1.setDisplayName("Report Id");
710                 
711                 DataColumnType dataColumnType2 = new DataColumnType();
712                 
713                 dataColumnType2.setTableId("reportaccess");
714                 dataColumnType2.setDbColName("ORDER_NO");
715                 dataColumnType2.setColName("ORDER_NO");
716                 dataColumnType2.setDbColType("INTEGER");
717                 dataColumnType2.setDisplayName("Order No");
718                 
719                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
720                 listDataColumnType.add(dataColumnType1);
721                 listDataColumnType.add(dataColumnType2);
722                 
723                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
724
725                 wizardProcessor.processWizardStep(httpServletRequest);
726                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
727
728         }
729
730         @Test
731         public void testProcessWizardStep_processColumnOrderAll_case1() throws Exception {
732                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_VALIDATE);
733                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
734                 mockHttpAttribute("showDashboardOptions","");
735                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
736                 
737                 setWizardSteps(AppConstants.WS_COLUMNS, AppConstants.WSS_ORDER_ALL);
738
739                 String[] colId = {"REP_ID", "ORDER_NO", "ROLE_ID"};
740                 String[] colOrder = {"1", "2", "3"};
741                 
742                 mockHttpParameterValues("colId", colId);
743                 mockHttpParameterValues("colOrder", colOrder);
744                 
745                 DataColumnType dataColumnType1 = new DataColumnType();
746                 
747                 dataColumnType1.setTableId("reportaccess");
748                 dataColumnType1.setDbColName("REP_ID");
749                 dataColumnType1.setColName("REP_ID");
750                 dataColumnType1.setDbColType("INTEGER");
751                 dataColumnType1.setDisplayName("Report Id");
752                 
753                 Mockito.when(reportDefinition.getColumnById("REP_ID")).thenReturn(dataColumnType1);
754                 
755                 DataColumnType dataColumnType2 = new DataColumnType();
756                 
757                 dataColumnType2.setTableId("reportaccess");
758                 dataColumnType2.setDbColName("ORDER_NO");
759                 dataColumnType2.setColName("ORDER_NO");
760                 dataColumnType2.setDbColType("INTEGER");
761                 dataColumnType2.setDisplayName("Order No");
762                 
763                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
764                 listDataColumnType.add(dataColumnType1);
765                 listDataColumnType.add(dataColumnType2);
766                 
767                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
768
769                 wizardProcessor.processWizardStep(httpServletRequest);
770                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
771
772         }
773
774         
775         @Test
776         public void testProcessWizardStep_processColumnDelete_case1() throws Exception {
777                 
778                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_DELETE);
779                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
780                 mockHttpAttribute("showDashboardOptions","");
781                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
782
783                 setWizardSteps(AppConstants.WS_COLUMNS, "NA");
784
785                 wizardProcessor.processWizardStep(httpServletRequest);
786                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
787         }
788         
789         @Test
790         public void testProcessWizardStep_processColumnMoveUp_case1() throws Exception {
791                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_MOVE_UP);
792                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
793                 mockHttpAttribute("showDashboardOptions","");
794                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
795
796                 setWizardSteps(AppConstants.WS_COLUMNS, "NA");
797                 
798                 wizardProcessor.processWizardStep(httpServletRequest);
799                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
800         }
801         
802         
803         @Test
804         public void testProcessWizardStep_processColumnMoveDown_case1() throws Exception {
805                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_MOVE_DOWN);
806                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
807                 mockHttpAttribute("showDashboardOptions","");
808                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
809
810                 setWizardSteps(AppConstants.WS_COLUMNS, "NA");
811
812                 wizardProcessor.processWizardStep(httpServletRequest);
813                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
814
815         }       
816         
817         @Test
818         public void testProcessWizardStep_processFormFieldAddEdit_case1() throws Exception {
819                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "ACTION");
820                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
821                 mockHttpAttribute("showDashboardOptions","");
822                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
823
824                 setWizardSteps(AppConstants.WS_FORM_FIELDS, AppConstants.WSS_ADD);
825                 
826                 Mockito.when(reportDefinition.getReportDefType()).thenReturn(AppConstants.RD_SQL_BASED);
827
828                 FormFieldType formFieldType = new FormFieldType();              
829                 formFieldType.setFieldId(AppConstants.RI_REPORT_ID);
830                                 
831                 Mockito.when(reportDefinition.addFormFieldType(Mockito.anyObject(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyObject(), Mockito.anyObject(), Mockito.anyString(), Mockito.anyString())).thenReturn(formFieldType);
832                 
833                 mockHttpAttribute("fieldName", "REP_ID");
834                 mockHttpAttribute("fieldColId", "REP_ID");
835                 mockHttpAttribute("displayFormat", "TABLE");
836                 mockHttpAttribute("fieldType", "INTEGER");
837                 mockHttpAttribute("validation", "Success");
838                 mockHttpAttribute("mandatory", "Y");
839                 mockHttpAttribute("defaultValue", "null");
840                 mockHttpAttribute("fieldHelp", "Refer ONAP Help");
841                 mockHttpAttribute("fieldSQL", "SELECT 1 FROM DUAL");
842                 mockHttpAttribute("fieldDefaultSQL", "SELECT 1 FROM DUAL");
843                 mockHttpAttribute("visible", "Y");
844                 
845                 mockHttpAttribute("dependsOn", "");
846                 mockHttpAttribute("rangeStartDate", "01/01/2018");
847                 mockHttpAttribute("rangeEndDate", "12/12/2018");
848                 mockHttpAttribute("rangeStartDateSQL", "Y");
849                 mockHttpAttribute("rangeEndDateSQL", "Y");
850                 mockHttpAttribute("isGroupFormField", "Y");
851                 
852                 wizardProcessor.processWizardStep(httpServletRequest);
853                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
854         }       
855         
856         
857         @Test
858         public void testProcessWizardStep_processFormFieldAddEdit_case2() throws Exception {
859                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_ADD_USER);
860                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
861                 mockHttpAttribute("showDashboardOptions","");
862                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
863
864                 setWizardSteps(AppConstants.WS_FORM_FIELDS, AppConstants.WSS_EDIT);
865
866                 Mockito.when(reportDefinition.getReportDefType()).thenReturn(AppConstants.RD_SQL_BASED);
867
868                 FormFieldType formFieldType = new FormFieldType();              
869                 formFieldType.setFieldId(AppConstants.RI_REPORT_ID);
870                 
871                 Mockito.when(reportDefinition.getFormFieldById(Mockito.anyString())).thenReturn(formFieldType);
872                 
873                 Mockito.when(reportDefinition.addFormFieldType(Mockito.anyObject(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyObject(), Mockito.anyObject(), Mockito.anyString(), Mockito.anyString())).thenReturn(formFieldType);
874                 
875                 mockHttpAttribute("fieldName", "REP_ID");
876                 mockHttpAttribute("fieldColId", "REP_ID");
877                 mockHttpAttribute("displayFormat", "TABLE");
878                 mockHttpAttribute("fieldType", "INTEGER");
879                 mockHttpAttribute("validation", "Success");
880                 mockHttpAttribute("mandatory", "Y");
881                 mockHttpAttribute("defaultValue", "null");
882                 mockHttpAttribute("fieldHelp", "Refer ONAP Help");
883                 mockHttpAttribute("fieldSQL", "SELECT 1 FROM DUAL");
884                 mockHttpAttribute("fieldDefaultSQL", "SELECT 1 FROM DUAL");
885                 mockHttpAttribute("visible", "Y");
886                 mockHttpAttribute("dependsOn", "");
887                 mockHttpAttribute("rangeStartDate", "01/01/2018");
888                 mockHttpAttribute("rangeEndDate", "12/12/2018");
889                 mockHttpAttribute("rangeStartDateSQL", "Y");
890                 mockHttpAttribute("rangeEndDateSQL", "Y");
891                 mockHttpAttribute("isGroupFormField", "Y");
892                 mockHttpAttribute("newPredefinedValue", "Y");
893
894                 wizardProcessor.processWizardStep(httpServletRequest);
895                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
896
897         }       
898         
899         
900         @Test
901         public void testProcessWizardStep_processFormFieldDelete_case1() throws Exception {
902                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_DELETE);
903                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
904                 mockHttpAttribute("showDashboardOptions","");
905                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
906
907                 setWizardSteps(AppConstants.WS_FORM_FIELDS, AppConstants.WA_DELETE);
908                 Mockito.when(reportDefinition.getReportDefType()).thenReturn(AppConstants.RD_SQL_BASED);
909                 wizardProcessor.processWizardStep(httpServletRequest);
910                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
911
912         }       
913
914         
915         @Test
916         public void testProcessWizardStep_processFormFieldMoveUp_case1() throws Exception {
917                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_MOVE_UP);
918                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
919                 mockHttpAttribute("showDashboardOptions","");
920                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
921
922                 setWizardSteps(AppConstants.WS_FORM_FIELDS, AppConstants.WA_MOVE_UP);
923                 Mockito.when(reportDefinition.getReportDefType()).thenReturn(AppConstants.RD_SQL_BASED);
924
925                 wizardProcessor.processWizardStep(httpServletRequest);
926                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
927
928         }       
929                 
930         @Test
931         public void testProcessWizardStep_processFormFieldMoveDown_case1() throws Exception {
932                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_MOVE_DOWN);
933                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
934                 mockHttpAttribute("showDashboardOptions","");
935                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
936
937                 setWizardSteps(AppConstants.WS_FORM_FIELDS, AppConstants.WA_MOVE_DOWN);
938                 Mockito.when(reportDefinition.getReportDefType()).thenReturn(AppConstants.RD_SQL_BASED);
939
940                 wizardProcessor.processWizardStep(httpServletRequest);
941                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
942         }       
943         
944         @Test
945         public void testProcessWizardStep_processFormFieldBlank_case1() throws Exception {
946                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WSS_ADD_BLANK);
947                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
948                 mockHttpAttribute("showDashboardOptions","");
949                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
950
951                 setWizardSteps(AppConstants.WS_FORM_FIELDS, AppConstants.WSS_ADD_BLANK);
952                 
953                 Mockito.when(reportDefinition.getReportDefType()).thenReturn(AppConstants.RD_SQL_BASED);
954
955                 wizardProcessor.processWizardStep(httpServletRequest);
956                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
957         }       
958         
959         
960         @Test
961         public void testProcessWizardStep_processFormFieldInfoBar_case1() throws Exception {
962                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WSS_INFO_BAR);
963                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
964                 mockHttpAttribute("showDashboardOptions","");
965                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
966                 mockHttpAttribute("blueBarField", "REPORT ID");
967
968                 setWizardSteps(AppConstants.WS_FORM_FIELDS, AppConstants.WSS_INFO_BAR);
969                 
970                 Mockito.when(reportDefinition.getReportDefType()).thenReturn(AppConstants.RD_SQL_BASED);
971
972                 wizardProcessor.processWizardStep(httpServletRequest);
973                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
974         }       
975                 
976         @Test
977         public void testProcessWizardStep_processForecasting_case1() throws Exception {
978                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.RI_ACTION);
979                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
980                 mockHttpAttribute("showDashboardOptions","");
981                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
982                 
983                 mockHttpAttribute("timeAttribute", null);
984                 mockHttpAttribute("timeFormat", "");
985                 mockHttpAttribute("forecastingPeriod", "10hr");
986                 mockHttpAttribute("classifiers", "Y");
987                 
988                 mockHttpParameterValues("forecastCol", null);
989
990                 setWizardSteps(AppConstants.WS_DATA_FORECASTING, AppConstants.WSS_INFO_BAR);
991                 Mockito.when(encoder.encodeForSQL(Mockito.anyObject(), Mockito.anyString())).thenReturn(null);
992                 
993                 wizardProcessor.processWizardStep(httpServletRequest);
994                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
995         }       
996         
997
998         @Test
999         public void testProcessWizardStep_processForecasting_case2() throws Exception {
1000                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.RI_ACTION);
1001                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1002                 mockHttpAttribute("showDashboardOptions","");
1003                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1004
1005                 mockHttpAttribute("timeAttribute", "REP_ID");
1006                 mockHttpAttribute("timeFormat", "Default");
1007                 mockHttpAttribute("forecastingPeriod", "10hr");
1008                 mockHttpAttribute("classifiers", "Y");
1009                 
1010                 String []forecastCol = {"REP_ID", "ORDER_NO"};          
1011                 mockHttpParameterValues("forecastCol", forecastCol);
1012
1013                 setWizardSteps(AppConstants.WS_DATA_FORECASTING, AppConstants.WSS_INFO_BAR);
1014                                 
1015                 DataColumnType dataColumnType1 = new DataColumnType();
1016                 
1017                 dataColumnType1.setTableId("reportaccess");
1018                 dataColumnType1.setDbColName("REP_ID");
1019                 dataColumnType1.setColName("REP_ID");
1020                 dataColumnType1.setDbColType("INTEGER");
1021                 dataColumnType1.setDisplayName("Report Id");
1022                 dataColumnType1.setColId("REP_ID");
1023                 
1024                 DataColumnType dataColumnType2 = new DataColumnType();
1025                 
1026                 dataColumnType2.setTableId("reportaccess");
1027                 dataColumnType2.setDbColName("ORDER_NO");
1028                 dataColumnType2.setColName("ORDER_NO");
1029                 dataColumnType2.setDbColType("INTEGER");
1030                 dataColumnType2.setDisplayName("Order No");
1031                 dataColumnType2.setColId("ORDER_NO");
1032                 
1033                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
1034                 listDataColumnType.add(dataColumnType1);
1035                 listDataColumnType.add(dataColumnType2);
1036                 
1037                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
1038
1039                 wizardProcessor.processWizardStep(httpServletRequest);
1040                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1041         }       
1042         
1043         @Test
1044         public void testProcessWizardStep_processFilterAddEdit_case1() throws Exception {
1045                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "ACTION");
1046                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1047                 mockHttpAttribute("showDashboardOptions","");
1048                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1049                 mockHttpAttribute("blueBarField", "REPORT ID");
1050
1051                 setWizardSteps(AppConstants.WS_FILTERS, AppConstants.WSS_ADD);
1052                 
1053                 DataColumnType dataColumnType1 = new DataColumnType();
1054                 
1055                 dataColumnType1.setTableId("reportaccess");
1056                 dataColumnType1.setDbColName("REP_ID");
1057                 dataColumnType1.setColName("REP_ID");
1058                 dataColumnType1.setDbColType("INTEGER");
1059                 dataColumnType1.setDisplayName("Report Id");
1060                 
1061                 DataColumnType dataColumnType2 = new DataColumnType();
1062                 
1063                 dataColumnType2.setTableId("reportaccess");
1064                 dataColumnType2.setDbColName("ORDER_NO");
1065                 dataColumnType2.setColName("ORDER_NO");
1066                 dataColumnType2.setDbColType("INTEGER");
1067                 dataColumnType2.setDisplayName("Order No");
1068
1069                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
1070                 listDataColumnType.add(dataColumnType1);
1071                 listDataColumnType.add(dataColumnType2);
1072
1073                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType2);
1074                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
1075                 
1076                 mockHttpAttribute("filterColId", "ORDER_NO");
1077                 mockHttpAttribute("filterExpr", "ORDER_NO=");
1078                 mockHttpAttribute("argType", AppConstants.AT_COLUMN);
1079                 mockHttpAttribute("argValue", "1001");
1080                 
1081                 mockHttpAttribute("rangeEndDateSQL", "Y");
1082                 mockHttpAttribute("isGroupFormField", "Y");
1083                 
1084                 mockHttpAttribute("newPredefinedValue", "Y");
1085                 
1086                 mockHttpAttribute("filterJoin", "+");
1087                 mockHttpAttribute("openBrackets", "(");
1088                 mockHttpAttribute("closeBrackets", ")");
1089
1090                 wizardProcessor.processWizardStep(httpServletRequest);
1091                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1092         }
1093         
1094         
1095         @Test
1096         public void testProcessWizardStep_processFilterAddEdit_case2() throws Exception {
1097                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "ACTION");
1098                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1099                 mockHttpAttribute("showDashboardOptions","");
1100                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1101                 mockHttpAttribute("blueBarField", "REPORT ID");
1102
1103                 setWizardSteps(AppConstants.WS_FILTERS, AppConstants.WSS_EDIT);
1104
1105                 DataColumnType dataColumnType1 = new DataColumnType();
1106                 
1107                 dataColumnType1.setTableId("reportaccess");
1108                 dataColumnType1.setDbColName("REP_ID");
1109                 dataColumnType1.setColName("REP_ID");
1110                 dataColumnType1.setDbColType("INTEGER");
1111                 dataColumnType1.setDisplayName("Report Id");
1112                 
1113                 DataColumnType dataColumnType2 = new DataColumnType();
1114                 
1115                 dataColumnType2.setTableId("reportaccess");
1116                 dataColumnType2.setDbColName("ORDER_NO");
1117                 dataColumnType2.setColName("ORDER_NO");
1118                 dataColumnType2.setDbColType("INTEGER");
1119                 dataColumnType2.setDisplayName("Order No");
1120                 dataColumnType2.setColType("INTEGER");
1121
1122                 PowerMockito.when(Globals.getProcessFilterAddEdit()).thenReturn("= \'[argValue]\'");
1123                 
1124                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType2);
1125
1126                 
1127                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
1128                 listDataColumnType.add(dataColumnType1);
1129                 listDataColumnType.add(dataColumnType2);
1130
1131                 ColFilterType colFilterType = new ColFilterType();
1132
1133                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
1134                 Mockito.when(reportDefinition.getFilterById(Mockito.anyString(), Mockito.anyInt())).thenReturn(colFilterType);
1135                 
1136                 mockHttpAttribute("filterColId", "ORDER_NO");
1137                 mockHttpAttribute("filterExpr", "ORDER_NO=");
1138                 mockHttpAttribute("argType", AppConstants.AT_VALUE);
1139                 mockHttpAttribute("argValue", "1001");
1140                 
1141                 mockHttpAttribute("filterPos", "1");
1142                 
1143                 mockHttpAttribute("rangeEndDateSQL", "Y");
1144                 mockHttpAttribute("isGroupFormField", "Y");
1145                 
1146                 mockHttpAttribute("newPredefinedValue", "Y");
1147                 
1148                 mockHttpAttribute("filterJoin", "+");
1149                 mockHttpAttribute("openBrackets", "(");
1150                 mockHttpAttribute("closeBrackets", ")");
1151
1152                 wizardProcessor.processWizardStep(httpServletRequest);
1153                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1154         }
1155         
1156
1157         
1158         @Test
1159         public void testProcessWizardStep_processFilterDelete_case1() throws Exception {
1160                 
1161                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_DELETE);
1162                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1163                 mockHttpAttribute("showDashboardOptions","");
1164                 mockHttpAttribute(AppConstants.RI_DETAIL_ID, "ORDER_NO|1");
1165                 mockHttpAttribute("blueBarField", "REPORT ID");
1166
1167                 setWizardSteps(AppConstants.WS_FILTERS, AppConstants.WA_DELETE);
1168
1169                 wizardProcessor.processWizardStep(httpServletRequest);
1170                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1171         }
1172         
1173
1174         @Test
1175         public void testProcessWizardStep_processSortAddEdit_case1() throws Exception {
1176                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WS_SORTING);
1177                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1178                 mockHttpAttribute("showDashboardOptions","");
1179                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1180                 mockHttpAttribute("sortAscDesc","Asc");
1181                 setWizardSteps(AppConstants.WS_SORTING, AppConstants.WSS_ADD);
1182                                 
1183                 DataColumnType dataColumnType = new DataColumnType();
1184                 
1185                 dataColumnType.setTableId("reportaccess");
1186                 dataColumnType.setDbColName("rep_id");
1187                 dataColumnType.setColName("rep_id");
1188                 dataColumnType.setDbColType("integer");
1189                 
1190                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);           
1191                 mockHttpAttribute("sortColId","1");
1192
1193                 wizardProcessor.processWizardStep(httpServletRequest);
1194                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1195         }
1196         
1197         
1198         @Test
1199         public void testProcessWizardStep_processSortAddEdit_case2() throws Exception {
1200                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WS_SORTING);
1201                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1202                 mockHttpAttribute("showDashboardOptions","");
1203                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1204                 mockHttpAttribute("sortAscDesc","Asc");
1205
1206                 setWizardSteps(AppConstants.WS_SORTING, AppConstants.WSS_EDIT);
1207                                 
1208                 DataColumnType dataColumnType = new DataColumnType();
1209                 
1210                 dataColumnType.setTableId("reportaccess");
1211                 dataColumnType.setDbColName("rep_id");
1212                 dataColumnType.setColName("rep_id");
1213                 dataColumnType.setDbColType("integer");
1214                 
1215                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);           
1216                 mockHttpAttribute("sortColId","1");
1217
1218                 wizardProcessor.processWizardStep(httpServletRequest);
1219                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1220         }
1221         
1222
1223         @Test
1224         public void testProcessWizardStep_processSortOrderAll_case1() throws Exception {
1225                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WS_SORTING);
1226                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1227                 mockHttpAttribute("showDashboardOptions","");
1228                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1229
1230                 setWizardSteps(AppConstants.WS_SORTING, AppConstants.WSS_ORDER_ALL);
1231
1232                 String[] colId =new String [0];
1233                 String[] colOrder = {"1", "2", "3"};
1234                 String[] sortAscDesc = {"Desc", "Desc", "Desc"};
1235                 
1236                 mockHttpParameterValues("colId", colId);
1237                 mockHttpParameterValues("colOrder", colOrder);
1238                 mockHttpParameterValues("sortAscDesc", sortAscDesc);
1239                 
1240                 DataColumnType dataColumnType = new DataColumnType();
1241                 
1242                 dataColumnType.setTableId("reportaccess");
1243                 dataColumnType.setDbColName("rep_id");
1244                 dataColumnType.setColName("rep_id");
1245                 dataColumnType.setDbColType("integer");
1246                 
1247                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);           
1248                 mockHttpAttribute("sortColId","1");
1249
1250                 wizardProcessor.processWizardStep(httpServletRequest);
1251                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1252         }
1253         
1254         @Test
1255         public void testProcessWizardStep_processSortOrderAll_case2() throws Exception {
1256                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WS_SORTING);
1257                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1258                 mockHttpAttribute("showDashboardOptions","");
1259                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1260
1261                 setWizardSteps(AppConstants.WS_SORTING, AppConstants.WSS_ORDER_ALL);
1262
1263                 String[] colId = {"REP_ID", "ORDER_NO", "ROLE_ID"};
1264                 String[] sortOrder = {"1", "2", "0"};
1265                 String[] sortAscDesc = {"Desc", "Asc", "Desc"};
1266                 
1267                 mockHttpParameterValues("colId", colId);
1268                 mockHttpParameterValues("sortOrder", sortOrder);
1269                 mockHttpParameterValues("sortAscDesc", sortAscDesc);
1270
1271                 DataColumnType dataColumnType1 = new DataColumnType();
1272                 
1273                 dataColumnType1.setTableId("reportaccess");
1274                 dataColumnType1.setDbColName("REP_ID");
1275                 dataColumnType1.setColName("REP_ID");
1276                 dataColumnType1.setDbColType("INTEGER");
1277                 dataColumnType1.setDisplayName("Report Id");
1278                 dataColumnType1.setOrderByAscDesc("Desc");
1279                 dataColumnType1.setOrderBySeq(1);
1280                 
1281                 DataColumnType dataColumnType2 = new DataColumnType();
1282                 
1283                 dataColumnType2.setTableId("reportaccess");
1284                 dataColumnType2.setDbColName("ORDER_NO");
1285                 dataColumnType2.setColName("ORDER_NO");
1286                 dataColumnType2.setDbColType("INTEGER");
1287                 dataColumnType2.setDisplayName("Order No");
1288                 dataColumnType2.setOrderByAscDesc("Desc");
1289                 dataColumnType2.setOrderBySeq(1);
1290
1291                 DataColumnType dataColumnType3 = new DataColumnType();
1292                 
1293                 dataColumnType3.setTableId("reportaccess");
1294                 dataColumnType3.setDbColName("ROLE_ID");
1295                 dataColumnType3.setColName("ROLE_ID");
1296                 dataColumnType3.setDbColType("INTEGER");
1297                 dataColumnType3.setDisplayName("Role Id");
1298                 dataColumnType3.setOrderByAscDesc("Desc");
1299                 dataColumnType3.setOrderBySeq(0);
1300
1301                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
1302                 listDataColumnType.add(dataColumnType1);
1303                 listDataColumnType.add(dataColumnType2);
1304                 
1305                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
1306                 
1307                 Mockito.when(reportHandler.loadReportDefinition(httpServletRequest, "1001")).thenReturn(reportDefinition);
1308                 
1309                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenAnswer(new Answer<DataColumnType>() {
1310                         @Override
1311                         public DataColumnType answer(InvocationOnMock invocation) throws Throwable {
1312                               Object[] args = invocation.getArguments();
1313                               String inputString = (String) args[0];
1314                               
1315                               if ("REP_ID".equals(inputString))
1316                                   return dataColumnType1;
1317                                   
1318                               else if("ORDER_NO".equals(inputString))
1319                                   return dataColumnType2;
1320                               
1321                                else
1322                                   return null;
1323
1324                         }
1325                 } );
1326
1327                 mockHttpAttribute("sortColId","1");
1328                 wizardProcessor.processWizardStep(httpServletRequest);
1329                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1330         }
1331         
1332         @Test
1333         public void testProcessWizardStep_processSortDelete_case1() throws Exception {
1334                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_DELETE);
1335                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1336                 mockHttpAttribute("showDashboardOptions","");
1337                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1338
1339                 setWizardSteps(AppConstants.WS_SORTING, AppConstants.WA_DELETE);
1340                 wizardProcessor.processWizardStep(httpServletRequest);
1341                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1342         }
1343         
1344
1345         @Test
1346         public void testProcessWizardStep_processSortMoveUp_case1() throws Exception {
1347                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_MOVE_UP);
1348                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1349                 mockHttpAttribute("showDashboardOptions","");
1350                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1351
1352                 setWizardSteps(AppConstants.WS_SORTING, AppConstants.WA_MOVE_UP);
1353                 wizardProcessor.processWizardStep(httpServletRequest);
1354                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1355         }
1356         
1357
1358         @Test
1359         public void testProcessWizardStep_processSortMoveDown_case1() throws Exception {
1360                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_MOVE_DOWN);
1361                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1362                 mockHttpAttribute("showDashboardOptions","");
1363                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1364
1365                 setWizardSteps(AppConstants.WS_SORTING, AppConstants.WA_MOVE_DOWN);
1366                 wizardProcessor.processWizardStep(httpServletRequest);
1367                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1368         }
1369         
1370         @Test
1371         public void testProcessWizardStep_processAddJavascriptElement_case1() throws Exception {
1372                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WSS_ADD);
1373                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1374                 mockHttpAttribute("showDashboardOptions","");
1375                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1376
1377                 setWizardSteps(AppConstants.WS_JAVASCRIPT, AppConstants.WSS_ADD);
1378                 JavascriptItemType javascriptItemType = new JavascriptItemType();
1379
1380                 Mockito.when(reportDefinition.addJavascriptType(Mockito.anyObject(), Mockito.anyString())).thenReturn(javascriptItemType);
1381                 wizardProcessor.processWizardStep(httpServletRequest);
1382                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1383         }
1384         
1385         @Test
1386         public void testProcessWizardStep_processSaveJavascriptElement_case1() throws Exception {
1387                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_SAVE);
1388                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1389                 mockHttpAttribute("showDashboardOptions","");
1390                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1391
1392                 setWizardSteps(AppConstants.WS_JAVASCRIPT, AppConstants.WA_SAVE);
1393
1394                 mockHttpAttribute(AppConstants.RI_JAVASCRIPT, "document.getElementById(\"REP_ID\");");
1395                 mockHttpAttribute(AppConstants.RI_JAVASCRIPT_ITEM_ID, "1");
1396                 mockHttpAttribute("javascriptFormField-1", "-1");
1397
1398                 JavascriptItemType javascriptItemType = new JavascriptItemType();
1399                 Mockito.when(reportDefinition.addJavascriptType(Mockito.anyObject(), Mockito.anyString())).thenReturn(javascriptItemType);
1400                                 
1401                 wizardProcessor.processWizardStep(httpServletRequest);
1402                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1403         }       
1404         
1405         @Test
1406         public void testProcessWizardStep_processSaveJavascriptElement_case2() throws Exception {
1407                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_SAVE);
1408                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1409                 mockHttpAttribute("showDashboardOptions","");
1410                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1411
1412                 setWizardSteps(AppConstants.WS_JAVASCRIPT, AppConstants.WA_SAVE);
1413
1414                 mockHttpAttribute(AppConstants.RI_JAVASCRIPT, "document.getElementById(\"REP_ID\");");
1415                 mockHttpAttribute(AppConstants.RI_JAVASCRIPT_ITEM_ID, "-1");
1416
1417                 mockHttpAttribute("callText--1", "document.getElementById(\\\"REP_ID\\\");");
1418                 mockHttpAttribute("javascriptFormField--1", "1");
1419                 
1420                 JavascriptItemType javascriptItemType = new JavascriptItemType();
1421                 Mockito.when(reportDefinition.addJavascriptType(Mockito.anyObject(), Mockito.anyString())).thenReturn(javascriptItemType);
1422                 
1423                 wizardProcessor.processWizardStep(httpServletRequest);
1424                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1425         }               
1426         
1427         @Test
1428         public void testProcessWizardStep_processSaveJavascriptElement_case3() throws Exception {
1429                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_SAVE);
1430                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1431                 mockHttpAttribute("showDashboardOptions","");
1432                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1433
1434                 setWizardSteps(AppConstants.WS_JAVASCRIPT, AppConstants.WA_SAVE);
1435         
1436                 mockHttpAttribute(AppConstants.RI_JAVASCRIPT, "document.getElementById(\"REP_ID\");");
1437                 mockHttpAttribute(AppConstants.RI_JAVASCRIPT_ITEM_ID, "-1");
1438                 mockHttpAttribute("callText--1", "document.getElementById(\\\"REP_ID\\\");");
1439                 mockHttpAttribute("javascriptFormField--1", "os1");
1440                 
1441                 JavascriptItemType javascriptItemType = new JavascriptItemType();
1442                 Mockito.when(reportDefinition.addJavascriptType(Mockito.anyObject(), Mockito.anyString())).thenReturn(javascriptItemType);
1443
1444                 wizardProcessor.processWizardStep(httpServletRequest);
1445                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1446         }               
1447         
1448         @Test
1449         public void testProcessWizardStep_processDeleteJavascriptElement_case1() throws Exception {
1450                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_DELETE);
1451                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1452                 mockHttpAttribute("showDashboardOptions","");
1453                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1454
1455                 mockHttpAttribute(AppConstants.RI_JAVASCRIPT_ITEM_ID, "-1");
1456
1457                 setWizardSteps(AppConstants.WS_JAVASCRIPT, AppConstants.WA_DELETE);
1458                 
1459                 Mockito.when(reportDefinition.deleteJavascriptType(Mockito.anyString())).thenReturn(false);
1460                 wizardProcessor.processWizardStep(httpServletRequest);
1461                 
1462                 Mockito.when(reportDefinition.deleteJavascriptType(Mockito.anyString())).thenReturn(true);
1463                 wizardProcessor.processWizardStep(httpServletRequest);
1464
1465                 Mockito.verify(wizardProcessor, Mockito.times(2)).processWizardStep(httpServletRequest);
1466         }
1467         
1468         @Test
1469         public void testProcessWizardStep_processJavascript_case1() throws Exception {
1470
1471                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_MOVE_UP);
1472                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1473                 mockHttpAttribute("showDashboardOptions","");
1474                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1475
1476                 mockHttpAttribute(AppConstants.RI_JAVASCRIPT_ITEM_ID, "-1");
1477
1478                 setWizardSteps(AppConstants.WS_JAVASCRIPT, AppConstants.WA_SAVE);
1479
1480                 mockHttpAttribute(AppConstants.RI_JAVASCRIPT, "document.getElementById(\"REP_ID\");");
1481                 mockHttpAttribute(AppConstants.RI_JAVASCRIPT_ITEM_ID, "1");
1482                 mockHttpAttribute("javascriptFormField-1", "-1");
1483                 JavascriptItemType javascriptItemType = new JavascriptItemType();
1484                 Mockito.when(reportDefinition.addJavascriptType(Mockito.anyObject(), Mockito.anyString())).thenReturn(javascriptItemType);
1485                 
1486                 wizardProcessor.processWizardStep(httpServletRequest);
1487                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1488
1489         }       
1490         
1491
1492         @Test
1493         public void testProcessWizardStep_processChart_MultiplePieChart_case1() throws Exception {
1494                 
1495                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "WIZ_ACTION");
1496                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1497                 mockHttpAttribute("showDashboardOptions","");
1498                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1499                 mockHttpAttribute("blueBarField", "REPORT ID");
1500
1501                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
1502                 
1503                 mockHttpAttribute("chartType", AppConstants.GT_PIE_MULTIPLE);
1504                 mockHttpAttribute("chartTypeFixed", "N");
1505                 mockHttpAttribute("legendCol", "MULTI COLUMN");
1506                 mockHttpAttribute("leftAxisLabel", "USER");
1507                 mockHttpAttribute("rightAxisLabel", "TIME");
1508                 mockHttpAttribute("chartWidth", "500");
1509                 mockHttpAttribute("chartHeight", "500");
1510                 mockHttpAttribute("multiSeries", "N");
1511                 mockHttpAttribute("lastSeriesALineChart", "N");
1512                 mockHttpAttribute("lastSeriesABarChart", "N");          
1513                 mockHttpAttribute("animatedOption", "animate");
1514                 
1515                 mockHttpAttribute("multiplePieOrder", "N");
1516                 mockHttpAttribute("multiplePieLabelDisplay", "N");
1517                 mockHttpAttribute("chartDisplay", "N");
1518                 mockHttpAttribute("animatedOption", "N");
1519                 mockHttpAttribute("multiplePieOrderInRunPage", "Y");
1520                 mockHttpAttribute("multiplePieLabelDisplayInRunPage", "Y");
1521                 mockHttpAttribute("chartDisplayInRunPage", "Y");        
1522                 
1523                 mockHttpAttribute("yAxisLowerLimit", "500");
1524                 mockHttpAttribute("yAxisUpperLimit", "1200");
1525                 mockHttpAttribute("labelAngle", "N");
1526                 mockHttpAttribute("legendPosition", "Top");
1527                 mockHttpAttribute("labelAngle", "N");
1528                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
1529                 mockHttpAttribute("hideLegend", "labelAngle");
1530                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
1531                 mockHttpAttribute("hideTooltips", "N");
1532                 mockHttpAttribute("keepAsString", "N");
1533                 
1534                 mockHttpAttribute("drillDownReport", "-1");
1535                 
1536                 mockHttpAttribute("newChart1Axis", "1");
1537                 mockHttpAttribute("valueCol1", "");
1538                 mockHttpAttribute("valueCol1Color", "1");
1539                 mockHttpAttribute("valueColAxis", "1");
1540                 mockHttpAttribute("chartGroupAxis", "1");
1541                 mockHttpAttribute("YAxisLabel", "1");           
1542                 
1543                 DataColumnType dataColumnType = new DataColumnType();
1544                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
1545
1546                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
1547                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
1548                 chartDrillFormfield.setFormfield("REPORT_ID");
1549                 listChartDrillFormfield.add(chartDrillFormfield);
1550                 
1551                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
1552                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
1553                                 
1554                 wizardProcessor.processWizardStep(httpServletRequest);
1555         
1556                 
1557                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
1558                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
1559
1560                 mockHttpAttribute("leftAxisLabel", "");
1561                 mockHttpAttribute("rightAxisLabel", "");
1562                 
1563                 wizardProcessor.processWizardStep(httpServletRequest);
1564         
1565                 Mockito.verify(wizardProcessor, Mockito.times(2)).processWizardStep(httpServletRequest);
1566         }       
1567
1568         @Test
1569         public void testProcessWizardStep_processChart_MultiplePieChart_case2() throws Exception {
1570                 
1571                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "WIZ_ACTION");
1572                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1573                 mockHttpAttribute("showDashboardOptions","");
1574                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1575                 mockHttpAttribute("blueBarField", "REPORT ID");
1576
1577                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
1578
1579                 mockHttpAttribute("chartType", AppConstants.GT_PIE_MULTIPLE);
1580                 mockHttpAttribute("chartTypeFixed", "N");
1581                 mockHttpAttribute("legendCol", "REP_ID");
1582                 mockHttpAttribute("leftAxisLabel", "");
1583                 mockHttpAttribute("rightAxisLabel", "");
1584                 mockHttpAttribute("chartWidth", "500");
1585                 mockHttpAttribute("chartHeight", "500");
1586                 mockHttpAttribute("multiSeries", "N");
1587                 mockHttpAttribute("lastSeriesALineChart", "N");
1588                 mockHttpAttribute("lastSeriesABarChart", "N");          
1589                 mockHttpAttribute("animatedOption", "animate");
1590                 
1591                 mockHttpAttribute("multiplePieOrder", "N");
1592                 mockHttpAttribute("multiplePieLabelDisplay", "N");
1593                 mockHttpAttribute("chartDisplay", "N");
1594                 mockHttpAttribute("animatedOption", "N");
1595                 mockHttpAttribute("multiplePieOrderInRunPage", "Y");
1596                 mockHttpAttribute("multiplePieLabelDisplayInRunPage", "Y");
1597                 mockHttpAttribute("chartDisplayInRunPage", "Y");        
1598                 
1599                 mockHttpAttribute("yAxisLowerLimit", "500");
1600                 mockHttpAttribute("yAxisUpperLimit", "1200");
1601                 mockHttpAttribute("labelAngle", "N");
1602                 mockHttpAttribute("legendPosition", "Top");
1603                 mockHttpAttribute("labelAngle", "N");
1604                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
1605                 mockHttpAttribute("hideLegend", "labelAngle");
1606                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
1607                 mockHttpAttribute("hideTooltips", "N");
1608                 mockHttpAttribute("keepAsString", "N");
1609                 
1610                 mockHttpAttribute("drillDownReport", "-1");
1611                 
1612                 mockHttpAttribute("newChart1Axis", "1");
1613                 mockHttpAttribute("valueCol1", "");
1614                 mockHttpAttribute("valueCol1Color", "1");
1615                 mockHttpAttribute("valueColAxis", "1");
1616                 mockHttpAttribute("chartGroupAxis", "1");
1617                 mockHttpAttribute("YAxisLabel", "1");           
1618                 
1619                 DataColumnType dataColumnType = new DataColumnType();
1620
1621                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
1622
1623                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
1624                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
1625
1626                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
1627
1628                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
1629                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
1630                 chartDrillFormfield.setFormfield("REPORT_ID");
1631                 listChartDrillFormfield.add(chartDrillFormfield);
1632
1633                 DataColumnType dataColumnType1 = new DataColumnType();
1634                 
1635                 dataColumnType1.setTableId("reportaccess");
1636                 dataColumnType1.setDbColName("REP_ID");
1637                 dataColumnType1.setColName("REP_ID");
1638                 dataColumnType1.setDbColType("INTEGER");
1639                 dataColumnType1.setDisplayName("Report Id");
1640                 dataColumnType1.setColId("REP_ID");
1641                 dataColumnType1.setColOnChart(AppConstants.GT_COMPARE_PREVYEAR_CHART);
1642
1643                 DataColumnType dataColumnType2 = new DataColumnType();
1644                 
1645                 dataColumnType2.setTableId("reportaccess");
1646                 dataColumnType2.setDbColName("ORDER_NO");
1647                 dataColumnType2.setColName("ORDER_NO");
1648                 dataColumnType2.setDbColType("INTEGER");
1649                 dataColumnType2.setDisplayName("Order No");
1650                 dataColumnType2.setColId("ORDER_NO");
1651                 
1652                 dataColumnType2.setColOnChart(AppConstants.GC_LEGEND);
1653                 
1654                 
1655                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
1656                 listDataColumnType.add(dataColumnType1);
1657                 listDataColumnType.add(dataColumnType2);
1658                 
1659                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
1660                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
1661                                 
1662                 wizardProcessor.processWizardStep(httpServletRequest);
1663
1664                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1665         }       
1666
1667                 
1668         @Test
1669         public void testProcessWizardStep_processChart_RegressionPlotChart_case1() throws Exception {
1670                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "WIZ_ACTION");
1671                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1672                 mockHttpAttribute("showDashboardOptions","");
1673                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1674                 mockHttpAttribute("blueBarField", "REPORT ID");
1675
1676                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
1677
1678                 mockHttpAttribute("chartType", AppConstants.GT_REGRESSION);
1679                 mockHttpAttribute("chartTypeFixed", "N");
1680                 mockHttpAttribute("legendCol", "REP_ID");
1681                 mockHttpAttribute("leftAxisLabel", "");
1682                 mockHttpAttribute("rightAxisLabel", "");
1683                 mockHttpAttribute("chartWidth", "500");
1684                 mockHttpAttribute("chartHeight", "500");
1685                 mockHttpAttribute("multiSeries", "N");
1686                 mockHttpAttribute("lastSeriesALineChart", "N");
1687                 mockHttpAttribute("lastSeriesABarChart", "N");          
1688                 mockHttpAttribute("animatedOption", "animate");
1689                 
1690                 mockHttpAttribute("multiplePieOrder", "N");
1691                 mockHttpAttribute("multiplePieLabelDisplay", "N");
1692                 mockHttpAttribute("chartDisplay", "N");
1693                 mockHttpAttribute("animatedOption", "N");
1694                 mockHttpAttribute("multiplePieOrderInRunPage", "Y");
1695                 mockHttpAttribute("multiplePieLabelDisplayInRunPage", "Y");
1696                 mockHttpAttribute("chartDisplayInRunPage", "Y");        
1697                 
1698                 mockHttpAttribute("yAxisLowerLimit", "500");
1699                 mockHttpAttribute("yAxisUpperLimit", "1200");
1700                 mockHttpAttribute("labelAngle", "N");
1701                 mockHttpAttribute("legendPosition", "Top");
1702                 mockHttpAttribute("labelAngle", "N");
1703                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
1704                 mockHttpAttribute("hideLegend", "labelAngle");
1705                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
1706                 mockHttpAttribute("hideTooltips", "N");
1707                 mockHttpAttribute("keepAsString", "N");
1708                 
1709                 mockHttpAttribute("drillDownReport", "-1");
1710                 
1711                 mockHttpAttribute("newChart1Axis", "1");
1712                 mockHttpAttribute("valueCol1", "");
1713                 mockHttpAttribute("valueCol1Color", "1");
1714                 mockHttpAttribute("valueColAxis", "1");
1715                 mockHttpAttribute("chartGroupAxis", "1");
1716                 mockHttpAttribute("YAxisLabel", "1");           
1717                 
1718                 mockHttpAttribute("regressionType", "Y");
1719                 mockHttpAttribute("valueLinearRegressionColor", "Y");
1720                 mockHttpAttribute("valueExponentialRegressionColor", "BLUE");
1721                 mockHttpAttribute("regressionPointCustomization", "YELLOW");
1722                 
1723                 mockHttpAttribute("chartSeries", "REP_ID");
1724                 
1725                 DataColumnType dataColumnType = new DataColumnType();
1726
1727                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
1728
1729                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
1730                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
1731                 
1732                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
1733
1734                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
1735                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
1736                 chartDrillFormfield.setFormfield("REPORT_ID");
1737                 listChartDrillFormfield.add(chartDrillFormfield);
1738
1739                 DataColumnType dataColumnType1 = new DataColumnType();
1740                 
1741                 dataColumnType1.setTableId("reportaccess");
1742                 dataColumnType1.setDbColName("REP_ID");
1743                 dataColumnType1.setColName("REP_ID");
1744                 dataColumnType1.setDbColType("INTEGER");
1745                 dataColumnType1.setDisplayName("Report Id");
1746                 dataColumnType1.setColId("REP_ID");
1747                 dataColumnType1.setColOnChart(AppConstants.GT_COMPARE_PREVYEAR_CHART);
1748
1749                 DataColumnType dataColumnType2 = new DataColumnType();
1750                 
1751                 dataColumnType2.setTableId("reportaccess");
1752                 dataColumnType2.setDbColName("ORDER_NO");
1753                 dataColumnType2.setColName("ORDER_NO");
1754                 dataColumnType2.setDbColType("INTEGER");
1755                 dataColumnType2.setDisplayName("Order No");
1756                 dataColumnType2.setColId("ORDER_NO");
1757                 
1758                 dataColumnType2.setColOnChart(AppConstants.GC_LEGEND);
1759                 
1760                 
1761                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
1762                 listDataColumnType.add(dataColumnType1);
1763                 listDataColumnType.add(dataColumnType2);
1764                 
1765                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
1766                 
1767                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
1768                                 
1769                 wizardProcessor.processWizardStep(httpServletRequest);
1770         
1771                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1772
1773         }       
1774
1775         @Test
1776         public void testProcessWizardStep_processChart_RegressionPlotChart_case2() throws Exception {
1777                 
1778                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "WIZ_ACTION");
1779                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1780                 mockHttpAttribute("showDashboardOptions","");
1781                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1782                 mockHttpAttribute("blueBarField", "REPORT ID");
1783
1784                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
1785
1786                 mockHttpAttribute("chartType", AppConstants.GT_REGRESSION);
1787                 mockHttpAttribute("chartTypeFixed", "N");
1788                 mockHttpAttribute("legendCol", "REP_ID");
1789                 mockHttpAttribute("leftAxisLabel", "");
1790                 mockHttpAttribute("rightAxisLabel", "");
1791                 mockHttpAttribute("chartWidth", "500");
1792                 mockHttpAttribute("chartHeight", "500");
1793                 mockHttpAttribute("multiSeries", "N");
1794                 mockHttpAttribute("lastSeriesALineChart", "N");
1795                 mockHttpAttribute("lastSeriesABarChart", "N");          
1796                 mockHttpAttribute("animatedOption", "animate");
1797                 
1798                 mockHttpAttribute("multiplePieOrder", "N");
1799                 mockHttpAttribute("multiplePieLabelDisplay", "N");
1800                 mockHttpAttribute("chartDisplay", "N");
1801                 mockHttpAttribute("animatedOption", "N");
1802                 mockHttpAttribute("multiplePieOrderInRunPage", "Y");
1803                 mockHttpAttribute("multiplePieLabelDisplayInRunPage", "Y");
1804                 mockHttpAttribute("chartDisplayInRunPage", "Y");        
1805                 
1806                 mockHttpAttribute("yAxisLowerLimit", "500");
1807                 mockHttpAttribute("yAxisUpperLimit", "1200");
1808                 mockHttpAttribute("labelAngle", "N");
1809                 mockHttpAttribute("legendPosition", "Top");
1810                 mockHttpAttribute("labelAngle", "N");
1811                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
1812                 mockHttpAttribute("hideLegend", "labelAngle");
1813                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
1814                 mockHttpAttribute("hideTooltips", "N");
1815                 mockHttpAttribute("keepAsString", "N");
1816                 
1817                 mockHttpAttribute("drillDownReport", "-1");
1818                 
1819                 mockHttpAttribute("newChart1Axis", "1");
1820                 mockHttpAttribute("valueCol1", "");
1821                 mockHttpAttribute("valueCol1Color", "1");
1822                 mockHttpAttribute("valueColAxis", "1");
1823                 mockHttpAttribute("chartGroupAxis", "1");
1824                 mockHttpAttribute("YAxisLabel", "1");           
1825                 
1826                 mockHttpAttribute("regressionType", "");
1827                 mockHttpAttribute("valueLinearRegressionColor", "Y");
1828                 mockHttpAttribute("valueExponentialRegressionColor", "BLUE");
1829                 mockHttpAttribute("regressionPointCustomization", "YELLOW");
1830                 
1831                 mockHttpAttribute("chartSeries", "REP_ID");
1832                 
1833                 DataColumnType dataColumnType = new DataColumnType();
1834
1835                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
1836
1837                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
1838                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
1839
1840                 
1841                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
1842
1843                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
1844                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
1845                 chartDrillFormfield.setFormfield("REPORT_ID");
1846                 listChartDrillFormfield.add(chartDrillFormfield);
1847                 
1848
1849                 DataColumnType dataColumnType1 = new DataColumnType();
1850                 
1851                 dataColumnType1.setTableId("reportaccess");
1852                 dataColumnType1.setDbColName("REP_ID");
1853                 dataColumnType1.setColName("REP_ID");
1854                 dataColumnType1.setDbColType("INTEGER");
1855                 dataColumnType1.setDisplayName("Report Id");
1856                 dataColumnType1.setColId("REP_ID");
1857                 dataColumnType1.setColOnChart(AppConstants.GT_COMPARE_PREVYEAR_CHART);
1858
1859                 DataColumnType dataColumnType2 = new DataColumnType();
1860                 
1861                 dataColumnType2.setTableId("reportaccess");
1862                 dataColumnType2.setDbColName("ORDER_NO");
1863                 dataColumnType2.setColName("ORDER_NO");
1864                 dataColumnType2.setDbColType("INTEGER");
1865                 dataColumnType2.setDisplayName("Order No");
1866                 dataColumnType2.setColId("ORDER_NO");
1867                 
1868                 dataColumnType2.setColOnChart(AppConstants.GC_LEGEND);
1869                 
1870                 
1871                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
1872                 listDataColumnType.add(dataColumnType1);
1873                 listDataColumnType.add(dataColumnType2);
1874                 
1875                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
1876                 
1877                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
1878                                 
1879                 wizardProcessor.processWizardStep(httpServletRequest);
1880         
1881                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1882
1883         }       
1884         
1885         @Test
1886         public void testProcessWizardStep_processChart_BarChart3D_case1() throws Exception {
1887                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "WIZ_ACTION");
1888                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1889                 mockHttpAttribute("showDashboardOptions","");
1890                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
1891                 mockHttpAttribute("blueBarField", "REPORT ID");
1892
1893                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
1894
1895                 mockHttpAttribute("chartType", AppConstants.GT_BAR_3D);
1896                 mockHttpAttribute("chartTypeFixed", "N");
1897                 mockHttpAttribute("legendCol", "REP_ID");
1898                 mockHttpAttribute("leftAxisLabel", "");
1899                 mockHttpAttribute("rightAxisLabel", "");
1900                 mockHttpAttribute("chartWidth", "500");
1901                 mockHttpAttribute("chartHeight", "500");
1902                 mockHttpAttribute("multiSeries", "N");
1903                 mockHttpAttribute("lastSeriesALineChart", "N");
1904                 mockHttpAttribute("lastSeriesABarChart", "N");          
1905                 mockHttpAttribute("animatedOption", "animate");
1906         
1907                 mockHttpAttribute("chartGroup", "Group");
1908                 mockHttpAttribute("drillDownReport", "DrillDown");              
1909                 mockHttpAttribute("yAxis", "Y");
1910                 mockHttpAttribute("drillDownReport", "-1");
1911                 
1912                 mockHttpAttribute("drillDownXAxisFormfield", "1");
1913                 mockHttpAttribute("drillDownYAxisFormfield", "1");
1914                 mockHttpAttribute("drillDownSeriesAxisFormfield", "1");
1915                 
1916                 mockHttpAttribute("yAxisLowerLimit", "500");
1917                 mockHttpAttribute("yAxisUpperLimit", "1200");
1918                 mockHttpAttribute("labelAngle", "N");
1919                 mockHttpAttribute("legendPosition", "Top");
1920                 mockHttpAttribute("labelAngle", "N");
1921                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
1922                 mockHttpAttribute("hideLegend", "labelAngle");
1923                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
1924                 mockHttpAttribute("hideTooltips", "N");
1925                 mockHttpAttribute("keepAsString", "N");
1926                 
1927                 mockHttpAttribute("drillDownReport", "-1");
1928                 
1929                 mockHttpAttribute("newChart1Axis", "1");
1930                 mockHttpAttribute("valueCol1", "");
1931                 mockHttpAttribute("valueCol1Color", "1");
1932                 mockHttpAttribute("valueColAxis", "1");
1933                 mockHttpAttribute("chartGroupAxis", "1");
1934                 mockHttpAttribute("YAxisLabel", "1");           
1935                 
1936                 
1937                 mockHttpAttribute("chartOrientation", "1");             
1938                 mockHttpAttribute("secondaryChartRenderer", "1");               
1939                 mockHttpAttribute("chartDisplay", "1");         
1940                 mockHttpAttribute("chartOrientationInRunPage", "1");            
1941                 mockHttpAttribute("secondaryChartRendererInRunPage", "1");              
1942                 mockHttpAttribute("chartDisplayInRunPage", "1");                
1943
1944                 mockHttpAttribute("chartSeries", "REP_ID");
1945                 
1946                 DataColumnType dataColumnType = new DataColumnType();
1947
1948                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
1949
1950                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
1951                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
1952
1953                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
1954
1955                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
1956                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
1957                 chartDrillFormfield.setFormfield("REPORT_ID");
1958                 listChartDrillFormfield.add(chartDrillFormfield);
1959
1960                 DataColumnType dataColumnType1 = new DataColumnType();
1961                 
1962                 dataColumnType1.setTableId("reportaccess");
1963                 dataColumnType1.setDbColName("REP_ID");
1964                 dataColumnType1.setColName("REP_ID");
1965                 dataColumnType1.setDbColType("INTEGER");
1966                 dataColumnType1.setDisplayName("Report Id");
1967                 dataColumnType1.setColId("REP_ID");
1968                 dataColumnType1.setColOnChart(AppConstants.GT_COMPARE_PREVYEAR_CHART);
1969
1970                 DataColumnType dataColumnType2 = new DataColumnType();
1971                 
1972                 dataColumnType2.setTableId("reportaccess");
1973                 dataColumnType2.setDbColName("ORDER_NO");
1974                 dataColumnType2.setColName("ORDER_NO");
1975                 dataColumnType2.setDbColType("INTEGER");
1976                 dataColumnType2.setDisplayName("Order No");
1977                 dataColumnType2.setColId("ORDER_NO");
1978                 
1979                 dataColumnType2.setColOnChart(AppConstants.GC_LEGEND);
1980                 
1981                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
1982                 listDataColumnType.add(dataColumnType1);
1983                 listDataColumnType.add(dataColumnType2);
1984                 
1985                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
1986                 
1987                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
1988                                 
1989                 wizardProcessor.processWizardStep(httpServletRequest);
1990         
1991                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
1992         }               
1993         
1994         @Test
1995         public void testProcessWizardStep_processChart_BarChart3D_case2() throws Exception {
1996                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "WIZ_ACTION");
1997                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
1998                 mockHttpAttribute("showDashboardOptions","");
1999                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2000                 mockHttpAttribute("blueBarField", "REPORT ID");
2001
2002                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
2003
2004                 mockHttpAttribute("chartType", AppConstants.GT_BAR_3D);
2005                 mockHttpAttribute("chartTypeFixed", "N");
2006                 mockHttpAttribute("legendCol", "REP_ID");
2007                 mockHttpAttribute("leftAxisLabel", "");
2008                 mockHttpAttribute("rightAxisLabel", "");
2009                 mockHttpAttribute("chartWidth", "500");
2010                 mockHttpAttribute("chartHeight", "500");
2011                 mockHttpAttribute("multiSeries", "N");
2012                 mockHttpAttribute("lastSeriesALineChart", "N");
2013                 mockHttpAttribute("lastSeriesABarChart", "N");          
2014                 mockHttpAttribute("animatedOption", "animate");
2015         
2016                 mockHttpAttribute("chartGroup", "Group");
2017                 mockHttpAttribute("drillDownReport", "DrillDown");              
2018                 mockHttpAttribute("yAxis", "Y");
2019                 mockHttpAttribute("drillDownReport", "-1");
2020                 
2021                 mockHttpAttribute("drillDownXAxisFormfield", "-1");
2022                 mockHttpAttribute("drillDownYAxisFormfield", "-1");
2023                 mockHttpAttribute("drillDownSeriesAxisFormfield", "-1");
2024                 
2025                 
2026                 mockHttpAttribute("yAxisLowerLimit", "500");
2027                 mockHttpAttribute("yAxisUpperLimit", "1200");
2028                 mockHttpAttribute("labelAngle", "N");
2029                 mockHttpAttribute("legendPosition", "Top");
2030                 mockHttpAttribute("labelAngle", "N");
2031                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
2032                 mockHttpAttribute("hideLegend", "labelAngle");
2033                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
2034                 mockHttpAttribute("hideTooltips", "N");
2035                 mockHttpAttribute("keepAsString", "N");
2036                 
2037                 mockHttpAttribute("drillDownReport", "-1");
2038                 
2039                 mockHttpAttribute("newChart1Axis", "1");
2040                 mockHttpAttribute("valueCol1", "");
2041                 mockHttpAttribute("valueCol1Color", "1");
2042                 mockHttpAttribute("valueColAxis", "1");
2043                 mockHttpAttribute("chartGroupAxis", "1");
2044                 mockHttpAttribute("YAxisLabel", "1");           
2045                 
2046                 mockHttpAttribute("chartOrientation", "1");             
2047                 mockHttpAttribute("secondaryChartRenderer", "1");               
2048                 mockHttpAttribute("chartDisplay", "1");         
2049                 mockHttpAttribute("chartOrientationInRunPage", "1");            
2050                 mockHttpAttribute("secondaryChartRendererInRunPage", "1");              
2051                 mockHttpAttribute("chartDisplayInRunPage", "1");                
2052                 
2053                 mockHttpAttribute("chartSeries", "REP_ID");
2054                 
2055                 DataColumnType dataColumnType = new DataColumnType();
2056
2057                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
2058
2059                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
2060                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
2061                 
2062                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
2063
2064                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
2065                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
2066                 chartDrillFormfield.setFormfield("REPORT_ID");
2067                 listChartDrillFormfield.add(chartDrillFormfield);
2068                 
2069
2070                 DataColumnType dataColumnType1 = new DataColumnType();
2071                 
2072                 dataColumnType1.setTableId("reportaccess");
2073                 dataColumnType1.setDbColName("REP_ID");
2074                 dataColumnType1.setColName("REP_ID");
2075                 dataColumnType1.setDbColType("INTEGER");
2076                 dataColumnType1.setDisplayName("Report Id");
2077                 dataColumnType1.setColId("REP_ID");
2078                 dataColumnType1.setColOnChart(AppConstants.GT_COMPARE_PREVYEAR_CHART);
2079
2080                 DataColumnType dataColumnType2 = new DataColumnType();
2081                 
2082                 dataColumnType2.setTableId("reportaccess");
2083                 dataColumnType2.setDbColName("ORDER_NO");
2084                 dataColumnType2.setColName("ORDER_NO");
2085                 dataColumnType2.setDbColType("INTEGER");
2086                 dataColumnType2.setDisplayName("Order No");
2087                 dataColumnType2.setColId("ORDER_NO");
2088                 
2089                 dataColumnType2.setColOnChart(AppConstants.GC_LEGEND);
2090                 
2091                 
2092                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
2093                 listDataColumnType.add(dataColumnType1);
2094                 listDataColumnType.add(dataColumnType2);
2095                 
2096                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
2097                 
2098                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
2099                                 
2100                 wizardProcessor.processWizardStep(httpServletRequest);
2101         
2102                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2103         }               
2104         
2105         
2106         @Test
2107         public void testProcessWizardStep_processChart_LineChart_case1() throws Exception {
2108                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "WIZ_ACTION");
2109                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
2110                 mockHttpAttribute("showDashboardOptions","");
2111                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2112                 mockHttpAttribute("blueBarField", "REPORT ID");
2113
2114                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
2115
2116                 mockHttpAttribute("chartType", AppConstants.GT_LINE);
2117                 mockHttpAttribute("chartTypeFixed", "N");
2118                 mockHttpAttribute("legendCol", "REP_ID");
2119                 mockHttpAttribute("leftAxisLabel", "");
2120                 mockHttpAttribute("rightAxisLabel", "");
2121                 mockHttpAttribute("chartWidth", "500");
2122                 mockHttpAttribute("chartHeight", "500");
2123                 mockHttpAttribute("multiSeries", "N");
2124                 mockHttpAttribute("lastSeriesALineChart", "N");
2125                 mockHttpAttribute("lastSeriesABarChart", "N");          
2126                 mockHttpAttribute("animatedOption", "animate");
2127         
2128                 mockHttpAttribute("chartGroup", "Group");
2129                 mockHttpAttribute("drillDownReport", "DrillDown");              
2130                 mockHttpAttribute("yAxis", "Y");
2131                 mockHttpAttribute("drillDownReport", "-1");
2132                 
2133                 mockHttpAttribute("drillDownXAxisFormfield", "-1");
2134                 mockHttpAttribute("drillDownYAxisFormfield", "-1");
2135                 mockHttpAttribute("drillDownSeriesAxisFormfield", "-1");
2136                 
2137                 
2138                 mockHttpAttribute("yAxisLowerLimit", "500");
2139                 mockHttpAttribute("yAxisUpperLimit", "1200");
2140                 mockHttpAttribute("labelAngle", "N");
2141                 mockHttpAttribute("legendPosition", "Top");
2142                 mockHttpAttribute("labelAngle", "N");
2143                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
2144                 mockHttpAttribute("hideLegend", "labelAngle");
2145                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
2146                 mockHttpAttribute("hideTooltips", "N");
2147                 mockHttpAttribute("keepAsString", "N");
2148                 
2149                 mockHttpAttribute("drillDownReport", "-1");
2150                 
2151                 mockHttpAttribute("newChart1Axis", "1");
2152                 mockHttpAttribute("valueCol1", "");
2153                 mockHttpAttribute("valueCol1Color", "1");
2154                 mockHttpAttribute("valueColAxis", "1");
2155                 mockHttpAttribute("chartGroupAxis", "1");
2156                 mockHttpAttribute("YAxisLabel", "1");           
2157                 
2158                 mockHttpAttribute("chartOrientation", "1");             
2159                 mockHttpAttribute("secondaryChartRenderer", "1");               
2160                 mockHttpAttribute("chartDisplay", "1");         
2161                 mockHttpAttribute("chartOrientationInRunPage", "1");            
2162                 mockHttpAttribute("secondaryChartRendererInRunPage", "1");              
2163                 mockHttpAttribute("chartDisplayInRunPage", "1");                
2164         
2165                 mockHttpAttribute("chartSeries", "REP_ID");
2166                 
2167                 DataColumnType dataColumnType = new DataColumnType();
2168
2169                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
2170
2171                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
2172                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
2173
2174                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
2175
2176                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
2177                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
2178                 chartDrillFormfield.setFormfield("REPORT_ID");
2179                 listChartDrillFormfield.add(chartDrillFormfield);
2180
2181                 DataColumnType dataColumnType1 = new DataColumnType();
2182                 
2183                 dataColumnType1.setTableId("reportaccess");
2184                 dataColumnType1.setDbColName("REP_ID");
2185                 dataColumnType1.setColName("REP_ID");
2186                 dataColumnType1.setDbColType("INTEGER");
2187                 dataColumnType1.setDisplayName("Report Id");
2188                 dataColumnType1.setColId("REP_ID");
2189                 dataColumnType1.setColOnChart(AppConstants.GT_COMPARE_PREVYEAR_CHART);
2190
2191                 DataColumnType dataColumnType2 = new DataColumnType();
2192                 
2193                 dataColumnType2.setTableId("reportaccess");
2194                 dataColumnType2.setDbColName("ORDER_NO");
2195                 dataColumnType2.setColName("ORDER_NO");
2196                 dataColumnType2.setDbColType("INTEGER");
2197                 dataColumnType2.setDisplayName("Order No");
2198                 dataColumnType2.setColId("ORDER_NO");
2199                 
2200                 dataColumnType2.setColOnChart(AppConstants.GC_LEGEND);
2201                 
2202                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
2203                 listDataColumnType.add(dataColumnType1);
2204                 listDataColumnType.add(dataColumnType2);
2205                 
2206                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
2207                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
2208                                 
2209                 wizardProcessor.processWizardStep(httpServletRequest);
2210
2211                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2212         }               
2213
2214         
2215         @Test
2216         public void testProcessWizardStep_processChart_TimeDifferenceChart_case1() throws Exception {
2217                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "WIZ_ACTION");
2218                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
2219                 mockHttpAttribute("showDashboardOptions","");
2220                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2221                 mockHttpAttribute("blueBarField", "REPORT ID");
2222
2223                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
2224                 
2225                 mockHttpAttribute("chartType", AppConstants.GT_TIME_DIFFERENCE_CHART);
2226                 mockHttpAttribute("chartTypeFixed", "N");
2227                 mockHttpAttribute("legendCol", "REP_ID");
2228                 mockHttpAttribute("leftAxisLabel", "");
2229                 mockHttpAttribute("rightAxisLabel", "");
2230                 mockHttpAttribute("chartWidth", "500");
2231                 mockHttpAttribute("chartHeight", "500");
2232                 mockHttpAttribute("multiSeries", "N");
2233                 mockHttpAttribute("lastSeriesALineChart", "N");
2234                 mockHttpAttribute("lastSeriesABarChart", "N");          
2235                 mockHttpAttribute("animatedOption", "animate");
2236         
2237                 mockHttpAttribute("intervalFromDate", "Y");
2238                 mockHttpAttribute("intervalToDate", "Y");
2239                 mockHttpAttribute("intervalLabel", "Y");
2240                 mockHttpAttribute("intervalInputInRunPage", "Y");
2241                 
2242                 
2243                 mockHttpAttribute("chartGroup", "Group");
2244                 mockHttpAttribute("drillDownReport", "DrillDown");              
2245                 mockHttpAttribute("yAxis", "Y");
2246                 mockHttpAttribute("drillDownReport", "-1");
2247                 
2248                 mockHttpAttribute("drillDownXAxisFormfield", "-1");
2249                 mockHttpAttribute("drillDownYAxisFormfield", "-1");
2250                 mockHttpAttribute("drillDownSeriesAxisFormfield", "-1");
2251                 
2252                 
2253                 mockHttpAttribute("yAxisLowerLimit", "500");
2254                 mockHttpAttribute("yAxisUpperLimit", "1200");
2255                 mockHttpAttribute("labelAngle", "N");
2256                 mockHttpAttribute("legendPosition", "Top");
2257                 mockHttpAttribute("labelAngle", "N");
2258                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
2259                 mockHttpAttribute("hideLegend", "labelAngle");
2260                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
2261                 mockHttpAttribute("hideTooltips", "N");
2262                 mockHttpAttribute("keepAsString", "N");
2263                 
2264                 mockHttpAttribute("drillDownReport", "-1");
2265                 
2266                 mockHttpAttribute("newChart1Axis", "1");
2267                 mockHttpAttribute("valueCol1", "");
2268                 mockHttpAttribute("valueCol1Color", "1");
2269                 mockHttpAttribute("valueColAxis", "1");
2270                 mockHttpAttribute("chartGroupAxis", "1");
2271                 mockHttpAttribute("YAxisLabel", "1");           
2272                 
2273                 
2274                 mockHttpAttribute("chartOrientation", "1");             
2275                 mockHttpAttribute("secondaryChartRenderer", "1");               
2276                 mockHttpAttribute("chartDisplay", "1");         
2277                 mockHttpAttribute("chartOrientationInRunPage", "1");            
2278                 mockHttpAttribute("secondaryChartRendererInRunPage", "1");              
2279                 mockHttpAttribute("chartDisplayInRunPage", "1");                
2280         
2281                 mockHttpAttribute("chartSeries", "REP_ID");
2282                 
2283                 DataColumnType dataColumnType = new DataColumnType();
2284
2285                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
2286
2287                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
2288                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
2289
2290                 
2291                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
2292
2293                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
2294                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
2295                 chartDrillFormfield.setFormfield("REPORT_ID");
2296                 listChartDrillFormfield.add(chartDrillFormfield);
2297                 
2298
2299                 DataColumnType dataColumnType1 = new DataColumnType();
2300                 
2301                 dataColumnType1.setTableId("reportaccess");
2302                 dataColumnType1.setDbColName("REP_ID");
2303                 dataColumnType1.setColName("REP_ID");
2304                 dataColumnType1.setDbColType("INTEGER");
2305                 dataColumnType1.setDisplayName("Report Id");
2306                 dataColumnType1.setColId("REP_ID");
2307                 dataColumnType1.setColOnChart(AppConstants.GT_COMPARE_PREVYEAR_CHART);
2308
2309                 DataColumnType dataColumnType2 = new DataColumnType();
2310                 
2311                 dataColumnType2.setTableId("reportaccess");
2312                 dataColumnType2.setDbColName("ORDER_NO");
2313                 dataColumnType2.setColName("ORDER_NO");
2314                 dataColumnType2.setDbColType("INTEGER");
2315                 dataColumnType2.setDisplayName("Order No");
2316                 dataColumnType2.setColId("ORDER_NO");
2317                 
2318                 dataColumnType2.setColOnChart(AppConstants.GC_LEGEND);
2319                 
2320                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
2321                 listDataColumnType.add(dataColumnType1);
2322                 listDataColumnType.add(dataColumnType2);
2323                 
2324                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
2325                 
2326                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
2327                                 
2328                 wizardProcessor.processWizardStep(httpServletRequest);
2329
2330                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2331         }               
2332         
2333         @Test
2334         public void testProcessWizardStep_processChart_VerticalStackedBarChart_case1() throws Exception {
2335                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "WIZ_ACTION");
2336                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
2337                 mockHttpAttribute("showDashboardOptions","");
2338                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2339                 mockHttpAttribute("blueBarField", "REPORT ID");
2340
2341                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
2342
2343                 mockHttpAttribute("chartType", AppConstants.GT_STACKED_VERT_BAR);
2344                 mockHttpAttribute("chartTypeFixed", "N");
2345                 mockHttpAttribute("legendCol", "REP_ID");
2346                 mockHttpAttribute("leftAxisLabel", "");
2347                 mockHttpAttribute("rightAxisLabel", "");
2348                 mockHttpAttribute("chartWidth", "500");
2349                 mockHttpAttribute("chartHeight", "500");
2350                 mockHttpAttribute("multiSeries", "N");
2351                 mockHttpAttribute("lastSeriesALineChart", "N");
2352                 mockHttpAttribute("lastSeriesABarChart", "N");          
2353                 mockHttpAttribute("animatedOption", "animate");
2354         
2355                 mockHttpAttribute("intervalFromDate", "Y");
2356                 mockHttpAttribute("intervalToDate", "Y");
2357                 mockHttpAttribute("intervalLabel", "Y");
2358                 mockHttpAttribute("intervalInputInRunPage", "Y");
2359
2360                 mockHttpAttribute("overlayItemValue", "Y");
2361                 mockHttpAttribute("animatedOption", "animate");
2362                 
2363                 mockHttpAttribute("chartGroup", "Group");
2364                 mockHttpAttribute("drillDownReport", "DrillDown");              
2365                 mockHttpAttribute("yAxis", "Y");
2366                 mockHttpAttribute("drillDownReport", "-1");
2367                 
2368                 mockHttpAttribute("drillDownXAxisFormfield", "-1");
2369                 mockHttpAttribute("drillDownYAxisFormfield", "-1");
2370                 mockHttpAttribute("drillDownSeriesAxisFormfield", "-1");
2371                 
2372                 mockHttpAttribute("yAxisLowerLimit", "500");
2373                 mockHttpAttribute("yAxisUpperLimit", "1200");
2374                 mockHttpAttribute("labelAngle", "N");
2375                 mockHttpAttribute("legendPosition", "Top");
2376                 mockHttpAttribute("labelAngle", "N");
2377                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
2378                 mockHttpAttribute("hideLegend", "labelAngle");
2379                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
2380                 mockHttpAttribute("hideTooltips", "N");
2381                 mockHttpAttribute("keepAsString", "N");
2382                 
2383                 mockHttpAttribute("drillDownReport", "-1");
2384                 
2385                 mockHttpAttribute("newChart1Axis", "1");
2386                 mockHttpAttribute("valueCol1", "");
2387                 mockHttpAttribute("valueCol1Color", "1");
2388                 mockHttpAttribute("valueColAxis", "1");
2389                 mockHttpAttribute("chartGroupAxis", "1");
2390                 mockHttpAttribute("YAxisLabel", "1");           
2391                 
2392                 
2393                 mockHttpAttribute("chartOrientation", "1");             
2394                 mockHttpAttribute("secondaryChartRenderer", "1");               
2395                 mockHttpAttribute("chartDisplay", "1");         
2396                 mockHttpAttribute("chartOrientationInRunPage", "1");            
2397                 mockHttpAttribute("secondaryChartRendererInRunPage", "1");              
2398                 mockHttpAttribute("chartDisplayInRunPage", "1");                
2399         
2400                 mockHttpAttribute("chartSeries", "REP_ID");
2401                 
2402                 DataColumnType dataColumnType = new DataColumnType();
2403
2404                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
2405
2406                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
2407                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
2408
2409                 
2410                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
2411
2412                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
2413                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
2414                 chartDrillFormfield.setFormfield("REPORT_ID");
2415                 listChartDrillFormfield.add(chartDrillFormfield);
2416
2417                 DataColumnType dataColumnType1 = new DataColumnType();
2418                 
2419                 dataColumnType1.setTableId("reportaccess");
2420                 dataColumnType1.setDbColName("REP_ID");
2421                 dataColumnType1.setColName("REP_ID");
2422                 dataColumnType1.setDbColType("INTEGER");
2423                 dataColumnType1.setDisplayName("Report Id");
2424                 dataColumnType1.setColId("REP_ID");
2425                 dataColumnType1.setColOnChart(AppConstants.GT_COMPARE_PREVYEAR_CHART);
2426
2427                 DataColumnType dataColumnType2 = new DataColumnType();
2428                 
2429                 dataColumnType2.setTableId("reportaccess");
2430                 dataColumnType2.setDbColName("ORDER_NO");
2431                 dataColumnType2.setColName("ORDER_NO");
2432                 dataColumnType2.setDbColType("INTEGER");
2433                 dataColumnType2.setDisplayName("Order No");
2434                 dataColumnType2.setColId("ORDER_NO");
2435                 
2436                 dataColumnType2.setColOnChart(AppConstants.GC_LEGEND);
2437                 
2438                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
2439                 listDataColumnType.add(dataColumnType1);
2440                 listDataColumnType.add(dataColumnType2);
2441                 
2442                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
2443                 
2444                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
2445                                 
2446                 wizardProcessor.processWizardStep(httpServletRequest);
2447         
2448                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2449         }               
2450         
2451         @Test
2452         public void testProcessWizardStep_processChart_HorizontalStackedBarChart_case1() throws Exception {
2453                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, "WIZ_ACTION");
2454                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
2455                 mockHttpAttribute("showDashboardOptions","");
2456                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2457                 mockHttpAttribute("blueBarField", "REPORT ID");
2458
2459                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
2460
2461                 mockHttpAttribute("chartType", AppConstants.GT_STACKED_HORIZ_BAR);
2462                 mockHttpAttribute("chartTypeFixed", "N");
2463                 mockHttpAttribute("legendCol", "REP_ID");
2464                 mockHttpAttribute("leftAxisLabel", "");
2465                 mockHttpAttribute("rightAxisLabel", "");
2466                 mockHttpAttribute("chartWidth", "500");
2467                 mockHttpAttribute("chartHeight", "500");
2468                 mockHttpAttribute("multiSeries", "N");
2469                 mockHttpAttribute("lastSeriesALineChart", "N");
2470                 mockHttpAttribute("lastSeriesABarChart", "N");          
2471                 mockHttpAttribute("animatedOption", "animate");
2472         
2473                 mockHttpAttribute("intervalFromDate", "Y");
2474                 mockHttpAttribute("intervalToDate", "Y");
2475                 mockHttpAttribute("intervalLabel", "Y");
2476                 mockHttpAttribute("intervalInputInRunPage", "Y");
2477                 
2478                 mockHttpAttribute("overlayItemValue", "Y");
2479                 mockHttpAttribute("animatedOption", "animate");
2480                 
2481                 mockHttpAttribute("chartGroup", "Group");
2482                 mockHttpAttribute("drillDownReport", "DrillDown");              
2483                 mockHttpAttribute("yAxis", "Y");
2484                 mockHttpAttribute("drillDownReport", "-1");
2485                 
2486                 mockHttpAttribute("drillDownXAxisFormfield", "-1");
2487                 mockHttpAttribute("drillDownYAxisFormfield", "-1");
2488                 mockHttpAttribute("drillDownSeriesAxisFormfield", "-1");
2489                 
2490                 mockHttpAttribute("yAxisLowerLimit", "500");
2491                 mockHttpAttribute("yAxisUpperLimit", "1200");
2492                 mockHttpAttribute("labelAngle", "N");
2493                 mockHttpAttribute("legendPosition", "Top");
2494                 mockHttpAttribute("labelAngle", "N");
2495                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
2496                 mockHttpAttribute("hideLegend", "labelAngle");
2497                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
2498                 mockHttpAttribute("hideTooltips", "N");
2499                 mockHttpAttribute("keepAsString", "N");
2500                 
2501                 mockHttpAttribute("drillDownReport", "-1");
2502                 
2503                 mockHttpAttribute("newChart1Axis", "1");
2504                 mockHttpAttribute("valueCol1", "");
2505                 mockHttpAttribute("valueCol1Color", "1");
2506                 mockHttpAttribute("valueColAxis", "1");
2507                 mockHttpAttribute("chartGroupAxis", "1");
2508                 mockHttpAttribute("YAxisLabel", "1");           
2509                 
2510                 mockHttpAttribute("chartOrientation", "1");             
2511                 mockHttpAttribute("secondaryChartRenderer", "1");               
2512                 mockHttpAttribute("chartDisplay", "1");         
2513                 mockHttpAttribute("chartOrientationInRunPage", "1");            
2514                 mockHttpAttribute("secondaryChartRendererInRunPage", "1");              
2515                 mockHttpAttribute("chartDisplayInRunPage", "1");                
2516         
2517                 mockHttpAttribute("chartSeries", "REP_ID");
2518                 
2519                 DataColumnType dataColumnType = new DataColumnType();
2520
2521                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
2522
2523                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
2524                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
2525                 
2526                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
2527
2528                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
2529                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
2530                 chartDrillFormfield.setFormfield("REPORT_ID");
2531                 listChartDrillFormfield.add(chartDrillFormfield);
2532                 
2533
2534                 DataColumnType dataColumnType1 = new DataColumnType();
2535                 
2536                 dataColumnType1.setTableId("reportaccess");
2537                 dataColumnType1.setDbColName("REP_ID");
2538                 dataColumnType1.setColName("REP_ID");
2539                 dataColumnType1.setDbColType("INTEGER");
2540                 dataColumnType1.setDisplayName("Report Id");
2541                 dataColumnType1.setColId("REP_ID");
2542                 dataColumnType1.setColOnChart(AppConstants.GT_COMPARE_PREVYEAR_CHART);
2543
2544                 DataColumnType dataColumnType2 = new DataColumnType();
2545                 
2546                 dataColumnType2.setTableId("reportaccess");
2547                 dataColumnType2.setDbColName("ORDER_NO");
2548                 dataColumnType2.setColName("ORDER_NO");
2549                 dataColumnType2.setDbColType("INTEGER");
2550                 dataColumnType2.setDisplayName("Order No");
2551                 dataColumnType2.setColId("ORDER_NO");
2552                 
2553                 dataColumnType2.setColOnChart(AppConstants.GC_LEGEND);
2554                 
2555                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
2556                 listDataColumnType.add(dataColumnType1);
2557                 listDataColumnType.add(dataColumnType2);
2558                 
2559                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
2560                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
2561                                 
2562                 wizardProcessor.processWizardStep(httpServletRequest);
2563
2564                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2565         }               
2566         
2567
2568         @Test
2569         public void testProcessWizardStep_processChart_VerticalStackedBarLinesChart_case1() throws Exception {
2570                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_ADD_USER);
2571                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
2572                 mockHttpAttribute("showDashboardOptions","");
2573                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2574                 mockHttpAttribute("blueBarField", "REPORT ID");
2575
2576                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
2577
2578                 mockHttpAttribute("chartType", AppConstants.GT_STACKED_VERT_BAR_LINES);
2579                 mockHttpAttribute("chartTypeFixed", "N");
2580                 mockHttpAttribute("legendCol", "REP_ID");
2581                 mockHttpAttribute("leftAxisLabel", "");
2582                 mockHttpAttribute("rightAxisLabel", "");
2583                 mockHttpAttribute("chartWidth", "500");
2584                 mockHttpAttribute("chartHeight", "500");
2585                 mockHttpAttribute("multiSeries", "N");
2586                 mockHttpAttribute("lastSeriesALineChart", "N");
2587                 mockHttpAttribute("lastSeriesABarChart", "N");          
2588                 mockHttpAttribute("animatedOption", "animate");
2589         
2590                 mockHttpAttribute("intervalFromDate", "Y");
2591                 mockHttpAttribute("intervalToDate", "Y");
2592                 mockHttpAttribute("intervalLabel", "Y");
2593                 mockHttpAttribute("intervalInputInRunPage", "Y");
2594
2595                 mockHttpAttribute("overlayItemValue", "Y");
2596                 mockHttpAttribute("animatedOption", "animate");
2597                 
2598                 mockHttpAttribute("chartGroup", "Group");
2599                 mockHttpAttribute("drillDownReport", "DrillDown");              
2600                 mockHttpAttribute("yAxis", "Y");
2601                 mockHttpAttribute("drillDownReport", "-1");
2602                 
2603                 mockHttpAttribute("drillDownXAxisFormfield", "-1");
2604                 mockHttpAttribute("drillDownYAxisFormfield", "-1");
2605                 mockHttpAttribute("drillDownSeriesAxisFormfield", "-1");
2606                 
2607                 mockHttpAttribute("yAxisLowerLimit", "500");
2608                 mockHttpAttribute("yAxisUpperLimit", "1200");
2609                 mockHttpAttribute("labelAngle", "N");
2610                 mockHttpAttribute("legendPosition", "Top");
2611                 mockHttpAttribute("labelAngle", "N");
2612                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
2613                 mockHttpAttribute("hideLegend", "labelAngle");
2614                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
2615                 mockHttpAttribute("hideTooltips", "N");
2616                 mockHttpAttribute("keepAsString", "N");
2617                 
2618                 mockHttpAttribute("drillDownReport", "-1");
2619                 
2620                 mockHttpAttribute("newChart1Axis", "1");
2621                 mockHttpAttribute("valueCol1", "");
2622                 mockHttpAttribute("valueCol1Color", "1");
2623                 mockHttpAttribute("valueColAxis", "1");
2624                 mockHttpAttribute("chartGroupAxis", "1");
2625                 mockHttpAttribute("YAxisLabel", "1");           
2626                 
2627                 
2628                 mockHttpAttribute("chartOrientation", "1");             
2629                 mockHttpAttribute("secondaryChartRenderer", "1");               
2630                 mockHttpAttribute("chartDisplay", "1");         
2631                 mockHttpAttribute("chartOrientationInRunPage", "1");            
2632                 mockHttpAttribute("secondaryChartRendererInRunPage", "1");              
2633                 mockHttpAttribute("chartDisplayInRunPage", "1");                
2634         
2635                 mockHttpAttribute("chartSeries", "REP_ID");
2636                 
2637                 mockHttpAttribute("valueColNew", "REP_ID");             
2638                 mockHttpAttribute("valueColNewColor", "YELLOW");                
2639                 mockHttpAttribute("valueColNewAxis", "Y");              
2640                 
2641                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
2642                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
2643                 
2644                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
2645
2646                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
2647                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
2648                 chartDrillFormfield.setFormfield("REPORT_ID");
2649                 listChartDrillFormfield.add(chartDrillFormfield);
2650                 
2651
2652                 DataColumnType dataColumnType1 = new DataColumnType();
2653                 
2654                 dataColumnType1.setTableId("reportaccess");
2655                 dataColumnType1.setDbColName("REP_ID");
2656                 dataColumnType1.setColName("REP_ID");
2657                 dataColumnType1.setDbColType("INTEGER");
2658                 dataColumnType1.setDisplayName("Report Id");
2659                 dataColumnType1.setColId("REP_ID");
2660                 dataColumnType1.setColOnChart(AppConstants.GT_COMPARE_PREVYEAR_CHART);
2661
2662                 DataColumnType dataColumnType2 = new DataColumnType();
2663                 
2664                 dataColumnType2.setTableId("reportaccess");
2665                 dataColumnType2.setDbColName("ORDER_NO");
2666                 dataColumnType2.setColName("ORDER_NO");
2667                 dataColumnType2.setDbColType("INTEGER");
2668                 dataColumnType2.setDisplayName("Order No");
2669                 dataColumnType2.setColId("ORDER_NO");
2670                 
2671                 dataColumnType2.setColOnChart(AppConstants.GC_LEGEND);
2672                 
2673                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
2674                 listDataColumnType.add(dataColumnType1);
2675                 listDataColumnType.add(dataColumnType2);
2676                 
2677                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
2678                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType1);
2679                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
2680                                 
2681                 wizardProcessor.processWizardStep(httpServletRequest);
2682
2683                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2684         }               
2685         
2686
2687         @Test
2688         public void testProcessWizardStep_processChart_HorizontalStackedBarLinesChart_case1() throws Exception {
2689                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_ADD_USER);
2690                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
2691                 mockHttpAttribute("showDashboardOptions","");
2692                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2693                 mockHttpAttribute("blueBarField", "REPORT ID");
2694
2695                 setWizardSteps(AppConstants.WS_CHART, AppConstants.WA_SAVE);
2696
2697                 mockHttpAttribute("chartType", AppConstants.GT_STACKED_HORIZ_BAR_LINES);
2698                 mockHttpAttribute("chartTypeFixed", "N");
2699                 mockHttpAttribute("legendCol", "REP_ID");
2700                 mockHttpAttribute("leftAxisLabel", "");
2701                 mockHttpAttribute("rightAxisLabel", "");
2702                 mockHttpAttribute("chartWidth", "500");
2703                 mockHttpAttribute("chartHeight", "500");
2704                 mockHttpAttribute("multiSeries", "N");
2705                 mockHttpAttribute("lastSeriesALineChart", "N");
2706                 mockHttpAttribute("lastSeriesABarChart", "N");          
2707                 mockHttpAttribute("animatedOption", "animate");
2708         
2709                 mockHttpAttribute("intervalFromDate", "Y");
2710                 mockHttpAttribute("intervalToDate", "Y");
2711                 mockHttpAttribute("intervalLabel", "Y");
2712                 mockHttpAttribute("intervalInputInRunPage", "Y");
2713
2714                 mockHttpAttribute("overlayItemValue", "Y");
2715                 mockHttpAttribute("animatedOption", "animate");
2716
2717                 mockHttpAttribute("chartGroup", "Group");
2718                 mockHttpAttribute("drillDownReport", "DrillDown");              
2719                 mockHttpAttribute("yAxis", "Y");
2720                 mockHttpAttribute("drillDownReport", "-1");
2721                 
2722                 mockHttpAttribute("drillDownXAxisFormfield", "-1");
2723                 mockHttpAttribute("drillDownYAxisFormfield", "-1");
2724                 mockHttpAttribute("drillDownSeriesAxisFormfield", "-1");
2725                 
2726                 mockHttpAttribute("yAxisLowerLimit", "500");
2727                 mockHttpAttribute("yAxisUpperLimit", "1200");
2728                 mockHttpAttribute("labelAngle", "N");
2729                 mockHttpAttribute("legendPosition", "Top");
2730                 mockHttpAttribute("labelAngle", "N");
2731                 mockHttpAttribute("maxLabelsInDomainAxis", "N");
2732                 mockHttpAttribute("hideLegend", "labelAngle");
2733                 mockHttpAttribute("showLegendDisplayOptionsInRunPage", "N");
2734                 mockHttpAttribute("hideTooltips", "N");
2735                 mockHttpAttribute("keepAsString", "N");
2736                 
2737                 mockHttpAttribute("drillDownReport", "-1");
2738                 
2739                 mockHttpAttribute("newChart1Axis", "1");
2740                 mockHttpAttribute("valueCol1", "");
2741                 mockHttpAttribute("valueCol1Color", "1");
2742                 mockHttpAttribute("valueColAxis", "1");
2743                 mockHttpAttribute("chartGroupAxis", "1");
2744                 mockHttpAttribute("YAxisLabel", "1");           
2745                 
2746                 mockHttpAttribute("chartOrientation", "1");             
2747                 mockHttpAttribute("secondaryChartRenderer", "1");               
2748                 mockHttpAttribute("chartDisplay", "1");         
2749                 mockHttpAttribute("chartOrientationInRunPage", "1");            
2750                 mockHttpAttribute("secondaryChartRendererInRunPage", "1");              
2751                 mockHttpAttribute("chartDisplayInRunPage", "1");                
2752         
2753                 mockHttpAttribute("chartSeries", "REP_ID");
2754                 
2755                 mockHttpAttribute("valueColNew", "");           
2756                 mockHttpAttribute("valueColNewColor", "YELLOW");                
2757                 mockHttpAttribute("valueColNewAxis", "Y");              
2758
2759                 DataColumnType dataColumnType = new DataColumnType();
2760
2761                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType);
2762
2763                 ChartAdditionalOptions chartAdditionalOptions = new ChartAdditionalOptions();
2764                 Mockito.when(reportDefinition.getChartAdditionalOptions()).thenReturn(chartAdditionalOptions);
2765                 
2766                 ChartDrillOptions chartDrillOptions = new ChartDrillOptions();
2767
2768                 List<ChartDrillFormfield> listChartDrillFormfield = chartDrillOptions.getTargetFormfield();
2769                 ChartDrillFormfield chartDrillFormfield = new ChartDrillFormfield();
2770                 chartDrillFormfield.setFormfield("REPORT_ID");
2771                 listChartDrillFormfield.add(chartDrillFormfield);
2772
2773                 DataColumnType dataColumnType1 = new DataColumnType();
2774                 
2775                 dataColumnType1.setTableId("reportaccess");
2776                 dataColumnType1.setDbColName("REP_ID");
2777                 dataColumnType1.setColName("REP_ID");
2778                 dataColumnType1.setDbColType("INTEGER");
2779                 dataColumnType1.setDisplayName("Report Id");
2780                 dataColumnType1.setColId("REP_ID");
2781                 dataColumnType1.setColOnChart(AppConstants.GT_COMPARE_PREVYEAR_CHART);
2782
2783                 DataColumnType dataColumnType2 = new DataColumnType();
2784                 
2785                 dataColumnType2.setTableId("reportaccess");
2786                 dataColumnType2.setDbColName("ORDER_NO");
2787                 dataColumnType2.setColName("ORDER_NO");
2788                 dataColumnType2.setDbColType("INTEGER");
2789                 dataColumnType2.setDisplayName("Order No");
2790                 dataColumnType2.setColId("ORDER_NO");
2791                 
2792                 dataColumnType2.setColOnChart(AppConstants.GC_LEGEND);
2793                 
2794                 List<DataColumnType> listDataColumnType = new ArrayList<DataColumnType>();
2795                 listDataColumnType.add(dataColumnType1);
2796                 listDataColumnType.add(dataColumnType2);
2797                 
2798                 Mockito.when(reportDefinition.getAllColumns()).thenReturn(listDataColumnType);
2799                 Mockito.when(reportDefinition.getColumnById(Mockito.anyString())).thenReturn(dataColumnType1);
2800                 Mockito.when(reportDefinition.getChartDrillOptions()).thenReturn(chartDrillOptions);
2801                                 
2802                 wizardProcessor.processWizardStep(httpServletRequest);
2803                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2804         }               
2805                 
2806
2807         @Test
2808         public void testProcessWizardStep_Schedule_Add_User_case1() throws Exception {
2809                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_ADD_USER);
2810                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
2811                 mockHttpAttribute("showDashboardOptions","");
2812                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2813                 mockHttpAttribute("blueBarField", "REPORT ID");
2814
2815                 setWizardSteps(AppConstants.WS_SCHEDULE, AppConstants.WA_SAVE);
2816                 
2817                 mockHttpAttribute(AppConstants.RI_DETAIL_ID, "2001");
2818                 mockHttpAttribute("pdfAttachmentKey", "PdfKey");
2819                 mockHttpAttribute("log_id", "Log#1234");
2820                 mockHttpAttribute("user_id", "demo");
2821                 
2822                 mockHttpAttribute("schedEnabled", "N");
2823                 mockHttpAttribute("schedStartDate", "03/12/2018");
2824                 mockHttpAttribute("schedEndDate", "03/12/2999");
2825                 mockHttpAttribute("schedEndHour", "9");
2826                 mockHttpAttribute("schedMin", "30");
2827                 mockHttpAttribute("schedEndMin", "10");
2828                 mockHttpAttribute("schedEndAMPM", "AM");
2829                 mockHttpAttribute("schedRunDate", "N");
2830                 mockHttpAttribute("schedHour", "10");
2831                 mockHttpAttribute("schedAMPM", "AM");
2832                                 
2833                 mockHttpAttribute("schedRecurrence", "Y");
2834                 mockHttpAttribute("conditional", "Y");
2835                 mockHttpAttribute("encryptMode" , "Y");
2836                 mockHttpAttribute("conditionSQL", "REPORT_ID=1001");
2837                 mockHttpAttribute("notify_type", "QUEUE");
2838                 mockHttpAttribute("downloadLimit", "1024mb");
2839                 mockHttpAttribute("formFields", "REPORT_ID");
2840                 mockHttpAttribute("sendAttachment", "Y");
2841                 mockHttpAttribute("schedEmailAdd", "Y");
2842                 mockHttpAttribute("schedEmailAddRole", "Y");
2843                 
2844                 PowerMockito.when(Globals.getUseLoginIdInSchedYN()).thenReturn("Y");
2845                 
2846                 wizardProcessor.processWizardStep(httpServletRequest);
2847                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2848         }               
2849
2850         @Test
2851         public void testProcessWizardStep_Schedule_Delete_User_case1() throws Exception {
2852                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_DELETE_USER);
2853                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
2854                 mockHttpAttribute("showDashboardOptions","");
2855                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2856                 mockHttpAttribute("blueBarField", "REPORT ID");
2857
2858                 setWizardSteps(AppConstants.WS_SCHEDULE, AppConstants.WA_SAVE);
2859                         
2860                 mockHttpAttribute("pdfAttachmentKey", "PdfKey");
2861                 mockHttpAttribute("log_id", "Log#1234");
2862                 mockHttpAttribute("user_id", "demo");
2863                 
2864                 mockHttpAttribute("schedEnabled", "N");
2865                 mockHttpAttribute("schedStartDate", "03/12/2018");
2866                 mockHttpAttribute("schedEndDate", "03/12/2999");
2867                 mockHttpAttribute("schedEndHour", "9");
2868                 mockHttpAttribute("schedMin", "30");
2869                 mockHttpAttribute("schedEndMin", "10");
2870                 mockHttpAttribute("schedEndAMPM", "AM");
2871                 mockHttpAttribute("schedRunDate", "N");
2872                 mockHttpAttribute("schedHour", "10");
2873                 mockHttpAttribute("schedAMPM", "AM");
2874                                 
2875                 mockHttpAttribute("schedRecurrence", "Y");
2876                 mockHttpAttribute("conditional", "Y");
2877                 mockHttpAttribute("encryptMode" , "Y");
2878
2879                 mockHttpAttribute("conditionSQL", "REPORT_ID=1001");
2880                 mockHttpAttribute("notify_type", "QUEUE");
2881                 mockHttpAttribute("downloadLimit", "1024mb");
2882                 mockHttpAttribute("formFields", "REPORT_ID");
2883                 
2884                 mockHttpAttribute("sendAttachment", "Y");
2885                 mockHttpAttribute("schedEmailAdd", "Y");
2886                 mockHttpAttribute("schedEmailAddRole", "Y");
2887                 
2888                 wizardProcessor.processWizardStep(httpServletRequest);
2889
2890                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2891         }               
2892
2893         
2894         @Test
2895         public void testProcessWizardStep_Schedule_Add_Role_case1() throws Exception {
2896                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_ADD_ROLE);
2897                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
2898                 mockHttpAttribute("showDashboardOptions","");
2899                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2900                 mockHttpAttribute("blueBarField", "REPORT ID");
2901
2902                 setWizardSteps(AppConstants.WS_SCHEDULE, AppConstants.WA_SAVE);
2903
2904                 mockHttpAttribute("pdfAttachmentKey", "PdfKey");
2905                 mockHttpAttribute("log_id", "Log#1234");
2906                 mockHttpAttribute("user_id", "demo");
2907                 
2908                 mockHttpAttribute("schedEnabled", "N");
2909                 mockHttpAttribute("schedStartDate", "03/12/2018");
2910                 mockHttpAttribute("schedEndDate", "03/12/2999");
2911                 mockHttpAttribute("schedEndHour", "9");
2912                 mockHttpAttribute("schedMin", "30");
2913                 mockHttpAttribute("schedEndMin", "10");
2914                 mockHttpAttribute("schedEndAMPM", "AM");
2915                 mockHttpAttribute("schedRunDate", "N");
2916                 mockHttpAttribute("schedHour", "10");
2917                 mockHttpAttribute("schedAMPM", "AM");
2918                 mockHttpAttribute("schedRecurrence", "Y");
2919                 mockHttpAttribute("conditional", "Y");
2920                 mockHttpAttribute("encryptMode" , "Y");
2921                 mockHttpAttribute("conditionSQL", "REPORT_ID=1001");
2922                 mockHttpAttribute("notify_type", "QUEUE");
2923                 mockHttpAttribute("downloadLimit", "1024mb");
2924                 mockHttpAttribute("formFields", "REPORT_ID");
2925                 mockHttpAttribute("sendAttachment", "Y");
2926                 mockHttpAttribute("schedEmailAdd", "Y");
2927                 mockHttpAttribute("schedEmailAddRole", "Y");
2928                 
2929                 wizardProcessor.processWizardStep(httpServletRequest);
2930
2931                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2932         }               
2933         
2934         @Test
2935         public void testProcessWizardStep_Schedule_Delete_Role_case1() throws Exception {
2936                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_DELETE_ROLE);
2937                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
2938                 mockHttpAttribute("showDashboardOptions","");
2939                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2940                 mockHttpAttribute("blueBarField", "REPORT ID");
2941
2942                 setWizardSteps(AppConstants.WS_SCHEDULE, AppConstants.WA_SAVE);
2943
2944                 mockHttpAttribute(AppConstants.RI_DETAIL_ID, "2001");
2945                 mockHttpAttribute("pdfAttachmentKey", "PdfKey");
2946                 mockHttpAttribute("log_id", "Log#1234");
2947                 mockHttpAttribute("user_id", "demo");
2948                 
2949                 mockHttpAttribute("schedEnabled", "N");
2950                 mockHttpAttribute("schedStartDate", "03/12/2018");
2951                 mockHttpAttribute("schedEndDate", "03/12/2999");
2952                 mockHttpAttribute("schedEndHour", "9");
2953                 mockHttpAttribute("schedMin", "30");
2954                 mockHttpAttribute("schedEndMin", "10");
2955                 mockHttpAttribute("schedEndAMPM", "AM");
2956                 mockHttpAttribute("schedRunDate", "N");
2957                 mockHttpAttribute("schedHour", "10");
2958                 mockHttpAttribute("schedAMPM", "AM");
2959                                 
2960                 mockHttpAttribute("schedRecurrence", "Y");
2961                 
2962                 mockHttpAttribute("conditional", "Y");
2963                 
2964                 mockHttpAttribute("encryptMode" , "Y");
2965                 
2966                 mockHttpAttribute("conditionSQL", "REPORT_ID=1001");
2967                 mockHttpAttribute("notify_type", "QUEUE");
2968                 mockHttpAttribute("downloadLimit", "1024mb");
2969                 mockHttpAttribute("formFields", "REPORT_ID");
2970                 
2971                 mockHttpAttribute("sendAttachment", "Y");
2972
2973                 mockHttpAttribute("schedEmailAdd", "Y");
2974                 mockHttpAttribute("schedEmailAddRole", "Y");
2975                 
2976                 wizardProcessor.processWizardStep(httpServletRequest);
2977                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2978         }               
2979
2980         @Test
2981         public void testProcessWizardStep_processUserAccess_Add_User_case1() throws Exception {
2982         
2983                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_ADD_USER);
2984                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
2985                 mockHttpAttribute("showDashboardOptions","");
2986                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
2987                 mockHttpAttribute("blueBarField", "REPORT ID");
2988
2989                 setWizardSteps(AppConstants.WS_USER_ACCESS, AppConstants.WA_SAVE);
2990
2991                 mockHttpAttribute("reportOwner", "Owner");
2992                 mockHttpAttribute("public", "Y");
2993                 mockHttpAttribute("newUserId", "Y");
2994                 
2995                 Mockito.when(reportDefinition.getReportSecurity()).thenReturn(reportSecurity);
2996                 wizardProcessor.processWizardStep(httpServletRequest);
2997         
2998                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
2999         }               
3000
3001         @Test
3002         public void testProcessWizardStep_processUserAccess_Delete_User_case1() throws Exception {
3003                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.WA_DELETE_USER);
3004                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
3005                 mockHttpAttribute("showDashboardOptions","");
3006                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
3007                 mockHttpAttribute("blueBarField", "REPORT ID");
3008
3009                 setWizardSteps(AppConstants.WS_USER_ACCESS, AppConstants.WA_SAVE);
3010
3011                 mockHttpAttribute("reportOwner", "Owner");
3012                 mockHttpAttribute("public", "Y");
3013                 mockHttpAttribute("newUserId", "Y");
3014
3015                 Mockito.when(reportDefinition.getReportSecurity()).thenReturn(reportSecurity);
3016
3017                 wizardProcessor.processWizardStep(httpServletRequest);
3018         
3019                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
3020         }               
3021         
3022         @Test
3023         public void testProcessImportSemaphore_case1() throws Exception {
3024                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
3025                 Mockito.when(reportRuntime.getSemaphoreList()).thenReturn(null);
3026                 wizardProcessor.processImportSemaphorePopup(httpServletRequest);
3027         
3028                 Mockito.verify(wizardProcessor, Mockito.times(1)).processImportSemaphorePopup(httpServletRequest);
3029         }               
3030         
3031
3032         @Test
3033         public void testProcessImportSemaphore_case2() throws Exception {
3034                 SemaphoreList semaphoreList = new SemaphoreList();              
3035                 List<SemaphoreType> listSemaphoreType = semaphoreList.getSemaphore();
3036                 
3037                 SemaphoreType st1 = new SemaphoreType();
3038                 SemaphoreType st2 = new SemaphoreType();
3039                 
3040                 st1.setSemaphoreName("Name1");
3041             st1.setSemaphoreId("Id1");
3042             
3043                 st2.setSemaphoreName("Name2");
3044             st2.setSemaphoreId("Id2");
3045             
3046             listSemaphoreType.add(st1);
3047             listSemaphoreType.add(st2);
3048                 
3049             mockHttpAttribute(AppConstants.RI_REPORT_ID, REPORT_ID);
3050                 
3051                 Mockito.when(reportRuntime.getSemaphoreList()).thenReturn(semaphoreList);
3052                 
3053                 Mockito.when(reportDefinition.addSemaphore(Mockito.anyObject(), Mockito.anyObject())).thenReturn(st1);
3054                 
3055                 wizardProcessor.processImportSemaphorePopup(httpServletRequest);
3056         
3057                 Mockito.verify(wizardProcessor, Mockito.times(1)).processImportSemaphorePopup(httpServletRequest);
3058         }               
3059         
3060
3061         /***
3062         
3063         @Test
3064         public void testProcessSemaphorePopup_case1() throws Exception {
3065                 
3066                 mockHttpAttribute("semaphoreId", "Id");
3067                 mockHttpAttribute("semaphoreName", "Name");
3068                 mockHttpAttribute("semaphoreType", "Type");
3069
3070                 String [] formatId = {"", ""};
3071                 String [] lessThanValue = {"1", "1"};
3072                 String [] expression = {"", ""};
3073                 String [] bold = {"", ""};
3074                 String [] italic = {"", ""};
3075                 String [] underline = {"", ""};
3076                 String [] bgColor = {"", ""};
3077                 String [] fontColor = {"", ""};
3078                 String [] fontFace = {"", ""};
3079                 String [] fontSize = {"", ""};
3080                 
3081                 mockHttpParameterValues("formatId", formatId);
3082                 mockHttpParameterValues("lessThanValue", lessThanValue);
3083                 mockHttpParameterValues("expression", expression);
3084                 mockHttpParameterValues("bold", bold);
3085                 mockHttpParameterValues("italic", italic);
3086                 mockHttpParameterValues("underline", underline);
3087                 mockHttpParameterValues("bgColor", bgColor);
3088                 mockHttpParameterValues("fontColor", fontColor);
3089                 mockHttpParameterValues("fontFace", fontFace);
3090                 mockHttpParameterValues("fontSize", fontSize);
3091                 
3092                 SemaphoreType semaphoreType = new SemaphoreType();
3093                 
3094                 //Mockito.when(reportDefinition.getSemaphoreFormatById(Mockito.anyObject(), Mockito.anyString())).thenReturn(new FormatType());
3095                 //PowerMockito.when(reportDefinition.addEmptyFormatType(Mockito.anyObject(), Mockito.anyObject())).thenReturn(new FormatType());
3096                 
3097                 Mockito.when(reportDefinition.addSemaphoreType( Mockito.anyObject(),  Mockito.anyString(), Mockito.anyString(), Mockito.anyString())).thenReturn(new SemaphoreType());
3098                 
3099                 Mockito.when(reportDefinition.getSemaphoreById("Id")).thenReturn(semaphoreType);
3100
3101                 PowerMockito.when(ReportDefinition.getSemaphoreFormatById( Mockito.anyObject(),  Mockito.anyString())).thenReturn(new FormatType());
3102                 
3103                 //Mockito.when(reportDefinition.getSemaphoreById("Id")).thenReturn(null);
3104
3105                 //Mockito.when(reportRuntime.getSemaphoreList()).thenReturn(semaphoreList);
3106                 
3107                 //Mockito.when(reportDefinition.addSemaphore(Mockito.anyObject(), Mockito.anyObject())).thenReturn(st1);
3108
3109                 wizardProcessor.processSemaphorePopup(httpServletRequest);
3110         
3111                 Mockito.verify(wizardProcessor, Mockito.times(1)).processSemaphorePopup(httpServletRequest);
3112         }       
3113         ***/    
3114
3115         
3116         /*
3117         
3118         private void mockHttpAttribute(String attributeName, String attributeValue) {
3119                 mockHttpAttribute(attributeName)).thenReturn(attributeValue);
3120         }
3121         
3122         private void mockHttpParameterValues(String parameterName, String[] parameterValue) {
3123                 Mockito.when(httpServletRequest.getParameterValues(parameterName)).thenReturn(parameterValue);
3124         }*/
3125
3126
3127         /*
3128         @Test
3129         public void testProcessWizardStep_processTableAdd_case1() throws Exception {
3130                 //ReportSecurity reportSecurity = new ReportSecurity("10001");
3131                 
3132                 String reportUserAccessSql= Globals.getReportUserAccess();
3133                 reportUserAccessSql = reportUserAccessSql.replace("[reportID]", "1001");
3134                                                                 
3135                 PowerMockito.when(DbUtils.executeQuery(reportUserAccessSql)).thenReturn(dataSet1);
3136                 
3137                 String dataMock[][] = { {"Role1", "User1"},{"Role2", "User2"},{"Role3", "User3"} };
3138                 
3139                 
3140                 Mockito.when (dataSet1.getRowCount()).thenReturn(3);
3141                 
3142                 PowerMockito.when(dataSet1.getString(Mockito.anyInt(), Mockito.anyInt())).thenAnswer(new Answer<String>() {
3143                         
3144                         @Override
3145                         public String answer(InvocationOnMock invocation) throws Throwable {
3146                               Object[] args = invocation.getArguments();
3147                               int row = (int) args[0];
3148                               int col = (int) args[1];
3149                               
3150                               if (col < 2)
3151                                   return dataMock[row][col];
3152                               else
3153                                   return "Y";
3154                         }
3155                 });
3156                 
3157                 String newScheduleSql = Globals.getNewScheduleData();
3158                 PowerMockito.when(DbUtils.executeQuery(newScheduleSql)).thenReturn(dataSet2);
3159
3160                 Mockito.when(dataSet2.getString(0,0)).thenReturn("4001");
3161                 
3162
3163                 CustomReportType customReportType = new CustomReportType();
3164                 
3165                 customReportType.setReportName("ONAP Portal users");
3166                 customReportType.setReportDescr("Report for ONAP Portal users");
3167                 customReportType.setChartType("Bar Chart");
3168                 customReportType.setCreateId("2001");
3169                 customReportType.setReportType("User Type");
3170                 
3171                 GregorianCalendar gregorianCalendar = new GregorianCalendar();
3172                 gregorianCalendar.setTime(Calendar.getInstance().getTime());
3173                 
3174                 customReportType.setCreateDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar));
3175                 
3176                 ReportWrapper rw = new ReportWrapper(customReportType,"1001", "ONAP PORTAL", "2001", "", "", "", "", false);
3177                 
3178                 //ReportWrapper(CustomReportType cr, String reportID, String ownerID, String createID, String createDate, String updateID, String updateDate, String menuID, boolean menuApproved)
3179                 
3180                 ReportDefinition localReportDefinition = new ReportDefinition(rw, httpServletRequest);
3181                 
3182                 Mockito.when(httpServletRequest.getParameter(AppConstants.RI_WIZARD_ACTION)).thenReturn(AppConstants.WA_VALIDATE);
3183                 mockHttpAttribute(AppConstants.RI_REPORT_ID)).thenReturn("1001");
3184                 mockHttpAttribute("showDashboardOptions")).thenReturn("");
3185                 mockHttpAttribute("folder_id")).thenReturn("2001");
3186                 
3187                 Mockito.when(reportHandler.loadReportDefinition(httpServletRequest, "1001")).thenReturn(localReportDefinition);
3188                 
3189                 Mockito.when(reportDefinition.getWizardSequence()).thenReturn(wizardSequence);
3190                 Mockito.when(wizardSequence.getCurrentStep()).thenReturn(AppConstants.WS_TABLES); 
3191                 Mockito.when(wizardSequence.getCurrentSubStep()).thenReturn(AppConstants.WSS_ADD);
3192
3193                 Mockito.when(reportDefinition.getReportID()).thenReturn("10001");
3194                 mockHttpAttribute("reportSQL")).thenReturn("SELECT  [colNames.toString()] FROM ( [reportSQL]");
3195                 
3196                 
3197                 mockHttpAttribute("tableName")).thenReturn("cr_report_access crc");
3198                 mockHttpAttribute("joinTableName")).thenReturn("cr_report cr");
3199                 mockHttpAttribute("joinExpr")).thenReturn("crc.rep_id = cr.rep_id");
3200                 mockHttpAttribute("tablePK")).thenReturn("crc.rep_id");
3201                 mockHttpAttribute("displayName")).thenReturn("Report Access");
3202                         
3203                 String columnNames[] = {"ID", "COL1", "COL2", "COL3"};
3204                 String columnType[] = {"Integer", "VARCHAR2", "VARCHAR2", "VARCHAR2"};
3205                 //String columnVal[] = {"1", "Val1", "Val2", "Val3"};
3206                 
3207
3208                 
3209                 Mockito.when(resultSet.next()).thenReturn(true);
3210                 Mockito.when(resultSet.getMetaData()).thenReturn(resultSetMetaData);
3211
3212                 Mockito.when(resultSetMetaData.getColumnCount()).thenReturn(columnNames.length);
3213                         
3214                 Mockito.when(resultSetMetaData.getColumnLabel(Mockito.anyInt())).thenAnswer(new Answer<String>() {
3215                         
3216                         @Override
3217                         public String answer(InvocationOnMock invocation) throws Throwable {
3218                               Object[] args = invocation.getArguments();
3219                               int columnIndex = Integer.parseInt((String) args[0]);
3220                                         return columnNames[columnIndex+1];
3221                         }
3222                 });
3223                 
3224                 Mockito.when(resultSetMetaData.getColumnType(Mockito.anyInt())).thenAnswer(new Answer<String>() {
3225                         
3226                         @Override
3227                         public String answer(InvocationOnMock invocation) throws Throwable {
3228                               Object[] args = invocation.getArguments();
3229                               int columnIndex = Integer.parseInt((String) args[0]);
3230                                         return columnType[columnIndex+1];
3231                         }
3232                 });     
3233                 
3234                 //DataSet localDataSet = new DataSet(resultSet);                                
3235                 //PowerMockito.when(DbUtils.executeQuery(reportUserAccessSql)).thenReturn(localDataSet);
3236                 
3237                 wizardProcessor.processWizardStep(httpServletRequest);
3238         }
3239         
3240         
3241         @Test
3242         public void testProcessWizardStep_not_null_arguments_crosstab() throws Exception {
3243                 PowerMockito.whenNew(ReportHandler.class).withNoArguments().thenReturn(reportHandler);  
3244                 Mockito.when(AppUtils.getRequestValue(httpServletRequest, AppConstants.RI_REPORT_ID)).thenReturn("1000");
3245                 Mockito.when(AppUtils.getRequestNvlValue(httpServletRequest, "showDashboardOptions")).thenReturn("");
3246         
3247                 Mockito.when(AppUtils.getRequestNvlValue(httpServletRequest, "reportType")).thenReturn(AppConstants.RT_CROSSTAB);
3248                 Mockito.when(reportHandler.loadReportDefinition(httpServletRequest,"1000")).thenReturn(reportDefinition);
3249                 
3250                 Mockito.when(httpServletRequest.getParameter(AppConstants.RI_WIZARD_ACTION)).thenReturn("NA");
3251                 Mockito.when(reportDefinition.getWizardSequence()).thenReturn(wizardSequence);
3252                 Mockito.when(wizardSequence.getCurrentStep()).thenReturn(AppConstants.WS_DEFINITION);
3253                 Mockito.when(wizardSequence.getCurrentSubStep()).thenReturn("NA");
3254                 
3255                 Mockito.when(reportDefinition.getReportID()).thenReturn("1");
3256                 Mockito.when(reportDefinition.getReportType()).thenReturn(AppConstants.RT_CROSSTAB);
3257                 
3258                 mockHttpAttribute("reportName")).thenReturn("Report 1");
3259                 mockHttpAttribute("reportDescr")).thenReturn("Report One help for testing...");
3260
3261                 wizardProcessor.processWizardStep(httpServletRequest);
3262                 
3263
3264                 //Mockito.when(AppUtils.getRequestNvlValue(httpServletRequest, "widthNo")).thenReturn("500px");
3265
3266                 //wizardProcessor.processWizardStep(httpServletRequest);
3267                 
3268                 
3269                 
3270         }
3271         
3272         ***/
3273         
3274         
3275         @Test
3276         public void testProcessAdhocSchedule_Add_User_case1() throws Exception {
3277                 
3278                 mockHttpAttribute("pdfAttachmentKey", "PdfKey");
3279                 mockHttpAttribute("log_id", "Log#1234");
3280                 mockHttpAttribute("user_id", "demo");
3281                 
3282                 mockHttpAttribute("schedEnabled", "N");
3283                 mockHttpAttribute("schedStartDate", "03/12/2018");
3284                 mockHttpAttribute("schedEndDate", "03/12/2999");
3285                 mockHttpAttribute("schedEndHour", "9");
3286                 mockHttpAttribute("schedMin", "30");
3287                 mockHttpAttribute("schedEndMin", "10");
3288                 mockHttpAttribute("schedEndAMPM", "AM");
3289                 mockHttpAttribute("schedRunDate", "N");
3290                 mockHttpAttribute("schedHour", "10");
3291                 mockHttpAttribute("schedAMPM", "AM");
3292                                 
3293                 mockHttpAttribute("schedRecurrence", "Y");
3294                 
3295                 mockHttpAttribute("conditional", "Y");
3296                 
3297                 mockHttpAttribute("conditionSQL", "REPORT_ID=1001");
3298                 mockHttpAttribute("notify_type", "QUEUE");
3299                 mockHttpAttribute("downloadLimit", "1024mb");
3300                 mockHttpAttribute("formFields", "REPORT_ID");
3301                 
3302                 mockHttpAttribute("sendAttachment", "Y");
3303
3304                 mockHttpAttribute("schedEmailAdd", "Y");
3305                 mockHttpAttribute("schedEmailAddRole", "Y");
3306                 
3307                 Mockito.when(httpServletRequest.getSession(false)).thenReturn(httpSession);
3308                 Mockito.when(httpSession.getAttribute("user_attribute_name") ).thenReturn(user);
3309                 
3310                 PowerMockito.when(Globals.getUseLoginIdInSchedYN()).thenReturn("Y");
3311
3312                 wizardProcessor.processAdhocSchedule(httpServletRequest, AppConstants.WA_ADD_USER);
3313
3314                 Mockito.verify(wizardProcessor, Mockito.times(1)).processAdhocSchedule(httpServletRequest, AppConstants.WA_ADD_USER);
3315         }
3316
3317         @Test
3318         public void testProcessAdhocSchedule_Delete_User_case1() throws Exception {
3319
3320                 mockHttpAttribute(AppConstants.RI_DETAIL_ID, "2001");
3321                 mockHttpAttribute("pdfAttachmentKey", "PdfKey");
3322                 mockHttpAttribute("log_id", "Log#1234");
3323                 mockHttpAttribute("user_id", "demo");
3324                 
3325                 mockHttpAttribute("schedEnabled", "N");
3326                 mockHttpAttribute("schedStartDate", "03/12/2018");
3327                 mockHttpAttribute("schedEndDate", "03/12/2999");
3328                 mockHttpAttribute("schedEndHour", "9");
3329                 mockHttpAttribute("schedMin", "30");
3330                 mockHttpAttribute("schedEndMin", "10");
3331                 mockHttpAttribute("schedEndAMPM", "AM");
3332                 mockHttpAttribute("schedRunDate", "N");
3333                 mockHttpAttribute("schedHour", "10");
3334                 mockHttpAttribute("schedAMPM", "AM");
3335                                 
3336                 mockHttpAttribute("schedRecurrence", "Y");
3337                 mockHttpAttribute("conditional", "Y");
3338                 
3339                 mockHttpAttribute("conditionSQL", "REPORT_ID=1001");
3340                 mockHttpAttribute("notify_type", "QUEUE");
3341                 mockHttpAttribute("downloadLimit", "1024mb");
3342                 mockHttpAttribute("formFields", "REPORT_ID");
3343                 
3344                 mockHttpAttribute("sendAttachment", "Y");
3345                 mockHttpAttribute("schedEmailAdd", "Y");
3346                 mockHttpAttribute("schedEmailAddRole", "Y");
3347                 
3348                 Mockito.when(httpServletRequest.getSession(false)).thenReturn(httpSession);
3349                 Mockito.when(httpSession.getAttribute("user_attribute_name") ).thenReturn(user);
3350                 
3351                 wizardProcessor.processAdhocSchedule(httpServletRequest, AppConstants.WA_DELETE_USER);
3352                 Mockito.verify(wizardProcessor, Mockito.times(1)).processAdhocSchedule(httpServletRequest, AppConstants.WA_DELETE_USER);
3353         }
3354  
3355
3356         @Test
3357         public void testProcessAdhocSchedule_Add_Role_case1() throws Exception {
3358
3359                 mockHttpAttribute(AppConstants.RI_DETAIL_ID, "2001");
3360                 mockHttpAttribute("pdfAttachmentKey", "PdfKey");
3361                 mockHttpAttribute("log_id", "Log#1234");
3362                 mockHttpAttribute("user_id", "demo");
3363                 
3364                 mockHttpAttribute("schedEnabled", "N");
3365                 mockHttpAttribute("schedStartDate", "03/12/2018");
3366                 mockHttpAttribute("schedEndDate", "03/12/2999");
3367                 mockHttpAttribute("schedEndHour", "9");
3368                 mockHttpAttribute("schedMin", "30");
3369                 mockHttpAttribute("schedEndMin", "10");
3370                 mockHttpAttribute("schedEndAMPM", "AM");
3371                 mockHttpAttribute("schedRunDate", "N");
3372                 mockHttpAttribute("schedHour", "10");
3373                 mockHttpAttribute("schedAMPM", "AM");
3374                                 
3375                 mockHttpAttribute("schedRecurrence", "Y");
3376                 
3377                 mockHttpAttribute("conditional", "Y");
3378                 
3379                 mockHttpAttribute("conditionSQL", "REPORT_ID=1001");
3380                 mockHttpAttribute("notify_type", "QUEUE");
3381                 mockHttpAttribute("downloadLimit", "1024mb");
3382                 mockHttpAttribute("formFields", "REPORT_ID");
3383                 
3384                 mockHttpAttribute("sendAttachment", "Y");
3385
3386                 mockHttpAttribute("schedEmailAdd", "Y");
3387                 mockHttpAttribute("schedEmailAddRole", "Y");
3388                 
3389                 Mockito.when(httpServletRequest.getSession(false)).thenReturn(httpSession);
3390
3391                 Mockito.when(httpSession.getAttribute("user_attribute_name") ).thenReturn(user);
3392                 
3393                 PowerMockito.when(Globals.getUseLoginIdInSchedYN()).thenReturn("Y");
3394                 
3395                 wizardProcessor.processAdhocSchedule(httpServletRequest, AppConstants.WA_ADD_ROLE);
3396                 Mockito.verify(wizardProcessor, Mockito.times(1)).processAdhocSchedule(httpServletRequest, AppConstants.WA_ADD_ROLE);           
3397         }
3398
3399
3400         @Test
3401         public void testProcessAdhocSchedule_Delete_Role_case1() throws Exception {
3402
3403                 mockHttpAttribute(AppConstants.RI_DETAIL_ID, "2001");
3404                 mockHttpAttribute("pdfAttachmentKey", "PdfKey");
3405                 mockHttpAttribute("log_id", "Log#1234");
3406                 mockHttpAttribute("user_id", "demo");
3407                 
3408                 mockHttpAttribute("schedEnabled", "N");
3409                 mockHttpAttribute("schedStartDate", "03/12/2018");
3410                 mockHttpAttribute("schedEndDate", "03/12/2999");
3411                 mockHttpAttribute("schedEndHour", "9");
3412                 mockHttpAttribute("schedMin", "30");
3413                 mockHttpAttribute("schedEndMin", "10");
3414                 mockHttpAttribute("schedEndAMPM", "AM");
3415                 mockHttpAttribute("schedRunDate", "N");
3416                 mockHttpAttribute("schedHour", "10");
3417                 mockHttpAttribute("schedAMPM", "AM");
3418                                 
3419                 mockHttpAttribute("schedRecurrence", "Y");
3420                 
3421                 mockHttpAttribute("conditional", "Y");
3422                 
3423                 mockHttpAttribute("conditionSQL", "REPORT_ID=1001");
3424                 mockHttpAttribute("notify_type", "QUEUE");
3425                 mockHttpAttribute("downloadLimit", "1024mb");
3426                 mockHttpAttribute("formFields", "REPORT_ID");
3427                 
3428                 mockHttpAttribute("sendAttachment", "Y");
3429
3430                 mockHttpAttribute("schedEmailAdd", "Y");
3431                 mockHttpAttribute("schedEmailAddRole", "Y");
3432                 Mockito.when(httpServletRequest.getSession(false)).thenReturn(httpSession);
3433                 Mockito.when(httpSession.getAttribute("user_attribute_name") ).thenReturn(user);
3434                 wizardProcessor.processAdhocSchedule(httpServletRequest, AppConstants.WA_DELETE_ROLE);
3435                 
3436         }
3437         
3438
3439         @Test
3440         public void testProcessWizardStep_processMap_case1() throws Exception {
3441                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.RI_ACTION);
3442                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
3443                 mockHttpAttribute("showDashboardOptions","");
3444                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
3445
3446                 setWizardSteps(AppConstants.WS_MAP, AppConstants.WA_SAVE);
3447
3448                 mockHttpAttribute("addressColumn0", "");
3449                 mockHttpAttribute("dataColumn0", "");
3450                 mockHttpAttribute("legendColumn", "");
3451                 mockHttpAttribute("markerColor0", "");
3452                 mockHttpAttribute("isMapAllowed", "");
3453                 mockHttpAttribute("useDefaultSize", "");
3454                 mockHttpAttribute("height", "");
3455                 mockHttpAttribute("width", "");
3456                 mockHttpAttribute("addAddress", "");
3457                 mockHttpAttribute("latColumn", "");
3458                 mockHttpAttribute("longColumn", "");
3459                 mockHttpAttribute("colorColumn", "");
3460                 
3461                 mockHttpAttribute("markerCount", "");
3462                 
3463                 
3464                 Mockito.when(reportDefinition.getReportMap()).thenReturn(null);
3465                 wizardProcessor.processWizardStep(httpServletRequest);
3466
3467                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
3468         }               
3469         
3470         @Test
3471         public void testProcessWizardStep_processMap_case2() throws Exception {
3472                 mockHttpParameter(AppConstants.RI_WIZARD_ACTION, AppConstants.RI_ACTION);
3473                 mockHttpAttribute(AppConstants.RI_REPORT_ID,REPORT_ID);
3474                 mockHttpAttribute("showDashboardOptions","");
3475                 mockHttpAttribute(AppConstants.RI_DETAIL_ID,DETAIL_ID);
3476
3477                 setWizardSteps(AppConstants.WS_MAP, AppConstants.WA_SAVE);
3478
3479                 ReportMap reportMap = new ReportMap();
3480                 
3481                 mockHttpAttribute("addressColumn0", "Y");
3482                 mockHttpAttribute("dataColumn0", "Y");
3483                 mockHttpAttribute("legendColumn", "Y");
3484                 mockHttpAttribute("markerColor0", "Y");
3485                 mockHttpAttribute("isMapAllowed", "Y");
3486                 mockHttpAttribute("useDefaultSize", "Y");
3487                 mockHttpAttribute("height", "Y");
3488                 mockHttpAttribute("width", "Y");
3489                 mockHttpAttribute("addAddress", "Y");
3490                 mockHttpAttribute("latColumn", "Y");
3491                 mockHttpAttribute("longColumn", "Y");
3492                 mockHttpAttribute("colorColumn", "Y");
3493                 
3494                 mockHttpAttribute("markerCount", "3");
3495                 
3496                 mockHttpAttribute("addressColumn1", "1");
3497                 mockHttpAttribute("dataHeader1", "Header1");
3498                 mockHttpAttribute("dataColumn1", "DataColumn1");
3499                 mockHttpAttribute("markerColor1", "Color1");
3500                 
3501                 mockHttpAttribute("addressColumn2", "2");
3502                 mockHttpAttribute("dataHeader2", "Header2");
3503                 mockHttpAttribute("dataColumn2", "DataColumn2");
3504                 mockHttpAttribute("markerColor2", "Color2");
3505
3506                 Mockito.when(reportDefinition.getReportMap()).thenReturn(reportMap);
3507                 wizardProcessor.processWizardStep(httpServletRequest);
3508
3509                 Mockito.verify(wizardProcessor, Mockito.times(1)).processWizardStep(httpServletRequest);
3510         }               
3511
3512 }