You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by sh...@apache.org on 2022/07/02 00:44:58 UTC
[servicecomb-java-chassis] branch master updated: [SCB-2475] migrate servicestage module to junit5 (#3173)
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 64889246d [SCB-2475] migrate servicestage module to junit5 (#3173)
64889246d is described below
commit 64889246d2bd1e3e974793aee410299bf32e90c1
Author: ZhangJian He <sh...@gmail.com>
AuthorDate: Sat Jul 2 08:44:51 2022 +0800
[SCB-2475] migrate servicestage module to junit5 (#3173)
---
.../servicecomb/common/rest/filter/TestHttpServerFilter.java | 2 +-
.../filter/TestHttpServerFilterBeforeSendResponseExecutor.java | 6 +++---
.../src/test/java/org/apache/servicecomb/qps/TestConfig.java | 10 +++++-----
.../servicecomb/authentication/TestAccessController.java | 6 +++---
.../servicecomb/authentication/TestConsumerAuthHandler.java | 6 +++---
.../servicecomb/authentication/TestProviderAuthHandler.java | 10 +++++-----
.../huaweicloud/servicestage/TestAKSKAuthHeaderProvider.java | 2 +-
.../servicecomb/huaweicloud/servicestage/TestCasEnvConfig.java | 10 +++++-----
.../huaweicloud/servicestage/TestEnvVariablesAdapter.java | 10 +++++-----
9 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/TestHttpServerFilter.java b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/TestHttpServerFilter.java
index 3976843b8..584a35aaa 100644
--- a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/TestHttpServerFilter.java
+++ b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/TestHttpServerFilter.java
@@ -22,8 +22,8 @@ import java.util.concurrent.ExecutionException;
import org.apache.servicecomb.core.Invocation;
import org.apache.servicecomb.foundation.test.scaffolding.exception.RuntimeExceptionWithoutStackTrace;
import org.apache.servicecomb.foundation.vertx.http.HttpServletResponseEx;
-import org.junit.Test;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
public class TestHttpServerFilter {
diff --git a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/TestHttpServerFilterBeforeSendResponseExecutor.java b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/TestHttpServerFilterBeforeSendResponseExecutor.java
index 80f424081..c004feca6 100644
--- a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/TestHttpServerFilterBeforeSendResponseExecutor.java
+++ b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/filter/TestHttpServerFilterBeforeSendResponseExecutor.java
@@ -24,11 +24,11 @@ import java.util.concurrent.ExecutionException;
import org.apache.servicecomb.core.Invocation;
import org.apache.servicecomb.foundation.test.scaffolding.exception.RuntimeExceptionWithoutStackTrace;
import org.apache.servicecomb.foundation.vertx.http.HttpServletResponseEx;
-import org.junit.Before;
-import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import mockit.Mocked;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class TestHttpServerFilterBeforeSendResponseExecutor {
@Mocked
@@ -42,7 +42,7 @@ public class TestHttpServerFilterBeforeSendResponseExecutor {
HttpServerFilterBeforeSendResponseExecutor executor =
new HttpServerFilterBeforeSendResponseExecutor(httpServerFilters, invocation, responseEx);
- @Before
+ @BeforeEach
public void setup() {
httpServerFilters.add(new HttpServerFilterBaseForTest());
}
diff --git a/handlers/handler-flowcontrol-qps/src/test/java/org/apache/servicecomb/qps/TestConfig.java b/handlers/handler-flowcontrol-qps/src/test/java/org/apache/servicecomb/qps/TestConfig.java
index bd9e285c3..ea9f47440 100644
--- a/handlers/handler-flowcontrol-qps/src/test/java/org/apache/servicecomb/qps/TestConfig.java
+++ b/handlers/handler-flowcontrol-qps/src/test/java/org/apache/servicecomb/qps/TestConfig.java
@@ -18,18 +18,18 @@
package org.apache.servicecomb.qps;
import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class TestConfig {
- @BeforeClass
+ @BeforeAll
public static void classSetup() {
ArchaiusUtils.resetConfig();
}
- @AfterClass
+ @AfterAll
public static void classTeardown() {
ArchaiusUtils.resetConfig();
}
diff --git a/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestAccessController.java b/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestAccessController.java
index 76e9b5749..059ac411a 100644
--- a/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestAccessController.java
+++ b/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestAccessController.java
@@ -22,12 +22,12 @@ import java.util.Map;
import org.apache.servicecomb.authentication.provider.AccessController;
import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
import org.apache.servicecomb.registry.api.registry.Microservice;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
public class TestAccessController {
- @After
+ @AfterEach
public void tearDown() {
ArchaiusUtils.resetConfig();
}
diff --git a/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestConsumerAuthHandler.java b/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestConsumerAuthHandler.java
index cf2786ad2..652eb0f1a 100644
--- a/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestConsumerAuthHandler.java
+++ b/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestConsumerAuthHandler.java
@@ -20,8 +20,8 @@ import org.apache.servicecomb.authentication.consumer.ConsumerAuthHandler;
import org.apache.servicecomb.authentication.consumer.RSAConsumerTokenManager;
import org.apache.servicecomb.core.Invocation;
import org.apache.servicecomb.swagger.invocation.AsyncResponse;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
public class TestConsumerAuthHandler {
@@ -51,7 +51,7 @@ public class TestConsumerAuthHandler {
consumerAuthHandler.handle(invocation, asyncResp);
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
invocation = Mockito.mock(Invocation.class);
asyncResp = Mockito.mock(AsyncResponse.class);
diff --git a/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestProviderAuthHandler.java b/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestProviderAuthHandler.java
index 74c358bde..9203a5808 100644
--- a/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestProviderAuthHandler.java
+++ b/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/TestProviderAuthHandler.java
@@ -22,9 +22,9 @@ import org.apache.servicecomb.core.Const;
import org.apache.servicecomb.core.Invocation;
import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
import org.apache.servicecomb.swagger.invocation.AsyncResponse;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
public class TestProviderAuthHandler {
@@ -32,14 +32,14 @@ public class TestProviderAuthHandler {
AsyncResponse asyncResp = null;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
ConfigUtil.installDynamicConfig();
invocation = Mockito.mock(Invocation.class);
asyncResp = Mockito.mock(AsyncResponse.class);
Mockito.when(invocation.getContext(Const.AUTH_TOKEN)).thenReturn("testtoken");
}
- @After
+ @AfterEach
public void tearDown() {
ArchaiusUtils.resetConfig();
}
diff --git a/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestAKSKAuthHeaderProvider.java b/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestAKSKAuthHeaderProvider.java
index 298240374..d5ff9cdda 100644
--- a/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestAKSKAuthHeaderProvider.java
+++ b/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestAKSKAuthHeaderProvider.java
@@ -18,7 +18,7 @@
package org.apache.servicecomb.huaweicloud.servicestage;
import org.junit.jupiter.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import com.netflix.config.ConcurrentCompositeConfiguration;
diff --git a/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestCasEnvConfig.java b/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestCasEnvConfig.java
index e21186c6a..078ec5ae2 100644
--- a/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestCasEnvConfig.java
+++ b/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestCasEnvConfig.java
@@ -16,14 +16,14 @@
*/
package org.apache.servicecomb.huaweicloud.servicestage;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class TestCasEnvConfig {
- @BeforeClass
+ @BeforeAll
public static void init() {
System.setProperty("CAS_APPLICATION_ID", "application-id");
System.setProperty("CAS_ENVIRONMENT_ID", "env-id");
@@ -37,7 +37,7 @@ public class TestCasEnvConfig {
Assertions.assertEquals("env-id", instance.getNonEmptyProperties().get("CAS_ENVIRONMENT_ID"));
}
- @AfterClass
+ @AfterAll
public static void destroy() {
System.getProperties().remove("CAS_ENVIRONMENT_ID");
System.getProperties().remove("CAS_APPLICATION_ID");
diff --git a/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestEnvVariablesAdapter.java b/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestEnvVariablesAdapter.java
index 46e8649f7..004dbf941 100644
--- a/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestEnvVariablesAdapter.java
+++ b/huawei-cloud/servicestage/src/test/java/org/apache/servicecomb/huaweicloud/servicestage/TestEnvVariablesAdapter.java
@@ -17,14 +17,14 @@
package org.apache.servicecomb.huaweicloud.servicestage;
import org.apache.servicecomb.registry.api.registry.MicroserviceInstance;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
public class TestEnvVariablesAdapter {
- @BeforeClass
+ @BeforeAll
public static void init() {
System.setProperty("servicecomb.huaweicloud.servicestage.cas.application-id", "application-id");
System.setProperty("servicecomb.huaweicloud.servicestage.cas.environment-id", "env-id");
@@ -41,7 +41,7 @@ public class TestEnvVariablesAdapter {
Assertions.assertEquals("env-id", instance.getProperties().get("CAS_ENVIRONMENT_ID"));
}
- @AfterClass
+ @AfterAll
public static void destroy() {
System.getProperties().remove("servicecomb.huaweicloud.servicestage.cas.application-id");
System.getProperties().remove("servicecomb.huaweicloud.servicestage.cas.environment-id");