Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gdyjdao
SkyWalking
提交
c2319bcc
S
SkyWalking
项目概览
gdyjdao
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / 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,发现更多精彩内容 >>
提交
c2319bcc
编写于
6月 04, 2017
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add three test utils, prepare for removing the “get” method from the Tag classes.
上级
77d43ca1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
52 addition
and
47 deletion
+52
-47
apm-commons/apm-trace/src/main/java/org/skywalking/apm/trace/tag/AbstractTag.java
...c/main/java/org/skywalking/apm/trace/tag/AbstractTag.java
+7
-0
apm-commons/apm-trace/src/main/java/org/skywalking/apm/trace/tag/ShortTag.java
.../src/main/java/org/skywalking/apm/trace/tag/ShortTag.java
+0
-36
apm-commons/apm-trace/src/test/java/org/skywalking/apm/trace/tag/TagsTest.java
.../src/test/java/org/skywalking/apm/trace/tag/TagsTest.java
+0
-11
apm-sniffer/apm-sniffer-mock/src/main/java/org/skywalking/apm/sniffer/mock/trace/tag/BooleanTagGetter.java
...ywalking/apm/sniffer/mock/trace/tag/BooleanTagGetter.java
+15
-0
apm-sniffer/apm-sniffer-mock/src/main/java/org/skywalking/apm/sniffer/mock/trace/tag/IntTagGetter.java
...g/skywalking/apm/sniffer/mock/trace/tag/IntTagGetter.java
+15
-0
apm-sniffer/apm-sniffer-mock/src/main/java/org/skywalking/apm/sniffer/mock/trace/tag/StringTagGetter.java
...kywalking/apm/sniffer/mock/trace/tag/StringTagGetter.java
+15
-0
未找到文件。
apm-commons/apm-trace/src/main/java/org/skywalking/apm/trace/tag/AbstractTag.java
浏览文件 @
c2319bcc
...
...
@@ -24,5 +24,12 @@ public abstract class AbstractTag<T> {
protected
abstract
void
set
(
Span
span
,
T
tagValue
);
/**
* @return the key of this tag.
*/
public
String
key
()
{
return
this
.
key
;
}
public
abstract
T
get
(
Span
span
);
}
apm-commons/apm-trace/src/main/java/org/skywalking/apm/trace/tag/ShortTag.java
已删除
100644 → 0
浏览文件 @
77d43ca1
package
org.skywalking.apm.trace.tag
;
import
org.skywalking.apm.trace.Span
;
/**
* Do the same thing as {@link StringTag}, just with a {@link Short} value.
* <p>
* Created by wusheng on 2017/2/17.
*/
public
class
ShortTag
extends
AbstractTag
<
Short
>
{
public
ShortTag
(
String
key
)
{
super
(
key
);
}
@Override
public
void
set
(
Span
span
,
Short
tagValue
)
{
span
.
setTag
(
super
.
key
,
(
int
)
tagValue
.
shortValue
());
}
/**
* Get a tag value, type of {@link Short}.
* After akka-message/serialize, all tags values are type of {@link String}, convert to {@link Short}, if necessary.
*
* @param span
* @return tag value
*/
@Override
public
Short
get
(
Span
span
)
{
Integer
tagValue
=
span
.
getIntTag
(
super
.
key
);
if
(
tagValue
==
null
)
{
return
null
;
}
else
{
return
Short
.
valueOf
(
tagValue
.
toString
());
}
}
}
apm-commons/apm-trace/src/test/java/org/skywalking/apm/trace/tag/TagsTest.java
浏览文件 @
c2319bcc
...
...
@@ -40,15 +40,4 @@ public class TagsTest {
tag
.
set
(
span
,
123
);
Assert
.
assertEquals
(
123
,
tag
.
get
(
span
).
intValue
());
}
@Test
public
void
testShortTag
()
{
ShortTag
tag
=
new
ShortTag
(
"test.key"
);
Span
span
=
new
Span
(
1
,
"/test"
);
Assert
.
assertNull
(
tag
.
get
(
span
));
short
value
=
123
;
tag
.
set
(
span
,
value
);
Assert
.
assertEquals
(
value
,
tag
.
get
(
span
).
intValue
());
}
}
apm-sniffer/apm-sniffer-mock/src/main/java/org/skywalking/apm/sniffer/mock/trace/tag/BooleanTagGetter.java
0 → 100644
浏览文件 @
c2319bcc
package
org.skywalking.apm.sniffer.mock.trace.tag
;
import
org.skywalking.apm.trace.Span
;
import
org.skywalking.apm.trace.tag.BooleanTag
;
/**
* Test case util for getting the {@link Boolean} type of the tag value.
*
* @author wusheng
*/
public
class
BooleanTagGetter
{
public
static
Boolean
get
(
Span
span
,
BooleanTag
tag
)
{
return
span
.
getBoolTag
(
tag
.
key
());
}
}
apm-sniffer/apm-sniffer-mock/src/main/java/org/skywalking/apm/sniffer/mock/trace/tag/IntTagGetter.java
0 → 100644
浏览文件 @
c2319bcc
package
org.skywalking.apm.sniffer.mock.trace.tag
;
import
org.skywalking.apm.trace.Span
;
import
org.skywalking.apm.trace.tag.IntTag
;
/**
* Test case util for getting the {@link Integer} type of the tag value.
*
* @author wusheng
*/
public
class
IntTagGetter
{
public
static
Integer
get
(
Span
span
,
IntTag
tag
)
{
return
span
.
getIntTag
(
tag
.
key
());
}
}
apm-sniffer/apm-sniffer-mock/src/main/java/org/skywalking/apm/sniffer/mock/trace/tag/StringTagGetter.java
0 → 100644
浏览文件 @
c2319bcc
package
org.skywalking.apm.sniffer.mock.trace.tag
;
import
org.skywalking.apm.trace.Span
;
import
org.skywalking.apm.trace.tag.StringTag
;
/**
* Test case util for getting the {@link String} type of the tag value.
*
* @author wusheng
*/
public
class
StringTagGetter
{
public
static
String
get
(
Span
span
,
StringTag
tag
)
{
return
span
.
getStrTag
(
tag
.
key
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录