diff --git a/pom.xml b/pom.xml
index e6a7ffcf3af7e45b7bef6721e8bb372137cdc2fb..724aa9caca014d801ab94dbf085e318722cc7686 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,6 +16,11 @@
spring-boot-starter
2.0.6.RELEASE
+
+ org.springframework.boot
+ spring-boot-starter-web
+ 2.0.1.RELEASE
+
org.springframework.boot
spring-boot-starter-test
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_02_Create.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_02_Create.java
index 9c37155410460cb5e96c6567b0ca7c1e33b36ea3..72efed49745336ac35da0720b64871c92efdfac4 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_02_Create.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_02_Create.java
@@ -32,7 +32,7 @@ public class CuratorTest_02_Create {
public void testCreate2() throws Exception {
//基本创建
//如果创建节点,没有指定数据,则默认将当前客户端的ip作为数据存储
- String path = client.create().forPath("/app5");
+ String path = client.create().forPath("/app34");
System.out.println(path);
}
}
\ No newline at end of file
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_03_Create.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_03_Create.java
index cce42724636e0149af06866d102b86daaaa980ad..8a7e8f4ab4b1bb9a78254784ac28b915cea82296 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_03_Create.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_03_Create.java
@@ -3,7 +3,10 @@ package com.kwan.shuyu.crud;
import org.apache.curator.framework.CuratorFramework;
import org.apache.zookeeper.CreateMode;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* 设置节点的类型
@@ -12,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 09:54
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class CuratorTest_03_Create {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_04_Create.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_04_Create.java
index 5908e9e322328b90c65a062049fb9e696449afc4..f7e40cc25c3e609f4f6fa754570f806b9803fc47 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_04_Create.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_04_Create.java
@@ -2,7 +2,10 @@ package com.kwan.shuyu.crud;
import org.apache.curator.framework.CuratorFramework;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* 创建多级节点
@@ -11,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 09:54
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class CuratorTest_04_Create {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_05_Get.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_05_Get.java
index 82019c2460ed67561ff9b4bb04f4d1fa4ba52c48..71bbcc4163ef84e9a10861270712f4f3df35cdcf 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_05_Get.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_05_Get.java
@@ -2,7 +2,10 @@ package com.kwan.shuyu.crud;
import org.apache.curator.framework.CuratorFramework;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* 查询数据
@@ -11,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 09:54
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class CuratorTest_05_Get {
@Autowired
@@ -25,7 +30,7 @@ public class CuratorTest_05_Get {
@Test
public void testGet1() throws Exception {
//1. 查询数据:get
- byte[] data = client.getData().forPath("/app1");
+ byte[] data = client.getData().forPath("/app5");
System.out.println(new String(data));
}
}
\ No newline at end of file
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_06_Get.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_06_Get.java
index dc75673cbce99cd28baed3fe54fbf4556b9e5ba1..77fbbf08120624e402dd4b52ee0a8b48ff1e9c85 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_06_Get.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_06_Get.java
@@ -2,7 +2,10 @@ package com.kwan.shuyu.crud;
import org.apache.curator.framework.CuratorFramework;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
@@ -13,6 +16,8 @@ import java.util.List;
* @version : 2.2.0
* @date : 2023/5/15 09:54
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class CuratorTest_06_Get {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_07_Get.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_07_Get.java
index 5d2b444499d6f65c1f82941bb57c064fc49e33c6..a7f2149c3d2ed28d104c05d8859ff994e322d110 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_07_Get.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_07_Get.java
@@ -3,7 +3,10 @@ package com.kwan.shuyu.crud;
import org.apache.curator.framework.CuratorFramework;
import org.apache.zookeeper.data.Stat;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* 查询节点状态信息
@@ -12,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 09:54
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class CuratorTest_07_Get {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_08_Set.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_08_Set.java
index 278301b1c934d4c4b12daae60cc1c5a72fb6392a..f27651a4bc501779c2dca447c463f937fce375fc 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_08_Set.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_08_Set.java
@@ -2,7 +2,10 @@ package com.kwan.shuyu.crud;
import org.apache.curator.framework.CuratorFramework;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* 基本修改数据
@@ -11,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 09:54
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class CuratorTest_08_Set {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_09_Set.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_09_Set.java
index a004975a1951f023d45d35f8c18935470dabab9c..db777bd5651bd082520d9261cc7ddec017acec78 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_09_Set.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_09_Set.java
@@ -3,7 +3,10 @@ package com.kwan.shuyu.crud;
import org.apache.curator.framework.CuratorFramework;
import org.apache.zookeeper.data.Stat;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* 根据版本修改
@@ -12,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 09:54
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class CuratorTest_09_Set {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_10_Delete.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_10_Delete.java
index 15ae895efff4105fd4b276ce53f97404f08c4e0a..6db66928005ccde2b5096f7e757b0be2de1b6e35 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_10_Delete.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_10_Delete.java
@@ -2,7 +2,10 @@ package com.kwan.shuyu.crud;
import org.apache.curator.framework.CuratorFramework;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* 删除单个节点
@@ -11,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 09:54
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class CuratorTest_10_Delete {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_11_Delete.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_11_Delete.java
index 44693ea65279c5950029b4048828d0ddf3c19f76..1e7d6d31861f0cf984b4406b78789d3ac2d43f02 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_11_Delete.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_11_Delete.java
@@ -2,7 +2,10 @@ package com.kwan.shuyu.crud;
import org.apache.curator.framework.CuratorFramework;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* 删除带有子节点的节点
@@ -11,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 09:54
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class CuratorTest_11_Delete {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_12_Delete.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_12_Delete.java
index ad063b27d9a760293ce96871d2d2c3e803513695..cf541e82c5e7a8e44df4642a46bbde1b38495cd0 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_12_Delete.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_12_Delete.java
@@ -2,7 +2,10 @@ package com.kwan.shuyu.crud;
import org.apache.curator.framework.CuratorFramework;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* 必须成功的删除:为了防止网络抖动。本质就是重试。
@@ -11,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 09:54
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class CuratorTest_12_Delete {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/crud/CuratorTest_13_Delete.java b/src/test/java/com/kwan/shuyu/crud/CuratorTest_13_Delete.java
index 85aaf1a3c260b3625aa319c689b80a82f881dd61..7f74b93a966425329d22d4a4440432648d7d1e9a 100644
--- a/src/test/java/com/kwan/shuyu/crud/CuratorTest_13_Delete.java
+++ b/src/test/java/com/kwan/shuyu/crud/CuratorTest_13_Delete.java
@@ -4,7 +4,10 @@ import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.api.BackgroundCallback;
import org.apache.curator.framework.api.CuratorEvent;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* 删除回调:inBackground
@@ -13,6 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 09:54
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class CuratorTest_13_Delete {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/watch/Watcher_01_NodeCache.java b/src/test/java/com/kwan/shuyu/watch/Watcher_01_NodeCache.java
index 357f997aaeddc4aeb41068b31d889ee224e8e4f7..e8fbd5009b44d9f35b47abd971b40feb8db961fd 100644
--- a/src/test/java/com/kwan/shuyu/watch/Watcher_01_NodeCache.java
+++ b/src/test/java/com/kwan/shuyu/watch/Watcher_01_NodeCache.java
@@ -4,7 +4,10 @@ import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.recipes.cache.NodeCache;
import org.apache.curator.framework.recipes.cache.NodeCacheListener;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* Watcher监听
@@ -13,6 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 10:29
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class Watcher_01_NodeCache {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/watch/Watcher_02_PathChildrenCache.java b/src/test/java/com/kwan/shuyu/watch/Watcher_02_PathChildrenCache.java
index 276b071b173d22aa4aa0e766f9c5615e84210341..f8ccd9aae711ad402fbb7fc774fee59e45d51714 100644
--- a/src/test/java/com/kwan/shuyu/watch/Watcher_02_PathChildrenCache.java
+++ b/src/test/java/com/kwan/shuyu/watch/Watcher_02_PathChildrenCache.java
@@ -5,7 +5,10 @@ import org.apache.curator.framework.recipes.cache.PathChildrenCache;
import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;
import org.apache.curator.framework.recipes.cache.PathChildrenCacheListener;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* Watcher监听
@@ -14,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 10:29
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class Watcher_02_PathChildrenCache {
@Autowired
diff --git a/src/test/java/com/kwan/shuyu/watch/Watcher_03_TreeCache.java b/src/test/java/com/kwan/shuyu/watch/Watcher_03_TreeCache.java
index 573b213afbc41f07f8a4ab85719a8e880d7d3e19..cfce9b228c47fc553d227d83db11443da3d56385 100644
--- a/src/test/java/com/kwan/shuyu/watch/Watcher_03_TreeCache.java
+++ b/src/test/java/com/kwan/shuyu/watch/Watcher_03_TreeCache.java
@@ -5,7 +5,10 @@ import org.apache.curator.framework.recipes.cache.TreeCache;
import org.apache.curator.framework.recipes.cache.TreeCacheEvent;
import org.apache.curator.framework.recipes.cache.TreeCacheListener;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
/**
* Watcher监听
@@ -14,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @version : 2.2.0
* @date : 2023/5/15 10:29
*/
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class Watcher_03_TreeCache {
@Autowired