Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
a5b3e9c6
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
a5b3e9c6
编写于
12月 19, 2018
作者:
ShardingSphere
提交者:
GitHub
12月 19, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1650 from cherrylzhao/dev
Refactor DatasourceConfiguration & DataSourceParamter
上级
af3ee22c
4c9c075d
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
53 addition
and
79 deletion
+53
-79
sharding-core/src/main/java/io/shardingsphere/core/config/DataSourceConfiguration.java
...o/shardingsphere/core/config/DataSourceConfiguration.java
+19
-20
sharding-core/src/main/java/io/shardingsphere/core/constant/PoolType.java
...c/main/java/io/shardingsphere/core/constant/PoolType.java
+2
-0
sharding-core/src/main/java/io/shardingsphere/core/constant/transaction/ProxyPoolType.java
...ardingsphere/core/constant/transaction/ProxyPoolType.java
+0
-28
sharding-core/src/main/java/io/shardingsphere/core/rule/DataSourceParameter.java
...java/io/shardingsphere/core/rule/DataSourceParameter.java
+0
-7
sharding-core/src/test/java/io/shardingsphere/core/config/DataSourceConfigurationTest.java
...ardingsphere/core/config/DataSourceConfigurationTest.java
+2
-2
sharding-orchestration/sharding-orchestration-core/src/test/java/io/shardingsphere/orchestration/internal/registry/config/listener/DataSourceChangedListenerTest.java
...gistry/config/listener/DataSourceChangedListenerTest.java
+1
-2
sharding-orchestration/sharding-orchestration-core/src/test/java/io/shardingsphere/orchestration/yaml/ConfigurationYamlConverterTest.java
...re/orchestration/yaml/ConfigurationYamlConverterTest.java
+3
-4
sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/datasource/JDBCRawBackendDataSourceFactory.java
...kend/jdbc/datasource/JDBCRawBackendDataSourceFactory.java
+0
-1
sharding-proxy/src/main/resources/conf/config-master_slave.yaml
...ng-proxy/src/main/resources/conf/config-master_slave.yaml
+0
-3
sharding-proxy/src/main/resources/conf/config-sharding.yaml
sharding-proxy/src/main/resources/conf/config-sharding.yaml
+0
-2
sharding-proxy/src/test/java/io/shardingsphere/shardingproxy/config/ShardingConfigurationLoaderTest.java
...shardingproxy/config/ShardingConfigurationLoaderTest.java
+0
-1
sharding-proxy/src/test/java/io/shardingsphere/shardingproxy/util/DataSourceConverterTest.java
...ingsphere/shardingproxy/util/DataSourceConverterTest.java
+26
-2
sharding-proxy/src/test/resources/conf/config-master_slave.yaml
...ng-proxy/src/test/resources/conf/config-master_slave.yaml
+0
-3
sharding-proxy/src/test/resources/conf/config-sharding.yaml
sharding-proxy/src/test/resources/conf/config-sharding.yaml
+0
-2
sharding-transaction/sharding-transaction-2pc/sharding-transaction-2pc-xa/src/test/java/io/shardingsphere/transaction/xa/manager/AtomikosDataSourceBeanWrapperTest.java
...saction/xa/manager/AtomikosDataSourceBeanWrapperTest.java
+0
-2
未找到文件。
sharding-core/src/main/java/io/shardingsphere/core/config/DataSourceConfiguration.java
浏览文件 @
a5b3e9c6
...
...
@@ -21,6 +21,7 @@ import com.google.common.base.CaseFormat;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Optional
;
import
com.google.common.collect.Sets
;
import
io.shardingsphere.core.constant.PoolType
;
import
io.shardingsphere.core.exception.ShardingConfigurationException
;
import
io.shardingsphere.core.rule.DataSourceParameter
;
import
lombok.Getter
;
...
...
@@ -69,19 +70,8 @@ public final class DataSourceConfiguration {
* @return data source configuration
*/
public
static
DataSourceConfiguration
getDataSourceConfiguration
(
final
DataSource
dataSource
)
{
Map
<
String
,
Object
>
properties
=
new
LinkedHashMap
<>();
try
{
for
(
Method
each
:
findAllGetterMethods
(
dataSource
))
{
String
propertyName
=
CaseFormat
.
UPPER_CAMEL
.
to
(
CaseFormat
.
LOWER_CAMEL
,
each
.
getName
().
substring
(
GETTER_PREFIX
.
length
()));
if
(
GENERAL_CLASS_TYPE
.
contains
(
each
.
getReturnType
())
&&
!
SKIPPED_PROPERTY_NAMES
.
contains
(
propertyName
))
{
properties
.
put
(
propertyName
,
each
.
invoke
(
dataSource
));
}
}
}
catch
(
final
ReflectiveOperationException
ex
)
{
throw
new
ShardingConfigurationException
(
ex
);
}
DataSourceConfiguration
result
=
new
DataSourceConfiguration
(
dataSource
.
getClass
().
getName
());
result
.
getProperties
().
putAll
(
properties
);
result
.
getProperties
().
putAll
(
findAllGetterProperties
(
dataSource
)
);
return
result
;
}
...
...
@@ -92,20 +82,29 @@ public final class DataSourceConfiguration {
* @return data source configuration
*/
public
static
DataSourceConfiguration
getDataSourceConfiguration
(
final
DataSourceParameter
dataSourceParameter
)
{
DataSourceConfiguration
result
=
new
DataSourceConfiguration
(
DataSourceParameter
.
DATA_SOURCE_POOL_CLASS_NAME
);
for
(
Field
each
:
dataSourceParameter
.
getClass
().
getDeclaredFields
())
{
try
{
each
.
setAccessible
(
true
);
result
.
getProperties
().
put
(
each
.
getName
(),
each
.
get
(
dataSourceParameter
));
}
catch
(
final
ReflectiveOperationException
ignored
)
{
DataSourceConfiguration
result
=
new
DataSourceConfiguration
(
PoolType
.
HIKARI
.
getClassName
());
result
.
getProperties
().
putAll
(
findAllGetterProperties
(
dataSourceParameter
));
return
result
;
}
private
static
Map
<
String
,
Object
>
findAllGetterProperties
(
final
Object
target
)
{
Map
<
String
,
Object
>
result
=
new
LinkedHashMap
<>();
try
{
for
(
Method
each
:
findAllGetterMethods
(
target
.
getClass
()))
{
String
propertyName
=
CaseFormat
.
UPPER_CAMEL
.
to
(
CaseFormat
.
LOWER_CAMEL
,
each
.
getName
().
substring
(
GETTER_PREFIX
.
length
()));
if
(
GENERAL_CLASS_TYPE
.
contains
(
each
.
getReturnType
())
&&
!
SKIPPED_PROPERTY_NAMES
.
contains
(
propertyName
))
{
result
.
put
(
propertyName
,
each
.
invoke
(
target
));
}
}
}
catch
(
final
ReflectiveOperationException
ex
)
{
throw
new
ShardingConfigurationException
(
ex
);
}
return
result
;
}
private
static
Collection
<
Method
>
findAllGetterMethods
(
final
DataSource
dataSource
)
{
private
static
Collection
<
Method
>
findAllGetterMethods
(
final
Class
<?>
clz
)
{
Collection
<
Method
>
result
=
new
HashSet
<>();
for
(
Method
each
:
dataSource
.
getClass
()
.
getMethods
())
{
for
(
Method
each
:
clz
.
getMethods
())
{
if
(
each
.
getName
().
startsWith
(
GETTER_PREFIX
)
&&
0
==
each
.
getParameterTypes
().
length
)
{
result
.
add
(
each
);
}
...
...
sharding-core/src/main/java/io/shardingsphere/core/constant/PoolType.java
浏览文件 @
a5b3e9c6
...
...
@@ -17,6 +17,7 @@
package
io.shardingsphere.core.constant
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
/**
...
...
@@ -25,6 +26,7 @@ import lombok.RequiredArgsConstructor;
* @author zhaojun
*/
@RequiredArgsConstructor
@Getter
public
enum
PoolType
{
HIKARI
(
"com.zaxxer.hikari.HikariDataSource"
),
...
...
sharding-core/src/main/java/io/shardingsphere/core/constant/transaction/ProxyPoolType.java
已删除
100644 → 0
浏览文件 @
af3ee22c
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package
io.shardingsphere.core.constant.transaction
;
/**
* Proxy datasource type which support XA transaction manager.
*
* @author zhaojun
*/
public
enum
ProxyPoolType
{
VENDOR
,
TOMCAT_DBCP2
}
sharding-core/src/main/java/io/shardingsphere/core/rule/DataSourceParameter.java
浏览文件 @
a5b3e9c6
...
...
@@ -17,7 +17,6 @@
package
io.shardingsphere.core.rule
;
import
io.shardingsphere.core.constant.transaction.ProxyPoolType
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
@@ -30,8 +29,6 @@ import lombok.Setter;
@Setter
public
final
class
DataSourceParameter
{
public
static
final
String
DATA_SOURCE_POOL_CLASS_NAME
=
"com.zaxxer.hikari.HikariDataSource"
;
private
static
final
long
DEFAULT_CONNECTION_TIMEOUT_MILLISECONDS
=
30
*
1000
;
private
static
final
long
DEFAULT_IDLE_TIMEOUT_MILLISECONDS
=
60
*
1000
;
...
...
@@ -44,16 +41,12 @@ public final class DataSourceParameter {
private
static
final
int
DEFAULT_MIN_POOL_SIZE
=
1
;
private
ProxyPoolType
proxyDatasourceType
=
ProxyPoolType
.
VENDOR
;
private
String
url
;
private
String
username
;
private
String
password
;
private
boolean
autoCommit
;
private
long
connectionTimeoutMilliseconds
=
DEFAULT_CONNECTION_TIMEOUT_MILLISECONDS
;
private
long
idleTimeoutMilliseconds
=
DEFAULT_IDLE_TIMEOUT_MILLISECONDS
;
...
...
sharding-core/src/test/java/io/shardingsphere/core/config/DataSourceConfigurationTest.java
浏览文件 @
a5b3e9c6
...
...
@@ -18,7 +18,7 @@
package
io.shardingsphere.core.config
;
import
com.zaxxer.hikari.HikariDataSource
;
import
io.shardingsphere.core.
rule.DataSourceParameter
;
import
io.shardingsphere.core.
constant.PoolType
;
import
org.junit.Test
;
import
java.sql.SQLException
;
...
...
@@ -55,7 +55,7 @@ public final class DataSourceConfigurationTest {
properties
.
put
(
"jdbcUrl"
,
"jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL"
);
properties
.
put
(
"username"
,
"root"
);
properties
.
put
(
"password"
,
"root"
);
DataSourceConfiguration
dataSourceConfig
=
new
DataSourceConfiguration
(
DataSourceParameter
.
DATA_SOURCE_POOL_CLASS_NAME
);
DataSourceConfiguration
dataSourceConfig
=
new
DataSourceConfiguration
(
PoolType
.
HIKARI
.
getClassName
()
);
dataSourceConfig
.
getProperties
().
putAll
(
properties
);
HikariDataSource
actual
=
(
HikariDataSource
)
dataSourceConfig
.
createDataSource
();
assertThat
(
actual
.
getDriverClassName
(),
is
(
"org.h2.Driver"
));
...
...
sharding-orchestration/sharding-orchestration-core/src/test/java/io/shardingsphere/orchestration/internal/registry/config/listener/DataSourceChangedListenerTest.java
浏览文件 @
a5b3e9c6
...
...
@@ -34,8 +34,7 @@ import static org.junit.Assert.assertThat;
public
final
class
DataSourceChangedListenerTest
{
private
static
final
String
DATA_SOURCE_YAML
=
"master_ds: !!io.shardingsphere.orchestration.yaml.YamlDataSourceConfiguration\n"
+
" dataSourceClassName: com.zaxxer.hikari.HikariDataSource\n"
+
" properties:\n"
+
" DATA_SOURCE_POOL_CLASS_NAME: com.zaxxer.hikari.HikariDataSource\n"
+
" proxyDatasourceType: !!io.shardingsphere.core.constant.transaction.ProxyPoolType 'VENDOR'\n"
+
" dataSourceClassName: com.zaxxer.hikari.HikariDataSource\n"
+
" properties:\n"
+
" url: jdbc:mysql://localhost:3306/demo_ds_master\n"
+
" username: root\n"
+
" password: null\n"
;
private
DataSourceChangedListener
dataSourceChangedListener
;
...
...
sharding-orchestration/sharding-orchestration-core/src/test/java/io/shardingsphere/orchestration/yaml/ConfigurationYamlConverterTest.java
浏览文件 @
a5b3e9c6
...
...
@@ -23,8 +23,8 @@ import io.shardingsphere.api.config.rule.ShardingRuleConfiguration;
import
io.shardingsphere.api.config.rule.TableRuleConfiguration
;
import
io.shardingsphere.api.config.strategy.InlineShardingStrategyConfiguration
;
import
io.shardingsphere.core.config.DataSourceConfiguration
;
import
io.shardingsphere.core.constant.PoolType
;
import
io.shardingsphere.core.rule.Authentication
;
import
io.shardingsphere.core.rule.DataSourceParameter
;
import
org.junit.Test
;
import
java.util.Collections
;
...
...
@@ -40,8 +40,7 @@ import static org.junit.Assert.assertTrue;
public
class
ConfigurationYamlConverterTest
{
private
static
final
String
DATA_SOURCE_YAML
=
"master_ds: !!io.shardingsphere.orchestration.yaml.YamlDataSourceConfiguration\n"
+
" dataSourceClassName: com.zaxxer.hikari.HikariDataSource\n"
+
" properties:\n"
+
" DATA_SOURCE_POOL_CLASS_NAME: com.zaxxer.hikari.HikariDataSource\n"
+
" proxyDatasourceType: !!io.shardingsphere.core.constant.transaction.ProxyPoolType 'VENDOR'\n"
+
" dataSourceClassName: com.zaxxer.hikari.HikariDataSource\n"
+
" properties:\n"
+
" url: jdbc:mysql://localhost:3306/demo_ds_master\n"
+
" username: root\n"
+
" password: null\n"
;
private
static
final
String
SHARDING_RULE_YAML
=
" tables:\n"
+
" t_order:\n"
+
" actualDataNodes: ds_${0..1}.t_order_${0..1}\n"
+
" tableStrategy:\n"
...
...
@@ -114,7 +113,7 @@ public class ConfigurationYamlConverterTest {
properties
.
put
(
"jdbcUrl"
,
"jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL"
);
properties
.
put
(
"username"
,
"root"
);
properties
.
put
(
"password"
,
"root"
);
DataSourceConfiguration
result
=
new
DataSourceConfiguration
(
DataSourceParameter
.
DATA_SOURCE_POOL_CLASS_NAME
);
DataSourceConfiguration
result
=
new
DataSourceConfiguration
(
PoolType
.
DRUID
.
getClassName
()
);
result
.
getProperties
().
putAll
(
properties
);
return
Collections
.
singletonMap
(
"test"
,
result
);
}
...
...
sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/datasource/JDBCRawBackendDataSourceFactory.java
浏览文件 @
a5b3e9c6
...
...
@@ -57,7 +57,6 @@ public final class JDBCRawBackendDataSourceFactory implements JDBCBackendDataSou
config
.
setJdbcUrl
(
dataSourceParameter
.
getUrl
());
config
.
setUsername
(
dataSourceParameter
.
getUsername
());
config
.
setPassword
(
dataSourceParameter
.
getPassword
());
config
.
setAutoCommit
(
dataSourceParameter
.
isAutoCommit
());
config
.
setConnectionTimeout
(
dataSourceParameter
.
getConnectionTimeoutMilliseconds
());
config
.
setIdleTimeout
(
dataSourceParameter
.
getIdleTimeoutMilliseconds
());
config
.
setMaxLifetime
(
dataSourceParameter
.
getMaxLifetimeMilliseconds
());
...
...
sharding-proxy/src/main/resources/conf/config-master_slave.yaml
浏览文件 @
a5b3e9c6
...
...
@@ -15,7 +15,6 @@
# url: jdbc:mysql://127.0.0.1:3306/demo_ds_master?serverTimezone=UTC&useSSL=false
# username: root
# password:
# autoCommit: true
# connectionTimeoutMilliseconds: 30000
# idleTimeoutMilliseconds: 60000
# maxLifetimeMilliseconds: 1800000
...
...
@@ -24,7 +23,6 @@
# url: jdbc:mysql://127.0.0.1:3306/demo_ds_slave_0?serverTimezone=UTC&useSSL=false
# username: root
# password:
# autoCommit: true
# connectionTimeoutMilliseconds: 30000
# idleTimeoutMilliseconds: 60000
# maxLifetimeMilliseconds: 1800000
...
...
@@ -33,7 +31,6 @@
# url: jdbc:mysql://127.0.0.1:3306/demo_ds_slave_1?serverTimezone=UTC&useSSL=false
# username: root
# password:
# autoCommit: true
# connectionTimeoutMilliseconds: 30000
# idleTimeoutMilliseconds: 60000
# maxLifetimeMilliseconds: 1800000
...
...
sharding-proxy/src/main/resources/conf/config-sharding.yaml
浏览文件 @
a5b3e9c6
...
...
@@ -15,7 +15,6 @@
# url: jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
# username: root
# password:
# autoCommit: true
# connectionTimeoutMilliseconds: 30000
# idleTimeoutMilliseconds: 60000
# maxLifetimeMilliseconds: 1800000
...
...
@@ -24,7 +23,6 @@
# url: jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
# username: root
# password:
# autoCommit: true
# connectionTimeoutMilliseconds: 30000
# idleTimeoutMilliseconds: 60000
# maxLifetimeMilliseconds: 1800000
...
...
sharding-proxy/src/test/java/io/shardingsphere/shardingproxy/config/ShardingConfigurationLoaderTest.java
浏览文件 @
a5b3e9c6
...
...
@@ -91,7 +91,6 @@ public final class ShardingConfigurationLoaderTest {
assertThat
(
actual
.
getUrl
(),
is
(
expectedURL
));
assertThat
(
actual
.
getUsername
(),
is
(
"root"
));
assertNull
(
actual
.
getPassword
());
assertTrue
(
actual
.
isAutoCommit
());
assertThat
(
actual
.
getConnectionTimeoutMilliseconds
(),
is
(
30000L
));
assertThat
(
actual
.
getIdleTimeoutMilliseconds
(),
is
(
60000L
));
assertThat
(
actual
.
getMaxLifetimeMilliseconds
(),
is
(
1800000L
));
...
...
sharding-proxy/src/test/java/io/shardingsphere/shardingproxy/util/DataSourceConverterTest.java
浏览文件 @
a5b3e9c6
...
...
@@ -19,6 +19,7 @@ package io.shardingsphere.shardingproxy.util;
import
io.shardingsphere.core.config.DataSourceConfiguration
;
import
io.shardingsphere.core.rule.DataSourceParameter
;
import
org.hamcrest.CoreMatchers
;
import
org.junit.Test
;
import
java.util.HashMap
;
...
...
@@ -52,11 +53,34 @@ public final class DataSourceConverterTest {
@Test
public
void
assertGetDataSourceConfigurationMap
()
{
Map
<
String
,
DataSourceParameter
>
dataSourceParameterMap
=
new
HashMap
<>(
2
,
1
);
dataSourceParameterMap
.
put
(
"ds_0"
,
new
DataSourceParameter
());
dataSourceParameterMap
.
put
(
"ds_1"
,
new
DataSourceParameter
());
dataSourceParameterMap
.
put
(
"ds_0"
,
crate
DataSourceParameter
());
dataSourceParameterMap
.
put
(
"ds_1"
,
crate
DataSourceParameter
());
Map
<
String
,
DataSourceConfiguration
>
actual
=
DataSourceConverter
.
getDataSourceConfigurationMap
(
dataSourceParameterMap
);
assertThat
(
actual
.
size
(),
is
(
2
));
assertNotNull
(
actual
.
get
(
"ds_0"
));
assertNotNull
(
actual
.
get
(
"ds_1"
));
assertThatParameter
(
actual
.
get
(
"ds_0"
));
assertThatParameter
(
actual
.
get
(
"ds_1"
));
}
private
DataSourceParameter
crateDataSourceParameter
()
{
DataSourceParameter
result
=
new
DataSourceParameter
();
result
.
setUsername
(
"root"
);
result
.
setUrl
(
"jdbc:mysql://localhost:3306/demo_ds"
);
result
.
setPassword
(
"root"
);
return
result
;
}
private
void
assertThatParameter
(
final
DataSourceConfiguration
actual
)
{
Map
<
String
,
Object
>
properties
=
actual
.
getProperties
();
assertThat
(
properties
.
get
(
"maxPoolSize"
),
CoreMatchers
.<
Object
>
is
(
50
));
assertThat
(
properties
.
get
(
"minPoolSize"
),
CoreMatchers
.<
Object
>
is
(
1
));
assertThat
(
properties
.
get
(
"connectionTimeoutMilliseconds"
),
CoreMatchers
.<
Object
>
is
(
30
*
1000L
));
assertThat
(
properties
.
get
(
"idleTimeoutMilliseconds"
),
CoreMatchers
.<
Object
>
is
(
60
*
1000L
));
assertThat
(
properties
.
get
(
"maxLifetimeMilliseconds"
),
CoreMatchers
.<
Object
>
is
(
0L
));
assertThat
(
properties
.
get
(
"maintenanceIntervalMilliseconds"
),
CoreMatchers
.<
Object
>
is
(
30
*
1000L
));
assertThat
(
properties
.
get
(
"url"
),
CoreMatchers
.<
Object
>
is
(
"jdbc:mysql://localhost:3306/demo_ds"
));
assertThat
(
properties
.
get
(
"username"
),
CoreMatchers
.<
Object
>
is
(
"root"
));
assertThat
(
properties
.
get
(
"password"
),
CoreMatchers
.<
Object
>
is
(
"root"
));
}
}
sharding-proxy/src/test/resources/conf/config-master_slave.yaml
浏览文件 @
a5b3e9c6
...
...
@@ -5,7 +5,6 @@ dataSources:
url
:
jdbc:mysql://127.0.0.1:3306/master_ds
username
:
root
password
:
autoCommit
:
true
connectionTimeoutMilliseconds
:
30000
idleTimeoutMilliseconds
:
60000
maxLifetimeMilliseconds
:
1800000
...
...
@@ -14,7 +13,6 @@ dataSources:
url
:
jdbc:mysql://127.0.0.1:3306/slave_ds_0
username
:
root
password
:
autoCommit
:
true
connectionTimeoutMilliseconds
:
30000
idleTimeoutMilliseconds
:
60000
maxLifetimeMilliseconds
:
1800000
...
...
@@ -23,7 +21,6 @@ dataSources:
url
:
jdbc:mysql://127.0.0.1:3306/slave_ds_1
username
:
root
password
:
autoCommit
:
true
connectionTimeoutMilliseconds
:
30000
idleTimeoutMilliseconds
:
60000
maxLifetimeMilliseconds
:
1800000
...
...
sharding-proxy/src/test/resources/conf/config-sharding.yaml
浏览文件 @
a5b3e9c6
...
...
@@ -5,7 +5,6 @@ dataSources:
url
:
jdbc:mysql://127.0.0.1:3306/ds_0
username
:
root
password
:
autoCommit
:
true
connectionTimeoutMilliseconds
:
30000
idleTimeoutMilliseconds
:
60000
maxLifetimeMilliseconds
:
1800000
...
...
@@ -14,7 +13,6 @@ dataSources:
url
:
jdbc:mysql://127.0.0.1:3306/ds_1
username
:
root
password
:
autoCommit
:
true
connectionTimeoutMilliseconds
:
30000
idleTimeoutMilliseconds
:
60000
maxLifetimeMilliseconds
:
1800000
...
...
sharding-transaction/sharding-transaction-2pc/sharding-transaction-2pc-xa/src/test/java/io/shardingsphere/transaction/xa/manager/AtomikosDataSourceBeanWrapperTest.java
浏览文件 @
a5b3e9c6
...
...
@@ -20,7 +20,6 @@ package io.shardingsphere.transaction.xa.manager;
import
com.atomikos.beans.PropertyException
;
import
com.atomikos.jdbc.AtomikosDataSourceBean
;
import
io.shardingsphere.core.constant.DatabaseType
;
import
io.shardingsphere.core.constant.transaction.ProxyPoolType
;
import
io.shardingsphere.core.rule.DataSourceParameter
;
import
io.shardingsphere.transaction.xa.convert.dialect.XADataSourceFactory
;
import
io.shardingsphere.transaction.xa.convert.dialect.XADatabaseType
;
...
...
@@ -51,7 +50,6 @@ public class AtomikosDataSourceBeanWrapperTest {
@Test
public
void
assertWrapToAtomikosDataSourceBean
()
throws
PropertyException
{
AtomikosDataSourceBeanWrapper
atomikosDataSourceBeanWrapper
=
new
AtomikosDataSourceBeanWrapper
();
parameter
.
setProxyDatasourceType
(
ProxyPoolType
.
VENDOR
);
AtomikosDataSourceBean
targetDataSource
=
(
AtomikosDataSourceBean
)
atomikosDataSourceBeanWrapper
.
wrap
(
xaDataSource
,
"ds1"
,
parameter
);
assertThat
(
targetDataSource
,
Matchers
.
instanceOf
(
AtomikosDataSourceBean
.
class
));
assertThat
(
targetDataSource
.
getXaDataSource
(),
is
(
xaDataSource
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录