-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathparseTest.java
More file actions
62 lines (44 loc) · 1.81 KB
/
Copy pathparseTest.java
File metadata and controls
62 lines (44 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package testSQLFiles;
import junit.framework.TestCase;
import gudusoft.gsqlparser.EDbVendor;
import gudusoft.gsqlparser.TGSqlParser;
import java.io.File;
public class parseTest extends TestCase {
String xsdfile = "file:/C:/prg/gsp_java/library/doc/xml/sqlquery.xsd";
// public static String test.gspCommon.BASE_SQL_DIR = "c:/prg/gsp_sqlfiles/TestCases/";
static void parsefiles(EDbVendor db,String dir) {
File parent = new File( dir );
if (!( parent.exists( ) && parent.isDirectory( ))){
System.out.println("Skip this testcase, directory not exists:"+dir);
return;
}
TGSqlParser sqlparser = new TGSqlParser(db);
test.SqlFileList sqlfiles = new test.SqlFileList(dir,true);
for(int k=0;k < sqlfiles.sqlfiles.size();k++){
sqlparser.sqlfilename = sqlfiles.sqlfiles.get(k).toString();
// System.out.printf("%s\n",sqlparser.sqlfilename);
// boolean b = sqlparser.parse() == 0;
try{
boolean b = sqlparser.parse() == 0;
assertTrue(sqlparser.sqlfilename+"\n"+sqlparser.getErrormessage(),b);
if (b){
// xmlVisitor xv2 = new xmlVisitor(xsdfile);
// xv2.run(sqlparser);
//xv2.validXml();
}
}catch (Exception e){
System.out.println("parsefiles error:"+e.getMessage()+" "+ sqlparser.sqlfilename);
throw e;
}
}
}
public void testDax(){
parsefiles(EDbVendor.dbvdax,test.gspCommon.BASE_SQL_DIR+"dax");
}
// public void testSnowflake(){
// parsefiles(EDbVendor.dbvsnowflake,test.gspCommon.BASE_SQL_DIR+"snowflake");
// }
public void testBigquery(){
parsefiles(EDbVendor.dbvbigquery,test.gspCommon.BASE_SQL_DIR+"bigquery");
}
}