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