001: /*
002: *
003: * Derby - Class org.apache.derbyTesting.functionTests.tests.nist.NistScripts
004: *
005: * Licensed to the Apache Software Foundation (ASF) under one or more
006: * contributor license agreements. See the NOTICE file distributed with
007: * this work for additional information regarding copyright ownership.
008: * The ASF licenses this file to You under the Apache License, Version 2.0
009: * (the "License"); you may not use this file except in compliance with
010: * the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
017: * either express or implied. See the License for the specific
018: * language governing permissions and limitations under the License.
019: */
020: package org.apache.derbyTesting.functionTests.tests.nist;
021:
022: import junit.framework.Test;
023: import junit.framework.TestSuite;
024:
025: import org.apache.derbyTesting.functionTests.util.ScriptTestCase;
026: import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
027: import org.apache.derbyTesting.junit.TestConfiguration;
028:
029: /**
030: * Run the NIST scripts as a single suite.
031: *
032: */
033: public final class NistScripts extends ScriptTestCase {
034:
035: /**
036: * The complete set of NIST scripts for Derby.
037: * First element of array is the script name,
038: * second element is the user name for the connection.
039: */
040: private static final String[][] TESTS = { { "schema1", "HU" },
041: { "basetab", "HU" }, { "schema5", "FLATER" },
042: { "schema8", "SUN" }, { "temp_schem10", "HU" },
043: { "temp_cts5sch2", "HU" }, { "temp_cts5tab", "CTS1" },
044: { "flattab", "FLATER" }, { "dml012", "HU" },
045: { "dml013", "HU" }, { "dml018", "HU" }, { "dml022", "HU" },
046: { "dml025", "HU" }, { "dml044", "HU" }, { "dml045", "HU" },
047: { "dml051", "HU" }, { "dml059", "HU" }, { "dml061", "HU" },
048: { "dml073", "HU" }, { "dml087", "FLATER" },
049: { "dml090", "HU" }, { "dml106", "FLATER" },
050: { "dml108", "FLATER" }, { "dml114", "FLATER" },
051: { "dml141", "FLATER" }, { "dml144", "FLATER" },
052: { "dml162", "FLATER" }, { "dml177", "FLATER" },
053: { "dml010", "HU" }, { "dml015", "HU" }, { "dml020", "HU" },
054: { "dml037", "HU" }, { "dml038", "HU" }, { "dml042", "HU" },
055: { "dml043", "HU" }, { "dml047", "HU" }, { "dml056", "HU" },
056: { "dml065", "HU" }, { "dml076", "HU" }, { "sdl012", "HU" },
057: { "dml029", "HU" }, { "yts796", "CTS1" },
058: { "dml075", "HU" }, { "dml024", "HU" }, { "dml070", "HU" },
059: { "dml147", "FLATER" }, { "dml009", "HU" },
060: { "dml008", "HU" }, { "dml014", "HU" },
061: { "dml016", "SULLIVAN1" }, { "dml021", "HU" },
062: { "dml034", "HU" }, { "dml023", "HU" }, { "dml026", "HU" },
063: { "dml033", "HU" }, { "dml039", "HU" }, { "dml050", "HU" },
064: { "dml052", "HU" }, { "dml053", "HU" }, { "dml055", "HU" },
065: { "dml057", "HU" }, { "dml058", "HU" },
066: { "dml155", "FLATER" }, { "xts729", "CTS1" },
067: { "xts730", "CTS1" }, { "yts797", "CTS1" },
068: { "yts798", "CTS1" }, { "dml069", "HU" },
069: { "dml080", "SCHANZLE" }, { "dml081", "SCHANZLE" },
070: { "dml083", "SCHANZLE" }, { "dml085", "SCHANZLE" },
071: { "dml132", "FLATER" }, { "dml099", "FLATER" },
072: { "dml049", "HU" }, { "dml173", "FLATER" },
073: { "dml174", "FLATER" }, { "dml179", "FLATER" },
074: { "yts812", "CTS1" }, { "dml001", "HU" },
075: { "dml004", "HU" }, { "dml035", "HU" }, { "dml046", "HU" },
076: { "dml060", "HU" }, { "dml068", "HU" },
077: { "yts799", "CTS1" }, { "dml001", "HU" },
078: { "dml079", "HU" }, { "dml165", "FLATER" },
079: { "dml104", "FLATER" }, { "dml112", "FLATER" },
080: { "dml148", "FLATER" }, { "dml019", "HU" },
081: { "dml149", "FLATER" }, { "dml168", "FLATER" },
082: { "dml170", "FLATER" }, { "xts752", "CTS1" },
083: { "xts753", "CTS1" }, { "cdr002", "SUN" },
084: { "cdr003", "SUN" }, { "cdr004", "SUN" },
085: { "cdr005", "SUN" }, { "cdr006", "SUN" },
086: { "cdr007", "SUN" }, { "cdr027", "SUN" },
087: { "cdr030", "SUN" }, { "dml134", "FLATER" },
088: { "dml005", "HU" }, { "dml011", "HU" }, { "dml027", "HU" },
089: { "dml082", "SCHANZLE" }, { "dml091", "SCHANZLE" },
090: { "dml119", "FLATER" }, { "dml130", "FLATER" },
091: { "dml158", "HU" }, { "dml178", "FLATER" },
092: { "dml181", "FLATER" }, { "dml182", "FLATER" },
093: { "xts701", "CTS1" }, { "xts731", "CTS1" },
094: { "xts740", "CTS1" }, { "xts742", "CTS1" },
095: { "xts760", "CTS1" }, { "yts811", "CTS1" },
096: { "dml160", "FLATER" }, { "schema4", "SULLIVAN1" } };
097:
098: /**
099: * Return the suite that runs the NIST SQL scripts.
100: */
101: public static Test suite() {
102: TestSuite suite = new TestSuite();
103:
104: String suiteUser = null;
105: TestSuite userSuite = null;
106: for (int i = 0; i < TESTS.length; i++) {
107:
108: String testScript = TESTS[i][0];
109: String testUser = TESTS[i][1];
110:
111: Test test = new NistScripts(testScript);
112:
113: if (testUser.equals(suiteUser)) {
114: userSuite.addTest(test);
115: continue;
116: }
117:
118: // Add the new user suite with the change user decorator to
119: // the main suite but continue to add tests to the user suite.
120: userSuite = new TestSuite();
121: String password = testUser.concat("PWD");
122: suite.addTest(TestConfiguration.changeUserDecorator(
123: userSuite, testUser, password));
124: suiteUser = testUser;
125:
126: userSuite.addTest(test);
127: }
128:
129: return new CleanDatabaseTestSetup(getIJConfig(suite));
130: }
131:
132: /*
133: * A single JUnit test that runs a single language SQL script.
134: */
135: private NistScripts(String nistScript) {
136: super(nistScript);
137: }
138: }
|