This is an automated email from the ASF dual-hosted git repository.
shoothzj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new c7d6983d5 Migrate governance module to junit5 (#4100)
c7d6983d5 is described below
commit c7d6983d559f9963af4be8cfb90589c5e4a5cc86
Author: pengxiangrui127 <[email protected]>
AuthorDate: Thu Dec 7 07:40:53 2023 +0800
Migrate governance module to junit5 (#4100)
Co-authored-by: ZhangJian He <[email protected]>
---
.../governance/handler/ext/RetryExtensionTest.java | 8 ++++----
.../router/RouterDistributorDynamicConfig2Test.java | 12 ++++++------
.../router/RouterDistributorDynamicConfigTest.java | 11 +++++------
.../servicecomb/router/RouterDistributorFileConfigTest.java | 7 +++----
.../router/RouterDistributorFileWeightLessTest.java | 7 +++----
.../router/RouterDistributorGlobalConfigTest.java | 11 +++++------
6 files changed, 26 insertions(+), 30 deletions(-)
diff --git
a/governance/src/test/java/org/apache/servicecomb/governance/handler/ext/RetryExtensionTest.java
b/governance/src/test/java/org/apache/servicecomb/governance/handler/ext/RetryExtensionTest.java
index 15a0c5489..1fbde35e0 100644
---
a/governance/src/test/java/org/apache/servicecomb/governance/handler/ext/RetryExtensionTest.java
+++
b/governance/src/test/java/org/apache/servicecomb/governance/handler/ext/RetryExtensionTest.java
@@ -24,16 +24,16 @@ import java.net.SocketTimeoutException;
import java.util.Arrays;
import java.util.List;
-import org.junit.Test;
+
import org.junit.jupiter.api.Assertions;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import
org.springframework.boot.test.context.ConfigDataApplicationContextInitializer;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
import io.vertx.core.VertxException;
-@RunWith(SpringRunner.class)
+@SpringBootTest
@ContextConfiguration(locations = "classpath:META-INF/spring/*.xml",
initializers = ConfigDataApplicationContextInitializer.class)
public class RetryExtensionTest {
diff --git
a/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorDynamicConfig2Test.java
b/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorDynamicConfig2Test.java
index 02eff7978..cc8cc9ce9 100644
---
a/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorDynamicConfig2Test.java
+++
b/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorDynamicConfig2Test.java
@@ -30,19 +30,19 @@ import
org.apache.servicecomb.governance.marker.GovernanceRequest;
import org.apache.servicecomb.governance.marker.GovernanceRequestExtractor;
import org.apache.servicecomb.router.cache.RouterRuleCache;
import org.apache.servicecomb.router.distribute.RouterDistributor;
-import org.junit.Before;
-import org.junit.Test;
+
import org.junit.jupiter.api.Assertions;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.test.context.ConfigDataApplicationContextInitializer;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.Environment;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-@RunWith(SpringRunner.class)
+@SpringBootTest
@ContextConfiguration(locations = "classpath:META-INF/spring/*.xml",
initializers = ConfigDataApplicationContextInitializer.class)
public class RouterDistributorDynamicConfig2Test {
private static final String TARGET_SERVICE_NAME = "test_server";
@@ -91,7 +91,7 @@ public class RouterDistributorDynamicConfig2Test {
private final Map<String, Object> dynamicValues = new HashMap<>();
- @Before
+ @BeforeEach
public void setUp() {
ConfigurableEnvironment configurableEnvironment =
(ConfigurableEnvironment) environment;
diff --git
a/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorDynamicConfigTest.java
b/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorDynamicConfigTest.java
index 6ded0c211..4418a3082 100644
---
a/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorDynamicConfigTest.java
+++
b/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorDynamicConfigTest.java
@@ -30,19 +30,18 @@ import
org.apache.servicecomb.governance.marker.GovernanceRequest;
import org.apache.servicecomb.governance.marker.GovernanceRequestExtractor;
import org.apache.servicecomb.router.cache.RouterRuleCache;
import org.apache.servicecomb.router.distribute.RouterDistributor;
-import org.junit.Before;
-import org.junit.Test;
import org.junit.jupiter.api.Assertions;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.test.context.ConfigDataApplicationContextInitializer;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.Environment;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-@RunWith(SpringRunner.class)
+@SpringBootTest
@ContextConfiguration(locations = "classpath:META-INF/spring/*.xml",
initializers = ConfigDataApplicationContextInitializer.class)
public class RouterDistributorDynamicConfigTest {
private static final String TARGET_SERVICE_NAME = "test_server";
@@ -108,7 +107,7 @@ public class RouterDistributorDynamicConfigTest {
private final Map<String, Object> dynamicValues = new HashMap<>();
- @Before
+ @BeforeEach
public void setUp() {
ConfigurableEnvironment configurableEnvironment =
(ConfigurableEnvironment) environment;
diff --git
a/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorFileConfigTest.java
b/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorFileConfigTest.java
index 63af6e2a5..54ebcb058 100644
---
a/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorFileConfigTest.java
+++
b/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorFileConfigTest.java
@@ -18,19 +18,18 @@ package org.apache.servicecomb.router;
import org.apache.servicecomb.governance.marker.GovernanceRequest;
import org.apache.servicecomb.router.distribute.RouterDistributor;
-import org.junit.Test;
import org.junit.jupiter.api.Assertions;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.test.context.ConfigDataApplicationContextInitializer;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-@RunWith(SpringRunner.class)
+@SpringBootTest
@ContextConfiguration(locations = "classpath:META-INF/spring/*.xml",
initializers = ConfigDataApplicationContextInitializer.class)
public class RouterDistributorFileConfigTest {
private static final String TARGET_SERVICE_NAME = "test_server1";
diff --git
a/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorFileWeightLessTest.java
b/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorFileWeightLessTest.java
index 43edbb041..68b04bc9c 100644
---
a/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorFileWeightLessTest.java
+++
b/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorFileWeightLessTest.java
@@ -22,15 +22,14 @@ import java.util.List;
import org.apache.servicecomb.governance.marker.GovernanceRequest;
import org.apache.servicecomb.router.distribute.RouterDistributor;
-import org.junit.Test;
import org.junit.jupiter.api.Assertions;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.test.context.ConfigDataApplicationContextInitializer;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-@RunWith(SpringRunner.class)
+@SpringBootTest
@ContextConfiguration(locations = "classpath:META-INF/spring/*.xml",
initializers = ConfigDataApplicationContextInitializer.class)
public class RouterDistributorFileWeightLessTest {
private static final String TARGET_SERVICE_NAME = "test_server2";
diff --git
a/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorGlobalConfigTest.java
b/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorGlobalConfigTest.java
index 489f1a6e5..89a54d769 100644
---
a/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorGlobalConfigTest.java
+++
b/governance/src/test/java/org/apache/servicecomb/router/RouterDistributorGlobalConfigTest.java
@@ -30,19 +30,18 @@ import
org.apache.servicecomb.governance.marker.GovernanceRequest;
import org.apache.servicecomb.governance.marker.GovernanceRequestExtractor;
import org.apache.servicecomb.router.cache.RouterRuleCache;
import org.apache.servicecomb.router.distribute.RouterDistributor;
-import org.junit.Before;
-import org.junit.Test;
import org.junit.jupiter.api.Assertions;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.test.context.ConfigDataApplicationContextInitializer;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.Environment;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-@RunWith(SpringRunner.class)
+@SpringBootTest
@ContextConfiguration(locations = "classpath:META-INF/spring/*.xml",
initializers = ConfigDataApplicationContextInitializer.class)
public class RouterDistributorGlobalConfigTest {
private static final String TARGET_SERVICE_NAME = "test_server";
@@ -99,7 +98,7 @@ public class RouterDistributorGlobalConfigTest {
private final Map<String, Object> dynamicValues = new HashMap<>();
- @Before
+ @BeforeEach
public void setUp() {
ConfigurableEnvironment configurableEnvironment =
(ConfigurableEnvironment) environment;