未验证 提交 72160c12 编写于 作者: X xiaoyu 提交者: GitHub

Fix test error. (#5821)

* Fix test error.

* Fix test error.

* remove un import.
上级 60d76e08
......@@ -30,6 +30,7 @@ import org.apache.shardingsphere.proxy.backend.schema.ProxySchemaContexts;
import org.apache.shardingsphere.proxy.backend.schema.ProxySchemaContexts.JDBCBackendDataSource;
import org.apache.shardingsphere.transaction.ShardingTransactionManagerEngine;
import org.apache.shardingsphere.transaction.core.TransactionType;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -264,4 +265,14 @@ public final class BackendConnectionTest {
transactionManager.begin();
backendConnection.setCurrentSchema("newSchema");
}
@SneakyThrows(ReflectiveOperationException.class)
@After
public void clean() {
Field field = ProxySchemaContexts.getInstance().getClass().getDeclaredField("backendDataSource");
field.setAccessible(true);
Class<?> clazz = field.getType();
Object datasource = clazz.getDeclaredConstructors()[0].newInstance(ProxySchemaContexts.getInstance());
field.set(ProxySchemaContexts.getInstance(), datasource);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册