Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿信在这里
SkyWalking
提交
a4d2f237
S
SkyWalking
项目概览
阿信在这里
/
SkyWalking
与 Fork 源项目一致
Fork自
山不在高_有仙则灵 / SkyWalking
通知
1
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,发现更多精彩内容 >>
提交
a4d2f237
编写于
2月 20, 2017
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add skywalking-sniffer-mock module. For testing sdk-plugin and collector(not merged yet) modules.
上级
75d8aba0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
95 addition
and
20 deletion
+95
-20
skywalking-sniffer/pom.xml
skywalking-sniffer/pom.xml
+1
-0
skywalking-sniffer/skywalking-api/pom.xml
skywalking-sniffer/skywalking-api/pom.xml
+0
-20
skywalking-sniffer/skywalking-sniffer-mock/pom.xml
skywalking-sniffer/skywalking-sniffer-mock/pom.xml
+30
-0
skywalking-sniffer/skywalking-sniffer-mock/src/main/java/com/a/eye/skywalking/sniffer/mock/context/MockTracerContextListener.java
...lking/sniffer/mock/context/MockTracerContextListener.java
+51
-0
skywalking-sniffer/skywalking-sniffer-mock/src/main/java/com/a/eye/skywalking/sniffer/mock/context/SegmentAssert.java
.../a/eye/skywalking/sniffer/mock/context/SegmentAssert.java
+13
-0
未找到文件。
skywalking-sniffer/pom.xml
浏览文件 @
a4d2f237
...
...
@@ -17,6 +17,7 @@
<module>
skywalking-api
</module>
<module>
skywalking-sdk-plugin
</module>
<module>
skywalking-toolkit-activation
</module>
<module>
skywalking-sniffer-mock
</module>
</modules>
<properties>
...
...
skywalking-sniffer/skywalking-api/pom.xml
浏览文件 @
a4d2f237
...
...
@@ -51,26 +51,6 @@
<artifactId>
disruptor
</artifactId>
<version>
3.3.6
</version>
</dependency>
<!-- test dependencies section -->
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.11
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.powermock
</groupId>
<artifactId>
powermock-api-mockito
</artifactId>
<version>
1.6.5
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.powermock
</groupId>
<artifactId>
powermock-module-junit4
</artifactId>
<version>
1.6.5
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
...
...
skywalking-sniffer/skywalking-sniffer-mock/pom.xml
0 → 100644
浏览文件 @
a4d2f237
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
skywalking-sniffer
</artifactId>
<groupId>
com.a.eye
</groupId>
<version>
3.0-2017
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
skywalking-sniffer-mock
</artifactId>
<description>
This is a sniffer mock module, test for test-dependency, only.
</description>
<dependencies>
<dependency>
<groupId>
com.a.eye
</groupId>
<artifactId>
skywalking-api
</artifactId>
<version>
${project.version}
</version>
</dependency>
<!-- direct dependency junit, based on this is a mock module. -->
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
</dependency>
</dependencies>
</project>
skywalking-sniffer/skywalking-sniffer-mock/src/main/java/com/a/eye/skywalking/sniffer/mock/context/MockTracerContextListener.java
0 → 100644
浏览文件 @
a4d2f237
package
com.a.eye.skywalking.sniffer.mock.context
;
import
com.a.eye.skywalking.api.context.TracerContext
;
import
com.a.eye.skywalking.api.context.TracerContextListener
;
import
com.a.eye.skywalking.trace.TraceSegment
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
org.junit.Assert
;
/**
* This is mock tracer context listener, which should be added by calling {@link TracerContext.ListenerManager#add(TracerContextListener)}.
* This mock listener will hold all finished trace, which all are generated by {@link TracerContext#finish()}.
*
* Created by wusheng on 2017/2/20.
*/
public
class
MockTracerContextListener
implements
TracerContextListener
{
private
List
<
TraceSegment
>
finishedTraceSegments
=
Collections
.
synchronizedList
(
new
ArrayList
<
TraceSegment
>());
@Override
public
void
afterFinished
(
TraceSegment
traceSegment
)
{
finishedTraceSegments
.
add
(
traceSegment
);
}
/**
* Assert all finished {@link #finishedTraceSegments} match the given size.
*
* @param size the give size.
*/
public
void
assertSize
(
int
size
){
Assert
.
assertEquals
(
size
,
finishedTraceSegments
.
size
());
}
/**
* Assert the {@link TraceSegment} at the given index of {@link #finishedTraceSegments},
* and run the given {@link SegmentAssert#call(TraceSegment)} to assert.
*
* @param index the given index.
* @param segmentAssert the given assert.
*/
public
void
assertTraceSegment
(
int
index
,
SegmentAssert
segmentAssert
){
assertSize
(
index
+
1
);
segmentAssert
.
call
(
finishedTraceSegments
.
get
(
index
));
}
/**
* Clear all hold data.
*/
public
void
clear
(){
finishedTraceSegments
.
clear
();
}
}
skywalking-sniffer/skywalking-sniffer-mock/src/main/java/com/a/eye/skywalking/sniffer/mock/context/SegmentAssert.java
0 → 100644
浏览文件 @
a4d2f237
package
com.a.eye.skywalking.sniffer.mock.context
;
import
com.a.eye.skywalking.trace.TraceSegment
;
/**
* The <code>SegmentAssert</code> interface should be implemented by any
* class whose instances are intended to assert a trace segment data.
*
* Created by wusheng on 2017/2/20.
*/
public
interface
SegmentAssert
{
void
call
(
TraceSegment
finishedSegment
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录