You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/10/31 08:58:59 UTC
[shardingsphere] branch master updated: Fix
IncrementalDataScalingTask execute fail in unit tests bug. (#7991)
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 8711298 Fix IncrementalDataScalingTask execute fail in unit tests bug. (#7991)
8711298 is described below
commit 8711298b2a28cdd7a357d9163639360eace7bcb4
Author: 邱鹿 Lucas <lu...@163.com>
AuthorDate: Sat Oct 31 16:58:35 2020 +0800
Fix IncrementalDataScalingTask execute fail in unit tests bug. (#7991)
* Fix IncrementalDataScalingTask execute fail in unit tests bug
Co-authored-by: qiulu3 <Lucas209910>
---
.../apache/shardingsphere/scaling/web/HttpServerHandlerTest.java | 6 ++++--
.../shardingsphere/scaling/core/ScalingJobControllerTest.java | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/test/java/org/apache/shardingsphere/scaling/web/HttpServerHandlerTest.java b/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/test/java/org/apache/shardingsphere/scaling/web/HttpServerHandlerTest.java
index 69edd67..799c666 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/test/java/org/apache/shardingsphere/scaling/web/HttpServerHandlerTest.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/test/java/org/apache/shardingsphere/scaling/web/HttpServerHandlerTest.java
@@ -64,8 +64,10 @@ public final class HttpServerHandlerTest {
@Before
@SneakyThrows(ReflectiveOperationException.class)
public void setUp() {
- ScalingContext.getInstance().init(new ServerConfiguration());
- ReflectionUtil.setFieldValue(ScalingContext.getInstance(), "taskExecuteEngine", mock(ShardingScalingExecuteEngine.class));
+ if (null == ScalingContext.getInstance().getServerConfig()) {
+ ScalingContext.getInstance().init(new ServerConfiguration());
+ ReflectionUtil.setFieldValue(ScalingContext.getInstance(), "taskExecuteEngine", mock(ShardingScalingExecuteEngine.class));
+ }
}
@Test
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/ScalingJobControllerTest.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/ScalingJobControllerTest.java
index 5c829f9..261c8ea 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/ScalingJobControllerTest.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/ScalingJobControllerTest.java
@@ -52,8 +52,10 @@ public final class ScalingJobControllerTest {
@Before
@SneakyThrows(ReflectiveOperationException.class)
public void setUp() {
- ScalingContext.getInstance().init(new ServerConfiguration());
- ReflectionUtil.setFieldValue(ScalingContext.getInstance(), "taskExecuteEngine", mock(ShardingScalingExecuteEngine.class));
+ if (null == ScalingContext.getInstance().getServerConfig()) {
+ ScalingContext.getInstance().init(new ServerConfiguration());
+ ReflectionUtil.setFieldValue(ScalingContext.getInstance(), "taskExecuteEngine", mock(ShardingScalingExecuteEngine.class));
+ }
}
@Test