Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
b396c99e
S
SkyWalking
项目概览
山不在高_有仙则灵
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
12
Star
0
Fork
2
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
b396c99e
编写于
10月 13, 2017
作者:
wu-sheng
提交者:
GitHub
10月 13, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #514 from OpenSkywalking/feature/headcheck
Feature/headcheck
上级
a4ac825d
f0d6db2a
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
138 addition
and
135 deletion
+138
-135
apm-collector/apm-collector-agentjvm/src/test/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandlerTestCase.java
...entjvm/grpc/handler/JVMMetricsServiceHandlerTestCase.java
+18
-18
apm-collector/apm-collector-agentregister/src/test/java/org/skywalking/apm/collector/agentregister/grpc/handler/ApplicationRegisterServiceHandlerTestCase.java
...pc/handler/ApplicationRegisterServiceHandlerTestCase.java
+5
-1
apm-collector/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/grpc/handler/TraceSegmentServiceHandlerTestCase.java
...ream/grpc/handler/TraceSegmentServiceHandlerTestCase.java
+36
-36
apm-collector/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegmentJsonReaderTestCase.java
.../jetty/handler/reader/TraceSegmentJsonReaderTestCase.java
+0
-1
apm-collector/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/SegmentPost.java
...kywalking/apm/collector/agentstream/mock/SegmentPost.java
+14
-14
apm-collector/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/GrpcSegmentPost.java
.../apm/collector/agentstream/mock/grpc/GrpcSegmentPost.java
+17
-17
apm-collector/apm-collector-stream/src/test/java/org/skywalking/apm/collector/stream/worker/util/TimeBucketUtilsTestCase.java
...collector/stream/worker/util/TimeBucketUtilsTestCase.java
+0
-3
apm-commons/apm-datacarrier/src/test/java/org/skywalking/apm/commons/datacarrier/consumer/ConsumerTest.java
...alking/apm/commons/datacarrier/consumer/ConsumerTest.java
+6
-6
apm-commons/apm-datacarrier/src/test/java/org/skywalking/apm/commons/datacarrier/consumer/SampleConsumer.java
...king/apm/commons/datacarrier/consumer/SampleConsumer.java
+1
-1
apm-commons/apm-util/src/test/java/org/skywalking/apm/util/ConfigInitializerTest.java
...t/java/org/skywalking/apm/util/ConfigInitializerTest.java
+17
-17
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/boot/DefaultNamedThreadFactoryTest.java
...ng/apm/agent/core/boot/DefaultNamedThreadFactoryTest.java
+2
-1
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/boot/ServiceManagerTest.java
...rg/skywalking/apm/agent/core/boot/ServiceManagerTest.java
+7
-7
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/logging/EasyLoggerTest.java
...org/skywalking/apm/agent/core/logging/EasyLoggerTest.java
+6
-6
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/logging/SystemOutWriterTest.java
...kywalking/apm/agent/core/logging/SystemOutWriterTest.java
+3
-3
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/logging/WriterFactoryTest.java
.../skywalking/apm/agent/core/logging/WriterFactoryTest.java
+3
-3
checkStyle.xml
checkStyle.xml
+1
-1
java.header
java.header
+0
-0
pom.xml
pom.xml
+2
-0
未找到文件。
apm-collector/apm-collector-agentjvm/src/test/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandlerTestCase.java
浏览文件 @
b396c99e
...
...
@@ -41,11 +41,11 @@ public class JVMMetricsServiceHandlerTestCase {
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JVMMetricsServiceHandlerTestCase
.
class
);
private
static
JVMMetricsServiceGrpc
.
JVMMetricsServiceBlockingStub
stub
;
private
static
JVMMetricsServiceGrpc
.
JVMMetricsServiceBlockingStub
STUB
;
public
static
void
main
(
String
[]
args
)
{
ManagedChannel
channel
=
ManagedChannelBuilder
.
forAddress
(
"localhost"
,
11800
).
usePlaintext
(
true
).
build
();
stub
=
JVMMetricsServiceGrpc
.
newBlockingStub
(
channel
);
STUB
=
JVMMetricsServiceGrpc
.
newBlockingStub
(
channel
);
final
long
timeInterval
=
1
;
Executors
.
newSingleThreadScheduledExecutor
().
scheduleAtFixedRate
(()
->
multiInstanceJvmSend
(),
1
,
timeInterval
,
TimeUnit
.
SECONDS
);
...
...
@@ -68,7 +68,7 @@ public class JVMMetricsServiceHandlerTestCase {
buildGcMetric
(
jvmMetric
);
jvmMetricsBuilder
.
addMetrics
(
jvmMetric
.
build
());
stub
.
collect
(
jvmMetricsBuilder
.
build
());
STUB
.
collect
(
jvmMetricsBuilder
.
build
());
}
private
static
void
buildCpuMetric
(
JVMMetric
.
Builder
jvmMetric
)
{
...
...
@@ -78,21 +78,21 @@ public class JVMMetricsServiceHandlerTestCase {
}
private
static
void
buildMemoryMetric
(
JVMMetric
.
Builder
jvmMetric
)
{
Memory
.
Builder
builder
_1
=
Memory
.
newBuilder
();
builder
_1
.
setIsHeap
(
true
);
builder
_1
.
setInit
(
20
);
builder
_1
.
setMax
(
100
);
builder
_1
.
setUsed
(
50
);
builder
_1
.
setCommitted
(
30
);
jvmMetric
.
addMemory
(
builder
_1
.
build
());
Memory
.
Builder
builder
_2
=
Memory
.
newBuilder
();
builder
_2
.
setIsHeap
(
false
);
builder
_2
.
setInit
(
200
);
builder
_2
.
setMax
(
1000
);
builder
_2
.
setUsed
(
500
);
builder
_2
.
setCommitted
(
300
);
jvmMetric
.
addMemory
(
builder
_2
.
build
());
Memory
.
Builder
builder
Heap
=
Memory
.
newBuilder
();
builder
Heap
.
setIsHeap
(
true
);
builder
Heap
.
setInit
(
20
);
builder
Heap
.
setMax
(
100
);
builder
Heap
.
setUsed
(
50
);
builder
Heap
.
setCommitted
(
30
);
jvmMetric
.
addMemory
(
builder
Heap
.
build
());
Memory
.
Builder
builder
NonHeap
=
Memory
.
newBuilder
();
builder
NonHeap
.
setIsHeap
(
false
);
builder
NonHeap
.
setInit
(
200
);
builder
NonHeap
.
setMax
(
1000
);
builder
NonHeap
.
setUsed
(
500
);
builder
NonHeap
.
setCommitted
(
300
);
jvmMetric
.
addMemory
(
builder
NonHeap
.
build
());
}
private
static
void
buildMemoryPoolMetric
(
JVMMetric
.
Builder
jvmMetric
)
{
...
...
apm-collector/apm-collector-agentregister/src/test/java/org/skywalking/apm/collector/agentregister/grpc/handler/ApplicationRegisterServiceHandlerTestCase.java
浏览文件 @
b396c99e
...
...
@@ -23,12 +23,16 @@ import io.grpc.ManagedChannelBuilder;
import
org.skywalking.apm.network.proto.Application
;
import
org.skywalking.apm.network.proto.ApplicationMapping
;
import
org.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author pengys5
*/
public
class
ApplicationRegisterServiceHandlerTestCase
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApplicationRegisterServiceHandlerTestCase
.
class
);
private
ApplicationRegisterServiceGrpc
.
ApplicationRegisterServiceBlockingStub
stub
;
public
void
testRegister
()
{
...
...
@@ -37,6 +41,6 @@ public class ApplicationRegisterServiceHandlerTestCase {
Application
application
=
Application
.
newBuilder
().
addApplicationCode
(
"test141"
).
build
();
ApplicationMapping
mapping
=
stub
.
register
(
application
);
System
.
out
.
println
(
mapping
.
getApplication
(
0
).
getKey
()
+
", "
+
mapping
.
getApplication
(
0
).
getValue
());
logger
.
debug
(
mapping
.
getApplication
(
0
).
getKey
()
+
", "
+
mapping
.
getApplication
(
0
).
getValue
());
}
}
apm-collector/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/grpc/handler/TraceSegmentServiceHandlerTestCase.java
浏览文件 @
b396c99e
...
...
@@ -91,42 +91,42 @@ public class TraceSegmentServiceHandlerTestCase {
segmentBuilder
.
setApplicationInstanceId
(
2
);
segmentBuilder
.
setTraceSegmentId
(
UniqueId
.
newBuilder
().
addIdParts
(
200
).
addIdParts
(
200
).
addIdParts
(
200
).
build
());
SpanObject
.
Builder
span
_
0
=
SpanObject
.
newBuilder
();
span
_
0
.
setSpanId
(
0
);
span
_
0
.
setOperationName
(
"/dubbox-case/case/dubbox-rest"
);
span
_
0
.
setOperationNameId
(
0
);
span
_
0
.
setParentSpanId
(-
1
);
span
_
0
.
setSpanLayer
(
SpanLayer
.
Http
);
span
_
0
.
setStartTime
(
now
);
span
_
0
.
setEndTime
(
now
+
100000
);
span
_
0
.
setComponentId
(
ComponentsDefine
.
TOMCAT
.
getId
());
span
_
0
.
setIsError
(
false
);
span
_
0
.
setSpanType
(
SpanType
.
Entry
);
span
_
0
.
setPeerId
(
2
);
span
_
0
.
setPeer
(
"localhost:8082"
);
LogMessage
.
Builder
log
_
0
=
LogMessage
.
newBuilder
();
log
_
0
.
setTime
(
now
);
log
_
0
.
addData
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"log1"
).
setValue
(
"value1"
));
log
_
0
.
addData
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"log2"
).
setValue
(
"value2"
));
log
_
0
.
addData
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"log3"
).
setValue
(
"value3"
));
span
_0
.
addLogs
(
log_
0
.
build
());
span
_
0
.
addTags
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"tag1"
).
setValue
(
"value1"
));
span
_
0
.
addTags
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"tag2"
).
setValue
(
"value2"
));
span
_
0
.
addTags
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"tag3"
).
setValue
(
"value3"
));
segmentBuilder
.
addSpans
(
span
_
0
);
TraceSegmentReference
.
Builder
ref
_
0
=
TraceSegmentReference
.
newBuilder
();
ref
_
0
.
setEntryServiceId
(
1
);
ref
_
0
.
setEntryServiceName
(
"ServiceName"
);
ref
_
0
.
setNetworkAddress
(
"localhost:8081"
);
ref
_
0
.
setNetworkAddressId
(
1
);
ref
_
0
.
setParentApplicationInstanceId
(
1
);
ref
_
0
.
setParentServiceId
(
1
);
ref
_
0
.
setParentServiceName
(
""
);
ref
_
0
.
setParentSpanId
(
2
);
ref
_
0
.
setParentTraceSegmentId
(
UniqueId
.
newBuilder
().
addIdParts
(
100
).
addIdParts
(
100
).
addIdParts
(
100
).
build
());
SpanObject
.
Builder
span0
=
SpanObject
.
newBuilder
();
span0
.
setSpanId
(
0
);
span0
.
setOperationName
(
"/dubbox-case/case/dubbox-rest"
);
span0
.
setOperationNameId
(
0
);
span0
.
setParentSpanId
(-
1
);
span0
.
setSpanLayer
(
SpanLayer
.
Http
);
span0
.
setStartTime
(
now
);
span0
.
setEndTime
(
now
+
100000
);
span0
.
setComponentId
(
ComponentsDefine
.
TOMCAT
.
getId
());
span0
.
setIsError
(
false
);
span0
.
setSpanType
(
SpanType
.
Entry
);
span0
.
setPeerId
(
2
);
span0
.
setPeer
(
"localhost:8082"
);
LogMessage
.
Builder
log0
=
LogMessage
.
newBuilder
();
log0
.
setTime
(
now
);
log0
.
addData
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"log1"
).
setValue
(
"value1"
));
log0
.
addData
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"log2"
).
setValue
(
"value2"
));
log0
.
addData
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"log3"
).
setValue
(
"value3"
));
span
0
.
addLogs
(
log
0
.
build
());
span0
.
addTags
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"tag1"
).
setValue
(
"value1"
));
span0
.
addTags
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"tag2"
).
setValue
(
"value2"
));
span0
.
addTags
(
KeyWithStringValue
.
newBuilder
().
setKey
(
"tag3"
).
setValue
(
"value3"
));
segmentBuilder
.
addSpans
(
span0
);
TraceSegmentReference
.
Builder
ref0
=
TraceSegmentReference
.
newBuilder
();
ref0
.
setEntryServiceId
(
1
);
ref0
.
setEntryServiceName
(
"ServiceName"
);
ref0
.
setNetworkAddress
(
"localhost:8081"
);
ref0
.
setNetworkAddressId
(
1
);
ref0
.
setParentApplicationInstanceId
(
1
);
ref0
.
setParentServiceId
(
1
);
ref0
.
setParentServiceName
(
""
);
ref0
.
setParentSpanId
(
2
);
ref0
.
setParentTraceSegmentId
(
UniqueId
.
newBuilder
().
addIdParts
(
100
).
addIdParts
(
100
).
addIdParts
(
100
).
build
());
// segmentBuilder.addRefs(ref_0);
builder
.
setSegment
(
segmentBuilder
.
build
().
toByteString
());
...
...
apm-collector/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegmentJsonReaderTestCase.java
浏览文件 @
b396c99e
...
...
@@ -34,7 +34,6 @@ public class TraceSegmentJsonReaderTestCase {
public
void
testRead
()
throws
IOException
{
TraceSegmentJsonReader
reader
=
new
TraceSegmentJsonReader
();
JsonElement
jsonElement
=
JsonFileReader
.
INSTANCE
.
read
(
"json/segment/normal/dubbox-consumer.json"
);
System
.
out
.
println
(
jsonElement
.
toString
());
JsonReader
jsonReader
=
new
JsonReader
(
new
StringReader
(
jsonElement
.
toString
()));
jsonReader
.
beginArray
();
...
...
apm-collector/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/SegmentPost.java
浏览文件 @
b396c99e
...
...
@@ -64,14 +64,14 @@ public class SegmentPost {
ServiceNameEsDAO
serviceNameEsDAO
=
new
ServiceNameEsDAO
();
serviceNameEsDAO
.
setClient
(
client
);
ServiceNameDataDefine
.
ServiceName
serviceName
_
1
=
new
ServiceNameDataDefine
.
ServiceName
(
"1"
,
""
,
0
,
1
);
serviceNameEsDAO
.
save
(
serviceName
_
1
);
ServiceNameDataDefine
.
ServiceName
serviceName
_
2
=
new
ServiceNameDataDefine
.
ServiceName
(
"2"
,
"org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"
,
2
,
2
);
serviceNameEsDAO
.
save
(
serviceName
_
2
);
ServiceNameDataDefine
.
ServiceName
serviceName
_
3
=
new
ServiceNameDataDefine
.
ServiceName
(
"3"
,
"/dubbox-case/case/dubbox-rest"
,
2
,
3
);
serviceNameEsDAO
.
save
(
serviceName
_
3
);
ServiceNameDataDefine
.
ServiceName
serviceName
_
4
=
new
ServiceNameDataDefine
.
ServiceName
(
"4"
,
"org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"
,
3
,
4
);
serviceNameEsDAO
.
save
(
serviceName
_
4
);
ServiceNameDataDefine
.
ServiceName
serviceName1
=
new
ServiceNameDataDefine
.
ServiceName
(
"1"
,
""
,
0
,
1
);
serviceNameEsDAO
.
save
(
serviceName1
);
ServiceNameDataDefine
.
ServiceName
serviceName2
=
new
ServiceNameDataDefine
.
ServiceName
(
"2"
,
"org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"
,
2
,
2
);
serviceNameEsDAO
.
save
(
serviceName2
);
ServiceNameDataDefine
.
ServiceName
serviceName3
=
new
ServiceNameDataDefine
.
ServiceName
(
"3"
,
"/dubbox-case/case/dubbox-rest"
,
2
,
3
);
serviceNameEsDAO
.
save
(
serviceName3
);
ServiceNameDataDefine
.
ServiceName
serviceName4
=
new
ServiceNameDataDefine
.
ServiceName
(
"4"
,
"org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"
,
3
,
4
);
serviceNameEsDAO
.
save
(
serviceName4
);
while
(
true
)
{
JsonElement
consumer
=
JsonFileReader
.
INSTANCE
.
read
(
"json/segment/normal/dubbox-consumer.json"
);
...
...
@@ -82,12 +82,12 @@ public class SegmentPost {
modifyTime
(
provider
);
HttpClientTools
.
INSTANCE
.
post
(
"http://localhost:12800/segments"
,
provider
.
toString
());
diff
=
0
;
DIFF
=
0
;
Thread
.
sleep
(
1000
);
}
}
private
static
long
diff
=
0
;
private
static
long
DIFF
=
0
;
private
static
void
modifyTime
(
JsonElement
jsonElement
)
{
JsonArray
segmentArray
=
jsonElement
.
getAsJsonArray
();
...
...
@@ -98,12 +98,12 @@ public class SegmentPost {
long
startTime
=
span
.
getAsJsonObject
().
get
(
"st"
).
getAsLong
();
long
endTime
=
span
.
getAsJsonObject
().
get
(
"et"
).
getAsLong
();
if
(
diff
==
0
)
{
diff
=
System
.
currentTimeMillis
()
-
startTime
;
if
(
DIFF
==
0
)
{
DIFF
=
System
.
currentTimeMillis
()
-
startTime
;
}
span
.
getAsJsonObject
().
addProperty
(
"st"
,
startTime
+
diff
);
span
.
getAsJsonObject
().
addProperty
(
"et"
,
endTime
+
diff
);
span
.
getAsJsonObject
().
addProperty
(
"st"
,
startTime
+
DIFF
);
span
.
getAsJsonObject
().
addProperty
(
"et"
,
endTime
+
DIFF
);
}
}
}
...
...
apm-collector/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/GrpcSegmentPost.java
浏览文件 @
b396c99e
...
...
@@ -219,15 +219,15 @@ public class GrpcSegmentPost {
LogMessage
.
Builder
entryLogMessage
=
LogMessage
.
newBuilder
();
entryLogMessage
.
setTime
(
timestamp
);
KeyWithStringValue
.
Builder
data
_
1
=
KeyWithStringValue
.
newBuilder
();
data
_
1
.
setKey
(
"url"
);
data
_
1
.
setValue
(
"http://localhost:18080/dubbox-case/case/dubbox-rest"
);
entryLogMessage
.
addData
(
data
_
1
);
KeyWithStringValue
.
Builder
data
_
2
=
KeyWithStringValue
.
newBuilder
();
data
_
2
.
setKey
(
"http.method"
);
data
_
2
.
setValue
(
"GET"
);
entryLogMessage
.
addData
(
data
_
2
);
KeyWithStringValue
.
Builder
data1
=
KeyWithStringValue
.
newBuilder
();
data1
.
setKey
(
"url"
);
data1
.
setValue
(
"http://localhost:18080/dubbox-case/case/dubbox-rest"
);
entryLogMessage
.
addData
(
data1
);
KeyWithStringValue
.
Builder
data2
=
KeyWithStringValue
.
newBuilder
();
data2
.
setKey
(
"http.method"
);
data2
.
setValue
(
"GET"
);
entryLogMessage
.
addData
(
data2
);
entrySpan
.
addLogs
(
entryLogMessage
);
segmentBuilder
.
addSpans
(
entrySpan
);
...
...
@@ -292,15 +292,15 @@ public class GrpcSegmentPost {
LogMessage
.
Builder
entryLogMessage
=
LogMessage
.
newBuilder
();
entryLogMessage
.
setTime
(
timestamp
);
KeyWithStringValue
.
Builder
data
_
1
=
KeyWithStringValue
.
newBuilder
();
data
_
1
.
setKey
(
"url"
);
data
_
1
.
setValue
(
"rest://172.25.0.4:20880/org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"
);
entryLogMessage
.
addData
(
data
_
1
);
KeyWithStringValue
.
Builder
data1
=
KeyWithStringValue
.
newBuilder
();
data1
.
setKey
(
"url"
);
data1
.
setValue
(
"rest://172.25.0.4:20880/org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"
);
entryLogMessage
.
addData
(
data1
);
KeyWithStringValue
.
Builder
data
_
2
=
KeyWithStringValue
.
newBuilder
();
data
_
2
.
setKey
(
"http.method"
);
data
_
2
.
setValue
(
"GET"
);
entryLogMessage
.
addData
(
data
_
2
);
KeyWithStringValue
.
Builder
data2
=
KeyWithStringValue
.
newBuilder
();
data2
.
setKey
(
"http.method"
);
data2
.
setValue
(
"GET"
);
entryLogMessage
.
addData
(
data2
);
entrySpan
.
addLogs
(
entryLogMessage
);
segmentBuilder
.
addSpans
(
entrySpan
);
...
...
apm-collector/apm-collector-stream/src/test/java/org/skywalking/apm/collector/stream/worker/util/TimeBucketUtilsTestCase.java
浏览文件 @
b396c99e
...
...
@@ -57,10 +57,7 @@ public class TimeBucketUtilsTestCase {
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
1490922929258L
);
calendar
.
set
(
Calendar
.
SECOND
,
calendar
.
get
(
Calendar
.
SECOND
)
-
3
);
// System.out.println(calendar.getTimeInMillis());
calendar
.
set
(
Calendar
.
SECOND
,
calendar
.
get
(
Calendar
.
SECOND
)
-
2
);
// System.out.println(calendar.getTimeInMillis());
calendar
.
set
(
Calendar
.
SECOND
,
calendar
.
get
(
Calendar
.
SECOND
)
-
2
);
// System.out.println(calendar.getTimeInMillis());
}
}
apm-commons/apm-datacarrier/src/test/java/org/skywalking/apm/commons/datacarrier/consumer/ConsumerTest.java
浏览文件 @
b396c99e
...
...
@@ -32,9 +32,9 @@ import org.skywalking.apm.commons.datacarrier.SampleData;
* Created by wusheng on 2016/10/26.
*/
public
class
ConsumerTest
{
public
static
LinkedBlockingQueue
<
SampleData
>
buffer
=
new
LinkedBlockingQueue
<
SampleData
>();
public
static
LinkedBlockingQueue
<
SampleData
>
BUFFER
=
new
LinkedBlockingQueue
<
SampleData
>();
public
static
boolean
isOccurError
=
false
;
public
static
boolean
IS_OCCUR_ERROR
=
false
;
@Test
public
void
testConsumerLessThanChannel
()
throws
IllegalAccessException
{
...
...
@@ -71,7 +71,7 @@ public class ConsumerTest {
Thread
.
sleep
(
2000
);
List
<
SampleData
>
result
=
new
ArrayList
<
SampleData
>();
buffer
.
drainTo
(
result
);
BUFFER
.
drainTo
(
result
);
Assert
.
assertEquals
(
200
,
result
.
size
());
...
...
@@ -94,7 +94,7 @@ public class ConsumerTest {
consumer
.
onError
=
true
;
carrier
.
consume
(
consumer
,
5
);
Assert
.
assertTrue
(
isOccurError
);
Assert
.
assertTrue
(
IS_OCCUR_ERROR
);
}
class
SampleConsumer2
implements
IConsumer
<
SampleData
>
{
...
...
@@ -116,7 +116,7 @@ public class ConsumerTest {
@Override
public
void
onError
(
List
<
SampleData
>
data
,
Throwable
t
)
{
isOccurError
=
true
;
IS_OCCUR_ERROR
=
true
;
}
@Override
...
...
@@ -126,7 +126,7 @@ public class ConsumerTest {
}
private
IConsumer
getConsumer
(
DataCarrier
<
SampleData
>
carrier
)
throws
IllegalAccessException
{
ConsumerPool
pool
=
(
(
ConsumerPool
)
MemberModifier
.
field
(
DataCarrier
.
class
,
"consumerPool"
).
get
(
carrier
)
);
ConsumerPool
pool
=
(
ConsumerPool
)
MemberModifier
.
field
(
DataCarrier
.
class
,
"consumerPool"
).
get
(
carrier
);
ConsumerThread
[]
threads
=
(
ConsumerThread
[])
MemberModifier
.
field
(
ConsumerPool
.
class
,
"consumerThreads"
).
get
(
pool
);
return
(
IConsumer
)
MemberModifier
.
field
(
ConsumerThread
.
class
,
"consumer"
).
get
(
threads
[
0
]);
...
...
apm-commons/apm-datacarrier/src/test/java/org/skywalking/apm/commons/datacarrier/consumer/SampleConsumer.java
浏览文件 @
b396c99e
...
...
@@ -36,7 +36,7 @@ public class SampleConsumer implements IConsumer<SampleData> {
public
void
consume
(
List
<
SampleData
>
data
)
{
for
(
SampleData
one
:
data
)
{
one
.
setIntValue
(
this
.
hashCode
());
ConsumerTest
.
buffer
.
offer
(
one
);
ConsumerTest
.
BUFFER
.
offer
(
one
);
}
}
...
...
apm-commons/apm-util/src/test/java/org/skywalking/apm/util/ConfigInitializerTest.java
浏览文件 @
b396c99e
...
...
@@ -30,17 +30,17 @@ public class ConfigInitializerTest {
@Test
public
void
testInitialize
()
throws
IllegalAccessException
{
Properties
properties
=
new
Properties
();
properties
.
put
(
"Level1Object.
strAttr
"
.
toLowerCase
(),
"stringValue"
);
properties
.
put
(
"Level1Object.Level2Object.
intAttr
"
.
toLowerCase
(),
"1000"
);
properties
.
put
(
"Level1Object.Level2Object.
longAttr
"
.
toLowerCase
(),
"1000"
);
properties
.
put
(
"Level1Object.Level2Object.
booleanAttr
"
.
toLowerCase
(),
"true"
);
properties
.
put
(
"Level1Object.
STR_ATTR
"
.
toLowerCase
(),
"stringValue"
);
properties
.
put
(
"Level1Object.Level2Object.
INT_ATTR
"
.
toLowerCase
(),
"1000"
);
properties
.
put
(
"Level1Object.Level2Object.
LONG_ATTR
"
.
toLowerCase
(),
"1000"
);
properties
.
put
(
"Level1Object.Level2Object.
BOOLEAN_ATTR
"
.
toLowerCase
(),
"true"
);
ConfigInitializer
.
initialize
(
properties
,
TestPropertiesObject
.
class
);
Assert
.
assertEquals
(
"stringValue"
,
TestPropertiesObject
.
Level1Object
.
strAttr
);
Assert
.
assertEquals
(
1000
,
TestPropertiesObject
.
Level1Object
.
Level2Object
.
intAttr
);
Assert
.
assertEquals
(
1000L
,
TestPropertiesObject
.
Level1Object
.
Level2Object
.
longAttr
);
Assert
.
assertEquals
(
true
,
TestPropertiesObject
.
Level1Object
.
Level2Object
.
booleanAttr
);
Assert
.
assertEquals
(
"stringValue"
,
TestPropertiesObject
.
Level1Object
.
STR_ATTR
);
Assert
.
assertEquals
(
1000
,
TestPropertiesObject
.
Level1Object
.
Level2Object
.
INT_ATTR
);
Assert
.
assertEquals
(
1000L
,
TestPropertiesObject
.
Level1Object
.
Level2Object
.
LONG_ATTR
);
Assert
.
assertEquals
(
true
,
TestPropertiesObject
.
Level1Object
.
Level2Object
.
BOOLEAN_ATTR
);
}
@Test
...
...
@@ -50,27 +50,27 @@ public class ConfigInitializerTest {
ConfigInitializer
.
initialize
(
properties
,
TestPropertiesObject
.
class
);
Assert
.
assertNull
(
TestPropertiesObject
.
Level1Object
.
strAttr
);
Assert
.
assertNull
(
TestPropertiesObject
.
Level1Object
.
STR_ATTR
);
}
@Before
public
void
clear
()
{
TestPropertiesObject
.
Level1Object
.
strAttr
=
null
;
TestPropertiesObject
.
Level1Object
.
Level2Object
.
intAttr
=
0
;
TestPropertiesObject
.
Level1Object
.
Level2Object
.
longAttr
=
0
;
TestPropertiesObject
.
Level1Object
.
Level2Object
.
booleanAttr
=
false
;
TestPropertiesObject
.
Level1Object
.
STR_ATTR
=
null
;
TestPropertiesObject
.
Level1Object
.
Level2Object
.
INT_ATTR
=
0
;
TestPropertiesObject
.
Level1Object
.
Level2Object
.
LONG_ATTR
=
0
;
TestPropertiesObject
.
Level1Object
.
Level2Object
.
BOOLEAN_ATTR
=
false
;
}
public
static
class
TestPropertiesObject
{
public
static
class
Level1Object
{
public
static
String
strAttr
=
null
;
public
static
String
STR_ATTR
=
null
;
public
static
class
Level2Object
{
public
static
int
intAttr
=
0
;
public
static
int
INT_ATTR
=
0
;
public
static
long
longAttr
;
public
static
long
LONG_ATTR
;
public
static
boolean
booleanAttr
;
public
static
boolean
BOOLEAN_ATTR
;
}
}
}
...
...
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/boot/DefaultNamedThreadFactoryTest.java
浏览文件 @
b396c99e
...
...
@@ -17,6 +17,7 @@
*/
package
org.skywalking.apm.agent.core.boot
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
...
...
@@ -36,6 +37,6 @@ public class DefaultNamedThreadFactoryTest {
});
newThread
.
start
();
assertNotNull
(
newThread
.
getName
());
assert
(
newThread
.
getName
().
contains
(
"DefaultNamedThreadFactoryTest"
));
Assert
.
assertTrue
(
newThread
.
getName
().
contains
(
"DefaultNamedThreadFactoryTest"
));
}
}
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/boot/ServiceManagerTest.java
浏览文件 @
b396c99e
...
...
@@ -63,18 +63,18 @@ public class ServiceManagerTest {
}
private
void
assertIgnoreTracingContextListener
()
throws
Exception
{
List
<
TracingContextListener
>
LISTENERS
=
getFieldValue
(
IgnoredTracerContext
.
ListenerManager
.
class
,
"LISTENERS"
);
assertThat
(
LISTENERS
.
size
(),
is
(
1
));
List
<
TracingContextListener
>
listeners
=
getFieldValue
(
IgnoredTracerContext
.
ListenerManager
.
class
,
"LISTENERS"
);
assertThat
(
listeners
.
size
(),
is
(
1
));
assertThat
(
LISTENERS
.
contains
(
ServiceManager
.
INSTANCE
.
findService
(
ContextManager
.
class
)),
is
(
true
));
assertThat
(
listeners
.
contains
(
ServiceManager
.
INSTANCE
.
findService
(
ContextManager
.
class
)),
is
(
true
));
}
private
void
assertTracingContextListener
()
throws
Exception
{
List
<
TracingContextListener
>
LISTENERS
=
getFieldValue
(
TracingContext
.
ListenerManager
.
class
,
"LISTENERS"
);
assertThat
(
LISTENERS
.
size
(),
is
(
3
));
List
<
TracingContextListener
>
listeners
=
getFieldValue
(
TracingContext
.
ListenerManager
.
class
,
"LISTENERS"
);
assertThat
(
listeners
.
size
(),
is
(
3
));
assertThat
(
LISTENERS
.
contains
(
ServiceManager
.
INSTANCE
.
findService
(
ContextManager
.
class
)),
is
(
true
));
assertThat
(
LISTENERS
.
contains
(
ServiceManager
.
INSTANCE
.
findService
(
TraceSegmentServiceClient
.
class
)),
is
(
true
));
assertThat
(
listeners
.
contains
(
ServiceManager
.
INSTANCE
.
findService
(
ContextManager
.
class
)),
is
(
true
));
assertThat
(
listeners
.
contains
(
ServiceManager
.
INSTANCE
.
findService
(
TraceSegmentServiceClient
.
class
)),
is
(
true
));
}
private
void
assertJVMService
(
JVMService
service
)
{
...
...
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/logging/EasyLoggerTest.java
浏览文件 @
b396c99e
...
...
@@ -33,13 +33,13 @@ import static org.mockito.Mockito.times;
* Created by wusheng on 2017/2/28.
*/
public
class
EasyLoggerTest
{
private
static
PrintStream
outRef
;
private
static
PrintStream
errRef
;
private
static
PrintStream
OUT_REF
;
private
static
PrintStream
ERR_REF
;
@BeforeClass
public
static
void
initAndHoldOut
()
{
outRef
=
System
.
out
;
errRef
=
System
.
err
;
OUT_REF
=
System
.
out
;
ERR_REF
=
System
.
err
;
}
@Test
...
...
@@ -110,7 +110,7 @@ public class EasyLoggerTest {
@AfterClass
public
static
void
reset
()
{
System
.
setOut
(
outRef
);
System
.
setErr
(
errRef
);
System
.
setOut
(
OUT_REF
);
System
.
setErr
(
ERR_REF
);
}
}
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/logging/SystemOutWriterTest.java
浏览文件 @
b396c99e
...
...
@@ -31,11 +31,11 @@ import static org.mockito.Mockito.times;
* Created by wusheng on 2017/2/28.
*/
public
class
SystemOutWriterTest
{
private
static
PrintStream
outRef
;
private
static
PrintStream
OUT_REF
;
@BeforeClass
public
static
void
initAndHoldOut
()
{
outRef
=
System
.
out
;
OUT_REF
=
System
.
out
;
}
@Test
...
...
@@ -50,6 +50,6 @@ public class SystemOutWriterTest {
@AfterClass
public
static
void
reset
()
{
System
.
setOut
(
outRef
);
System
.
setOut
(
OUT_REF
);
}
}
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/logging/WriterFactoryTest.java
浏览文件 @
b396c99e
...
...
@@ -30,11 +30,11 @@ import org.skywalking.apm.agent.core.conf.Config;
* Created by wusheng on 2017/2/28.
*/
public
class
WriterFactoryTest
{
private
static
PrintStream
errRef
;
private
static
PrintStream
ERR_REF
;
@BeforeClass
public
static
void
initAndHoldOut
()
{
errRef
=
System
.
err
;
ERR_REF
=
System
.
err
;
}
/**
...
...
@@ -54,6 +54,6 @@ public class WriterFactoryTest {
@AfterClass
public
static
void
reset
()
{
Config
.
Logging
.
DIR
=
""
;
System
.
setErr
(
errRef
);
System
.
setErr
(
ERR_REF
);
}
}
checkStyle.xml
浏览文件 @
b396c99e
...
...
@@ -30,7 +30,7 @@
<!-- header -->
<module
name=
"Header"
>
<property
name=
"headerFile"
value=
"
CHECKSTYLE_HEAD
"
/>
<property
name=
"headerFile"
value=
"
${checkstyle.header.file}
"
/>
</module>
<module
name=
"RegexpSingleline"
>
...
...
CHECKSTYLE_HEAD
→
java.header
浏览文件 @
b396c99e
文件已移动
pom.xml
浏览文件 @
b396c99e
...
...
@@ -87,6 +87,7 @@
<scala.compiler.version>
2.11.7
</scala.compiler.version>
<powermock.version>
1.6.4
</powermock.version>
<docker.plugin.version>
0.4.13
</docker.plugin.version>
<checkstyle.header.file>
java.header
</checkstyle.header.file>
</properties>
<dependencies>
...
...
@@ -315,6 +316,7 @@
<configLocation>
checkStyle.xml
</configLocation>
<encoding>
UTF-8
</encoding>
<consoleOutput>
true
</consoleOutput>
<includeTestSourceDirectory>
true
</includeTestSourceDirectory>
<failsOnError>
true
</failsOnError>
<excludes>
org/skywalking/apm/network/**/*.java,
org/skywalking/apm/collector/remote/grpc/**/*.java,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录