You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/05/28 07:06:04 UTC
[shardingsphere] branch master updated: Remove useless empty constructor of TransactionContexts (#18024)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 22417320903 Remove useless empty constructor of TransactionContexts (#18024)
22417320903 is described below
commit 224173209031a086964b46b0d3d718f312345d05
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat May 28 15:05:58 2022 +0800
Remove useless empty constructor of TransactionContexts (#18024)
---
.../shardingsphere/transaction/context/TransactionContexts.java | 5 -----
.../transaction/context/TransactionContextsTest.java | 8 --------
.../proxy/backend/context/BackendExecutorContextTest.java | 2 --
3 files changed, 15 deletions(-)
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/context/TransactionContexts.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/context/TransactionContexts.java
index 5b212892e13..3b45fdbe8d8 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/context/TransactionContexts.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/context/TransactionContexts.java
@@ -22,7 +22,6 @@ import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.transaction.ShardingSphereTransactionManagerEngine;
import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
/**
* Transaction contexts.
@@ -33,10 +32,6 @@ public final class TransactionContexts implements AutoCloseable {
private final Map<String, ShardingSphereTransactionManagerEngine> engines;
- public TransactionContexts() {
- this(new ConcurrentHashMap<>());
- }
-
@Override
public void close() throws Exception {
for (ShardingSphereTransactionManagerEngine each : engines.values()) {
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/context/TransactionContextsTest.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/context/TransactionContextsTest.java
index a9289058e3b..06f28f4d86c 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/context/TransactionContextsTest.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/context/TransactionContextsTest.java
@@ -27,20 +27,12 @@ import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
public final class TransactionContextsTest {
- @Test
- public void assertNewInstanceWithEmptyEngines() {
- TransactionContexts transactionContexts = new TransactionContexts();
- Map<String, ShardingSphereTransactionManagerEngine> engines = transactionContexts.getEngines();
- assertTrue(engines.isEmpty());
- }
-
@Test
public void assertGetDefaultTransactionManagerEngine() {
Map<String, ShardingSphereTransactionManagerEngine> actualEngines = Collections.singletonMap(DefaultDatabase.LOGIC_NAME, new ShardingSphereTransactionManagerEngine());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
index d4eab51c545..7c103ac4b9e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/context/BackendExecutorContextTest.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
-import org.apache.shardingsphere.transaction.context.TransactionContexts;
import org.junit.Before;
import org.junit.Test;
@@ -40,7 +39,6 @@ public final class BackendExecutorContextTest extends ProxyContextRestorer {
MetaDataContexts metaDataContexts = new MetaDataContexts(mock(MetaDataPersistService.class), new ShardingSphereMetaData(), mock(OptimizerContext.class));
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
- when(contextManager.getTransactionContexts()).thenReturn(new TransactionContexts());
ProxyContext.init(contextManager);
}