提交 d74303bc 编写于 作者: T terrymanu

rule => rule config 8th version, refactor test case for spring

上级 6c594c55
......@@ -18,16 +18,16 @@
package com.dangdang.ddframe.rdb.sharding;
import com.dangdang.ddframe.rdb.sharding.spring.GenerateKeyDBUnitTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.namespace.WithNamespaceAlgorithmClassTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.namespace.WithNamespaceAlgorithmExpressionForDynamicTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.namespace.WithNamespaceAlgorithmExpressionTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.namespace.WithNamespaceBindingTablesTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.namespace.WithNamespaceDefaultStrategyTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.namespace.WithNamespaceDifferentTablesTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.namespace.WithNamespaceForIndicatedDataSourceNamesTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.namespace.WithNamespaceForMasterSlaveWithDefaultStrategyTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.namespace.WithNamespaceForMasterSlaveWithStrategyRefTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.namespace.WithNamespaceForMasterSlaveWithStrategyTypeTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.WithNamespaceAlgorithmClassTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.WithNamespaceAlgorithmExpressionForDynamicTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.WithNamespaceAlgorithmExpressionTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.WithNamespaceBindingTablesTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.WithNamespaceDefaultStrategyTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.WithNamespaceDifferentTablesTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.WithNamespaceForIndicatedDataSourceNamesTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.WithNamespaceForMasterSlaveWithDefaultStrategyTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.WithNamespaceForMasterSlaveWithStrategyRefTest;
import com.dangdang.ddframe.rdb.sharding.spring.cases.WithNamespaceForMasterSlaveWithStrategyTypeTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
......
......@@ -29,7 +29,7 @@ import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
@ContextConfiguration(locations = "classpath:META-INF/rdb/namespace/withNamespaceGenerateKeyColumns.xml")
@ContextConfiguration(locations = "classpath:META-INF/rdb/withNamespaceGenerateKeyColumns.xml")
public class GenerateKeyDBUnitTest extends AbstractSpringDBUnitTest {
@Test
......
......@@ -15,11 +15,11 @@
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.spring.cases.namespace;
package com.dangdang.ddframe.rdb.sharding.spring.cases;
import com.dangdang.ddframe.rdb.sharding.spring.AbstractShardingBothDataBasesAndTablesSpringDBUnitTest;
import org.springframework.test.context.ContextConfiguration;
@ContextConfiguration(locations = "classpath:META-INF/rdb/namespace/withNamespaceAlgorithmClass.xml")
@ContextConfiguration(locations = "classpath:META-INF/rdb/withNamespaceAlgorithmClass.xml")
public final class WithNamespaceAlgorithmClassTest extends AbstractShardingBothDataBasesAndTablesSpringDBUnitTest {
}
......@@ -15,11 +15,11 @@
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.spring.cases.namespace;
package com.dangdang.ddframe.rdb.sharding.spring.cases;
import com.dangdang.ddframe.rdb.sharding.spring.AbstractShardingBothDataBasesAndTablesSpringDBUnitTest;
import org.springframework.test.context.ContextConfiguration;
@ContextConfiguration(locations = "classpath:META-INF/rdb/namespace/withNamespaceAlgorithmExpressionForDynamic.xml")
@ContextConfiguration(locations = "classpath:META-INF/rdb/withNamespaceAlgorithmExpressionForDynamic.xml")
public final class WithNamespaceAlgorithmExpressionForDynamicTest extends AbstractShardingBothDataBasesAndTablesSpringDBUnitTest {
}
......@@ -15,11 +15,11 @@
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.spring.cases.namespace;
package com.dangdang.ddframe.rdb.sharding.spring.cases;
import com.dangdang.ddframe.rdb.sharding.spring.AbstractShardingBothDataBasesAndTablesSpringDBUnitTest;
import org.springframework.test.context.ContextConfiguration;
@ContextConfiguration(locations = "classpath:META-INF/rdb/namespace/withNamespaceAlgorithmExpression.xml")
@ContextConfiguration(locations = "classpath:META-INF/rdb/withNamespaceAlgorithmExpression.xml")
public final class WithNamespaceAlgorithmExpressionTest extends AbstractShardingBothDataBasesAndTablesSpringDBUnitTest {
}
......@@ -15,12 +15,12 @@
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.spring.cases.namespace;
package com.dangdang.ddframe.rdb.sharding.spring.cases;
import org.springframework.test.context.ContextConfiguration;
import com.dangdang.ddframe.rdb.sharding.spring.AbstractShardingBothDataBasesAndTablesSpringDBUnitTest;
@ContextConfiguration(locations = "classpath:META-INF/rdb/namespace/withNamespaceBindingTables.xml")
@ContextConfiguration(locations = "classpath:META-INF/rdb/withNamespaceBindingTables.xml")
public final class WithNamespaceBindingTablesTest extends AbstractShardingBothDataBasesAndTablesSpringDBUnitTest {
}
......@@ -15,12 +15,12 @@
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.spring.cases.namespace;
package com.dangdang.ddframe.rdb.sharding.spring.cases;
import org.springframework.test.context.ContextConfiguration;
import com.dangdang.ddframe.rdb.sharding.spring.AbstractShardingBothDataBasesAndTablesSpringDBUnitTest;
@ContextConfiguration(locations = "classpath:META-INF/rdb/namespace/withNamespaceDefaultStrategy.xml")
@ContextConfiguration(locations = "classpath:META-INF/rdb/withNamespaceDefaultStrategy.xml")
public final class WithNamespaceDefaultStrategyTest extends AbstractShardingBothDataBasesAndTablesSpringDBUnitTest {
}
......@@ -15,11 +15,11 @@
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.spring.cases.namespace;
package com.dangdang.ddframe.rdb.sharding.spring.cases;
import com.dangdang.ddframe.rdb.sharding.spring.AbstractShardingBothDataBasesAndTablesSpringDBUnitTest;
import org.springframework.test.context.ContextConfiguration;
@ContextConfiguration(locations = "classpath:META-INF/rdb/namespace/withNamespaceDifferentTables.xml")
@ContextConfiguration(locations = "classpath:META-INF/rdb/withNamespaceDifferentTables.xml")
public final class WithNamespaceDifferentTablesTest extends AbstractShardingBothDataBasesAndTablesSpringDBUnitTest {
}
......@@ -15,11 +15,11 @@
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.spring.cases.namespace;
package com.dangdang.ddframe.rdb.sharding.spring.cases;
import com.dangdang.ddframe.rdb.sharding.spring.AbstractShardingBothDataBasesAndTablesSpringDBUnitTest;
import org.springframework.test.context.ContextConfiguration;
@ContextConfiguration(locations = "classpath:META-INF/rdb/namespace/withNamespaceForIndicatedDataSourceNames.xml")
@ContextConfiguration(locations = "classpath:META-INF/rdb/withNamespaceForIndicatedDataSourceNames.xml")
public final class WithNamespaceForIndicatedDataSourceNamesTest extends AbstractShardingBothDataBasesAndTablesSpringDBUnitTest {
}
......@@ -15,7 +15,7 @@
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.spring.cases.namespace;
package com.dangdang.ddframe.rdb.sharding.spring.cases;
import com.dangdang.ddframe.rdb.sharding.spring.AbstractShardingBothDataBasesAndTablesSpringDBUnitTest;
import org.springframework.test.context.ContextConfiguration;
......@@ -23,7 +23,7 @@ import org.springframework.test.context.ContextConfiguration;
import java.util.Arrays;
import java.util.List;
@ContextConfiguration(locations = "classpath:META-INF/rdb/namespace/withNamespaceForMasterSlaveWithDefaultStrategy.xml")
@ContextConfiguration(locations = "classpath:META-INF/rdb/withNamespaceForMasterSlaveWithDefaultStrategy.xml")
public final class WithNamespaceForMasterSlaveWithDefaultStrategyTest extends AbstractShardingBothDataBasesAndTablesSpringDBUnitTest {
@Override
......
......@@ -15,7 +15,7 @@
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.spring.cases.namespace;
package com.dangdang.ddframe.rdb.sharding.spring.cases;
import com.dangdang.ddframe.rdb.sharding.spring.AbstractShardingBothDataBasesAndTablesSpringDBUnitTest;
import org.springframework.test.context.ContextConfiguration;
......@@ -23,7 +23,7 @@ import org.springframework.test.context.ContextConfiguration;
import java.util.Arrays;
import java.util.List;
@ContextConfiguration(locations = "classpath:META-INF/rdb/namespace/withNamespaceForMasterSlaveWithStrategyRef.xml")
@ContextConfiguration(locations = "classpath:META-INF/rdb/withNamespaceForMasterSlaveWithStrategyRef.xml")
public final class WithNamespaceForMasterSlaveWithStrategyRefTest extends AbstractShardingBothDataBasesAndTablesSpringDBUnitTest {
@Override
......
......@@ -15,7 +15,7 @@
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.spring.cases.namespace;
package com.dangdang.ddframe.rdb.sharding.spring.cases;
import com.dangdang.ddframe.rdb.sharding.spring.AbstractShardingBothDataBasesAndTablesSpringDBUnitTest;
import org.springframework.test.context.ContextConfiguration;
......@@ -23,7 +23,7 @@ import org.springframework.test.context.ContextConfiguration;
import java.util.Arrays;
import java.util.List;
@ContextConfiguration(locations = "classpath:META-INF/rdb/namespace/withNamespaceForMasterSlaveWithStrategyType.xml")
@ContextConfiguration(locations = "classpath:META-INF/rdb/withNamespaceForMasterSlaveWithStrategyType.xml")
public final class WithNamespaceForMasterSlaveWithStrategyTypeTest extends AbstractShardingBothDataBasesAndTablesSpringDBUnitTest {
@Override
......
......@@ -7,7 +7,7 @@
http://www.dangdang.com/schema/ddframe/rdb
http://www.dangdang.com/schema/ddframe/rdb/rdb.xsd
">
<import resource="../datasource/dataSource.xml" />
<import resource="datasource/dataSource.xml" />
<rdb:strategy id="databaseStrategy" type="inline" sharding-columns="user_id" algorithm-expression="dbtbl_${user_id % 2}"/>
......
......@@ -7,7 +7,7 @@
http://www.dangdang.com/schema/ddframe/rdb
http://www.dangdang.com/schema/ddframe/rdb/rdb.xsd
">
<import resource="../datasource/dataSource.xml" />
<import resource="datasource/dataSource.xml" />
<rdb:strategy id="databaseStrategy" type="inline" sharding-columns="user_id" algorithm-expression="dbtbl_${user_id % 2}"/>
......
......@@ -7,7 +7,7 @@
http://www.dangdang.com/schema/ddframe/rdb
http://www.dangdang.com/schema/ddframe/rdb/rdb.xsd
">
<import resource="../datasource/dataSource.xml" />
<import resource="datasource/dataSource.xml" />
<rdb:strategy id="databaseStrategy" type="standard" sharding-columns="user_id" algorithm-class="com.dangdang.ddframe.rdb.sharding.spring.algorithm.PreciseModuloDatabaseShardingAlgorithm"/>
......
......@@ -7,7 +7,7 @@
http://www.dangdang.com/schema/ddframe/rdb
http://www.dangdang.com/schema/ddframe/rdb/rdb.xsd
">
<import resource="../datasource/dataSource.xml" />
<import resource="datasource/dataSource.xml" />
<rdb:data-source id="shardingDataSource">
<rdb:sharding-rule data-sources="dbtbl_0,dbtbl_1" default-data-source="dbtbl_0">
......
......@@ -7,7 +7,7 @@
http://www.dangdang.com/schema/ddframe/rdb
http://www.dangdang.com/schema/ddframe/rdb/rdb.xsd
">
<import resource="../datasource/dataSource.xml" />
<import resource="datasource/dataSource.xml" />
<rdb:strategy id="databaseStrategy" type="inline" sharding-columns="user_id" algorithm-expression="dbtbl_${user_id % 2}"/>
......
......@@ -7,7 +7,7 @@
http://www.dangdang.com/schema/ddframe/rdb
http://www.dangdang.com/schema/ddframe/rdb/rdb.xsd
">
<import resource="../datasource/dataSource.xml" />
<import resource="datasource/dataSource.xml" />
<rdb:strategy id="databaseStrategy" type="inline" sharding-columns="user_id" algorithm-expression="dbtbl_${user_id % 2}"/>
......
......@@ -7,7 +7,7 @@
http://www.dangdang.com/schema/ddframe/rdb
http://www.dangdang.com/schema/ddframe/rdb/rdb.xsd
">
<import resource="../datasource/masterSlaveDataSource.xml" />
<import resource="datasource/masterSlaveDataSource.xml" />
<rdb:master-slave-data-source id="dbtbl_0" master-data-source-ref="dbtbl_0_master" slave-data-sources-ref="dbtbl_0_slave_0, dbtbl_0_slave_1" />
<rdb:master-slave-data-source id="dbtbl_1" master-data-source-ref="dbtbl_1_master" slave-data-sources-ref="dbtbl_1_slave_0, dbtbl_1_slave_1" />
......
......@@ -7,7 +7,7 @@
http://www.dangdang.com/schema/ddframe/rdb
http://www.dangdang.com/schema/ddframe/rdb/rdb.xsd
">
<import resource="../datasource/masterSlaveDataSource.xml" />
<import resource="datasource/masterSlaveDataSource.xml" />
<bean id="randomStrategy" class="com.dangdang.ddframe.rdb.sharding.api.strategy.slave.RandomMasterSlaveLoadBalanceStrategy" />
......
......@@ -7,7 +7,7 @@
http://www.dangdang.com/schema/ddframe/rdb
http://www.dangdang.com/schema/ddframe/rdb/rdb.xsd
">
<import resource="../datasource/masterSlaveDataSource.xml" />
<import resource="datasource/masterSlaveDataSource.xml" />
<rdb:master-slave-data-source id="dbtbl_0" master-data-source-ref="dbtbl_0_master" slave-data-sources-ref="dbtbl_0_slave_0, dbtbl_0_slave_1" strategy-type="RANDOM" />
<rdb:master-slave-data-source id="dbtbl_1" master-data-source-ref="dbtbl_1_master" slave-data-sources-ref="dbtbl_1_slave_0, dbtbl_1_slave_1" strategy-type="RANDOM" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册