Source Code Cross Referenced for SQLValidationTestCases.java in  » Rule-Engine » Mandarax » test » org » mandarax » jdbc » parser » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Rule Engine » Mandarax » test.org.mandarax.jdbc.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 1999-2004 <a href="mailto:mandarax@jbdietrich.com">Jens Dietrich</a>
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */
018:
019:        package test.org.mandarax.jdbc.parser;
020:
021:        import junit.framework.TestSuite;
022:
023:        /**
024:         * A test suite for SQL validation test cases.
025:         * @author <A HREF="mailto:mandarax@jbdietrich.com">Jens Dietrich</A>
026:         * @version 3.3.2 <29 December 2004>
027:         * @since 3.0
028:         */
029:
030:        public class SQLValidationTestCases {
031:
032:            /**
033:             * Launch the test suite. See TestRunner for interpretation
034:             * of command line parameters.
035:             * @see test.org.mandarax.testsupport.TestRunner
036:             * @param args parameters
037:             */
038:            public static void main(String[] args) {
039:                test.org.mandarax.testsupport.TestRunner.run(
040:                        SQLValidationTestCases.class, args);
041:            }
042:
043:            /**
044:             * Create a test suite.
045:             * @return a test suite
046:             */
047:            public static TestSuite suite() {
048:
049:                TestSuite suite = new TestSuite(
050:                        "Test cases for the SQL parser (check whether SQL commands are accepted)");
051:
052:                suite
053:                        .addTest(new SQLValidationTestCase(
054:                                "select * from mytable"));
055:                suite.addTest(new SQLValidationTestCase(
056:                        "select * from default.mytable"));
057:                suite
058:                        .addTest(new SQLValidationTestCase(
059:                                "SELECT * FROM mytable"));
060:                suite
061:                        .addTest(new SQLValidationTestCase(
062:                                "Select * From mytable"));
063:                suite
064:                        .addTest(new SQLValidationTestCase(
065:                                "seLecT * fRoM mytable"));
066:                suite.addTest(new SQLValidationTestCase(
067:                        "select col1 from mytable"));
068:                suite.addTest(new SQLValidationTestCase(
069:                        "select col1,col2 from mytable"));
070:                suite.addTest(new SQLValidationTestCase(
071:                        "select col1,col2 from mytable where col1='test'"));
072:                suite.addTest(new SQLValidationTestCase(
073:                        "select col1,col2 from mytable WHERE col1='test'"));
074:                suite.addTest(new SQLValidationTestCase(
075:                        "select col1,col2 from mytable Where col1='test'"));
076:                suite.addTest(new SQLValidationTestCase(
077:                        "select col1,col2 from mytable wHerE col1='test'"));
078:                suite.addTest(new SQLValidationTestCase(
079:                        "select col1,col2 from mytable where col1!='test'"));
080:                suite
081:                        .addTest(new SQLValidationTestCase(
082:                                "select col1,col2 from mytable where col1=test",
083:                                false));
084:                // bugfix reported in Mandarax 3.2 / 3.3 - literals with whitespaces not parsed correctly
085:                suite
086:                        .addTest(new SQLValidationTestCase(
087:                                "select col1,col2 from mytable where col1='test with whitespaces'"));
088:                suite.addTest(new SQLValidationTestCase(
089:                        "select col1,col2 from mytable where col1=42"));
090:                suite.addTest(new SQLValidationTestCase(
091:                        "select col1,col2 from mytable where col1<42"));
092:                suite.addTest(new SQLValidationTestCase(
093:                        "select col1,col2 from mytable where col1>42"));
094:                suite.addTest(new SQLValidationTestCase(
095:                        "select col1,col2 from mytable where col1<=42"));
096:                suite.addTest(new SQLValidationTestCase(
097:                        "select col1,col2 from mytable where col1>=42"));
098:                suite
099:                        .addTest(new SQLValidationTestCase(
100:                                "select col1,col2 from mytable where col1 like 'abc%_'"));
101:                suite.addTest(new SQLValidationTestCase(
102:                        "select col1,col2 from mytable where col1=null"));
103:                suite
104:                        .addTest(new SQLValidationTestCase(
105:                                "select col1,col2 from mytable where col1=nulle",
106:                                false));
107:                suite
108:                        .addTest(new SQLValidationTestCase(
109:                                "select col1,col2 from mytable where col1='a' and col2='b'"));
110:                suite
111:                        .addTest(new SQLValidationTestCase(
112:                                "select col1,col2 from mytable where col1='a' and col2='b' and col3='c'"));
113:                suite
114:                        .addTest(new SQLValidationTestCase(
115:                                "select col1,col2 from mytable where not (col1=null and col2=null)"));
116:                suite
117:                        .addTest(new SQLValidationTestCase(
118:                                "select col1,col2 from mytable where col1='a' or col2='b'"));
119:                suite
120:                        .addTest(new SQLValidationTestCase(
121:                                "select col1,col2 from mytable where col1='a' or col2='b' or col3='c'"));
122:                suite
123:                        .addTest(new SQLValidationTestCase(
124:                                "select col1,col2 from mytable where not (col1=null or col2=null)"));
125:                suite
126:                        .addTest(new SQLValidationTestCase(
127:                                "select distinct col1,col2 from mytable where not (col1=null or col2=null)"));
128:                // order by
129:                suite.addTest(new SQLValidationTestCase(
130:                        "select col1,col2 from mytable order by col1"));
131:                suite.addTest(new SQLValidationTestCase(
132:                        "select col1,col2 from mytable order by col1,col2"));
133:                suite
134:                        .addTest(new SQLValidationTestCase(
135:                                "select col1,col2 from mytable order by col1,col2 asc"));
136:                suite
137:                        .addTest(new SQLValidationTestCase(
138:                                "select col1,col2 from mytable order by col1,col2 desc"));
139:                suite
140:                        .addTest(new SQLValidationTestCase(
141:                                "select col1,col2 from mytable order by col1 asc,col2 desc"));
142:                suite.addTest(new SQLValidationTestCase(
143:                        "select col1,col2 from mytable order by col1 asc"));
144:                suite.addTest(new SQLValidationTestCase(
145:                        "select col1,col2 from mytable order by col1 desc"));
146:                suite
147:                        .addTest(new SQLValidationTestCase(
148:                                "select col1,col2 from mytable where col1='a' order by col1 desc"));
149:                suite
150:                        .addTest(new SQLValidationTestCase(
151:                                "select col1,col2 from mytable where col1='a' or col1='b' order by col1 desc"));
152:                // group by
153:                suite.addTest(new SQLValidationTestCase(
154:                        "select col1,col2 from mytable group by col1"));
155:                suite.addTest(new SQLValidationTestCase(
156:                        "select col1,col2 from mytable group by col1, col2"));
157:                suite
158:                        .addTest(new SQLValidationTestCase(
159:                                "select col1,col2 from mytable group by col1, col2 having col1='a'"));
160:                // bugfix reported in Mandarax 3.2 / 3.3 - literals with whitespaces not parsed correctly
161:                suite
162:                        .addTest(new SQLValidationTestCase(
163:                                "select col1,col2 from mytable group by col1, col2 having col1='a and whitespace'"));
164:                suite
165:                        .addTest(new SQLValidationTestCase(
166:                                "select col1,col2 from mytable group by col1, col2 having col1='a' and col2='a'"));
167:                suite
168:                        .addTest(new SQLValidationTestCase(
169:                                "select col1,col2 from mytable group by col1, col2 having avg(col3)='a'"));
170:                suite
171:                        .addTest(new SQLValidationTestCase(
172:                                "select col2,avg(col1),col2,min(col1),max(col1),sum(col1) from mytable group by col1, col2 having avg(col3)='a'"));
173:                suite
174:                        .addTest(new SQLValidationTestCase(
175:                                "select col2,avg(col1),col2,min(col1),max(col1),sum(col1) from mytable group by col1, col2 order by avg(col3)"));
176:                suite
177:                        .addTest(new SQLValidationTestCase(
178:                                "select col2,avg(col1),col2,min(col1),max(col1),sum(col1) from mytable group by col1, col2 order by avg(col3) desc"));
179:                suite
180:                        .addTest(new SQLValidationTestCase(
181:                                "select col2,avg(col1),col2,min(col1),max(col1),sum(col1) from mytable group by col1, col2 order by avg(col3) asc"));
182:                suite
183:                        .addTest(new SQLValidationTestCase(
184:                                "select col2,avg(col1),col2,min(col1),max(col1),sum(col1) from mytable group by col1, col2 order by col1 desc,avg(col3) asc"));
185:                suite
186:                        .addTest(new SQLValidationTestCase(
187:                                "select col2,avg(col1),col2,min(col1),max(col1),sum(col1) from mytable where col3='magic' group by col1, col2 order by col1 desc,avg(col3) asc"));
188:                suite
189:                        .addTest(new SQLValidationTestCase(
190:                                "select col2,avg(col1),col2,min(col1),max(col1),sum(col1) from mytable where col3='magic' group by col1, col2 having col1='b' and avg(col3)='a' order by col1 desc, avg(col3) asc"));
191:                // count 
192:                suite.addTest(new SQLValidationTestCase(
193:                        "select count(*) from mytable"));
194:                suite.addTest(new SQLValidationTestCase(
195:                        "select count(*) from mytable group by col1"));
196:                suite.addTest(new SQLValidationTestCase(
197:                        "select count(*),col1 from mytable"));
198:
199:                // 
200:                suite.addTest(new SQLValidationTestCase(
201:                        "select * from is_father_of where father='F '"));
202:                return suite;
203:            }
204:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.