KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jaspersoft > jasperserver > war > wizard > SalesByMonthWizardFlow


1
2 /*
3  * Copyright (C) 2006 JasperSoft http://www.jaspersoft.com
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed WITHOUT ANY WARRANTY; and without the
11  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
16  * or write to:
17  *
18  * Free Software Foundation, Inc.,
19  * 59 Temple Place - Suite 330,
20  * Boston, MA USA 02111-1307
21  */

22
23 package com.jaspersoft.jasperserver.war.wizard;
24
25
26 import com.jaspersoft.jasperserver.war.wizard.TestAttribute.DataSourceAttrb;
27
28 import junit.framework.Test;
29 import junit.framework.TestCase;
30 import junit.framework.TestSuite;
31
32
33 /**
34  * The test cases are for: -
35  * testing the wizard flow for the Sales by Month Jrxml file
36  *
37  **/

38 public class SalesByMonthWizardFlow
39     extends AbstractHttpWizardBaseFlow {
40     /**
41      * Creates a new JDBCWizardFlowTest object.
42      *
43      * @param s
44      **/

45     public SalesByMonthWizardFlow(String JavaDoc s) {
46         super(s);
47     }
48     
49     
50     //****--------------------------------------------------------------------------*****/
51
//* HttpUnit test cases */
52
//****--------------------------------------------------------------------------*****/
53

54     
55     /**
56      * This test case method is for testing Wizard flow with respect to JDBC, for JS application
57      * This Page checks for the cancel and back buttons on different pages within the folw,
58      * also checks for the next button functionality with and without proer response.
59      * And finally publish the report on Report Browser page.
60      *
61      * @throws Exception if fails
62      **/

63     public void testWizardFlowWithJDBC()
64       throws Exception JavaDoc {
65         TestAttribute attrbs = new TestAttribute();
66         attrbs.setReportName("TestJDBC"+String.valueOf((int)(Math.random()*1000)));
67         attrbs.setLabel("Test report by http unit test for JDBC");
68         attrbs.setJrxml("SalesByMonth.jrxml");
69         attrbs.setJrmlResources(resourceMap);
70         DataSourceAttrb dsattrbs = attrbs.new DataSourceAttrb();
71         dsattrbs.setDataSourceType(TestAttribute.DSTYPE_JDBC);
72         dsattrbs.setName("jdbc");
73         dsattrbs.setLabel("Using JDBC DS");
74         dsattrbs.setDriver("com.mysql.jdbc.Driver");
75         dsattrbs.setUrl("jdbc:mysql://localhost:3306/jasperserver");
76         dsattrbs.setUsername("root");
77         dsattrbs.setPassword("root");
78         attrbs.setDataSourceAttrb(dsattrbs);
79         this.runWizardFlow(attrbs);
80     }
81     
82     
83     
84     /**
85      * This test case method is for testing Wizard flow with respect to JNDI, for JS application
86      * This Page checks for the cancel and back buttons on different pages within the folw,
87      * also checks for the next button functionality with and without proer response.
88      * And finally publish the report on Report Browser page.
89      *
90      * @throws Exception if fails
91      **/

92     public void testWizardFlowWithJNDI()
93       throws Exception JavaDoc {
94         TestAttribute attrbs = new TestAttribute();
95         attrbs.setReportName("TestJNDI"+String.valueOf((int)(Math.random()*1000)));
96         attrbs.setLabel("Test report by http unit test for JNDI");
97         attrbs.setJrxml("SalesByMonth.jrxml");
98         attrbs.setJrmlResources(resourceMap);
99         DataSourceAttrb dsattrbs = attrbs.new DataSourceAttrb();
100         dsattrbs.setDataSourceType(TestAttribute.DSTYPE_JNDI);
101         dsattrbs.setName("jndi");
102         dsattrbs.setLabel("Using jndi ds");
103         dsattrbs.setServiceName("jdbc/jserver");
104         attrbs.setDataSourceAttrb(dsattrbs);
105         this.runWizardFlow(attrbs);
106     }
107
108     
109     public void individualLoadFilePage() throws Exception JavaDoc {};
110       
111     
112         
113     //****--------------------------------------------------------------------------*****/
114
//* Base class method implementaion */
115
//****--------------------------------------------------------------------------*****/
116

117
118     
119     /* (non-Javadoc)
120      * @see com.jaspersoft.jasperserver.war.HttpUnitBaseTestCase#getloginCredentials()
121      */

122     protected String JavaDoc[] getloginCredentials() {
123         return new String JavaDoc[] { USERNAME, PASSWORD };
124     }
125     
126     
127
128     //****--------------------------------------------------------------------------*****/
129
//* main method to run the test */
130
//****--------------------------------------------------------------------------*****/
131

132     
133     
134     /**
135      * the main method for calling all the test cases whichever is being added into the suite.
136      *
137      * @param args
138      **/

139     public static void main(String JavaDoc[] args) {
140         try {
141             junit.textui.TestRunner.run(suite());
142         } catch (Exception JavaDoc _ex) {
143             _ex.printStackTrace();
144         }
145     }
146
147     /**
148      * this method is for adding which all test case/s method/s need to be
149      *
150      * @return Test
151      *
152      * @throws Exception if fails
153      **/

154     public static Test suite()
155       throws Exception JavaDoc {
156         TestSuite suite = new TestSuite();
157
158         TestCase test1 = new SalesByMonthWizardFlow("testWizardFlowWithJDBC");
159         TestCase test2 = new SalesByMonthWizardFlow("testWizardFlowWithJNDI");
160         suite.addTest(test1);
161         suite.addTest(test2);
162         
163         return suite;
164     }
165 }
166
Popular Tags