using System;
using System.Threading;
using edu.jhu.Cas.Jobs;
using edu.jhu.Cas.Users;
using edu.jhu.Cas.Util;
using edu.jhu.Cas.Servers;
using NUnit.Framework;
using NUnit.Core;
using System.Configuration;
using System.IO;
using System.Text.RegularExpressions;

/**
 * test queries for cjobs
 * each test does the following:
 *	-runs in short queue
 *	-maybe verifies result
 *	-maybe drops table
 *	-runs in long queue
 *	-maybe verifies result
 *	-maybe drops table
 */

namespace edu.jhu.Cas.Test{
	[TestFixture]	
	public class SampleQueries{
	
		public const string DEF_TARG = "DR1";
		
		[Test] 
			/**
			 * run them all, but don't verify results.  checking only that they run
			 * other tests are supposed to verify result accuracy
			 */

		public void GoNuts(){
			DirectoryInfo di = new DirectoryInfo("../test/samples");
			QTests tests = new QTests();
			foreach(FileInfo fi in di.GetFiles()){
				StreamReader sr = fi.OpenText();
				string qry = sr.ReadToEnd();
				sr.Close();
				//qry = qry.ToLower();
				//qry = qry.Replace("from","into mydb.sampletest from");
				tests.AddTest(qry,
					fi.Name,DEF_TARG,null,null,"drop table sampletest");
			}
			tests.RunAllTests();
		}

	}
}
