01: /*
02: * Copyright (C) 1999-2004 <a href="mailto:mandarax@jbdietrich.com">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package test.org.mandarax.jdbc.parser;
20:
21: import junit.framework.TestSuite;
22: import org.mandarax.jdbc.server.sql.*;
23:
24: /**
25: * A test suite for SQL parser test cases. Tests the from and Select clauses.
26: * @author <A HREF="mailto:mandarax@jbdietrich.com">Jens Dietrich</A>
27: * @version 3.3.2 <29 December 2004>
28: * @since 3.0
29: */
30:
31: public class SQLParserTestCasesForSelectAndFromClause {
32:
33: /**
34: * Launch the test suite. See TestRunner for interpretation
35: * of command line parameters.
36: * @see test.org.mandarax.testsupport.TestRunner
37: * @param args parameters
38: */
39: public static void main(String[] args) {
40: test.org.mandarax.testsupport.TestRunner.run(
41: SQLParserTestCasesForSelectAndFromClause.class, args);
42: }
43:
44: /**
45: * Create a test suite.
46: * @return a test suite
47: */
48: public static TestSuite suite() {
49:
50: TestSuite suite = new TestSuite(
51: "Test cases for parsing the SQL select and from clauses");
52:
53: // parser tests (we compare the respective structures)
54:
55: suite.addTest(new SQLParserTestCase("select * from mytable") {
56: public SelectStatement getExpectedSelect() {
57: return new SelectStatement("mytable", "*");
58: }
59: });
60: suite
61: .addTest(new SQLParserTestCase(
62: "select col1 from mytable") {
63: public SelectStatement getExpectedSelect() {
64: return new SelectStatement("mytable", "col1");
65: }
66: });
67: suite.addTest(new SQLParserTestCase(
68: "select col1,col2 from mytable") {
69: public SelectStatement getExpectedSelect() {
70: return new SelectStatement("mytable", "col1,col2");
71: }
72: });
73: suite.addTest(new SQLParserTestCase(
74: "select col1,col2,col3 from mytable") {
75: public SelectStatement getExpectedSelect() {
76: return new SelectStatement("mytable", "col1,col2,col3");
77: }
78: });
79:
80: return suite;
81: }
82: }
|