package com.alipay.zdal.test.ut.sqlparser.mysql; import java.util.List; import org.junit.Test; import junit.framework.Assert; import com.alipay.zdal.parser.sql.ast.SQLStatement; import com.alipay.zdal.parser.sql.dialect.mysql.parser.MySqlStatementParser; import com.alipay.zdal.parser.sql.dialect.mysql.visitor.MySqlOutputVisitor; public class Kill_Test { @Test public void test_0() throws Exception { String sql = "KILL QUERY 233"; MySqlStatementParser parser = new MySqlStatementParser(sql); List<SQLStatement> stmtList = parser.parseStatementList(); String text = output(stmtList); Assert.assertEquals("KILL QUERY 233;", text); } @Test public void test_1() throws Exception { String sql = "KILL CONNECTION 233"; MySqlStatementParser parser = new MySqlStatementParser(sql); List<SQLStatement> stmtList = parser.parseStatementList(); String text = output(stmtList); Assert.assertEquals("KILL CONNECTION 233;", text); } private String output(List<SQLStatement> stmtList) { StringBuilder out = new StringBuilder(); for (SQLStatement stmt : stmtList) { stmt.accept(new MySqlOutputVisitor(out)); out.append(";"); } return out.toString(); } }