001: /*
002: DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:
004: Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:
006:
007: The contents of this file are subject to the terms of either the GNU
008: General Public License Version 2 only ("GPL") or the Common
009: Development and Distribution License("CDDL") (collectively, the
010: "License"). You may not use this file except in compliance with the
011: License. You can obtain a copy of the License at
012: http://www.netbeans.org/cddl-gplv2.html
013: or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
014: specific language governing permissions and limitations under the
015: License. When distributing the software, include this License Header
016: Notice in each file and include the License file at
017: nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
018: particular file as subject to the "Classpath" exception as provided
019: by Sun in the GPL Version 2 section of the License file that
020: accompanied this code. If applicable, add the following below the
021: License Header, with the fields enclosed by brackets [] replaced by
022: your own identifying information:
023: "Portions Copyrighted [year] [name of copyright owner]"
024:
025: Contributor(s):
026:
027: The Original Software is NetBeans. The Initial Developer of the Original
028: Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
029: Microsystems, Inc. All Rights Reserved.
030:
031: If you wish your version of this file to be governed by only the CDDL
032: or only the GPL Version 2, indicate your decision by adding
033: "[Contributor] elects to include this software in this distribution
034: under the [CDDL or GPL Version 2] license." If you do not indicate a
035: single choice of license, a recipient has the option to distribute
036: your version of this file under either the CDDL, the GPL Version 2 or
037: to extend the choice of license to its licensees as provided above.
038: However, if you add GPL Version 2 code and therefore, elected the GPL
039: Version 2 license, then the option applies only if the new code is
040: made subject to such option by the copyright holder.
041: */
042: package org.netbeans.test.dataprovider.visualsqleditor;
043:
044: import java.util.*;
045: import java.io.*;
046: import junit.framework.Test;
047: import junit.framework.*;
048: import org.netbeans.junit.*;
049: import org.netbeans.modules.visualweb.gravy.*;
050: import org.netbeans.jemmy.*;
051: import org.netbeans.test.dataprovider.common.*;
052:
053: public class VisualSqlEditor_AcceptanceTests extends BaseTests {
054:
055: static {
056: TEST_METHOD_ARRAY = new String[] {
057: "testAcceptance_01", // check DB connection
058: "testAcceptance_04", "testAcceptance_05",
059: "testAcceptance_06", "testAcceptance_07",
060: "testAcceptance_08", "testAcceptance_09",
061:
062: "testAcceptance_02", // check & start application server
063: "testAcceptance_03", // create a new VW project
064: "testAcceptance_10", "testAcceptance_11",
065:
066: "testAcceptance_00" };
067: }
068:
069: public VisualSqlEditor_AcceptanceTests(String testName) {
070: super (testName);
071: }
072:
073: public static Test suite() {
074: return suite(VisualSqlEditor_AcceptanceTests.class,
075: "Visual Sql Editor Acceptance Tests");
076: }
077:
078: public void testAcceptance_04() { // add several DB tables to Query Editor
079: Utils.logMsg("=== testAcceptance_04() ===");
080: if (errMsg != null)
081: fail(STOP_TEST_BECAUSE_PREVIOUS_TEST_FAILS);
082:
083: Util.wait(1000);
084: try {
085: new AcceptanceTests(this ).checkQueryEditor_AddDBTables();
086: } catch (Throwable t) {
087: t.printStackTrace(Utils.logStream);
088: errMsg = t.getMessage();
089: }
090: Util.wait(1000);
091: new QueueTool().waitEmpty();
092: if (errMsg != null) {
093: fail(errMsg);
094: }
095: }
096:
097: public void testAcceptance_05() { // remove DB tables from Query Editor
098: Utils.logMsg("=== testAcceptance_05() ===");
099: if (errMsg != null)
100: fail(STOP_TEST_BECAUSE_PREVIOUS_TEST_FAILS);
101:
102: Util.wait(1000);
103: try {
104: new AcceptanceTests(this ).checkQueryEditor_RemoveDBTables();
105: } catch (Throwable t) {
106: t.printStackTrace(Utils.logStream);
107: errMsg = t.getMessage();
108: }
109: Util.wait(1000);
110: new QueueTool().waitEmpty();
111: if (errMsg != null) {
112: fail(errMsg);
113: }
114: }
115:
116: public void testAcceptance_06() { // parse SQL queries in Query Editor
117: Utils.logMsg("=== testAcceptance_06() ===");
118: if (errMsg != null)
119: fail(STOP_TEST_BECAUSE_PREVIOUS_TEST_FAILS);
120:
121: Util.wait(1000);
122: try {
123: new AcceptanceTests(this ).checkQueryEditor_ParseSQLQuery();
124: } catch (Throwable t) {
125: t.printStackTrace(Utils.logStream);
126: errMsg = t.getMessage();
127: }
128: Util.wait(1000);
129: new QueueTool().waitEmpty();
130: if (errMsg != null) {
131: fail(errMsg);
132: }
133: }
134:
135: public void testAcceptance_07() { // run SQL query with in Query Editor
136: Utils.logMsg("=== testAcceptance_07() ===");
137: errMsg = null;
138: if (errMsg != null)
139: fail(STOP_TEST_BECAUSE_PREVIOUS_TEST_FAILS);
140:
141: Util.wait(1000);
142: try {
143: new AcceptanceTests(this ).checkQueryEditor_RunSQLQuery();
144: } catch (Throwable t) {
145: t.printStackTrace(Utils.logStream);
146: errMsg = t.getMessage();
147: }
148: Util.wait(1000);
149: new QueueTool().waitEmpty();
150: if (errMsg != null) {
151: fail(errMsg);
152: }
153: }
154:
155: public void testAcceptance_08() { // run SQL query with ORDER clause in Query Editor
156: Utils.logMsg("=== testAcceptance_08() ===");
157: if (errMsg != null)
158: fail(STOP_TEST_BECAUSE_PREVIOUS_TEST_FAILS);
159:
160: Util.wait(1000);
161: try {
162: new AcceptanceTests(this )
163: .checkQueryEditor_RunOrderedSQLQuery();
164: } catch (Throwable t) {
165: t.printStackTrace(Utils.logStream);
166: errMsg = t.getMessage();
167: }
168: Util.wait(1000);
169: new QueueTool().waitEmpty();
170: if (errMsg != null) {
171: fail(errMsg);
172: }
173: }
174:
175: public void testAcceptance_09() { // run SQL query with criteria in Query Editor
176: Utils.logMsg("=== testAcceptance_09() ===");
177: if (errMsg != null)
178: fail(STOP_TEST_BECAUSE_PREVIOUS_TEST_FAILS);
179:
180: Util.wait(1000);
181: try {
182: new AcceptanceTests(this )
183: .checkQueryEditor_RunSQLQueryWithCriteria();
184: } catch (Throwable t) {
185: t.printStackTrace(Utils.logStream);
186: errMsg = t.getMessage();
187: }
188: Util.wait(1000);
189: new QueueTool().waitEmpty();
190: if (errMsg != null) {
191: fail(errMsg);
192: }
193: }
194:
195: public void testAcceptance_10() { // open Query Editor for CachedRowSet
196: Utils.logMsg("=== testAcceptance_10() ===");
197: if (errMsg != null)
198: fail(STOP_TEST_BECAUSE_PREVIOUS_TEST_FAILS);
199:
200: Util.wait(1000);
201: try {
202: new AcceptanceTests(this )
203: .checkQueryEditor_QueryEditorForCachedRowSet();
204: } catch (Throwable t) {
205: t.printStackTrace(Utils.logStream);
206: errMsg = t.getMessage();
207: }
208: Util.wait(1000);
209: new QueueTool().waitEmpty();
210: if (errMsg != null) {
211: fail(errMsg);
212: }
213: }
214:
215: public void testAcceptance_11() { // modify SQL query and reopen Query Editor for CachedRowSet
216: Utils.logMsg("=== testAcceptance_11() ===");
217: if (errMsg != null)
218: fail(STOP_TEST_BECAUSE_PREVIOUS_TEST_FAILS);
219:
220: Util.wait(1000);
221: try {
222: new AcceptanceTests(this )
223: .checkQueryEditor_ModifyQueryForCachedRowSet();
224: } catch (Throwable t) {
225: t.printStackTrace(Utils.logStream);
226: errMsg = t.getMessage();
227: }
228: Util.wait(1000);
229: new QueueTool().waitEmpty();
230: if (errMsg != null) {
231: fail(errMsg);
232: }
233: }
234: }
|