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