<%
for (int i = 0; i < fileCount; i++) {
try {
Properties sql = new Properties();
sql.load(new FileInputStream(sqlFiles[i]));
String testCat = sql.getProperty("Category");
String testName = sql.getProperty("Name");
files.put(testCat + testName, sql);
}
catch (Exception e) {} // don't care if we couldn't open one entry
}
Properties sql = null;
Enumeration keys = files.keys();
String curCat = "";
Vector sorted = new Vector();
while (keys.hasMoreElements()) {
sorted.add(keys.nextElement());
}
sortedkeys = sorted.toArray();
java.util.Arrays.sort(sortedkeys);
boolean expandCat = false;
boolean ulOpen = false;
String catExp = (String) session.getAttribute("catExp");
for (int i = 0; i < sortedkeys.length; i++) {
sql = (Properties) files.get(sortedkeys[i]);
String testCat = sql.getProperty("Category");
String testName = sql.getProperty("Name");
String provide = sql.getProperty("Provides");
if (provide != null)
provides.put(provide, new Integer(i));
if ((testCat != null) && (!testCat.equalsIgnoreCase(curCat))) {
if (ulOpen) out.println("");
expandCat = (testCat.equals(catExp));
out.println("");
curCat = testCat;
out.println("");
ulOpen = true;
}
if (!expandCat)
continue;
%>
- <%= testName %>
<%
}
if (ulOpen)
out.println(" ");
}
String numStr = request.getParameter("exec");
String stageStr = request.getParameter("stage");
if (numStr != null) {
int num = Integer.parseInt(numStr);
int stage = (stageStr != null) ? Integer.parseInt(stageStr) : 1;
if (num < sqlFiles.length) {
Properties sqlTest = (Properties) files.get(sortedkeys[num]);
String require = sqlTest.getProperty("Requires");
if ((require != null) && (session.getAttribute(require) == null)) {
Integer reqExec = (Integer)provides.get(require);
if (reqExec != null)
sqlTest = (Properties) files.get(sortedkeys[reqExec.intValue()]);
}
String testName = sqlTest.getProperty("Name");
String testDesc = sqlTest.getProperty("Description");
%>
|
Executing |
<%= testName %> |
Description |
<%= testDesc %> |
<%
Vector props = new Vector();
String prop = null;
int j = 0;
do {
//out.println("Trying to get val" + Integer.toString(j));
prop = request.getParameter("val" + Integer.toString(j));
if (prop != null) {
props.add(prop);
//out.println("Adding: " + prop + "");
}
j++;
}
while (prop != null);
Object[] params = props.toArray();
String testSQL = "";
int outputLevel = 10;
boolean didSomething = true;
for (int i = stage; didSomething; i++) {
didSomething = false;
String suffix = ((i < 2) ? "" : Integer.toString(i));
testSQL = sqlTest.getProperty("SQL" + suffix);
if (testSQL != null) {
testSQL = testSQL.replaceAll("\'", "\'\'");
}
String heading = sqlTest.getProperty("Heading" + suffix);
String linkColumn = sqlTest.getProperty("LinkColumn" + suffix);
String importFile = sqlTest.getProperty("ImportFile" + suffix);
String sqlExecuteFile = sqlTest.getProperty("SQLExecuteFile" + suffix);
String importSQL = sqlTest.getProperty("ImportSQL" + suffix);
String import2LSQL = sqlTest.getProperty("Import2LSQL" + suffix);
String importDupCheck = sqlTest.getProperty("ImportDupCheck" + suffix);
String ignoreException = sqlTest.getProperty("IgnoreException" + suffix);
String exportFile = sqlTest.getProperty("ExportFile" + suffix);
String formField = sqlTest.getProperty("Form" + suffix + ".0");
String sessionField = sqlTest.getProperty("SetSession" + suffix + ".0");
try { outputLevel = Integer.parseInt(sqlTest.getProperty("OutputLevel" + suffix)); } catch (Exception e) {}
// see if we have a form
if (heading != null) {
%>
<%= heading %>
<%
}
if (sqlExecuteFile != null) {
FileReader fin = new FileReader(sqlPath+"/"+sqlExecuteFile);
BufferedReader bis = new BufferedReader(fin);
String execLine = "";
for (String line = bis.readLine(); line != null; line = bis.readLine()) {
line = line.trim();
if (line.length() > 1) {
execLine += line;
if (execLine.endsWith(";")) {
runSQL(execLine, null, 0, 0, out);
execLine = "";
}
}
}
bis.close();
fin.close();
}
if (importFile != null) {
didSomething = true;
String fileName = importFile;
String iSQL = "";
int separator = fileName.indexOf('|');
if (separator > -1) {
fileName = importFile.substring(0, separator);
iSQL = importFile.substring(separator + 1);
}
try {
CSVFileReader fin = new CSVFileReader(new File(sqlPath+"/"+fileName), '|', false);
iSQL = iSQL.replaceAll("\'", "\'\'");
iSQL = replaceSessionTags(session, iSQL);
if (importDupCheck != null) {
importDupCheck = importDupCheck.replaceAll("\'", "\'\'");
importDupCheck = replaceSessionTags(session, importDupCheck);
}
int retVal = 0;
for (boolean more = fin.begin(); more; more = fin.next()) {
retVal++;
String colVals = "";
Vector |