Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
c0f6d20a
S
SkyWalking
项目概览
月轩居士
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c0f6d20a
编写于
12月 07, 2016
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
注册中心添加stop功能
上级
15b3add2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
31 addition
and
64 deletion
+31
-64
skywalking-commons/skywalking-registry/src/main/java/com/a/eye/skywalking/registry/RegistryNodeManager.java
...va/com/a/eye/skywalking/registry/RegistryNodeManager.java
+4
-0
skywalking-commons/skywalking-registry/src/main/java/com/a/eye/skywalking/registry/api/RegistryCenter.java
...ava/com/a/eye/skywalking/registry/api/RegistryCenter.java
+3
-0
skywalking-commons/skywalking-registry/src/main/java/com/a/eye/skywalking/registry/impl/zookeeper/ZookeeperRegistryCenter.java
...king/registry/impl/zookeeper/ZookeeperRegistryCenter.java
+4
-0
skywalking-commons/skywalking-registry/src/test/java/com/a/eye/skywalking/registry/impl/zookeeper/ZookeeperRegistryCenterTest.java
.../registry/impl/zookeeper/ZookeeperRegistryCenterTest.java
+20
-0
skywalking-storage-center/skywalking-routing/src/test/java/com/a/eye/skywalking/routing/router/NodeChangesListenerTest.java
...ye/skywalking/routing/router/NodeChangesListenerTest.java
+0
-64
未找到文件。
skywalking-commons/skywalking-registry/src/main/java/com/a/eye/skywalking/registry/RegistryNodeManager.java
浏览文件 @
c0f6d20a
...
@@ -34,4 +34,8 @@ public class RegistryNodeManager {
...
@@ -34,4 +34,8 @@ public class RegistryNodeManager {
public
List
<
String
>
getConnectionURLOfPreviousChanged
()
{
public
List
<
String
>
getConnectionURLOfPreviousChanged
()
{
return
new
ArrayList
<
String
>(
connectionURLOfPreviousChanged
);
return
new
ArrayList
<
String
>(
connectionURLOfPreviousChanged
);
}
}
public
void
clear
()
{
connectionURLOfPreviousChanged
=
new
ArrayList
<
String
>();
}
}
}
skywalking-commons/skywalking-registry/src/main/java/com/a/eye/skywalking/registry/api/RegistryCenter.java
浏览文件 @
c0f6d20a
...
@@ -30,4 +30,7 @@ public interface RegistryCenter {
...
@@ -30,4 +30,7 @@ public interface RegistryCenter {
* @param centerConfig 配置参数
* @param centerConfig 配置参数
*/
*/
void
start
(
Properties
centerConfig
);
void
start
(
Properties
centerConfig
);
void
stop
();
}
}
skywalking-commons/skywalking-registry/src/main/java/com/a/eye/skywalking/registry/impl/zookeeper/ZookeeperRegistryCenter.java
浏览文件 @
c0f6d20a
...
@@ -59,6 +59,10 @@ public class ZookeeperRegistryCenter implements RegistryCenter {
...
@@ -59,6 +59,10 @@ public class ZookeeperRegistryCenter implements RegistryCenter {
}
}
}
}
@Override
public
void
stop
()
{
nodeManager
.
clear
();
}
}
}
skywalking-commons/skywalking-registry/src/test/java/com/a/eye/skywalking/registry/impl/zookeeper/ZookeeperRegistryCenterTest.java
浏览文件 @
c0f6d20a
...
@@ -40,6 +40,24 @@ public class ZookeeperRegistryCenterTest extends TestSuite {
...
@@ -40,6 +40,24 @@ public class ZookeeperRegistryCenterTest extends TestSuite {
public
void
tearDown
()
throws
Exception
{
public
void
tearDown
()
throws
Exception
{
zkTestServer
.
getTempDirectory
().
delete
();
zkTestServer
.
getTempDirectory
().
delete
();
zkTestServer
.
stop
();
zkTestServer
.
stop
();
registryCenter
.
stop
();
}
@Test
public
void
subscribeNodeTest
()
throws
InterruptedException
{
final
StringBuilder
addUrl
=
new
StringBuilder
();
registryCenter
.
subscribe
(
"/skywalking/storage"
,
new
NotifyListener
()
{
@Override
public
void
notify
(
List
<
RegistryNode
>
registryNodes
)
{
for
(
RegistryNode
url
:
registryNodes
)
{
addUrl
.
append
(
url
.
getNode
()
+
","
);
}
}
});
registryCenter
.
register
(
"/skywalking/storage/127.0.0.1:9400"
);
Thread
.
sleep
(
100L
);
assertEquals
(
addUrl
.
deleteCharAt
(
addUrl
.
length
()
-
1
).
toString
(),
"127.0.0.1:9400"
);
}
}
...
@@ -59,6 +77,8 @@ public class ZookeeperRegistryCenterTest extends TestSuite {
...
@@ -59,6 +77,8 @@ public class ZookeeperRegistryCenterTest extends TestSuite {
assertEquals
(
addUrl
.
deleteCharAt
(
addUrl
.
length
()
-
1
).
toString
(),
"127.0.0.1:9400"
);
assertEquals
(
addUrl
.
deleteCharAt
(
addUrl
.
length
()
-
1
).
toString
(),
"127.0.0.1:9400"
);
}
}
@Test
@Test
public
void
registryNodeTest
()
throws
IOException
,
InterruptedException
,
KeeperException
{
public
void
registryNodeTest
()
throws
IOException
,
InterruptedException
,
KeeperException
{
registryCenter
.
register
(
"/skywalking/storage/test"
);
registryCenter
.
register
(
"/skywalking/storage/test"
);
...
...
skywalking-storage-center/skywalking-routing/src/test/java/com/a/eye/skywalking/routing/router/NodeChangesListenerTest.java
已删除
100644 → 0
浏览文件 @
15b3add2
package
com.a.eye.skywalking.routing.router
;
import
com.a.eye.skywalking.registry.RegistryCenterFactory
;
import
com.a.eye.skywalking.registry.api.CenterType
;
import
com.a.eye.skywalking.registry.api.RegistryCenter
;
import
com.a.eye.skywalking.registry.impl.zookeeper.ZookeeperConfig
;
import
com.a.eye.skywalking.routing.config.Config
;
import
org.apache.curator.test.TestingServer
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Spy
;
import
org.mockito.runners.MockitoJUnitRunner
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Properties
;
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
NodeChangesListenerTest
{
@Spy
private
Router
router
=
new
Router
();
private
TestingServer
zkTestServer
;
private
RegistryCenter
registryCenter
;
@Before
public
void
setUp
()
throws
Exception
{
zkTestServer
=
new
TestingServer
(
2181
,
true
);
registryCenter
=
RegistryCenterFactory
.
INSTANCE
.
getRegistryCenter
(
CenterType
.
DEFAULT_CENTER_TYPE
);
Properties
config
=
new
Properties
();
config
.
put
(
ZookeeperConfig
.
CONNECT_URL
,
"127.0.0.1:2181"
);
registryCenter
.
start
(
config
);
}
@Test
public
void
testRoutingStartBeforeStorageNode
()
throws
InterruptedException
{
registryCenter
.
register
(
Config
.
StorageNode
.
SUBSCRIBE_PATH
+
"/127.0.0.1:34000"
);
Thread
.
sleep
(
10
);
List
<
String
>
nodeURL
=
new
ArrayList
<>();
nodeURL
.
add
(
"127.0.0.1:34000"
);
//verify(router, times(1)).notify(eq(nodeURL), eq(NotifyListenerImpl.ChangeType.Add));
}
@Test
public
void
testStorageNodeStartBeforeRoutingStart
()
throws
InterruptedException
{
registryCenter
.
register
(
Config
.
StorageNode
.
SUBSCRIBE_PATH
+
"/127.0.0.1:34000"
);
Thread
.
sleep
(
10
);
List
<
String
>
nodeURL
=
new
ArrayList
<>();
nodeURL
.
add
(
"127.0.0.1:34000"
);
//verify(router, times(1)).notify(eq(nodeURL), eq(NotifyListenerImpl.ChangeType.Add));
}
@After
public
void
tearUp
()
throws
IOException
{
zkTestServer
.
stop
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录