This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 5ef1c5cc6d0 Fix exception in AlterTransactionRuleHandlerTest (#18992)
5ef1c5cc6d0 is described below
commit 5ef1c5cc6d0d8e64308b36bb81c2f3645745a2c7
Author: 吴伟杰 <[email protected]>
AuthorDate: Sun Jul 10 15:32:23 2022 +0800
Fix exception in AlterTransactionRuleHandlerTest (#18992)
---
.../common/updatable/AlterTransactionRuleHandlerTest.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterTransactionRuleHandlerTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterTransactionRuleHandlerTest.java
index 664c7ef93c3..25b4da2682f 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterTransactionRuleHandlerTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterTransactionRuleHandlerTest.java
@@ -42,7 +42,9 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import java.util.Collections;
+import java.util.HashMap;
import java.util.LinkedList;
+import java.util.Map;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
@@ -66,13 +68,13 @@ public final class AlterTransactionRuleHandlerTest extends
ProxyContextRestorer
}
private ShardingSphereMetaData createMetaData() {
- ShardingSphereRuleMetaData ruleMetaData = new
ShardingSphereRuleMetaData(new
LinkedList<>(Collections.singleton(createTransactionRule())));
- return new ShardingSphereMetaData(Collections.singletonMap("foo_db",
mockDatabase()), ruleMetaData, new ConfigurationProperties(new Properties()));
+ Map<String, ShardingSphereDatabase> databases = new
HashMap<>(Collections.singletonMap("foo_db", mockDatabase()));
+ ShardingSphereRuleMetaData ruleMetaData = new
ShardingSphereRuleMetaData(new
LinkedList<>(Collections.singleton(createTransactionRule(databases))));
+ return new ShardingSphereMetaData(databases, ruleMetaData, new
ConfigurationProperties(new Properties()));
}
- private TransactionRule createTransactionRule() {
- TransactionRule result = new TransactionRule(new
TransactionRuleConfiguration("LOCAL", null, new Properties()),
Collections.emptyMap(), mock(InstanceContext.class));
- return result;
+ private TransactionRule createTransactionRule(final Map<String,
ShardingSphereDatabase> databases) {
+ return new TransactionRule(new TransactionRuleConfiguration("LOCAL",
null, new Properties()), databases, mock(InstanceContext.class));
}
private ShardingSphereDatabase mockDatabase() {