Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
aee7517f
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aee7517f
编写于
11月 17, 2016
作者:
G
gaohongtao
提交者:
gaohongtao
11月 17, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test case refactor
上级
d8227795
变更
44
隐藏空白更改
内联
并排
Showing
44 changed file
with
160 addition
and
161 deletion
+160
-161
sharding-jdbc-config-parent/sharding-jdbc-config-common/src/test/java/com/dangdang/ddframe/rdb/sharding/config/common/api/ShardingRuleBuilderTest.java
...b/sharding/config/common/api/ShardingRuleBuilderTest.java
+1
-0
sharding-jdbc-config-parent/sharding-jdbc-config-common/src/test/java/com/dangdang/ddframe/rdb/sharding/config/common/fixture/AbstractNumberIdGenerator.java
...ding/config/common/fixture/AbstractNumberIdGenerator.java
+5
-2
sharding-jdbc-config-parent/sharding-jdbc-config-common/src/test/java/com/dangdang/ddframe/rdb/sharding/config/common/fixture/DecrementIdGenerator.java
.../sharding/config/common/fixture/DecrementIdGenerator.java
+2
-2
sharding-jdbc-config-parent/sharding-jdbc-config-common/src/test/java/com/dangdang/ddframe/rdb/sharding/config/common/fixture/IncrementIdGenerator.java
.../sharding/config/common/fixture/IncrementIdGenerator.java
+2
-2
sharding-jdbc-config-parent/sharding-jdbc-config-spring/src/test/java/com/dangdang/ddframe/rdb/sharding/AllSpringTests.java
...ava/com/dangdang/ddframe/rdb/sharding/AllSpringTests.java
+1
-1
sharding-jdbc-config-parent/sharding-jdbc-config-spring/src/test/java/com/dangdang/ddframe/rdb/sharding/spring/AutoIncrementDBUnitTest.java
.../ddframe/rdb/sharding/spring/AutoIncrementDBUnitTest.java
+1
-1
sharding-jdbc-config-parent/sharding-jdbc-config-spring/src/test/java/com/dangdang/ddframe/rdb/sharding/spring/fixture/AbstractNumberIdGenerator.java
...db/sharding/spring/fixture/AbstractNumberIdGenerator.java
+5
-2
sharding-jdbc-config-parent/sharding-jdbc-config-spring/src/test/java/com/dangdang/ddframe/rdb/sharding/spring/fixture/DecrementIdGenerator.java
...ame/rdb/sharding/spring/fixture/DecrementIdGenerator.java
+2
-2
sharding-jdbc-config-parent/sharding-jdbc-config-spring/src/test/java/com/dangdang/ddframe/rdb/sharding/spring/fixture/IncrementIdGenerator.java
...ame/rdb/sharding/spring/fixture/IncrementIdGenerator.java
+2
-2
sharding-jdbc-config-parent/sharding-jdbc-config-yaml/src/test/java/com/dangdang/ddframe/rdb/sharding/config/yaml/fixture/AbstractNumberIdGenerator.java
...arding/config/yaml/fixture/AbstractNumberIdGenerator.java
+5
-2
sharding-jdbc-config-parent/sharding-jdbc-config-yaml/src/test/java/com/dangdang/ddframe/rdb/sharding/config/yaml/fixture/DecrementIdGenerator.java
...db/sharding/config/yaml/fixture/DecrementIdGenerator.java
+2
-2
sharding-jdbc-config-parent/sharding-jdbc-config-yaml/src/test/java/com/dangdang/ddframe/rdb/sharding/config/yaml/fixture/IncrementIdGenerator.java
...db/sharding/config/yaml/fixture/IncrementIdGenerator.java
+2
-2
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/api/strategy/slave/SlaveLoadBalanceStrategy.java
...sharding/api/strategy/slave/SlaveLoadBalanceStrategy.java
+1
-1
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/executor/EventPostman.java
.../dangdang/ddframe/rdb/sharding/executor/EventPostman.java
+1
-1
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/executor/event/ExecutionEventBus.java
...dframe/rdb/sharding/executor/event/ExecutionEventBus.java
+1
-1
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/jdbc/GeneratedKeysResultSet.java
...ang/ddframe/rdb/sharding/jdbc/GeneratedKeysResultSet.java
+1
-1
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/jdbc/util/ParameterList.java
...angdang/ddframe/rdb/sharding/jdbc/util/ParameterList.java
+1
-1
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/result/GeneratedKeyContext.java
...frame/rdb/sharding/parser/result/GeneratedKeyContext.java
+1
-1
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/result/merger/AbstractSortableColumn.java
...sharding/parser/result/merger/AbstractSortableColumn.java
+1
-1
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/visitor/basic/mysql/MySQLEvalVisitor.java
...sharding/parser/visitor/basic/mysql/MySQLEvalVisitor.java
+1
-1
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/AllTests.java
...core/src/test/java/com/dangdang/ddframe/rdb/AllTests.java
+1
-1
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/integrate/db/pstatement/ShardingDataBasesOnlyForPStatementWithDMLTest.java
...tement/ShardingDataBasesOnlyForPStatementWithDMLTest.java
+1
-1
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/api/rule/TableRuleTest.java
...dangdang/ddframe/rdb/sharding/api/rule/TableRuleTest.java
+3
-15
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/executor/StatementExecutorTest.java
.../ddframe/rdb/sharding/executor/StatementExecutorTest.java
+7
-7
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/fixture/IncrementIdGenerator.java
...b/sharding/id/generator/fixture/IncrementIdGenerator.java
+2
-2
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/AllJDBCTests.java
.../com/dangdang/ddframe/rdb/sharding/jdbc/AllJDBCTests.java
+5
-5
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/GeneratedKeysResultSetMetaDataTest.java
...rdb/sharding/jdbc/GeneratedKeysResultSetMetaDataTest.java
+47
-47
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/GeneratedKeysResultSetTest.java
...ddframe/rdb/sharding/jdbc/GeneratedKeysResultSetTest.java
+12
-12
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/ShardingConnectionTest.java
...ang/ddframe/rdb/sharding/jdbc/ShardingConnectionTest.java
+4
-3
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/ShardingPreparedStatementTest.java
...rame/rdb/sharding/jdbc/ShardingPreparedStatementTest.java
+4
-4
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/adapter/ParameterizedAbstractPreparedStatementAdapterTest.java
...er/ParameterizedAbstractPreparedStatementAdapterTest.java
+5
-5
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/adapter/StatementAdapterTest.java
...frame/rdb/sharding/jdbc/adapter/StatementAdapterTest.java
+12
-12
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/unsupported/UnsupportedGeneratedKeysResultSetTest.java
...bc/unsupported/UnsupportedGeneratedKeysResultSetTest.java
+2
-2
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/util/ParameterListTest.java
...ang/ddframe/rdb/sharding/jdbc/util/ParameterListTest.java
+2
-2
sharding-jdbc-doc/content/post/id-generator.md
sharding-jdbc-doc/content/post/id-generator.md
+1
-1
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/main/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/CommonSelfIdGenerator.java
...rdb/sharding/id/generator/self/CommonSelfIdGenerator.java
+1
-1
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/AbstractWorkerIdTest.java
.../rdb/sharding/id/generator/self/AbstractWorkerIdTest.java
+1
-1
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/AllTest.java
...gdang/ddframe/rdb/sharding/id/generator/self/AllTest.java
+2
-2
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/ApiWorkerIdTest.java
...frame/rdb/sharding/id/generator/self/ApiWorkerIdTest.java
+1
-1
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/CommonSelfIdGeneratorTest.java
...sharding/id/generator/self/CommonSelfIdGeneratorTest.java
+2
-2
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/SystemEnvWorkerIdTest.java
...rdb/sharding/id/generator/self/SystemEnvWorkerIdTest.java
+3
-3
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/SystemPropertyWorkerIdTest.java
...harding/id/generator/self/SystemPropertyWorkerIdTest.java
+2
-2
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/fixture/FixClock.java
...rame/rdb/sharding/id/generator/self/fixture/FixClock.java
+1
-1
sharding-jdbc-transaction-parent/sharding-jdbc-transaction/src/main/java/com/dangdang/ddframe/rdb/transaction/soft/bed/async/AbstractBestEffortsDeliveryJobFactory.java
...soft/bed/async/AbstractBestEffortsDeliveryJobFactory.java
+1
-1
未找到文件。
sharding-jdbc-config-parent/sharding-jdbc-config-common/src/test/java/com/dangdang/ddframe/rdb/sharding/config/common/api/ShardingRuleBuilderTest.java
浏览文件 @
aee7517f
...
...
@@ -68,6 +68,7 @@ public final class ShardingRuleBuilderTest {
shardingRuleConfig
.
setDefaultDatabaseStrategy
(
getDatabaseStrategyConfig
(
"xxx.Algorithm"
));
new
ShardingRuleBuilder
(
shardingRuleConfig
).
build
();
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
assertBuildFailureWhenAutoIncrementClassNotExisted
()
{
ShardingRuleConfig
shardingRuleConfig
=
new
ShardingRuleConfig
();
...
...
sharding-jdbc-config-parent/sharding-jdbc-config-common/src/test/java/com/dangdang/ddframe/rdb/sharding/config/common/fixture/AbstractNumberIdGenerator.java
浏览文件 @
aee7517f
...
...
@@ -18,12 +18,15 @@
package
com.dangdang.ddframe.rdb.sharding.config.common.fixture
;
import
com.dangdang.ddframe.rdb.sharding.id.generator.IdGenerator
;
import
lombok.AccessLevel
;
import
lombok.Getter
;
import
java.util.concurrent.atomic.AtomicInteger
;
abstract
class
AbstractNumberIdGenerator
implements
IdGenerator
{
abstract
class
AbstractNumberIdGenerator
implements
IdGenerator
{
final
AtomicInteger
sequence
=
new
AtomicInteger
(
100
);
@Getter
(
AccessLevel
.
PACKAGE
)
private
final
AtomicInteger
sequence
=
new
AtomicInteger
(
100
);
@Override
public
void
initContext
(
final
String
tableName
,
final
String
columnName
)
{
...
...
sharding-jdbc-config-parent/sharding-jdbc-config-common/src/test/java/com/dangdang/ddframe/rdb/sharding/config/common/fixture/DecrementIdGenerator.java
浏览文件 @
aee7517f
...
...
@@ -17,10 +17,10 @@
package
com.dangdang.ddframe.rdb.sharding.config.common.fixture
;
public
class
DecrementIdGenerator
extends
AbstractNumberIdGenerator
{
public
class
DecrementIdGenerator
extends
AbstractNumberIdGenerator
{
@Override
public
Object
generateId
()
{
return
sequence
.
decrementAndGet
();
return
getSequence
()
.
decrementAndGet
();
}
}
sharding-jdbc-config-parent/sharding-jdbc-config-common/src/test/java/com/dangdang/ddframe/rdb/sharding/config/common/fixture/IncrementIdGenerator.java
浏览文件 @
aee7517f
...
...
@@ -17,10 +17,10 @@
package
com.dangdang.ddframe.rdb.sharding.config.common.fixture
;
public
class
IncrementIdGenerator
extends
AbstractNumberIdGenerator
{
public
class
IncrementIdGenerator
extends
AbstractNumberIdGenerator
{
@Override
public
Object
generateId
()
{
return
sequence
.
incrementAndGet
();
return
getSequence
()
.
incrementAndGet
();
}
}
sharding-jdbc-config-parent/sharding-jdbc-config-spring/src/test/java/com/dangdang/ddframe/rdb/sharding/AllSpringTests.java
浏览文件 @
aee7517f
...
...
@@ -47,7 +47,7 @@ import org.junit.runners.Suite.SuiteClasses;
WithNamespaceDifferentTablesTest
.
class
,
WithNamespaceForIndicatedDataSourceNamesTest
.
class
,
WithNamespaceForMasterSlaveTest
.
class
,
AutoIncrementDBUnitTest
.
class
,
AutoIncrementDBUnitTest
.
class
})
public
class
AllSpringTests
{
}
sharding-jdbc-config-parent/sharding-jdbc-config-spring/src/test/java/com/dangdang/ddframe/rdb/sharding/spring/AutoIncrementDBUnitTest.java
浏览文件 @
aee7517f
...
...
@@ -28,7 +28,7 @@ import static org.junit.Assert.assertEquals;
import
static
org
.
junit
.
Assert
.
assertTrue
;
@ContextConfiguration
(
locations
=
"classpath:META-INF/rdb/namespace/withNamespaceAutoIncrementColumns.xml"
)
public
class
AutoIncrementDBUnitTest
extends
AbstractSpringDBUnitTest
{
public
class
AutoIncrementDBUnitTest
extends
AbstractSpringDBUnitTest
{
@Test
public
void
test
()
throws
SQLException
{
...
...
sharding-jdbc-config-parent/sharding-jdbc-config-spring/src/test/java/com/dangdang/ddframe/rdb/sharding/spring/fixture/AbstractNumberIdGenerator.java
浏览文件 @
aee7517f
...
...
@@ -18,12 +18,15 @@
package
com.dangdang.ddframe.rdb.sharding.spring.fixture
;
import
com.dangdang.ddframe.rdb.sharding.id.generator.IdGenerator
;
import
lombok.AccessLevel
;
import
lombok.Getter
;
import
java.util.concurrent.atomic.AtomicInteger
;
abstract
class
AbstractNumberIdGenerator
implements
IdGenerator
{
abstract
class
AbstractNumberIdGenerator
implements
IdGenerator
{
final
AtomicInteger
sequence
=
new
AtomicInteger
(
100
);
@Getter
(
AccessLevel
.
PACKAGE
)
private
final
AtomicInteger
sequence
=
new
AtomicInteger
(
100
);
@Override
public
void
initContext
(
final
String
tableName
,
final
String
columnName
)
{
...
...
sharding-jdbc-config-parent/sharding-jdbc-config-spring/src/test/java/com/dangdang/ddframe/rdb/sharding/spring/fixture/DecrementIdGenerator.java
浏览文件 @
aee7517f
...
...
@@ -17,10 +17,10 @@
package
com.dangdang.ddframe.rdb.sharding.spring.fixture
;
public
class
DecrementIdGenerator
extends
AbstractNumberIdGenerator
{
public
class
DecrementIdGenerator
extends
AbstractNumberIdGenerator
{
@Override
public
Object
generateId
()
{
return
sequence
.
decrementAndGet
();
return
getSequence
()
.
decrementAndGet
();
}
}
sharding-jdbc-config-parent/sharding-jdbc-config-spring/src/test/java/com/dangdang/ddframe/rdb/sharding/spring/fixture/IncrementIdGenerator.java
浏览文件 @
aee7517f
...
...
@@ -17,10 +17,10 @@
package
com.dangdang.ddframe.rdb.sharding.spring.fixture
;
public
class
IncrementIdGenerator
extends
AbstractNumberIdGenerator
{
public
class
IncrementIdGenerator
extends
AbstractNumberIdGenerator
{
@Override
public
Object
generateId
()
{
return
sequence
.
incrementAndGet
();
return
getSequence
()
.
incrementAndGet
();
}
}
sharding-jdbc-config-parent/sharding-jdbc-config-yaml/src/test/java/com/dangdang/ddframe/rdb/sharding/config/yaml/fixture/AbstractNumberIdGenerator.java
浏览文件 @
aee7517f
...
...
@@ -18,12 +18,15 @@
package
com.dangdang.ddframe.rdb.sharding.config.yaml.fixture
;
import
com.dangdang.ddframe.rdb.sharding.id.generator.IdGenerator
;
import
lombok.AccessLevel
;
import
lombok.Getter
;
import
java.util.concurrent.atomic.AtomicInteger
;
abstract
class
AbstractNumberIdGenerator
implements
IdGenerator
{
abstract
class
AbstractNumberIdGenerator
implements
IdGenerator
{
final
AtomicInteger
sequence
=
new
AtomicInteger
(
100
);
@Getter
(
AccessLevel
.
PACKAGE
)
private
final
AtomicInteger
sequence
=
new
AtomicInteger
(
100
);
@Override
public
void
initContext
(
final
String
tableName
,
final
String
columnName
)
{
...
...
sharding-jdbc-config-parent/sharding-jdbc-config-yaml/src/test/java/com/dangdang/ddframe/rdb/sharding/config/yaml/fixture/DecrementIdGenerator.java
浏览文件 @
aee7517f
...
...
@@ -17,10 +17,10 @@
package
com.dangdang.ddframe.rdb.sharding.config.yaml.fixture
;
public
class
DecrementIdGenerator
extends
AbstractNumberIdGenerator
{
public
class
DecrementIdGenerator
extends
AbstractNumberIdGenerator
{
@Override
public
Object
generateId
()
{
return
sequence
.
decrementAndGet
();
return
getSequence
()
.
decrementAndGet
();
}
}
sharding-jdbc-config-parent/sharding-jdbc-config-yaml/src/test/java/com/dangdang/ddframe/rdb/sharding/config/yaml/fixture/IncrementIdGenerator.java
浏览文件 @
aee7517f
...
...
@@ -17,10 +17,10 @@
package
com.dangdang.ddframe.rdb.sharding.config.yaml.fixture
;
public
class
IncrementIdGenerator
extends
AbstractNumberIdGenerator
{
public
class
IncrementIdGenerator
extends
AbstractNumberIdGenerator
{
@Override
public
Object
generateId
()
{
return
sequence
.
incrementAndGet
();
return
getSequence
()
.
incrementAndGet
();
}
}
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/api/strategy/slave/SlaveLoadBalanceStrategy.java
浏览文件 @
aee7517f
...
...
@@ -34,5 +34,5 @@ public interface SlaveLoadBalanceStrategy {
* @param slaveDataSources 从库数据源列表
* @return 选中的从库数据源
*/
DataSource
getDataSource
(
final
String
name
,
final
List
<
DataSource
>
slaveDataSources
);
DataSource
getDataSource
(
String
name
,
List
<
DataSource
>
slaveDataSources
);
}
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/executor/EventPostman.java
浏览文件 @
aee7517f
...
...
@@ -34,7 +34,7 @@ import java.util.Collection;
* 消息投递员.
* 负责SQL执行消息的投递
*
* @author gaohongtao
.
* @author gaohongtao
*/
@RequiredArgsConstructor
class
EventPostman
{
...
...
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/executor/event/ExecutionEventBus.java
浏览文件 @
aee7517f
...
...
@@ -24,7 +24,7 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* 事件总线.
*
* @author gaohongtao
.
* @author gaohongtao
*/
public
class
ExecutionEventBus
{
...
...
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/jdbc/GeneratedKeysResultSet.java
浏览文件 @
aee7517f
...
...
@@ -33,7 +33,7 @@ import java.util.Map;
/**
* 生成键结果集.
*
* @author gaohongtao
.
* @author gaohongtao
*/
@RequiredArgsConstructor
public
class
GeneratedKeysResultSet
extends
AbstractUnsupportedGeneratedKeysResultSet
{
...
...
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/jdbc/util/ParameterList.java
浏览文件 @
aee7517f
...
...
@@ -28,7 +28,7 @@ import java.util.ArrayList;
* 参数列表.
* 对外提供参数值统一访问方式
*
* @author gaohongtao
.
* @author gaohongtao
*/
@RequiredArgsConstructor
public
class
ParameterList
extends
AbstractList
<
Object
>
{
...
...
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/result/GeneratedKeyContext.java
浏览文件 @
aee7517f
...
...
@@ -31,7 +31,7 @@ import java.util.Map;
/**
* 自动生成键上下文.
*
* @author gaohongtao
.
* @author gaohongtao
*/
@ToString
public
class
GeneratedKeyContext
{
...
...
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/result/merger/AbstractSortableColumn.java
浏览文件 @
aee7517f
...
...
@@ -25,7 +25,7 @@ import lombok.ToString;
/**
* 可排序列.
*
* @author gaohongtao
.
* @author gaohongtao
*/
@ToString
@Getter
...
...
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/visitor/basic/mysql/MySQLEvalVisitor.java
浏览文件 @
aee7517f
...
...
@@ -25,7 +25,7 @@ import java.util.Map;
/**
* MySQL变量中提取参数值与编号.
*
* @author gaohongtao
.
* @author gaohongtao
*/
public
class
MySQLEvalVisitor
extends
MySqlEvalVisitorImpl
{
...
...
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/AllTests.java
浏览文件 @
aee7517f
...
...
@@ -48,7 +48,7 @@ import org.junit.runners.Suite.SuiteClasses;
AllUtilTests
.
class
,
AllMetricsTests
.
class
,
AllIntegrateTests
.
class
,
AllIdGeneratorTest
.
class
,
AllIdGeneratorTest
.
class
})
public
class
AllTests
{
}
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/integrate/db/pstatement/ShardingDataBasesOnlyForPStatementWithDMLTest.java
浏览文件 @
aee7517f
...
...
@@ -60,7 +60,7 @@ public final class ShardingDataBasesOnlyForPStatementWithDMLTest extends Abstrac
String
sql
=
"INSERT INTO `t_order` (`order_id`, `status`) VALUES (?, ?)"
;
try
(
Connection
connection
=
shardingDataSource
.
getConnection
();
PreparedStatement
preparedStatement
=
connection
.
prepareStatement
(
sql
))
{
for
(
int
i
=
1
;
i
<=
10
;
i
++)
{
for
(
int
i
=
1
;
i
<=
10
;
i
++)
{
preparedStatement
.
setInt
(
1
,
i
);
preparedStatement
.
setString
(
2
,
"insert"
);
preparedStatement
.
executeUpdate
();
...
...
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/api/rule/TableRuleTest.java
浏览文件 @
aee7517f
...
...
@@ -25,6 +25,7 @@ import com.dangdang.ddframe.rdb.sharding.id.generator.IdGenerator;
import
com.dangdang.ddframe.rdb.sharding.id.generator.fixture.IncrementIdGenerator
;
import
com.google.common.collect.Sets
;
import
org.junit.Test
;
import
org.mockito.Mockito
;
import
javax.sql.DataSource
;
import
java.util.Arrays
;
...
...
@@ -204,22 +205,9 @@ public final class TableRuleTest {
@Test
public
void
assertAutoIncrementColumn
()
{
TableRule
actual
=
TableRule
.
builder
(
"logicTable"
).
dataSourceRule
(
createDataSourceRule
()).
autoIncrementColumns
(
"col_1"
,
IncrementIdGenerator
.
class
)
.
autoIncrementColumns
(
"col_2"
).
tableIdGenerator
(
Mock
IdGenerator
.
class
).
build
();
.
autoIncrementColumns
(
"col_2"
).
tableIdGenerator
(
Mock
ito
.
mock
(
IdGenerator
.
class
).
getClass
()
).
build
();
assertThat
(
actual
.
getAutoIncrementColumnMap
().
get
(
"col_1"
),
instanceOf
(
IncrementIdGenerator
.
class
));
assertThat
(
actual
.
getAutoIncrementColumnMap
().
get
(
"col_2"
),
instanceOf
(
MockIdGenerator
.
class
));
}
public
static
class
MockIdGenerator
implements
IdGenerator
{
@Override
public
void
initContext
(
final
String
tableName
,
final
String
columnName
)
{
}
@Override
public
Object
generateId
()
{
return
null
;
}
assertThat
(
actual
.
getAutoIncrementColumnMap
().
get
(
"col_2"
),
instanceOf
(
Mockito
.
mock
(
IdGenerator
.
class
).
getClass
()));
}
private
DataSourceRule
createDataSourceRule
()
{
...
...
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/executor/StatementExecutorTest.java
浏览文件 @
aee7517f
...
...
@@ -109,7 +109,6 @@ public final class StatementExecutorTest {
@Test
public
void
assertExecuteQueryForMultipleStatementsSuccess
()
throws
SQLException
{
Statement
statement1
=
mock
(
Statement
.
class
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDQL
(
statement1
,
"ds_0"
);
Statement
statement2
=
mock
(
Statement
.
class
);
ResultSet
resultSet1
=
mock
(
ResultSet
.
class
);
ResultSet
resultSet2
=
mock
(
ResultSet
.
class
);
...
...
@@ -118,6 +117,7 @@ public final class StatementExecutorTest {
when
(
statement2
.
executeQuery
(
SELECT_FROM_DUAL
)).
thenReturn
(
resultSet2
);
when
(
statement2
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
StatementExecutor
actual
=
new
StatementExecutor
(
executorEngine
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDQL
(
statement1
,
"ds_0"
);
actual
.
addStatement
(
wrapper1
);
StatementExecutorWrapper
wrapper2
=
createStatementExecutorWrapperForDQL
(
statement2
,
"ds_1"
);
actual
.
addStatement
(
wrapper2
);
...
...
@@ -158,7 +158,6 @@ public final class StatementExecutorTest {
@Test
public
void
assertExecuteQueryForMultipleStatementsFailure
()
throws
SQLException
{
Statement
statement1
=
mock
(
Statement
.
class
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDQL
(
statement1
,
"ds_0"
);
Statement
statement2
=
mock
(
Statement
.
class
);
SQLException
exp
=
new
SQLException
();
when
(
statement1
.
executeQuery
(
SELECT_FROM_DUAL
)).
thenThrow
(
exp
);
...
...
@@ -166,6 +165,7 @@ public final class StatementExecutorTest {
when
(
statement1
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
when
(
statement2
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
StatementExecutor
actual
=
new
StatementExecutor
(
executorEngine
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDQL
(
statement1
,
"ds_0"
);
actual
.
addStatement
(
wrapper1
);
StatementExecutorWrapper
wrapper2
=
createStatementExecutorWrapperForDQL
(
statement2
,
"ds_1"
);
actual
.
addStatement
(
wrapper2
);
...
...
@@ -204,13 +204,13 @@ public final class StatementExecutorTest {
@Test
public
void
assertExecuteUpdateForMultipleStatementsSuccess
()
throws
SQLException
{
Statement
statement1
=
mock
(
Statement
.
class
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDML
(
statement1
,
"ds_0"
);
Statement
statement2
=
mock
(
Statement
.
class
);
when
(
statement1
.
executeUpdate
(
DELETE_FROM_DUAL
)).
thenReturn
(
10
);
when
(
statement2
.
executeUpdate
(
DELETE_FROM_DUAL
)).
thenReturn
(
20
);
when
(
statement1
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
when
(
statement2
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
StatementExecutor
actual
=
new
StatementExecutor
(
executorEngine
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDML
(
statement1
,
"ds_0"
);
actual
.
addStatement
(
wrapper1
);
StatementExecutorWrapper
wrapper2
=
createStatementExecutorWrapperForDML
(
statement2
,
"ds_1"
);
actual
.
addStatement
(
wrapper2
);
...
...
@@ -249,7 +249,6 @@ public final class StatementExecutorTest {
@Test
public
void
assertExecuteUpdateForMultipleStatementsFailure
()
throws
SQLException
{
Statement
statement1
=
mock
(
Statement
.
class
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDML
(
statement1
,
"ds_0"
);
Statement
statement2
=
mock
(
Statement
.
class
);
SQLException
exp
=
new
SQLException
();
when
(
statement1
.
executeUpdate
(
DELETE_FROM_DUAL
)).
thenThrow
(
exp
);
...
...
@@ -257,6 +256,7 @@ public final class StatementExecutorTest {
when
(
statement1
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
when
(
statement2
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
StatementExecutor
actual
=
new
StatementExecutor
(
executorEngine
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDML
(
statement1
,
"ds_0"
);
actual
.
addStatement
(
wrapper1
);
StatementExecutorWrapper
wrapper2
=
createStatementExecutorWrapperForDML
(
statement2
,
"ds_1"
);
actual
.
addStatement
(
wrapper2
);
...
...
@@ -345,13 +345,13 @@ public final class StatementExecutorTest {
@Test
public
void
assertExecuteForMultipleStatementsSuccessWithDML
()
throws
SQLException
{
Statement
statement1
=
mock
(
Statement
.
class
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDML
(
statement1
,
"ds_0"
);
Statement
statement2
=
mock
(
Statement
.
class
);
when
(
statement1
.
execute
(
DELETE_FROM_DUAL
)).
thenReturn
(
false
);
when
(
statement2
.
execute
(
DELETE_FROM_DUAL
)).
thenReturn
(
false
);
when
(
statement1
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
when
(
statement2
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
StatementExecutor
actual
=
new
StatementExecutor
(
executorEngine
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDML
(
statement1
,
"ds_0"
);
actual
.
addStatement
(
wrapper1
);
StatementExecutorWrapper
wrapper2
=
createStatementExecutorWrapperForDML
(
statement2
,
"ds_1"
);
actual
.
addStatement
(
wrapper2
);
...
...
@@ -390,7 +390,6 @@ public final class StatementExecutorTest {
@Test
public
void
assertExecuteForMultipleStatementsFailureWithDML
()
throws
SQLException
{
Statement
statement1
=
mock
(
Statement
.
class
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDML
(
statement1
,
"ds_0"
);
Statement
statement2
=
mock
(
Statement
.
class
);
SQLException
exp
=
new
SQLException
();
when
(
statement1
.
execute
(
DELETE_FROM_DUAL
)).
thenThrow
(
exp
);
...
...
@@ -398,6 +397,7 @@ public final class StatementExecutorTest {
when
(
statement1
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
when
(
statement2
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
StatementExecutor
actual
=
new
StatementExecutor
(
executorEngine
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDML
(
statement1
,
"ds_0"
);
actual
.
addStatement
(
wrapper1
);
StatementExecutorWrapper
wrapper2
=
createStatementExecutorWrapperForDML
(
statement2
,
"ds_1"
);
actual
.
addStatement
(
wrapper2
);
...
...
@@ -435,13 +435,13 @@ public final class StatementExecutorTest {
@Test
public
void
assertExecuteForMultipleStatements
()
throws
SQLException
{
Statement
statement1
=
mock
(
Statement
.
class
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDQL
(
statement1
,
"ds_0"
);
Statement
statement2
=
mock
(
Statement
.
class
);
when
(
statement1
.
execute
(
SELECT_FROM_DUAL
)).
thenReturn
(
true
);
when
(
statement2
.
execute
(
SELECT_FROM_DUAL
)).
thenReturn
(
true
);
when
(
statement1
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
when
(
statement2
.
getConnection
()).
thenReturn
(
mock
(
Connection
.
class
));
StatementExecutor
actual
=
new
StatementExecutor
(
executorEngine
);
StatementExecutorWrapper
wrapper1
=
createStatementExecutorWrapperForDQL
(
statement1
,
"ds_0"
);
actual
.
addStatement
(
wrapper1
);
StatementExecutorWrapper
wrapper2
=
createStatementExecutorWrapperForDQL
(
statement2
,
"ds_0"
);
actual
.
addStatement
(
wrapper2
);
...
...
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/fixture/IncrementIdGenerator.java
浏览文件 @
aee7517f
...
...
@@ -21,7 +21,7 @@ import com.dangdang.ddframe.rdb.sharding.id.generator.IdGenerator;
import
java.util.concurrent.atomic.AtomicInteger
;
public
class
IncrementIdGenerator
implements
IdGenerator
{
public
class
IncrementIdGenerator
implements
IdGenerator
{
private
final
AtomicInteger
i
=
new
AtomicInteger
();
...
...
@@ -34,4 +34,4 @@ public class IncrementIdGenerator implements IdGenerator{
public
Object
generateId
()
{
return
i
.
incrementAndGet
();
}
}
\ No newline at end of file
}
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/AllJDBCTests.java
浏览文件 @
aee7517f
...
...
@@ -17,14 +17,14 @@
package
com.dangdang.ddframe.rdb.sharding.jdbc
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.adapter.AbstractPreparedStatementAdapterTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.adapter.ConnectionAdapterTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.adapter.DataSourceAdapterTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.adapter.ParameterizedAbstractPreparedStatementAdapterTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.adapter.PreparedStatementAdapterTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.adapter.ResultSetAdapterTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.adapter.ResultSetGetterAdapterTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.adapter.StatementAdapterTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.unsupported.
Abstract
UnsupportedGeneratedKeysResultSetTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.unsupported.UnsupportedGeneratedKeysResultSetTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.unsupported.UnsupportedOperationConnectionTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.unsupported.UnsupportedOperationDataSourceTest
;
import
com.dangdang.ddframe.rdb.sharding.jdbc.unsupported.UnsupportedOperationPreparedStatementTest
;
...
...
@@ -47,7 +47,7 @@ import org.junit.runners.Suite;
UnsupportedOperationPreparedStatementTest
.
class
,
UnsupportedOperationResultSetTest
.
class
,
UnsupportedUpdateOperationResultSetTest
.
class
,
Abstract
UnsupportedGeneratedKeysResultSetTest
.
class
,
UnsupportedGeneratedKeysResultSetTest
.
class
,
DataSourceAdapterTest
.
class
,
ConnectionAdapterTest
.
class
,
StatementAdapterTest
.
class
,
...
...
@@ -57,11 +57,11 @@ import org.junit.runners.Suite;
JdbcMethodInvocationTest
.
class
,
MasterSlaveDataSourceTest
.
class
,
ParameterListTest
.
class
,
AbstractPreparedStatementAdapterTest
.
class
,
Parameterized
AbstractPreparedStatementAdapterTest
.
class
,
ShardingConnectionTest
.
class
,
ShardingPreparedStatementTableOnlyTest
.
class
,
GeneratedKeysResultSetTest
.
class
,
GeneratedKeysResultSetMetaDataTest
.
class
,
GeneratedKeysResultSetMetaDataTest
.
class
})
public
class
AllJDBCTests
{
}
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/GeneratedKeysResultSetMetaDataTest.java
浏览文件 @
aee7517f
...
...
@@ -33,151 +33,151 @@ import static org.junit.Assert.assertTrue;
public
class
GeneratedKeysResultSetMetaDataTest
{
private
ResultSetMetaData
ac
ut
alMetaData
;
private
ResultSetMetaData
ac
tu
alMetaData
;
@Before
public
void
init
()
throws
SQLException
{
ac
ut
alMetaData
=
GeneratedKeysResultSetTest
.
createMock
().
getMetaData
();
ac
tu
alMetaData
=
GeneratedKeysResultSetTest
.
createMock
().
getMetaData
();
}
@Test
public
void
getColumnCount
()
throws
Exception
{
assertThat
(
ac
ut
alMetaData
.
getColumnCount
(),
is
(
2
));
assertThat
(
ac
tu
alMetaData
.
getColumnCount
(),
is
(
2
));
}
@Test
public
void
isAutoIncrement
()
throws
Exception
{
assertTrue
(
ac
ut
alMetaData
.
isAutoIncrement
(
1
));
assertTrue
(
ac
ut
alMetaData
.
isAutoIncrement
(
2
));
assertTrue
(
ac
tu
alMetaData
.
isAutoIncrement
(
1
));
assertTrue
(
ac
tu
alMetaData
.
isAutoIncrement
(
2
));
}
@Test
public
void
isCaseSensitive
()
throws
Exception
{
assertTrue
(
ac
ut
alMetaData
.
isCaseSensitive
(
1
));
assertTrue
(
ac
ut
alMetaData
.
isCaseSensitive
(
2
));
assertTrue
(
ac
tu
alMetaData
.
isCaseSensitive
(
1
));
assertTrue
(
ac
tu
alMetaData
.
isCaseSensitive
(
2
));
}
@Test
public
void
isSearchable
()
throws
Exception
{
assertFalse
(
ac
ut
alMetaData
.
isSearchable
(
1
));
assertFalse
(
ac
ut
alMetaData
.
isSearchable
(
2
));
assertFalse
(
ac
tu
alMetaData
.
isSearchable
(
1
));
assertFalse
(
ac
tu
alMetaData
.
isSearchable
(
2
));
}
@Test
public
void
isCurrency
()
throws
Exception
{
assertFalse
(
ac
ut
alMetaData
.
isCurrency
(
1
));
assertFalse
(
ac
ut
alMetaData
.
isCurrency
(
2
));
assertFalse
(
ac
tu
alMetaData
.
isCurrency
(
1
));
assertFalse
(
ac
tu
alMetaData
.
isCurrency
(
2
));
}
@Test
public
void
isNullable
()
throws
Exception
{
assertEquals
(
ac
ut
alMetaData
.
isNullable
(
1
),
ResultSetMetaData
.
columnNoNulls
);
assertEquals
(
ac
ut
alMetaData
.
isNullable
(
2
),
ResultSetMetaData
.
columnNoNulls
);
assertEquals
(
ac
tu
alMetaData
.
isNullable
(
1
),
ResultSetMetaData
.
columnNoNulls
);
assertEquals
(
ac
tu
alMetaData
.
isNullable
(
2
),
ResultSetMetaData
.
columnNoNulls
);
}
@Test
public
void
isSigned
()
throws
Exception
{
assertTrue
(
ac
ut
alMetaData
.
isSigned
(
1
));
assertTrue
(
ac
ut
alMetaData
.
isSigned
(
2
));
assertTrue
(
ac
tu
alMetaData
.
isSigned
(
1
));
assertTrue
(
ac
tu
alMetaData
.
isSigned
(
2
));
}
@Test
public
void
getColumnDisplaySize
()
throws
Exception
{
assertEquals
(
ac
ut
alMetaData
.
getColumnDisplaySize
(
1
),
0
);
assertEquals
(
ac
ut
alMetaData
.
getColumnDisplaySize
(
2
),
0
);
assertEquals
(
ac
tu
alMetaData
.
getColumnDisplaySize
(
1
),
0
);
assertEquals
(
ac
tu
alMetaData
.
getColumnDisplaySize
(
2
),
0
);
}
@Test
public
void
getColumnLabel
()
throws
Exception
{
assertThat
(
ac
ut
alMetaData
.
getColumnLabel
(
1
),
is
(
"order_id"
));
assertThat
(
ac
ut
alMetaData
.
getColumnLabel
(
2
),
is
(
"order_no"
));
assertThat
(
ac
tu
alMetaData
.
getColumnLabel
(
1
),
is
(
"order_id"
));
assertThat
(
ac
tu
alMetaData
.
getColumnLabel
(
2
),
is
(
"order_no"
));
}
@Test
public
void
getColumnName
()
throws
Exception
{
assertThat
(
ac
ut
alMetaData
.
getColumnName
(
1
),
is
(
"order_id"
));
assertThat
(
ac
ut
alMetaData
.
getColumnName
(
2
),
is
(
"order_no"
));
assertThat
(
ac
tu
alMetaData
.
getColumnName
(
1
),
is
(
"order_id"
));
assertThat
(
ac
tu
alMetaData
.
getColumnName
(
2
),
is
(
"order_no"
));
}
@Test
public
void
getSchemaName
()
throws
Exception
{
assertThat
(
ac
ut
alMetaData
.
getSchemaName
(
1
),
is
(
""
));
assertThat
(
ac
ut
alMetaData
.
getSchemaName
(
2
),
is
(
""
));
assertThat
(
ac
tu
alMetaData
.
getSchemaName
(
1
),
is
(
""
));
assertThat
(
ac
tu
alMetaData
.
getSchemaName
(
2
),
is
(
""
));
}
@Test
public
void
getPrecision
()
throws
Exception
{
assertEquals
(
ac
ut
alMetaData
.
getPrecision
(
1
),
0
);
assertEquals
(
ac
ut
alMetaData
.
getPrecision
(
2
),
0
);
assertEquals
(
ac
tu
alMetaData
.
getPrecision
(
1
),
0
);
assertEquals
(
ac
tu
alMetaData
.
getPrecision
(
2
),
0
);
}
@Test
public
void
getScale
()
throws
Exception
{
assertEquals
(
ac
ut
alMetaData
.
getScale
(
1
),
0
);
assertEquals
(
ac
ut
alMetaData
.
getScale
(
2
),
0
);
assertEquals
(
ac
tu
alMetaData
.
getScale
(
1
),
0
);
assertEquals
(
ac
tu
alMetaData
.
getScale
(
2
),
0
);
}
@Test
public
void
getTableName
()
throws
Exception
{
assertThat
(
ac
ut
alMetaData
.
getTableName
(
1
),
is
(
""
));
assertThat
(
ac
ut
alMetaData
.
getTableName
(
2
),
is
(
""
));
assertThat
(
ac
tu
alMetaData
.
getTableName
(
1
),
is
(
""
));
assertThat
(
ac
tu
alMetaData
.
getTableName
(
2
),
is
(
""
));
}
@Test
public
void
getCatalogName
()
throws
Exception
{
assertThat
(
ac
ut
alMetaData
.
getCatalogName
(
1
),
is
(
""
));
assertThat
(
ac
ut
alMetaData
.
getCatalogName
(
2
),
is
(
""
));
assertThat
(
ac
tu
alMetaData
.
getCatalogName
(
1
),
is
(
""
));
assertThat
(
ac
tu
alMetaData
.
getCatalogName
(
2
),
is
(
""
));
}
@Test
public
void
getColumnType
()
throws
Exception
{
assertEquals
(
ac
ut
alMetaData
.
getColumnType
(
1
),
Types
.
BIGINT
);
assertEquals
(
ac
ut
alMetaData
.
getColumnType
(
2
),
Types
.
VARCHAR
);
assertEquals
(
ac
tu
alMetaData
.
getColumnType
(
1
),
Types
.
BIGINT
);
assertEquals
(
ac
tu
alMetaData
.
getColumnType
(
2
),
Types
.
VARCHAR
);
}
@Test
public
void
getColumnTypeName
()
throws
Exception
{
assertThat
(
ac
ut
alMetaData
.
getColumnTypeName
(
1
),
is
(
""
));
assertThat
(
ac
ut
alMetaData
.
getColumnTypeName
(
2
),
is
(
""
));
assertThat
(
ac
tu
alMetaData
.
getColumnTypeName
(
1
),
is
(
""
));
assertThat
(
ac
tu
alMetaData
.
getColumnTypeName
(
2
),
is
(
""
));
}
@Test
public
void
isReadOnly
()
throws
Exception
{
assertTrue
(
ac
ut
alMetaData
.
isReadOnly
(
1
));
assertTrue
(
ac
ut
alMetaData
.
isReadOnly
(
2
));
assertTrue
(
ac
tu
alMetaData
.
isReadOnly
(
1
));
assertTrue
(
ac
tu
alMetaData
.
isReadOnly
(
2
));
}
@Test
public
void
isWritable
()
throws
Exception
{
assertFalse
(
ac
ut
alMetaData
.
isWritable
(
1
));
assertFalse
(
ac
ut
alMetaData
.
isWritable
(
2
));
assertFalse
(
ac
tu
alMetaData
.
isWritable
(
1
));
assertFalse
(
ac
tu
alMetaData
.
isWritable
(
2
));
}
@Test
public
void
isDefinitelyWritable
()
throws
Exception
{
assertFalse
(
ac
ut
alMetaData
.
isDefinitelyWritable
(
1
));
assertFalse
(
ac
ut
alMetaData
.
isDefinitelyWritable
(
2
));
assertFalse
(
ac
tu
alMetaData
.
isDefinitelyWritable
(
1
));
assertFalse
(
ac
tu
alMetaData
.
isDefinitelyWritable
(
2
));
}
@Test
public
void
getColumnClassName
()
throws
Exception
{
assertThat
(
ac
ut
alMetaData
.
getColumnClassName
(
1
),
is
(
"java.lang.Long"
));
assertThat
(
ac
ut
alMetaData
.
getColumnClassName
(
2
),
is
(
"java.lang.String"
));
assertThat
(
ac
tu
alMetaData
.
getColumnClassName
(
1
),
is
(
"java.lang.Long"
));
assertThat
(
ac
tu
alMetaData
.
getColumnClassName
(
2
),
is
(
"java.lang.String"
));
}
@Test
public
void
unwrap
()
throws
Exception
{
assertThat
(
ac
utalMetaData
.
unwrap
(
GeneratedKeysResultSetMetaData
.
class
),
is
(((
GeneratedKeysResultSetMetaData
)
acutalMetaData
)
));
assertThat
(
ac
tualMetaData
.
unwrap
(
GeneratedKeysResultSetMetaData
.
class
),
is
((
GeneratedKeysResultSetMetaData
)
actualMetaData
));
}
@Test
(
expected
=
SQLException
.
class
)
public
void
unwrapError
()
throws
Exception
{
ac
ut
alMetaData
.
unwrap
(
RowSetMetaDataImpl
.
class
);
ac
tu
alMetaData
.
unwrap
(
RowSetMetaDataImpl
.
class
);
}
@Test
public
void
isWrapperFor
()
throws
Exception
{
assertTrue
(
ac
ut
alMetaData
.
isWrapperFor
(
GeneratedKeysResultSetMetaData
.
class
));
assertTrue
(
ac
tu
alMetaData
.
isWrapperFor
(
GeneratedKeysResultSetMetaData
.
class
));
}
}
\ No newline at end of file
}
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/GeneratedKeysResultSetTest.java
浏览文件 @
aee7517f
...
...
@@ -37,11 +37,11 @@ import static org.junit.Assert.assertTrue;
public
class
GeneratedKeysResultSetTest
{
private
GeneratedKeysResultSet
actualResultSet
;
private
static
final
Statement
STATEMENT
=
Mockito
.
mock
(
Statement
.
class
)
;
private
static
final
Statement
statement
=
Mockito
.
mock
(
Statement
.
class
)
;
private
GeneratedKeysResultSet
actualResultSet
;
public
static
GeneratedKeysResultSet
createMock
()
{
static
GeneratedKeysResultSet
createMock
()
{
Map
<
String
,
Integer
>
columnMap
=
new
HashMap
<>();
columnMap
.
put
(
"order_id"
,
0
);
columnMap
.
put
(
"order_no"
,
1
);
...
...
@@ -50,7 +50,7 @@ public class GeneratedKeysResultSetTest {
valueTable
.
put
(
0
,
1
,
"OL_1"
);
valueTable
.
put
(
1
,
0
,
2L
);
valueTable
.
put
(
1
,
1
,
"OL_2"
);
return
new
GeneratedKeysResultSet
(
valueTable
,
columnMap
,
statement
);
return
new
GeneratedKeysResultSet
(
valueTable
,
columnMap
,
STATEMENT
);
}
@Before
...
...
@@ -96,18 +96,18 @@ public class GeneratedKeysResultSetTest {
@Test
public
void
getByte
()
throws
Exception
{
assertTrue
(
actualResultSet
.
next
());
assertThat
(
actualResultSet
.
getByte
(
1
),
is
((
byte
)
1L
));
assertThat
(
actualResultSet
.
getByte
(
1
),
is
((
byte
)
1L
));
assertTrue
(
actualResultSet
.
next
());
assertThat
(
actualResultSet
.
getByte
(
"order_id"
),
is
((
byte
)
2L
));
assertThat
(
actualResultSet
.
getByte
(
"order_id"
),
is
((
byte
)
2L
));
assertFalse
(
actualResultSet
.
next
());
}
@Test
public
void
getShort
()
throws
Exception
{
assertTrue
(
actualResultSet
.
next
());
assertThat
(
actualResultSet
.
getShort
(
1
),
is
((
short
)
1L
));
assertThat
(
actualResultSet
.
getShort
(
1
),
is
((
short
)
1L
));
assertTrue
(
actualResultSet
.
next
());
assertThat
(
actualResultSet
.
getShort
(
"order_id"
),
is
((
short
)
2L
));
assertThat
(
actualResultSet
.
getShort
(
"order_id"
),
is
((
short
)
2L
));
assertFalse
(
actualResultSet
.
next
());
}
...
...
@@ -170,9 +170,9 @@ public class GeneratedKeysResultSetTest {
@Test
public
void
getObject
()
throws
Exception
{
assertTrue
(
actualResultSet
.
next
());
assertThat
(
actualResultSet
.
getObject
(
2
),
is
((
Object
)
"OL_1"
));
assertThat
(
actualResultSet
.
getObject
(
2
),
is
((
Object
)
"OL_1"
));
assertTrue
(
actualResultSet
.
next
());
assertThat
(
actualResultSet
.
getObject
(
"order_no"
),
is
((
Object
)
"OL_2"
));
assertThat
(
actualResultSet
.
getObject
(
"order_no"
),
is
((
Object
)
"OL_2"
));
assertFalse
(
actualResultSet
.
next
());
}
...
...
@@ -188,7 +188,7 @@ public class GeneratedKeysResultSetTest {
@Test
public
void
getStatement
()
throws
Exception
{
assertThat
(
actualResultSet
.
getStatement
(),
is
(
statement
));
assertThat
(
actualResultSet
.
getStatement
(),
is
(
STATEMENT
));
}
}
\ No newline at end of file
}
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/ShardingConnectionTest.java
浏览文件 @
aee7517f
...
...
@@ -60,7 +60,8 @@ public class ShardingConnectionTest {
Map
<
String
,
DataSource
>
dataSourceMap
=
new
HashMap
<>(
1
);
dataSourceMap
.
put
(
DS_NAME
,
MASTER_SLAVE_DATA_SOURCE
);
DataSourceRule
dataSourceRule
=
new
DataSourceRule
(
dataSourceMap
);
ShardingRule
rule
=
new
ShardingRule
.
ShardingRuleBuilder
().
dataSourceRule
(
dataSourceRule
).
tableRules
(
Collections
.
singleton
(
new
TableRule
.
TableRuleBuilder
(
"test"
).
dataSourceRule
(
dataSourceRule
).
build
())).
build
();
ShardingRule
rule
=
new
ShardingRule
.
ShardingRuleBuilder
().
dataSourceRule
(
dataSourceRule
)
.
tableRules
(
Collections
.
singleton
(
new
TableRule
.
TableRuleBuilder
(
"test"
).
dataSourceRule
(
dataSourceRule
).
build
())).
build
();
ShardingContext
sc
=
new
ShardingContext
(
rule
,
null
,
null
);
connection
=
new
ShardingConnection
(
sc
);
}
...
...
@@ -69,7 +70,7 @@ public class ShardingConnectionTest {
public
void
clear
()
{
try
{
connection
.
close
();
}
catch
(
SQLException
ignored
)
{
}
catch
(
final
SQLException
ignored
)
{
}
}
...
...
@@ -110,4 +111,4 @@ public class ShardingConnectionTest {
connection
.
releaseBrokenConnection
(
conn
);
assertNotSame
(
conn
,
connection
.
getConnection
(
DS_NAME
,
SQLStatementType
.
UPDATE
));
}
}
\ No newline at end of file
}
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/ShardingPreparedStatementTest.java
浏览文件 @
aee7517f
...
...
@@ -281,22 +281,22 @@ public final class ShardingPreparedStatementTest extends AbstractShardingDataBas
assertEquals
(
preparedStatement
.
getGeneratedKeys
().
getLong
(
1
),
4
);
assertFalse
(
preparedStatement
.
getGeneratedKeys
().
next
());
try
(
ResultSet
rs
=
queryStatement
.
executeQuery
(
"SELECT `order_id` from `t_order` where `user_id` = 1"
))
{
try
(
ResultSet
rs
=
queryStatement
.
executeQuery
(
"SELECT `order_id` from `t_order` where `user_id` = 1"
))
{
assertThat
(
rs
.
next
(),
is
(
true
));
assertThat
(
rs
.
getInt
(
1
),
is
(
11
));
assertThat
(
rs
.
next
(),
is
(
false
));
}
try
(
ResultSet
rs
=
queryStatement
.
executeQuery
(
"SELECT `order_id` from `t_order` where `user_id` = 2"
))
{
try
(
ResultSet
rs
=
queryStatement
.
executeQuery
(
"SELECT `order_id` from `t_order` where `user_id` = 2"
))
{
assertThat
(
rs
.
next
(),
is
(
true
));
assertThat
(
rs
.
getInt
(
1
),
is
(
12
));
assertThat
(
rs
.
next
(),
is
(
false
));
}
try
(
ResultSet
rs
=
queryStatement
.
executeQuery
(
"SELECT `order_id` from `t_order` where `user_id` = 3"
))
{
try
(
ResultSet
rs
=
queryStatement
.
executeQuery
(
"SELECT `order_id` from `t_order` where `user_id` = 3"
))
{
assertThat
(
rs
.
next
(),
is
(
true
));
assertThat
(
rs
.
getInt
(
1
),
is
(
21
));
assertThat
(
rs
.
next
(),
is
(
false
));
}
try
(
ResultSet
rs
=
queryStatement
.
executeQuery
(
"SELECT `order_id` from `t_order` where `user_id` = 4"
))
{
try
(
ResultSet
rs
=
queryStatement
.
executeQuery
(
"SELECT `order_id` from `t_order` where `user_id` = 4"
))
{
assertThat
(
rs
.
next
(),
is
(
true
));
assertThat
(
rs
.
getInt
(
1
),
is
(
22
));
assertThat
(
rs
.
next
(),
is
(
false
));
...
...
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/adapter/AbstractPreparedStatementAdapterTest.java
→
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/adapter/
Parameterized
AbstractPreparedStatementAdapterTest.java
浏览文件 @
aee7517f
...
...
@@ -53,7 +53,7 @@ import static org.mockito.Mockito.CALLS_REAL_METHODS;
@RunWith
(
Parameterized
.
class
)
@RequiredArgsConstructor
public
class
AbstractPreparedStatementAdapterTest
{
public
class
Parameterized
AbstractPreparedStatementAdapterTest
{
private
final
String
methodName
;
...
...
@@ -67,8 +67,8 @@ public class AbstractPreparedStatementAdapterTest {
{
"setNull"
,
new
Class
[]{
int
.
class
,
int
.
class
},
new
Object
[]
{
1
,
Types
.
CHAR
}},
{
"setNull"
,
new
Class
[]{
int
.
class
,
int
.
class
,
String
.
class
},
new
Object
[]
{
1
,
Types
.
CHAR
,
"USER_DEFINE"
}},
{
"setBoolean"
,
new
Class
[]{
int
.
class
,
boolean
.
class
},
new
Object
[]
{
1
,
true
}},
{
"setByte"
,
new
Class
[]{
int
.
class
,
byte
.
class
},
new
Object
[]
{
1
,
(
byte
)
1
}},
{
"setShort"
,
new
Class
[]{
int
.
class
,
short
.
class
},
new
Object
[]
{
1
,
(
short
)
1
}},
{
"setByte"
,
new
Class
[]{
int
.
class
,
byte
.
class
},
new
Object
[]
{
1
,
(
byte
)
1
}},
{
"setShort"
,
new
Class
[]{
int
.
class
,
short
.
class
},
new
Object
[]
{
1
,
(
short
)
1
}},
{
"setInt"
,
new
Class
[]{
int
.
class
,
int
.
class
},
new
Object
[]
{
1
,
1
}},
{
"setLong"
,
new
Class
[]{
int
.
class
,
long
.
class
},
new
Object
[]
{
1
,
12121212332L
}},
{
"setFloat"
,
new
Class
[]{
int
.
class
,
float
.
class
},
new
Object
[]
{
1
,
1
F
}},
...
...
@@ -132,6 +132,6 @@ public class AbstractPreparedStatementAdapterTest {
assertThat
(
method
.
getParameterTypes
(),
is
(
parameterClasses
));
Field
argumentsField
=
JdbcMethodInvocation
.
class
.
getDeclaredField
(
"arguments"
);
argumentsField
.
setAccessible
(
true
);
assertThat
((
Object
[])
argumentsField
.
get
(
invocation
),
is
(
parameters
));
assertThat
((
Object
[])
argumentsField
.
get
(
invocation
),
is
(
parameters
));
}
}
\ No newline at end of file
}
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/adapter/StatementAdapterTest.java
浏览文件 @
aee7517f
...
...
@@ -167,22 +167,12 @@ public final class StatementAdapterTest extends AbstractShardingDataBasesOnlyDBU
public
ResultSet
executeQuery
(
final
String
sql
)
throws
SQLException
{
return
null
;
}
@Override
public
int
executeUpdate
(
final
String
sql
)
throws
SQLException
{
return
0
;
}
@Override
public
boolean
execute
(
final
String
sql
)
throws
SQLException
{
return
false
;
}
@Override
public
ResultSet
getResultSet
()
throws
SQLException
{
return
null
;
}
@Override
public
int
getResultSetConcurrency
()
throws
SQLException
{
return
0
;
...
...
@@ -198,6 +188,11 @@ public final class StatementAdapterTest extends AbstractShardingDataBasesOnlyDBU
return
null
;
}
@Override
public
int
executeUpdate
(
final
String
sql
)
throws
SQLException
{
return
0
;
}
@Override
public
int
executeUpdate
(
final
String
sql
,
final
int
autoGeneratedKeys
)
throws
SQLException
{
return
0
;
...
...
@@ -213,6 +208,11 @@ public final class StatementAdapterTest extends AbstractShardingDataBasesOnlyDBU
return
0
;
}
@Override
public
boolean
execute
(
final
String
sql
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
execute
(
final
String
sql
,
final
int
autoGeneratedKeys
)
throws
SQLException
{
return
false
;
...
...
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/unsupported/
Abstract
UnsupportedGeneratedKeysResultSetTest.java
→
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/unsupported/UnsupportedGeneratedKeysResultSetTest.java
浏览文件 @
aee7517f
...
...
@@ -23,7 +23,7 @@ import org.junit.Test;
import
java.sql.SQLFeatureNotSupportedException
;
import
java.util.HashMap
;
public
class
Abstract
UnsupportedGeneratedKeysResultSetTest
{
public
class
UnsupportedGeneratedKeysResultSetTest
{
@Test
(
expected
=
SQLFeatureNotSupportedException
.
class
)
public
void
getBoolean
()
throws
Exception
{
...
...
@@ -215,4 +215,4 @@ public class AbstractUnsupportedGeneratedKeysResultSetTest {
new
GeneratedKeysResultSet
().
getSQLXML
(
""
);
}
}
\ No newline at end of file
}
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/sharding/jdbc/util/ParameterListTest.java
浏览文件 @
aee7517f
...
...
@@ -28,7 +28,7 @@ public class ParameterListTest {
@Test
(
expected
=
ShardingJdbcException
.
class
)
public
void
recordMethodInvocation
()
throws
Exception
{
ParameterList
list
=
new
ParameterList
(
PreparedStatement
.
class
);
list
.
recordMethodInvocation
(
1
,
"noThatMethod"
,
null
,
null
);
list
.
recordMethodInvocation
(
1
,
"noThatMethod"
,
null
,
null
);
}
}
\ No newline at end of file
}
sharding-jdbc-doc/content/post/id-generator.md
浏览文件 @
aee7517f
...
...
@@ -80,7 +80,7 @@ TableRule.builder("t_order_item").autoIncrementColumns("order_item_id", com.x.x.
## 时间位(41bit)
从2016年11月1日零点到现在的毫秒数
从2016年11月1日零点到现在的毫秒数
,时间可以使用到2156年,满足大部分系统的要求。
## 工作进程位(10bit)
...
...
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/main/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/CommonSelfIdGenerator.java
浏览文件 @
aee7517f
...
...
@@ -44,7 +44,7 @@ import java.util.Date;
* 工作进程Id获取优先级: 系统变量{@code sjdbc.self.id.generator.worker.id} > 环境变量{@code SJDBC_SELF_ID_GENERATOR_WORKER_ID}
* ,另外可以调用@{@code CommonSelfIdGenerator.setWorkerId}进行设置
*
* @author gaohongtao
.
* @author gaohongtao
*/
@Getter
@Slf4j
...
...
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/AbstractWorkerIdTest.java
浏览文件 @
aee7517f
...
...
@@ -47,7 +47,7 @@ public abstract class AbstractWorkerIdTest {
CommonSelfIdGenerator
idGenerator
=
new
CommonSelfIdGenerator
();
idGenerator
.
initContext
(
"order"
,
"id"
);
assertThat
((
Long
)
idGenerator
.
generateId
(),
is
(
getWorkerId
()
<<
12L
));
assertThat
((
Long
)
idGenerator
.
generateId
(),
is
(
getWorkerId
()
<<
12L
));
assertThat
(
idGenerator
.
getTableName
(),
is
(
"order"
));
assertThat
(
idGenerator
.
getColumnName
(),
is
(
"id"
));
assertThat
(
idGenerator
.
getLastTime
(),
is
(
CommonSelfIdGenerator
.
SJDBC_EPOCH
));
...
...
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/AllTest.java
浏览文件 @
aee7517f
...
...
@@ -25,7 +25,7 @@ import org.junit.runners.Suite;
ApiWorkerIdTest
.
class
,
SystemPropertyWorkerIdTest
.
class
,
SystemEnvWorkerIdTest
.
class
,
CommonSelfIdGeneratorTest
.
class
,
})
CommonSelfIdGeneratorTest
.
class
})
public
class
AllTest
{
}
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/ApiWorkerIdTest.java
浏览文件 @
aee7517f
...
...
@@ -19,7 +19,7 @@ package com.dangdang.ddframe.rdb.sharding.id.generator.self;
import
org.junit.Before
;
public
class
ApiWorkerIdTest
extends
AbstractWorkerIdTest
{
public
class
ApiWorkerIdTest
extends
AbstractWorkerIdTest
{
@Before
public
void
init
()
{
...
...
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/CommonSelfIdGeneratorTest.java
浏览文件 @
aee7517f
...
...
@@ -63,7 +63,7 @@ public class CommonSelfIdGeneratorTest {
assertThat
(
maxId
((
1
<<
12
)
-
1
),
is
((
1L
<<
12L
)
-
2
));
assertThat
(
maxId
(
1
<<
12
),
is
((
1L
<<
12L
)
-
1
));
assertThat
(
maxId
((
1
<<
12
)
+
1
),
is
((
1L
<<
12L
)
-
1
));
assertThat
(
maxId
(
(
1
<<
13
)
),
is
((
1L
<<
12L
)
-
1
));
assertThat
(
maxId
(
1
<<
13
),
is
((
1L
<<
12L
)
-
1
));
assertThat
(
maxId
((
1
<<
13
)
+
1
),
is
((
1L
<<
12L
)
-
1
));
}
...
...
@@ -78,4 +78,4 @@ public class CommonSelfIdGeneratorTest {
}
return
preId
;
}
}
\ No newline at end of file
}
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/SystemEnvWorkerIdTest.java
浏览文件 @
aee7517f
...
...
@@ -21,14 +21,14 @@ import org.junit.Before;
import
org.junit.Rule
;
import
org.junit.contrib.java.lang.system.EnvironmentVariables
;
public
class
SystemEnvWorkerIdTest
extends
AbstractWorkerIdTest
{
public
class
SystemEnvWorkerIdTest
extends
AbstractWorkerIdTest
{
@Rule
public
final
EnvironmentVariables
ENVIRONMENT_VARIABLES
=
new
EnvironmentVariables
();
public
final
EnvironmentVariables
environmentVariables
=
new
EnvironmentVariables
();
@Before
public
void
setup
()
{
ENVIRONMENT_VARIABLES
.
set
(
"SJDBC_SELF_ID_GENERATOR_WORKER_ID"
,
"13"
);
environmentVariables
.
set
(
"SJDBC_SELF_ID_GENERATOR_WORKER_ID"
,
"13"
);
super
.
setup
();
}
...
...
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/SystemPropertyWorkerIdTest.java
浏览文件 @
aee7517f
...
...
@@ -20,10 +20,10 @@ package com.dangdang.ddframe.rdb.sharding.id.generator.self;
import
org.junit.Rule
;
import
org.junit.contrib.java.lang.system.ProvideSystemProperty
;
public
class
SystemPropertyWorkerIdTest
extends
AbstractWorkerIdTest
{
public
class
SystemPropertyWorkerIdTest
extends
AbstractWorkerIdTest
{
@Rule
public
final
ProvideSystemProperty
PROVIDE_SYSTEM_PROPERTY
=
new
ProvideSystemProperty
(
"sjdbc.self.id.generator.worker.id"
,
"12"
);
public
final
ProvideSystemProperty
provideSystemProperty
=
new
ProvideSystemProperty
(
"sjdbc.self.id.generator.worker.id"
,
"12"
);
@Override
protected
long
getWorkerId
()
{
...
...
sharding-jdbc-id-generator-parent/sharding-jdbc-self-id-generator/src/test/java/com/dangdang/ddframe/rdb/sharding/id/generator/self/fixture/FixClock.java
浏览文件 @
aee7517f
...
...
@@ -24,7 +24,7 @@ import lombok.RequiredArgsConstructor;
import
java.util.concurrent.atomic.AtomicInteger
;
@RequiredArgsConstructor
public
class
FixClock
extends
AbstractClock
{
public
class
FixClock
extends
AbstractClock
{
private
final
int
expectedInvokedTimes
;
...
...
sharding-jdbc-transaction-parent/sharding-jdbc-transaction/src/main/java/com/dangdang/ddframe/rdb/transaction/soft/bed/async/AbstractBestEffortsDeliveryJobFactory.java
浏览文件 @
aee7517f
...
...
@@ -51,7 +51,7 @@ public abstract class AbstractBestEffortsDeliveryJobFactory<T extends AbstractBe
jobScheduler
.
init
();
}
protected
abstract
ZookeeperConfiguration
createZookeeperConfiguration
(
final
T
config
);
protected
abstract
ZookeeperConfiguration
createZookeeperConfiguration
(
T
config
);
private
JobConfiguration
createBedJobConfiguration
(
final
T
bedJobConfig
)
{
JobConfiguration
result
=
new
JobConfiguration
(
bedJobConfig
.
getJobName
(),
NestedBestEffortsDeliveryJob
.
class
,
1
,
bedJobConfig
.
getCron
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录