Commit 6303c657 authored by terrymanu's avatar terrymanu
Browse files

For #660: add sharding-sql-test module, move sql xml test case and loading app here

parent b7468aa4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
        <module>sharding-jdbc-orchestration</module>
        <module>sharding-jdbc-orchestration-spring</module>
        <module>sharding-proxy</module>
        <module>sharding-sql-test</module>
    </modules>
    
    <properties>
+8 −2
Original line number Diff line number Diff line
@@ -4,8 +4,8 @@
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>sharding-jdbc</artifactId>
        <groupId>io.shardingjdbc</groupId>
        <artifactId>sharding-jdbc</artifactId>
        <version>2.1.0-SNAPSHOT</version>
    </parent>
    <artifactId>sharding-core</artifactId>
@@ -33,6 +33,12 @@
            <artifactId>snakeyaml</artifactId>
        </dependency>
        
        <dependency>
            <groupId>io.shardingjdbc</groupId>
            <artifactId>sharding-sql-test</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
+5 −4
Original line number Diff line number Diff line
@@ -21,14 +21,14 @@ import io.shardingjdbc.core.api.algorithm.fixture.TestComplexKeysShardingAlgorit
import io.shardingjdbc.core.api.config.TableRuleConfiguration;
import io.shardingjdbc.core.api.config.strategy.ComplexShardingStrategyConfiguration;
import io.shardingjdbc.core.api.fixture.ShardingRuleMockBuilder;
import io.shardingjdbc.core.parsing.jaxb.helper.SQLStatementHelper;
import io.shardingjdbc.core.util.SQLPlaceholderUtil;
import io.shardingjdbc.core.constant.DatabaseType;
import io.shardingjdbc.core.parsing.parser.base.AbstractBaseParseSQLTest;
import io.shardingjdbc.core.parsing.parser.base.AbstractBaseParseTest;
import io.shardingjdbc.core.parsing.parser.jaxb.Assert;
import io.shardingjdbc.core.parsing.parser.jaxb.helper.ParserJAXBHelper;
import io.shardingjdbc.core.rule.ShardingRule;
import io.shardingjdbc.core.util.SQLPlaceholderUtil;
import io.shardingjdbc.test.sql.jaxb.helper.SQLStatementHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -59,8 +59,9 @@ public final class SQLParsingEngineTest extends AbstractBaseParseSQLTest {
    
    @Test
    public void assertPreparedStatement() {
        for (DatabaseType each : SQLStatementHelper.getTypes(getTestCaseName())) {
            assertPreparedStatement(new SQLParsingEngine(each, SQLPlaceholderUtil.replacePreparedStatement(SQLStatementHelper.getSql(getTestCaseName())), buildShardingRule()).parse());
        for (io.shardingjdbc.test.sql.jaxb.DatabaseType each : SQLStatementHelper.getTypes(getTestCaseName())) {
            assertPreparedStatement(
                    new SQLParsingEngine(DatabaseType.valueOf(each.name()), SQLPlaceholderUtil.replacePreparedStatement(SQLStatementHelper.getSql(getTestCaseName())), buildShardingRule()).parse());
        }
    }
    
+2 −2
Original line number Diff line number Diff line
@@ -20,10 +20,10 @@ package io.shardingjdbc.core.parsing;
import com.google.common.base.Strings;
import com.google.common.collect.Sets;
import io.shardingjdbc.core.api.fixture.ShardingRuleMockBuilder;
import io.shardingjdbc.core.parsing.jaxb.SQLStatement;
import io.shardingjdbc.core.parsing.jaxb.helper.SQLStatementHelper;
import io.shardingjdbc.core.constant.DatabaseType;
import io.shardingjdbc.core.parsing.parser.exception.SQLParsingUnsupportedException;
import io.shardingjdbc.test.sql.jaxb.SQLStatement;
import io.shardingjdbc.test.sql.jaxb.helper.SQLStatementHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+3 −3
Original line number Diff line number Diff line
@@ -17,10 +17,10 @@

package io.shardingjdbc.core.parsing.parser.base;

import io.shardingjdbc.core.parsing.jaxb.helper.SQLStatementHelper;
import io.shardingjdbc.core.constant.DatabaseType;
import io.shardingjdbc.core.parsing.parser.jaxb.Assert;
import io.shardingjdbc.core.parsing.parser.jaxb.Asserts;
import io.shardingjdbc.test.sql.jaxb.helper.SQLStatementHelper;
import lombok.AccessLevel;
import lombok.Getter;

@@ -71,8 +71,8 @@ public abstract class AbstractBaseParseTest {
        List<Object[]> result = new ArrayList<>();
        for (int i = 0; i < asserts.getAsserts().size(); i++) {
            Assert assertObj = asserts.getAsserts().get(i);
            for (DatabaseType each : SQLStatementHelper.getTypes(assertObj.getId())) {
                result.add(getDataParameter(assertObj, each));
            for (io.shardingjdbc.test.sql.jaxb.DatabaseType each : SQLStatementHelper.getTypes(assertObj.getId())) {
                result.add(getDataParameter(assertObj, DatabaseType.valueOf(each.name())));
            }
        }
        return result;
Loading