KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > functionTests > tests > nist > NistScripts


1 /*
2  *
3  * Derby - Class org.apache.derbyTesting.functionTests.tests.nist.NistScripts
4  *
5  * Licensed to the Apache Software Foundation (ASF) under one or more
6  * contributor license agreements. See the NOTICE file distributed with
7  * this work for additional information regarding copyright ownership.
8  * The ASF licenses this file to You under the Apache License, Version 2.0
9  * (the "License"); you may not use this file except in compliance with
10  * the License. You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17  * either express or implied. See the License for the specific
18  * language governing permissions and limitations under the License.
19  */

20 package org.apache.derbyTesting.functionTests.tests.nist;
21
22 import junit.framework.Test;
23 import junit.framework.TestSuite;
24
25 import org.apache.derbyTesting.functionTests.util.ScriptTestCase;
26 import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
27 import org.apache.derbyTesting.junit.TestConfiguration;
28
29 /**
30  * Run the NIST scripts as a single suite.
31  *
32  */

33 public final class NistScripts extends ScriptTestCase {
34
35     /**
36      * The complete set of NIST scripts for Derby.
37      * First element of array is the script name,
38      * second element is the user name for the connection.
39      */

40     private static final String JavaDoc[][] TESTS = {
41     {"schema1", "HU"},
42     { "basetab", "HU"},
43     { "schema5", "FLATER"},
44     { "schema8", "SUN"},
45     { "temp_schem10", "HU"},
46     { "temp_cts5sch2", "HU"},
47     { "temp_cts5tab", "CTS1"},
48     { "flattab", "FLATER"},
49     { "dml012", "HU"},
50     { "dml013", "HU"},
51     { "dml018", "HU"},
52     { "dml022", "HU"},
53     {"dml025", "HU"},
54     {"dml044", "HU"},
55     {"dml045", "HU"},
56     {"dml051", "HU"},
57     {"dml059", "HU"},
58     {"dml061", "HU"},
59     {"dml073", "HU"},
60     {"dml087", "FLATER"},
61     {"dml090", "HU"},
62     {"dml106", "FLATER"},
63     {"dml108", "FLATER"},
64     {"dml114", "FLATER"},
65     {"dml141", "FLATER"},
66     {"dml144", "FLATER"},
67     {"dml162", "FLATER"},
68     {"dml177", "FLATER"},
69     {"dml010", "HU"},
70     {"dml015", "HU"},
71     {"dml020", "HU"},
72     {"dml037", "HU"},
73     {"dml038", "HU"},
74     {"dml042", "HU"},
75     {"dml043", "HU"},
76     {"dml047", "HU"},
77     {"dml056", "HU"},
78     {"dml065", "HU"},
79     {"dml076", "HU"},
80     {"sdl012", "HU"},
81     {"dml029", "HU"},
82     {"yts796", "CTS1"},
83     {"dml075", "HU"},
84     {"dml024", "HU"},
85     {"dml070", "HU"},
86     {"dml147", "FLATER"},
87     {"dml009", "HU"},
88     {"dml008", "HU"},
89     {"dml014", "HU"},
90     {"dml016", "SULLIVAN1"},
91     {"dml021", "HU"},
92     {"dml034", "HU"},
93     {"dml023", "HU"},
94     {"dml026", "HU"},
95     {"dml033", "HU"},
96     {"dml039", "HU"},
97     {"dml050", "HU"},
98     {"dml052", "HU"},
99     {"dml053", "HU"},
100     {"dml055", "HU"},
101     {"dml057", "HU"},
102     {"dml058", "HU"},
103     {"dml155", "FLATER"},
104     {"xts729", "CTS1"},
105     {"xts730", "CTS1"},
106     {"yts797", "CTS1"},
107     {"yts798", "CTS1"},
108     {"dml069", "HU"},
109     {"dml080", "SCHANZLE"},
110     {"dml081", "SCHANZLE"},
111     {"dml083", "SCHANZLE"},
112     {"dml085", "SCHANZLE"},
113     {"dml132", "FLATER"},
114     {"dml099", "FLATER"},
115     {"dml049", "HU"},
116     {"dml173", "FLATER"},
117     {"dml174", "FLATER"},
118     {"dml179", "FLATER"},
119     {"yts812", "CTS1"},
120     {"dml001", "HU"},
121     {"dml004", "HU"},
122     {"dml035", "HU"},
123     {"dml046", "HU"},
124     {"dml060", "HU"},
125     {"dml068", "HU"},
126     {"yts799", "CTS1"},
127     {"dml001", "HU"},
128     {"dml079", "HU"},
129     {"dml165", "FLATER"},
130     {"dml104", "FLATER"},
131     {"dml112", "FLATER"},
132     {"dml148", "FLATER"},
133     {"dml019", "HU"},
134     {"dml149", "FLATER"},
135     {"dml168", "FLATER"},
136     {"dml170", "FLATER"},
137     {"xts752", "CTS1"},
138     {"xts753", "CTS1"},
139     {"cdr002", "SUN"},
140     {"cdr003", "SUN"},
141     {"cdr004", "SUN"},
142     {"cdr005", "SUN"},
143     {"cdr006", "SUN"},
144     {"cdr007", "SUN"},
145     {"cdr027", "SUN"},
146     {"cdr030", "SUN"},
147     {"dml134", "FLATER"},
148     {"dml005", "HU"},
149     {"dml011", "HU"},
150     {"dml027", "HU"},
151     {"dml082", "SCHANZLE"},
152     {"dml091", "SCHANZLE"},
153     {"dml119", "FLATER"},
154     {"dml130", "FLATER"},
155     {"dml158", "HU"},
156     {"dml178", "FLATER"},
157     {"dml181", "FLATER"},
158     {"dml182", "FLATER"},
159     {"xts701", "CTS1"},
160     {"xts731", "CTS1"},
161     {"xts740", "CTS1"},
162     {"xts742", "CTS1"},
163     {"xts760", "CTS1"},
164     {"yts811", "CTS1"},
165     {"dml160", "FLATER"},
166     {"schema4", "SULLIVAN1"}
167     };
168
169     /**
170      * Return the suite that runs the NIST SQL scripts.
171      */

172     public static Test suite() {
173         TestSuite suite = new TestSuite();
174         
175         String JavaDoc suiteUser = null;
176         TestSuite userSuite = null;
177         for (int i = 0; i < TESTS.length; i++) {
178             
179             String JavaDoc testScript = TESTS[i][0];
180             String JavaDoc testUser = TESTS[i][1];
181             
182             Test test = new NistScripts(testScript);
183             
184             if (testUser.equals(suiteUser))
185             {
186                 userSuite.addTest(test);
187                 continue;
188             }
189             
190             // Add the new user suite with the change user decorator to
191
// the main suite but continue to add tests to the user suite.
192
userSuite = new TestSuite();
193             String JavaDoc password = testUser.concat("PWD");
194             suite.addTest(
195                     TestConfiguration.changeUserDecorator(userSuite, testUser, password));
196             suiteUser = testUser;
197             
198             userSuite.addTest(test);
199         }
200         
201        return new CleanDatabaseTestSetup(getIJConfig(suite));
202     }
203     
204     /*
205      * A single JUnit test that runs a single language SQL script.
206      */

207     private NistScripts(String JavaDoc nistScript){
208         super(nistScript);
209     }
210 }
211
Popular Tags