// Path: ddal-ddr/src/main/java/org/hellojavaer/ddal/ddr/shard/ShardParser.java
// public interface ShardParser {
// 
//     SQLParsedResult parse(String sql, Map<Object, Object> jdbcParams);
// 
// }
// 
// Path: ddal-ddr/src/main/java/org/hellojavaer/ddal/ddr/sqlparse/exception/AmbiguousRouteResultException.java
// public class AmbiguousRouteResultException extends DDRSQLParseException {
// 
//     public AmbiguousRouteResultException() {
//     }
// 
//     public AmbiguousRouteResultException(String message) {
//         super(message);
//     }
// 
//     public AmbiguousRouteResultException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public AmbiguousRouteResultException(Throwable cause) {
//         super(cause);
//     }
// 
//     public AmbiguousRouteResultException(String message, Throwable cause, boolean enableSuppression,
//                                          boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }


import org.hellojavaer.ddal.core.utils.Assert;
import org.hellojavaer.ddal.ddr.shard.ShardParser;
import org.hellojavaer.ddal.ddr.sqlparse.SQLParsedResult;
import org.hellojavaer.ddal.ddr.sqlparse.exception.AmbiguousRouteResultException;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
    @Test
    public void test00() {
        ShardParser parser = buildParserForId();
        SQLParsedResult parsedResult = parser.parse("delete from db.user AS user where id = 506 and name = 'allen'",
                                                    null);
        Assert.equals(parsedResult.getSql(), "DELETE FROM db_02.user_0122 AS user WHERE id = 506 AND name = 'allen'");
    }

    @Test
    public void test01() {
        ShardParser parser = buildParserForName();
        SQLParsedResult parsedResult = parser.parse("delete from db.user where id = 506 and name = 'allen'", null);
        Assert.equals(parsedResult.getSql(), "DELETE FROM db_02.user_0010 WHERE id = 506 AND name = 'allen'");
    }

    @Test
    public void test02() {
        ShardParser parser = buildParserForId();
        Map<Object, Object> map = new HashMap<Object, Object>();
        map.put(1, 506);
        map.put(2, "allen");
        map.put(3, "desc");
        SQLParsedResult parsedResult = parser.parse("DELETE FROM db.user WHERE id = ? AND name = ?", map);
        Assert.equals(parsedResult.getSql(), "DELETE FROM db_02.user_0122 WHERE id = ? AND name = ?");
    }

    @Test
    public void test03() {
        ShardParser parser = buildParserForName();
        Map<Object, Object> map = new HashMap<Object, Object>();
// Path: ddal-ddr/src/main/java/org/hellojavaer/ddal/ddr/shard/ShardParser.java
// public interface ShardParser {
// 
//     SQLParsedResult parse(String sql, Map<Object, Object> jdbcParams);
// 
// }
// 
// Path: ddal-ddr/src/main/java/org/hellojavaer/ddal/ddr/sqlparse/exception/AmbiguousRouteResultException.java
// public class AmbiguousRouteResultException extends DDRSQLParseException {
// 
//     public AmbiguousRouteResultException() {
//     }
// 
//     public AmbiguousRouteResultException(String message) {
//         super(message);
//     }
// 
//     public AmbiguousRouteResultException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public AmbiguousRouteResultException(Throwable cause) {
//         super(cause);
//     }
// 
//     public AmbiguousRouteResultException(String message, Throwable cause, boolean enableSuppression,
//                                          boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }


// Path: ddal-jsqlparser/src/test/java/org.hellojavaer.ddal.jsqlparser/DeleteTest.java
import org.hellojavaer.ddal.core.utils.Assert;
import org.hellojavaer.ddal.ddr.shard.ShardParser;
import org.hellojavaer.ddal.ddr.sqlparse.SQLParsedResult;
import org.hellojavaer.ddal.ddr.sqlparse.exception.AmbiguousRouteResultException;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;

    @Test
    public void test00() {
        ShardParser parser = buildParserForId();
        SQLParsedResult parsedResult = parser.parse("delete from db.user AS user where id = 506 and name = 'allen'",
                                                    null);
        Assert.equals(parsedResult.getSql(), "DELETE FROM db_02.user_0122 AS user WHERE id = 506 AND name = 'allen'");
    }

    @Test
    public void test01() {
        ShardParser parser = buildParserForName();
        SQLParsedResult parsedResult = parser.parse("delete from db.user where id = 506 and name = 'allen'", null);
        Assert.equals(parsedResult.getSql(), "DELETE FROM db_02.user_0010 WHERE id = 506 AND name = 'allen'");
    }

    @Test
    public void test02() {
        ShardParser parser = buildParserForId();
        Map<Object, Object> map = new HashMap<Object, Object>();
        map.put(1, 506);
        map.put(2, "allen");
        map.put(3, "desc");
        SQLParsedResult parsedResult = parser.parse("DELETE FROM db.user WHERE id = ? AND name = ?", map);
        Assert.equals(parsedResult.getSql(), "DELETE FROM db_02.user_0122 WHERE id = ? AND name = ?");
    }

    @Test
    public void test03() {
        ShardParser parser = buildParserForName();
        Map<Object, Object> map = new HashMap<Object, Object>();
        map.put(1, 506);