This is an automated email from the ASF dual-hosted git repository.

linghengqian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob.git


The following commit(s) were added to refs/heads/master by this push:
     new 38eedb89f Move zkRegCenter.init() and zkRegCenter.close() to 
@BeforeAll and @AfterAll to make tests run faster and look similar to other 
tests (#2378)
38eedb89f is described below

commit 38eedb89f051f5ce17872c230828d2e0bdf231e3
Author: TestBoost <[email protected]>
AuthorDate: Thu Dec 14 01:34:45 2023 -0600

    Move zkRegCenter.init() and zkRegCenter.close() to @BeforeAll and @AfterAll 
to make tests run faster and look similar to other tests (#2378)
---
 .../elasticjob/bootstrap/type/OneOffJobBootstrapTest.java   | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git 
a/bootstrap/src/test/java/org/apache/shardingsphere/elasticjob/bootstrap/type/OneOffJobBootstrapTest.java
 
b/bootstrap/src/test/java/org/apache/shardingsphere/elasticjob/bootstrap/type/OneOffJobBootstrapTest.java
index 5528c28fc..443a1a865 100644
--- 
a/bootstrap/src/test/java/org/apache/shardingsphere/elasticjob/bootstrap/type/OneOffJobBootstrapTest.java
+++ 
b/bootstrap/src/test/java/org/apache/shardingsphere/elasticjob/bootstrap/type/OneOffJobBootstrapTest.java
@@ -25,9 +25,8 @@ import 
org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
 import org.apache.shardingsphere.elasticjob.test.util.EmbedTestingServer;
 import org.apache.shardingsphere.elasticjob.test.util.ReflectionUtils;
 import org.awaitility.Awaitility;
-import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.quartz.Scheduler;
 import org.quartz.SchedulerException;
@@ -48,21 +47,17 @@ class OneOffJobBootstrapTest {
     
     private static final int SHARDING_TOTAL_COUNT = 3;
     
-    private ZookeeperRegistryCenter zkRegCenter;
+    private static ZookeeperRegistryCenter zkRegCenter;
     
     @BeforeAll
     static void init() {
         EMBED_TESTING_SERVER.start();
-    }
-    
-    @BeforeEach
-    void setUp() {
         zkRegCenter = new ZookeeperRegistryCenter(ZOOKEEPER_CONFIGURATION);
         zkRegCenter.init();
     }
     
-    @AfterEach
-    void tearDown() {
+    @AfterAll
+    static void tearDown() {
         zkRegCenter.close();
     }
     

Reply via email to