Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
killuaz丶x
SkyWalking
提交
11a4b384
S
SkyWalking
项目概览
killuaz丶x
/
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,发现更多精彩内容 >>
提交
11a4b384
编写于
6月 13, 2016
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.添加redis cluster测试类
上级
739ae017
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
137 addition
and
6 deletion
+137
-6
test/skywalking-agent-test/redis-test/pom.xml
test/skywalking-agent-test/redis-test/pom.xml
+0
-1
test/skywalking-agent-test/redis-test/src/main/java/com/ai/cloud/skywalking/agent/test/RedisClusterOperator.java
.../ai/cloud/skywalking/agent/test/RedisClusterOperator.java
+57
-0
test/skywalking-agent-test/redis-test/src/main/java/com/ai/cloud/skywalking/agent/test/RedisClusterPluginTest.java
...i/cloud/skywalking/agent/test/RedisClusterPluginTest.java
+39
-0
test/skywalking-agent-test/redis-test/src/main/java/com/ai/cloud/skywalking/agent/test/RedisOperator.java
...ava/com/ai/cloud/skywalking/agent/test/RedisOperator.java
+17
-2
test/skywalking-agent-test/redis-test/src/main/java/com/ai/cloud/skywalking/agent/test/RedisPluginTest.java
...a/com/ai/cloud/skywalking/agent/test/RedisPluginTest.java
+22
-1
test/skywalking-agent-test/redis-test/src/main/resources/redis.conf
...lking-agent-test/redis-test/src/main/resources/redis.conf
+2
-1
test/skywalking-agent-test/redis-test/src/main/resources/sky-walking.auth
...agent-test/redis-test/src/main/resources/sky-walking.auth
+0
-1
未找到文件。
test/skywalking-agent-test/redis-test/pom.xml
浏览文件 @
11a4b384
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
<groupId>
junit
</groupId>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
<version>
4.12
</version>
<scope>
test
</scope>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<groupId>
org.apache.logging.log4j
</groupId>
...
...
test/skywalking-agent-test/redis-test/src/main/java/com/ai/cloud/skywalking/agent/test/RedisClusterOperator.java
0 → 100644
浏览文件 @
11a4b384
package
com.ai.cloud.skywalking.agent.test
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
redis.clients.jedis.HostAndPort
;
import
redis.clients.jedis.JedisCluster
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.HashSet
;
import
java.util.Properties
;
import
java.util.Set
;
/**
* Created by xin on 16-6-13.
*/
public
class
RedisClusterOperator
{
private
static
Logger
logger
=
LogManager
.
getLogger
(
RedisClusterOperator
.
class
);
private
static
JedisCluster
jedisCluster
=
null
;
static
{
InputStream
inputStream
=
RedisOperator
.
class
.
getResourceAsStream
(
"/redis.conf"
);
Properties
properties
=
new
Properties
();
try
{
properties
.
load
(
inputStream
);
}
catch
(
IOException
e
)
{
logger
.
error
(
"Failed to load redis.conf"
,
e
);
System
.
exit
(-
1
);
}
jedisCluster
=
new
JedisCluster
(
getHostAndPorts
(
properties
.
getProperty
(
"redis.cluster.host"
,
"127.0.0.1:7000"
)));
}
private
static
Set
<
HostAndPort
>
getHostAndPorts
(
String
property
)
{
Set
<
HostAndPort
>
redisEnv
=
new
HashSet
<
HostAndPort
>();
String
[]
hosts
=
property
.
split
(
";"
);
for
(
String
host
:
hosts
)
{
String
[]
hostAndPort
=
host
.
split
(
":"
);
redisEnv
.
add
(
new
HostAndPort
(
hostAndPort
[
0
],
Integer
.
parseInt
(
hostAndPort
[
1
])));
}
return
redisEnv
;
}
public
static
void
setData
(
String
key
,
String
value
)
{
jedisCluster
.
set
(
key
,
value
);
}
public
static
String
getData
(
String
key
)
{
return
jedisCluster
.
get
(
key
);
}
public
static
void
delData
(
String
key
)
{
jedisCluster
.
del
(
key
);
}
}
test/skywalking-agent-test/redis-test/src/main/java/com/ai/cloud/skywalking/agent/test/RedisClusterPluginTest.java
0 → 100644
浏览文件 @
11a4b384
package
com.ai.cloud.skywalking.agent.test
;
import
com.ai.skywalking.testframework.api.TraceTreeAssert
;
import
org.junit.Test
;
public
class
RedisClusterPluginTest
{
@Test
public
void
testSetData
()
{
RedisClusterOperator
.
setData
(
"key1"
,
"value1"
);
TraceTreeAssert
.
assertEquals
(
new
String
[][]{
// 根据实际情况进行修改
{
"0.0"
,
"127.0.0.1:7001 set"
,
"key=key1"
},
{
"0"
,
"127.0.0.1:7002;127.0.0.1:7001;127.0.0.1:7000;127.0.0.1:7005;127.0.0.1:7004;127.0.0.1:7003; set"
,
"key=key1"
},
});
}
@Test
public
void
testGetData
()
{
RedisClusterOperator
.
getData
(
"key1"
);
TraceTreeAssert
.
assertEquals
(
new
String
[][]{
// 根据实际情况进行修改
{
"0.0"
,
"127.0.0.1:7001 get"
,
"key=key1"
},
{
"0"
,
"127.0.0.1:7002;127.0.0.1:7001;127.0.0.1:7000;127.0.0.1:7005;127.0.0.1:7004;127.0.0.1:7003; get"
,
"key=key1"
},
});
}
@Test
public
void
testDelData
()
{
RedisClusterOperator
.
delData
(
"key1"
);
TraceTreeAssert
.
assertEquals
(
new
String
[][]{
// 根据实际情况进行修改
{
"0.0"
,
"127.0.0.1:7001 del"
,
"key=key1"
},
{
"0"
,
"127.0.0.1:7001;127.0.0.1:7000; del"
,
"key=key1"
},
});
}
}
test/skywalking-agent-test/redis-test/src/main/java/com/ai/cloud/skywalking/agent/test/RedisOperator.java
浏览文件 @
11a4b384
...
@@ -27,7 +27,7 @@ public class RedisOperator {
...
@@ -27,7 +27,7 @@ public class RedisOperator {
System
.
exit
(-
1
);
System
.
exit
(-
1
);
}
}
jedisPool
=
new
JedisPool
(
properties
.
getProperty
(
"redis.ip"
,
"127.0.0.1"
),
jedisPool
=
new
JedisPool
(
properties
.
getProperty
(
"redis.ip"
,
"127.0.0.1"
),
Integer
.
parseInt
(
properties
.
getProperty
(
"redis.port"
,
"
2181
"
)));
Integer
.
parseInt
(
properties
.
getProperty
(
"redis.port"
,
"
6379
"
)));
}
}
...
@@ -38,6 +38,7 @@ public class RedisOperator {
...
@@ -38,6 +38,7 @@ public class RedisOperator {
jedis
.
set
(
key
,
value
);
jedis
.
set
(
key
,
value
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
logger
.
error
(
e
);
throw
e
;
}
finally
{
}
finally
{
if
(
jedis
!=
null
)
if
(
jedis
!=
null
)
jedis
.
close
();
jedis
.
close
();
...
@@ -51,11 +52,25 @@ public class RedisOperator {
...
@@ -51,11 +52,25 @@ public class RedisOperator {
return
jedis
.
get
(
key
);
return
jedis
.
get
(
key
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
logger
.
error
(
e
);
throw
e
;
}
finally
{
}
finally
{
if
(
jedis
!=
null
)
if
(
jedis
!=
null
)
jedis
.
close
();
jedis
.
close
();
}
}
return
""
;
}
public
static
void
delData
(
String
key
)
{
Jedis
jedis
=
null
;
try
{
jedis
=
jedisPool
.
getResource
();
jedis
.
del
(
key
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
throw
e
;
}
finally
{
if
(
jedis
!=
null
)
jedis
.
close
();
}
}
}
}
}
test/skywalking-agent-test/redis-test/src/main/java/com/ai/cloud/skywalking/agent/test/RedisPluginTest.java
浏览文件 @
11a4b384
package
com.ai.cloud.skywalking.agent.test
;
package
com.ai.cloud.skywalking.agent.test
;
import
com.ai.skywalking.testframework.api.TraceTreeAssert
;
import
com.ai.skywalking.testframework.api.TraceTreeAssert
;
import
org.junit.Test
;
public
class
RedisPluginTest
{
public
class
RedisPluginTest
{
public
static
void
main
(
String
[]
args
)
{
@Test
public
void
testSetData
()
{
RedisOperator
.
setData
(
"key1"
,
"value1"
);
RedisOperator
.
setData
(
"key1"
,
"value1"
);
TraceTreeAssert
.
assertEquals
(
new
String
[][]{
TraceTreeAssert
.
assertEquals
(
new
String
[][]{
{
"0"
,
"127.0.0.1:6379 set"
,
"key=key1"
},
{
"0"
,
"127.0.0.1:6379 set"
,
"key=key1"
},
});
});
}
@Test
public
void
testGetData
()
{
RedisOperator
.
getData
(
"key1"
);
TraceTreeAssert
.
assertEquals
(
new
String
[][]{
{
"0"
,
"127.0.0.1:6379 get"
,
"key=key1"
},
});
}
@Test
public
void
testDelData
()
{
RedisOperator
.
delData
(
"key1"
);
TraceTreeAssert
.
assertEquals
(
new
String
[][]{
{
"0"
,
"127.0.0.1:6379 del"
,
"key=key1"
},
});
}
}
}
}
test/skywalking-agent-test/redis-test/src/main/resources/redis.conf
浏览文件 @
11a4b384
redis
.
ip
=
127
.
0
.
0
.
1
redis
.
ip
=
127
.
0
.
0
.
1
redis
.
port
=
6379
redis
.
port
=
6379
\ No newline at end of file
redis
.
cluster
.
host
=
127
.
0
.
0
.
1
:
7000
;
127
.
0
.
0
.
1
:
7001
;
127
.
0
.
0
.
1
:
7000
;
127
.
0
.
0
.
1
:
7000
;
127
.
0
.
0
.
1
:
7000
;
127
.
0
.
0
.
1
:
7000
;
\ No newline at end of file
test/skywalking-agent-test/redis-test/src/main/resources/sky-walking.auth
浏览文件 @
11a4b384
...
@@ -4,7 +4,6 @@ buriedpoint.businesskey_max_length=300
...
@@ -4,7 +4,6 @@ buriedpoint.businesskey_max_length=300
sender.retry_get_sender_wait_interval=2000
sender.retry_get_sender_wait_interval=2000
buffer.pool_size=5
buffer.pool_size=5
senderchecker.check_polling_time=200
senderchecker.check_polling_time=200
sender.is_off=false
sender.max_send_length=20000
sender.max_send_length=20000
consumer.max_consumer=0
consumer.max_consumer=0
consumer.max_wait_time=5
consumer.max_wait_time=5
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录